]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TEvtGen/HepMC/IO_HEPEVT.h
Adding include path to allow compilation of CleanGeom task
[u/mrichter/AliRoot.git] / TEvtGen / HepMC / IO_HEPEVT.h
CommitLineData
0ca57c2f 1//--------------------------------------------------------------------------
2#ifndef HEPMC_IO_HEPEVT_H
3#define HEPMC_IO_HEPEVT_H
4
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).
9//
10// HEPEVT IO class
11//////////////////////////////////////////////////////////////////////////
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
27namespace HepMC {
28
29 class GenEvent;
30 class GenVertex;
31 class GenParticle;
32
33 //! HEPEVT IO class
34
35 ///
36 /// \class IO_HEPEVT
37 /// IO class for reading the standard HEPEVT common block.
38 ///
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.
48 /// default is false
49 bool trust_both_mothers_and_daughters() const;
50 /// default is true
51 bool trust_mothers_before_daughters() const;
52 /// default is true
53 bool print_inconsistency_errors() const;
54 /// default is true
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()
74 ///
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 );
86
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
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
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; }
116
117 inline bool IO_HEPEVT::trust_mothers_before_daughters() const
118 { return m_trust_mothers_before_daughters; }
119
120 inline bool IO_HEPEVT::print_inconsistency_errors() const
121 { return m_print_inconsistency_errors; }
122
123 inline void IO_HEPEVT::set_trust_both_mothers_and_daughters( bool b )
124 { m_trust_both_mothers_and_daughters = b; }
125
126 inline void IO_HEPEVT::set_trust_mothers_before_daughters( bool b )
127 { m_trust_mothers_before_daughters = b; }
128
129 inline void IO_HEPEVT::set_print_inconsistency_errors( bool b )
130 { m_print_inconsistency_errors = b; }
131
132 inline bool IO_HEPEVT::trust_beam_particles() const
133 { return m_trust_beam_particles; }
134
135 inline void IO_HEPEVT::set_trust_beam_particles( bool b )
136 { m_trust_beam_particles = b; }
137
138} // HepMC
139
140#endif // HEPMC_IO_HEPEVT_H
141//--------------------------------------------------------------------------