00001 //-------------------------------------------------------------------------- 00002 #ifndef HEPMC_IO_HEPEVT_H 00003 #define HEPMC_IO_HEPEVT_H 00004 00006 // Matt.Dobbs@Cern.CH, January 2000, 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 // HEPEVT IO class 00012 // 00013 // Important note: This class uses HepMC::HEPEVT_Wrapper which is an 00014 // interface to the fortran77 HEPEVT common block. 00015 // The precision and number of entries in the F77 common 00016 // block can be specified. See HepMC/HEPEVT_Wrapper.h. 00017 // You will very likely have to specify these values for your 00018 // application. 00019 // 00020 // 00021 00022 #include <map> 00023 #include <vector> 00024 #include "HepMC/IO_BaseClass.h" 00025 #include "HepMC/HEPEVT_Wrapper.h" 00026 00027 namespace HepMC { 00028 00029 class GenEvent; 00030 class GenVertex; 00031 class GenParticle; 00032 class ParticleDataTable; 00033 00035 00040 class IO_HEPEVT : public IO_BaseClass { 00041 public: 00042 IO_HEPEVT(); 00043 virtual ~IO_HEPEVT(); 00044 bool fill_next_event( GenEvent* ); 00045 void write_event( const GenEvent* ); 00046 void print( std::ostream& ostr = std::cout ) const; 00047 00048 // see comments below for these switches. 00050 bool trust_both_mothers_and_daughters() const; 00052 bool trust_mothers_before_daughters() const; 00054 bool print_inconsistency_errors() const; 00056 bool trust_beam_particles() const; 00058 void set_trust_mothers_before_daughters( bool b = 1 ); 00060 void set_trust_both_mothers_and_daughters( bool b = 0 ); 00084 void set_print_inconsistency_errors( bool b = 1 ); 00086 void set_trust_beam_particles( bool b = true ); 00087 00088 protected: // for internal use only 00090 GenParticle* build_particle( int index ); 00092 void build_production_vertex( 00093 int i,std::vector<HepMC::GenParticle*>& hepevt_particle, GenEvent* evt ); 00095 void build_end_vertex( 00096 int i, std::vector<HepMC::GenParticle*>& hepevt_particle, GenEvent* evt ); 00098 int find_in_map( 00099 const std::map<HepMC::GenParticle*,int>& m, GenParticle* p) const; 00100 00101 private: // following are not implemented for HEPEVT 00102 virtual void write_particle_data_table( const ParticleDataTable* ){} 00103 virtual bool fill_particle_data_table( ParticleDataTable* ) 00104 { return 0; } 00105 00106 private: // use of copy constructor is not allowed 00107 IO_HEPEVT( const IO_HEPEVT& ) : IO_BaseClass() {} 00108 00109 private: // data members 00110 00111 bool m_trust_mothers_before_daughters; 00112 bool m_trust_both_mothers_and_daughters; 00113 bool m_print_inconsistency_errors; 00114 bool m_trust_beam_particles; 00115 }; 00116 00118 // INLINES access methods // 00120 inline bool IO_HEPEVT::trust_both_mothers_and_daughters() const 00121 { return m_trust_both_mothers_and_daughters; } 00122 00123 inline bool IO_HEPEVT::trust_mothers_before_daughters() const 00124 { return m_trust_mothers_before_daughters; } 00125 00126 inline bool IO_HEPEVT::print_inconsistency_errors() const 00127 { return m_print_inconsistency_errors; } 00128 00129 inline void IO_HEPEVT::set_trust_both_mothers_and_daughters( bool b ) 00130 { m_trust_both_mothers_and_daughters = b; } 00131 00132 inline void IO_HEPEVT::set_trust_mothers_before_daughters( bool b ) 00133 { m_trust_mothers_before_daughters = b; } 00134 00135 inline void IO_HEPEVT::set_print_inconsistency_errors( bool b ) 00136 { m_print_inconsistency_errors = b; } 00137 00138 inline bool IO_HEPEVT::trust_beam_particles() const 00139 { return m_trust_beam_particles; } 00140 00141 inline void IO_HEPEVT::set_trust_beam_particles( bool b ) 00142 { m_trust_beam_particles = b; } 00143 00144 } // HepMC 00145 00146 #endif // HEPMC_IO_HEPEVT_H 00147 //--------------------------------------------------------------------------