| 1 |
// -*- C++ -*- |
| 2 |
// |
| 3 |
// This file is part of HepMC |
| 4 |
// Copyright (C) 2014-2019 The HepMC collaboration (see AUTHORS for details) |
| 5 |
// |
| 6 |
/** |
| 7 |
* @file Streamers.cc |
| 8 |
* @brief Implementation of \b methods GenEvent::Streamer and GenRunInfo::Streamer |
| 9 |
* |
| 10 |
*/ |
| 11 |
|
| 12 |
#include "HepMC3/GenEvent.h" |
| 13 |
|
| 14 |
#include "HepMC3/Data/GenEventData.h" |
| 15 |
#include "HepMC3/Data/GenRunInfoData.h" |
| 16 |
|
| 17 |
#ifdef HEPMC3_ROOTIO |
| 18 |
#include "TBuffer.h" |
| 19 |
#include "TClass.h" |
| 20 |
#endif |
| 21 |
|
| 22 |
|
| 23 |
namespace HepMC3 { |
| 24 |
|
| 25 |
#ifdef HEPMC3_ROOTIO |
| 26 |
|
| 27 |
void GenEvent::Streamer(TBuffer &b) { |
| 28 |
|
| 29 |
if (b.IsReading()) { |
| 30 |
|
| 31 |
GenEventData data; |
| 32 |
|
| 33 |
b.ReadClassBuffer(TClass::GetClass("HepMC3::GenEventData"), &data); |
| 34 |
|
| 35 |
read_data(data); |
| 36 |
|
| 37 |
} else { |
| 38 |
|
| 39 |
// fill the GenEventData structures |
| 40 |
GenEventData data; |
| 41 |
write_data(data); |
| 42 |
|
| 43 |
b.WriteClassBuffer(TClass::GetClass("HepMC3::GenEventData"), &data); |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
void GenRunInfo::Streamer(TBuffer &b) { |
| 49 |
|
| 50 |
if (b.IsReading()) { |
| 51 |
|
| 52 |
GenRunInfoData data; |
| 53 |
|
| 54 |
b.ReadClassBuffer(TClass::GetClass("HepMC3::GenRunInfoData"), &data); |
| 55 |
|
| 56 |
read_data(data); |
| 57 |
|
| 58 |
} else { |
| 59 |
|
| 60 |
// fill the GenRunInfo structures |
| 61 |
GenRunInfoData data; |
| 62 |
write_data(data); |
| 63 |
|
| 64 |
b.WriteClassBuffer(TClass::GetClass("HepMC3::GenRunInfoData"), &data); |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
#endif |
| 69 |
|
| 70 |
} // namespace HepMC3 |