]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TEvtGen/HepMC/IO_HERWIG.h
Adding include path to allow compilation of CleanGeom task
[u/mrichter/AliRoot.git] / TEvtGen / HepMC / IO_HERWIG.h
CommitLineData
0ca57c2f 1//--------------------------------------------------------------------------
2#ifndef HEPMC_IO_HERWIG_H
3#define HEPMC_IO_HERWIG_H
4
5//////////////////////////////////////////////////////////////////////////
6// Matt.Dobbs@Cern.CH, October 2002, 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// IO class for reading the (non-standard) HEPEVT common block from
11// the Herwig monte carlo program.
12// Notes:
13// - The HERWIG HEPEVT common block is non-standard, primarily because it
14// contains some color flow information. When you call IO_HERWIG, the
15// HEPEVT common block is transformed to the standard. THIS CHANGES THE
16// CONTENT of HEPEVT!.
17// - The HERWIG HEPEVT common block has some EXTRA non-physical ENTRIES
18// (such as CMS frame, HARD subprocess, and CONE).
19// These are removed by IO_HERWIG. Thus the HepMC event will APPEAR
20// to have fewer particles in it that herwig did.
21// There is a switch m_no_gaps_in_barcodes. For
22// true - then the extra particles are removed from HEPEVT, with
23// the result that the HepMC barcodes will be sequential, with
24// no gaps.
25// false - the barcodes will correspond directly to the HEPEVT index, but
26// there will be gaps ... ie some barcodes will be unassigned.
27// this switch requested by I Hinchliffe, October 31, 2002
28// - some of the Herwig GLUON SPLITTING products are not properly documented
29// in hepevt. I was unable to repair this in a simple and robust way.
30// Therefore some of the gluon splitting products will be orphans
31// in the HepMC output.
32// - Herwig uses HEPEVT_Wrapper::set_max_number_entries(4000);
33// HEPEVT_Wrapper::set_sizeof_real(8);
34// which are the defaults for HEPEVT_Wrapper.
35//////////////////////////////////////////////////////////////////////////
36//
37
38#include <set>
39#include <vector>
40#include "HepMC/IO_BaseClass.h"
41#include "HepMC/HEPEVT_Wrapper.h"
42
43namespace HepMC {
44
45 class GenEvent;
46 class GenVertex;
47 class GenParticle;
48
49 //! IO_HERWIG is used to get Herwig information
50
51 ///
52 /// \class IO_HERWIG
53 /// IO class for reading the HEPEVT common block from
54 /// the Herwig monte carlo program.
55 ///
56 class IO_HERWIG : public IO_BaseClass {
57 public:
58 IO_HERWIG();
59 virtual ~IO_HERWIG();
60 /// get the next event
61 bool fill_next_event( GenEvent* );
62 /// write to ostr
63 void print( std::ostream& ostr = std::cout ) const;
64 /// this information is dubious
65 double interfaces_to_version_number() const {return 6.400;}
66
67 // see comments below for these switches.
68 /// default is true
69 bool print_inconsistency_errors() const;
70 /// decide whether or not to print inconsistency errors
71 void set_print_inconsistency_errors( bool b = true );
72
73 /// ask how to deal with extra non-physical pseudo particles
74 bool no_gaps_in_barcodes() const
75 { return m_no_gaps_in_barcodes; }
76 /// The HERWIG HEPEVT common block has some EXTRA non-physical ENTRIES
77 /// (such as CMS frame, HARD subprocess, and CONE).
78 /// These are removed by IO_HERWIG. Thus the HepMC event will APPEAR
79 /// to have fewer particles in it that herwig did.
80 /// There is a switch m_no_gaps_in_barcodes. For
81 /// true - then the extra particles are removed from HEPEVT, with
82 /// the result that the HepMC barcodes will be sequential, with
83 /// no gaps.
84 /// false - the barcodes will correspond directly to the HEPEVT index, but
85 /// there will be gaps ... ie some barcodes will be unassigned.
86 /// this switch requested by I Hinchliffe, October 31, 2002
87 void set_no_gaps_in_barcodes( bool a )
88 { m_no_gaps_in_barcodes=a; }
89
90 protected: // for internal use only
91 /// default is true
92 bool trust_both_mothers_and_daughters() const;
93 /// default is false
94 bool trust_mothers_before_daughters() const;
95 /// define mother daughter trust rules
96 void set_trust_mothers_before_daughters( bool b = true );
97 /// define mother daughter trust rules
98 void set_trust_both_mothers_and_daughters( bool b = false );
99
100 /// make a particle
101 GenParticle* build_particle( int index );
102 /// make a production vertex
103 void build_production_vertex(
104 int i,std::vector<GenParticle*>& hepevt_particle, GenEvent* evt );
105 /// make a decay vertex
106 void build_end_vertex(
107 int i, std::vector<GenParticle*>& hepevt_particle, GenEvent* evt );
108 /// find this particle in the map
109 int find_in_map(
110 const std::map<GenParticle*,int>& m, GenParticle* p) const;
111
112 /// make the HERWIG HEPEVT common block look like the standard
113 void repair_hepevt() const;
114 /// deal with artifacts of repairing HEPEVT
115 void remove_gaps_in_hepevt() const;
116 /// zero out a HEPEVT pseudo particle
117 void zero_hepevt_entry( int i ) const;
118 /// translate particle ID
119 int translate_herwig_to_pdg_id( int i ) const;
120
121 private: // following are not implemented for Herwig
122 virtual void write_event( const GenEvent* ){}
123
124 private: // use of copy constructor is not allowed
125 IO_HERWIG( const IO_HERWIG& ) : IO_BaseClass() {}
126
127 private: // data members
128 bool m_trust_mothers_before_daughters;
129 bool m_trust_both_mothers_and_daughters;
130 bool m_print_inconsistency_errors;
131 bool m_no_gaps_in_barcodes;
132 std::vector<int> m_herwig_to_pdg_id;
133 std::set<int> m_no_antiparticles;
134 };
135
136 ////////////////////////////
137 // INLINES access methods //
138 ////////////////////////////
139 inline bool IO_HERWIG::trust_both_mothers_and_daughters() const
140 { return m_trust_both_mothers_and_daughters; }
141
142 inline bool IO_HERWIG::trust_mothers_before_daughters() const
143 { return m_trust_mothers_before_daughters; }
144
145 inline bool IO_HERWIG::print_inconsistency_errors() const
146 { return m_print_inconsistency_errors; }
147
148 inline void IO_HERWIG::set_trust_both_mothers_and_daughters( bool b )
149 { m_trust_both_mothers_and_daughters = b; }
150
151 inline void IO_HERWIG::set_trust_mothers_before_daughters( bool b )
152 { m_trust_mothers_before_daughters = b; }
153
154 inline void IO_HERWIG::set_print_inconsistency_errors( bool b )
155 { m_print_inconsistency_errors = b; }
156
157} // HepMC
158
159#endif // HEPMC_IO_HERWIG_H
160//--------------------------------------------------------------------------