HepMC Reference Documentation

HepMC

IO_HERWIG.h

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 #ifndef HEPMC_IO_HERWIG_H
00003 #define HEPMC_IO_HERWIG_H
00004 
00006 // Matt.Dobbs@Cern.CH, October 2002, refer to:
00007 // M. Dobbs and J.B. Hansen, "The HepMC C++ Monte Carlo Event Record for
00008 // High Energy Physics", Computer Physics Communications (to be published).
00009 //
00010 // IO class for reading the (non-standard) HEPEVT common block from 
00011 //  the Herwig monte carlo program.
00012 // Notes:
00013 //   - The HERWIG HEPEVT common block is non-standard, primarily because it 
00014 //     contains some color flow information. When you call IO_HERWIG, the 
00015 //     HEPEVT common block is transformed to the standard. THIS CHANGES THE
00016 //     CONTENT of HEPEVT!.
00017 //   - The HERWIG HEPEVT common block has some EXTRA non-physical ENTRIES 
00018 //     (such as CMS frame, HARD subprocess, and CONE).
00019 //     These are removed by IO_HERWIG. Thus the HepMC event will APPEAR
00020 //     to have fewer particles in it that herwig did.
00021 //     There is a switch m_no_gaps_in_barcodes. For
00022 //       true  - then the extra particles are removed from HEPEVT, with 
00023 //               the result that the HepMC barcodes will be sequential, with 
00024 //               no gaps.
00025 //       false - the barcodes will correspond directly to the HEPEVT index, but
00026 //               there will be gaps ... ie some barcodes will be unassigned.
00027 //       this switch requested by I Hinchliffe, October 31, 2002
00028 //   - some of the Herwig GLUON SPLITTING products are not properly documented
00029 //     in hepevt. I was unable to repair this in a simple and robust way. 
00030 //     Therefore some of the gluon splitting products will be orphans 
00031 //     in the HepMC output. 
00032 //   - Herwig uses      HEPEVT_Wrapper::set_max_number_entries(4000);
00033 //                      HEPEVT_Wrapper::set_sizeof_real(8);
00034 //     which are the defaults for HEPEVT_Wrapper.
00036 //
00037 
00038 #include <set>
00039 #include <vector>
00040 #include "HepMC/IO_BaseClass.h"
00041 #include "HepMC/HEPEVT_Wrapper.h"
00042 
00043 namespace HepMC {
00044 
00045     class GenEvent;
00046     class GenVertex;
00047     class GenParticle;
00048 
00050 
00056     class IO_HERWIG : public IO_BaseClass {
00057     public:
00058         IO_HERWIG();
00059         virtual           ~IO_HERWIG();
00061         bool              fill_next_event( GenEvent* );
00063         void              print( std::ostream& ostr = std::cout ) const;
00065         double            interfaces_to_version_number() const {return 6.400;}
00066                 
00067         // see comments below for these switches.
00069         bool              print_inconsistency_errors() const;
00071         void              set_print_inconsistency_errors( bool b = true );
00072 
00074         bool              no_gaps_in_barcodes() const 
00075                              { return m_no_gaps_in_barcodes; }
00087         void              set_no_gaps_in_barcodes( bool a ) 
00088                              { m_no_gaps_in_barcodes=a; }
00089 
00090     protected: // for internal use only
00092         bool              trust_both_mothers_and_daughters() const;
00094         bool              trust_mothers_before_daughters() const;
00096         void              set_trust_mothers_before_daughters( bool b = true );
00098         void              set_trust_both_mothers_and_daughters( bool b = false );
00099 
00101         GenParticle* build_particle( int index );
00103         void         build_production_vertex( 
00104             int i,std::vector<GenParticle*>& hepevt_particle, GenEvent* evt );
00106         void         build_end_vertex( 
00107             int i, std::vector<GenParticle*>& hepevt_particle, GenEvent* evt );
00109         int          find_in_map( 
00110             const std::map<GenParticle*,int>& m, GenParticle* p) const;
00111 
00113         void repair_hepevt() const;
00115         void remove_gaps_in_hepevt() const;
00117         void zero_hepevt_entry( int i ) const;
00119         int  translate_herwig_to_pdg_id( int i ) const;
00120 
00121     private: // following are not implemented for Herwig
00122         virtual void write_event( const GenEvent* ){}
00123 
00124     private: // use of copy constructor is not allowed
00125         IO_HERWIG( const IO_HERWIG& ) : IO_BaseClass() {}
00126 
00127     private: // data members
00128         bool              m_trust_mothers_before_daughters;
00129         bool              m_trust_both_mothers_and_daughters;
00130         bool              m_print_inconsistency_errors; 
00131         bool              m_no_gaps_in_barcodes;
00132         std::vector<int>  m_herwig_to_pdg_id;
00133         std::set<int>     m_no_antiparticles;
00134     };
00135 
00137     // INLINES access methods //
00139     inline bool IO_HERWIG::trust_both_mothers_and_daughters() const 
00140     { return m_trust_both_mothers_and_daughters; }
00141         
00142     inline bool IO_HERWIG::trust_mothers_before_daughters() const 
00143     { return m_trust_mothers_before_daughters; }
00144 
00145     inline bool IO_HERWIG::print_inconsistency_errors() const
00146     { return m_print_inconsistency_errors; }
00147 
00148     inline void IO_HERWIG::set_trust_both_mothers_and_daughters( bool b )
00149     { m_trust_both_mothers_and_daughters = b; }
00150 
00151     inline void IO_HERWIG::set_trust_mothers_before_daughters( bool b )
00152     { m_trust_mothers_before_daughters = b; }
00153 
00154     inline void IO_HERWIG::set_print_inconsistency_errors( bool b  )
00155     { m_print_inconsistency_errors = b; }
00156 
00157 } // HepMC
00158 
00159 #endif  // HEPMC_IO_HERWIG_H
00160 //--------------------------------------------------------------------------

Generated on Fri Feb 17 00:31:25 2012 for HepMC by  doxygen 1.4.7