StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IO_HEPEVT.h
1 //--------------------------------------------------------------------------
2 #ifndef HEPMC_IO_HEPEVT_H
3 #define HEPMC_IO_HEPEVT_H
4 
6 // Matt.Dobbs@Cern.CH, January 2000, refer to:
7 // M. Dobbs and J.B. Hansen, "The HepMC C++ Monte Carlo Event Record for
8 // High Energy Physics", Computer Physics Communications (to be published).
9 //
10 // HEPEVT IO class
12 //
13 // Important note: This class uses HepMC::HEPEVT_Wrapper which is an
14 // interface to the fortran77 HEPEVT common block.
15 // The precision and number of entries in the F77 common
16 // block can be specified. See HepMC/HEPEVT_Wrapper.h.
17 // You will very likely have to specify these values for your
18 // application.
19 //
20 //
21 
22 #include <map>
23 #include <vector>
24 #include "HepMC/IO_BaseClass.h"
25 #include "HepMC/HEPEVT_Wrapper.h"
26 
27 namespace HepMC {
28 
29  class GenEvent;
30  class GenVertex;
31  class GenParticle;
32 
34 
39  class IO_HEPEVT : public IO_BaseClass {
40  public:
41  IO_HEPEVT();
42  virtual ~IO_HEPEVT();
43  bool fill_next_event( GenEvent* );
44  void write_event( const GenEvent* );
45  void print( std::ostream& ostr = std::cout ) const;
46 
47  // see comments below for these switches.
51  bool trust_mothers_before_daughters() const;
53  bool print_inconsistency_errors() const;
55  bool trust_beam_particles() const;
57  void set_trust_mothers_before_daughters( bool b = true );
59  void set_trust_both_mothers_and_daughters( bool b = false );
83  void set_print_inconsistency_errors( bool b = true );
85  void set_trust_beam_particles( bool b = true );
86 
87  protected: // for internal use only
89  GenParticle* build_particle( int index );
92  int i,std::vector<HepMC::GenParticle*>& hepevt_particle, GenEvent* evt );
94  void build_end_vertex(
95  int i, std::vector<HepMC::GenParticle*>& hepevt_particle, GenEvent* evt );
97  int find_in_map(
98  const std::map<HepMC::GenParticle*,int>& m, GenParticle* p) const;
99 
100  private: // use of copy constructor is not allowed
101  IO_HEPEVT( const IO_HEPEVT& ) : IO_BaseClass() {}
102 
103  private: // data members
104 
105  bool m_trust_mothers_before_daughters;
106  bool m_trust_both_mothers_and_daughters;
107  bool m_print_inconsistency_errors;
108  bool m_trust_beam_particles;
109  };
110 
112  // INLINES access methods //
115  { return m_trust_both_mothers_and_daughters; }
116 
118  { return m_trust_mothers_before_daughters; }
119 
121  { return m_print_inconsistency_errors; }
122 
124  { m_trust_both_mothers_and_daughters = b; }
125 
127  { m_trust_mothers_before_daughters = b; }
128 
130  { m_print_inconsistency_errors = b; }
131 
133  { return m_trust_beam_particles; }
134 
136  { m_trust_beam_particles = b; }
137 
138 } // HepMC
139 
140 #endif // HEPMC_IO_HEPEVT_H
141 //--------------------------------------------------------------------------
bool print_inconsistency_errors() const
default is true
Definition: IO_HEPEVT.h:120
void set_trust_both_mothers_and_daughters(bool b=false)
define mother daughter trust rules
Definition: IO_HEPEVT.h:123
void set_trust_beam_particles(bool b=true)
declare whether or not beam particles exist
Definition: IO_HEPEVT.h:135
bool trust_mothers_before_daughters() const
default is true
Definition: IO_HEPEVT.h:117
void write_event(const GenEvent *)
write this GenEvent
Definition: IO_HEPEVT.cc:110
GenParticle * build_particle(int index)
create a GenParticle
Definition: IO_HEPEVT.cc:325
void build_end_vertex(int i, std::vector< HepMC::GenParticle * > &hepevt_particle, GenEvent *evt)
create an end vertex
Definition: IO_HEPEVT.cc:257
The GenEvent class is the core of HepMC.
Definition: GenEvent.h:155
all input/output classes inherit from IO_BaseClass
Definition: IO_BaseClass.h:34
int find_in_map(const std::map< HepMC::GenParticle *, int > &m, GenParticle *p) const
find this particle in the particle map
Definition: IO_HEPEVT.cc:340
void build_production_vertex(int i, std::vector< HepMC::GenParticle * > &hepevt_particle, GenEvent *evt)
create a production vertex
Definition: IO_HEPEVT.cc:191
void set_print_inconsistency_errors(bool b=true)
Definition: IO_HEPEVT.h:129
void set_trust_mothers_before_daughters(bool b=true)
define mother daughter trust rules
Definition: IO_HEPEVT.h:126
void print(std::ostream &ostr=std::cout) const
write output to ostr
Definition: IO_HEPEVT.cc:20
bool fill_next_event(GenEvent *)
fill this GenEvent
Definition: IO_HEPEVT.cc:31
bool trust_both_mothers_and_daughters() const
default is false
Definition: IO_HEPEVT.h:114
HEPEVT IO class.
Definition: IO_HEPEVT.h:39
bool trust_beam_particles() const
default is true
Definition: IO_HEPEVT.h:132
The GenParticle class contains information about generated particles.
Definition: GenParticle.h:60