HepMC3 event record library
Streamers.cc
Go to the documentation of this file.
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 
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  if (b.IsReading()) {
29  GenEventData data;
30 
31  b.ReadClassBuffer(TClass::GetClass("HepMC3::GenEventData"), &data);
32 
33  read_data(data);
34  } else {
35  // fill the GenEventData structures
36  GenEventData data;
37  write_data(data);
38 
39  b.WriteClassBuffer(TClass::GetClass("HepMC3::GenEventData"), &data);
40  }
41 }
42 
43 
44 void GenRunInfo::Streamer(TBuffer &b) {
45  if (b.IsReading()) {
46  GenRunInfoData data;
47 
48  b.ReadClassBuffer(TClass::GetClass("HepMC3::GenRunInfoData"), &data);
49 
50  read_data(data);
51  } else {
52  // fill the GenRunInfo structures
53  GenRunInfoData data;
54  write_data(data);
55 
56  b.WriteClassBuffer(TClass::GetClass("HepMC3::GenRunInfoData"), &data);
57  }
58 }
59 
60 #endif
61 
62 } // namespace HepMC3
GenEvent.h
Definition of class GenEvent.
HepMC3
HepMC3 main namespace.
Definition: AnalysisExample.h:19
HepMC3::GenEvent::write_data
void write_data(GenEventData &data) const
Fill GenEventData object.
Definition: GenEvent.cc:633
HepMC3::GenRunInfo::write_data
void write_data(GenRunInfoData &data) const
Fill GenRunInfoData object.
Definition: GenRunInfo.cc:51
HepMC3::GenRunInfo::read_data
void read_data(const GenRunInfoData &data)
Fill GenRunInfo based on GenRunInfoData.
Definition: GenRunInfo.cc:83
GenRunInfoData.h
Definition of struct GenRunInfoData.
HepMC3::GenEvent::read_data
void read_data(const GenEventData &data)
Fill GenEvent based on GenEventData.
Definition: GenEvent.cc:690
GenEventData.h
Definition of struct GenEventData.