hepmc - Blame information for rev 69

Subversion Repositories:
Rev:
Rev Author Line No. Line
2 garren 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  
43 namespace HepMC {
44  
45     class GenEvent;
46     class GenVertex;
47     class GenParticle;
48     class ParticleDataTable;
49  
65 garren 50     //! IO_HERWIG is used to get Herwig information
51  
52     ///
53     /// \class  IO_HERWIG
54     /// IO class for reading the HEPEVT common block from
55     ///  the Herwig monte carlo program.
56     ///
2 garren 57     class IO_HERWIG : public IO_BaseClass {
58     public:
59         IO_HERWIG();
60         virtual           ~IO_HERWIG();
65 garren 61         /// get the next event
2 garren 62         bool              fill_next_event( GenEvent* );
65 garren 63         /// write to ostr
2 garren 64         void              print( std::ostream& ostr = std::cout ) const;
65 garren 65         /// this information is dubious
2 garren 66         double            interfaces_to_version_number() const {return 6.400;}
67  
68         // see comments below for these switches.
65 garren 69         /// default is true
2 garren 70         bool              print_inconsistency_errors() const;
65 garren 71         /// decide whether or not to print inconsistency errors
2 garren 72         void              set_print_inconsistency_errors( bool b = 1 );
73  
65 garren 74         /// ask how to deal with extra non-physical pseudo particles
2 garren 75         bool              no_gaps_in_barcodes() const
76                              { return m_no_gaps_in_barcodes; }
65 garren 77         /// The HERWIG HEPEVT common block has some EXTRA non-physical ENTRIES
78         /// (such as CMS frame, HARD subprocess, and CONE).
79         /// These are removed by IO_HERWIG. Thus the HepMC event will APPEAR
80         /// to have fewer particles in it that herwig did.
81         /// There is a switch m_no_gaps_in_barcodes. For
82         ///   true  - then the extra particles are removed from HEPEVT, with
83         ///             the result that the HepMC barcodes will be sequential, with
84         ///             no gaps.
85         ///   false - the barcodes will correspond directly to the HEPEVT index, but
86         ///             there will be gaps ... ie some barcodes will be unassigned.
87         ///   this switch requested by I Hinchliffe, October 31, 2002
2 garren 88         void              set_no_gaps_in_barcodes( bool a )
89                              { m_no_gaps_in_barcodes=a; }
90  
91     protected: // for internal use only
65 garren 92         /// default is true
2 garren 93         bool              trust_both_mothers_and_daughters() const;
65 garren 94         /// default is false
2 garren 95         bool              trust_mothers_before_daughters() const;
65 garren 96         /// define mother daughter trust rules
2 garren 97         void              set_trust_mothers_before_daughters( bool b = 1 );
65 garren 98         /// define mother daughter trust rules
2 garren 99         void              set_trust_both_mothers_and_daughters( bool b = 0 );
100  
69 garren 101         /// make a particle
2 garren 102         GenParticle* build_particle( int index );
69 garren 103         /// make a production vertex
2 garren 104         void         build_production_vertex(
105             int i,std::vector<GenParticle*>& hepevt_particle, GenEvent* evt );
69 garren 106         /// make a decay vertex
2 garren 107         void         build_end_vertex(
108             int i, std::vector<GenParticle*>& hepevt_particle, GenEvent* evt );
65 garren 109         /// find this particle in the map
2 garren 110         int          find_in_map(
111             const std::map<GenParticle*,int>& m, GenParticle* p) const;
112  
65 garren 113         /// make the HERWIG HEPEVT common block look like the standard
2 garren 114         void repair_hepevt() const;
65 garren 115         /// deal with artifacts of repairing HEPEVT
2 garren 116         void remove_gaps_in_hepevt() const;
65 garren 117         /// zero out a HEPEVT pseudo particle
2 garren 118         void zero_hepevt_entry( int i ) const;
65 garren 119         /// translate particle ID
2 garren 120         int  translate_herwig_to_pdg_id( int i ) const;
121  
122     private: // following are not implemented for Herwig
123         virtual void write_event( const GenEvent* ){}
124         virtual void write_particle_data_table( const ParticleDataTable* ){}
125         virtual bool fill_particle_data_table( ParticleDataTable* )
126             { return 0; }
127  
128     private: // use of copy constructor is not allowed
129         IO_HERWIG( const IO_HERWIG& ) : IO_BaseClass() {}
130  
131     private: // data members
132         bool              m_trust_mothers_before_daughters;
133         bool              m_trust_both_mothers_and_daughters;
134         bool              m_print_inconsistency_errors;
135         bool              m_no_gaps_in_barcodes;
136         std::vector<int>  m_herwig_to_pdg_id;
137         std::set<int>     m_no_antiparticles;
138     };
139  
140     ////////////////////////////
141     // INLINES access methods //
142     ////////////////////////////
143     inline bool IO_HERWIG::trust_both_mothers_and_daughters() const
144     { return m_trust_both_mothers_and_daughters; }
145  
146     inline bool IO_HERWIG::trust_mothers_before_daughters() const
147     { return m_trust_mothers_before_daughters; }
148  
149     inline bool IO_HERWIG::print_inconsistency_errors() const
150     { return m_print_inconsistency_errors; }
151  
152     inline void IO_HERWIG::set_trust_both_mothers_and_daughters( bool b )
153     { m_trust_both_mothers_and_daughters = b; }
154  
155     inline void IO_HERWIG::set_trust_mothers_before_daughters( bool b )
156     { m_trust_mothers_before_daughters = b; }
157  
158     inline void IO_HERWIG::set_print_inconsistency_errors( bool b  )
159     { m_print_inconsistency_errors = b; }
160  
161 } // HepMC
162  
163 #endif  // HEPMC_IO_HERWIG_H
164 //--------------------------------------------------------------------------