1 //--------------------------------------------------------------------------
2 #ifndef HEPMC_IO_HEPEVT_H
3 #define HEPMC_IO_HEPEVT_H
5 //////////////////////////////////////////////////////////////////////////
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).
11 //////////////////////////////////////////////////////////////////////////
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
24 #include "HepMC/IO_BaseClass.h"
25 #include "HepMC/HEPEVT_Wrapper.h"
37 /// IO class for reading the standard HEPEVT common block.
39 class IO_HEPEVT : public IO_BaseClass {
43 bool fill_next_event( GenEvent* );
44 void write_event( const GenEvent* );
45 void print( std::ostream& ostr = std::cout ) const;
47 // see comments below for these switches.
49 bool trust_both_mothers_and_daughters() const;
51 bool trust_mothers_before_daughters() const;
53 bool print_inconsistency_errors() const;
55 bool trust_beam_particles() const;
56 /// define mother daughter trust rules
57 void set_trust_mothers_before_daughters( bool b = true );
58 /// define mother daughter trust rules
59 void set_trust_both_mothers_and_daughters( bool b = false );
60 /// Since HEPEVT has bi-directional pointers, it is possible that
61 /// the mother/daughter pointers are inconsistent (though physically
62 /// speaking this should never happen). In practise it happens often.
63 /// When a conflict occurs (i.e. when mother/daughter pointers are in
64 /// disagreement, where an empty (0) pointer is not considered a
65 /// disagreement) an error is printed. These errors can be turned off
66 /// with: myio_hepevt.set_print_inconsistency_errors(0);
67 /// but it is STRONGLY recommended that you print the HEPEVT
68 /// common and understand the inconsistency BEFORE you turn off the
69 /// errors. The messages are there for a reason [remember, there is
70 /// no message printed when the information is missing, ... only when
71 /// is it inconsistent. User beware.]
72 /// You can inspect the HEPEVT common block for inconsistencies with
73 /// HEPEVT_Wrapper::check_hepevt_consistency()
75 /// There is a switch controlling whether the mother pointers or
76 /// the daughters are to be trusted.
77 /// For example, in Pythia the mother information is always correctly
78 /// included, but the daughter information is often left unfilled: in
79 /// this case we want to trust the mother pointers and not necessarily
80 /// the daughters. [THIS IS THE DEFAULT]. Unfortunately the reverse
81 /// happens for the stdhep(2001) translation of Isajet, so we need
82 /// an option to toggle the choices.
83 void set_print_inconsistency_errors( bool b = true );
84 /// declare whether or not beam particles exist
85 void set_trust_beam_particles( bool b = true );
87 protected: // for internal use only
88 /// create a GenParticle
89 GenParticle* build_particle( int index );
90 /// create a production vertex
91 void build_production_vertex(
92 int i,std::vector<HepMC::GenParticle*>& hepevt_particle, GenEvent* evt );
93 /// create an end vertex
94 void build_end_vertex(
95 int i, std::vector<HepMC::GenParticle*>& hepevt_particle, GenEvent* evt );
96 /// find this particle in the particle map
98 const std::map<HepMC::GenParticle*,int>& m, GenParticle* p) const;
100 private: // use of copy constructor is not allowed
101 IO_HEPEVT( const IO_HEPEVT& ) : IO_BaseClass() {}
103 private: // data members
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;
111 ////////////////////////////
112 // INLINES access methods //
113 ////////////////////////////
114 inline bool IO_HEPEVT::trust_both_mothers_and_daughters() const
115 { return m_trust_both_mothers_and_daughters; }
117 inline bool IO_HEPEVT::trust_mothers_before_daughters() const
118 { return m_trust_mothers_before_daughters; }
120 inline bool IO_HEPEVT::print_inconsistency_errors() const
121 { return m_print_inconsistency_errors; }
123 inline void IO_HEPEVT::set_trust_both_mothers_and_daughters( bool b )
124 { m_trust_both_mothers_and_daughters = b; }
126 inline void IO_HEPEVT::set_trust_mothers_before_daughters( bool b )
127 { m_trust_mothers_before_daughters = b; }
129 inline void IO_HEPEVT::set_print_inconsistency_errors( bool b )
130 { m_print_inconsistency_errors = b; }
132 inline bool IO_HEPEVT::trust_beam_particles() const
133 { return m_trust_beam_particles; }
135 inline void IO_HEPEVT::set_trust_beam_particles( bool b )
136 { m_trust_beam_particles = b; }
140 #endif // HEPMC_IO_HEPEVT_H
141 //--------------------------------------------------------------------------