CLHEP/HepMC/CBhepevt.h

00001 // $Id: CBhepevt.h,v 1.1 2002/05/30 23:51:04 garren Exp $
00002 // ----------------------------------------------------------------------
00003 // CBhepevt.h
00004 // ----------------------------------------------------------------------
00005 // Author:  Lynn Garren, Marc Paterno
00006 // 
00007 // This is part of the Fortran interface to the stdhep common blocks
00008 // Do not attempt to use hepevt_ directly.
00009 //
00010 // user code:
00011 //   CBhepevt * hep = CBhepevt::instance();
00012 //   hep->hepevt()->nhep;
00013 //   hep->hepev2()->jmulti[i];
00014 // ----------------------------------------------------------------------
00015 #ifndef CBHEPEVT_H
00016 #define CBHEPEVT_H
00017 
00018 #include "CLHEP/HepMC/GenEvent.h"
00019 #include "CLHEP/HepMC/HepMCConfig.h"
00020 
00021 #include "CLHEP/HepMC/include/stdhep.h"
00022 #include "CLHEP/HepMC/include/hepev4.h"
00023 
00024 namespace HepMC {
00025 
00030 class CBhepevt {
00031 
00032 public:
00033 
00034   CBhepevt() 
00035   : hptr( & hepevt_ ),
00036     hptr2( & hepev2_ ),
00037     hptr3( & hepev3_ ),
00038     hptr4( & hepev4_ ),
00039     hptr5( & hepev5_ ), 
00040     itsTrustMothers( true )
00041   { ; }
00042 
00043   hepevt_t * hepevt() { return hptr; }
00044   hepev2_t * hepev2() { return hptr2; }
00045   hepev3_t * hepev3() { return hptr3; }
00046   hepev4_t * hepev4() { return hptr4; }
00047   hepev5_t * hepev5() { return hptr5; }
00048   static int max_number_entries() { return NMXHEP; }
00049   static int max_multiple_interactions() { return NMXMLT; }
00050   int        number_children( int index );
00051   int        number_parents( int index ); 
00052 
00053   void       clean( );
00054   bool       toGenEvent( GenEvent *, bool printErrors );
00055   bool       fromGenEvent( const GenEvent * );
00056   bool       addtoHEPEVT( const GenEvent * );     // not yet implemented
00057   
00058   // decide how to deal with HEPEVT
00059   bool  trustMothers() const { return itsTrustMothers; }
00060   void  setTrustMothers( bool b ) { itsTrustMothers = b; }
00061 
00062 private:
00063 
00064   hepevt_t * hptr;
00065   hepev2_t * hptr2;
00066   hepev3_t * hptr3;
00067   hepev4_t * hptr4;
00068   hepev5_t * hptr5;
00069   bool       itsTrustMothers;
00070 
00071   // internal functions
00072   GenParticle* createParticle( int index );
00073   void buildProductionVertex( int i, 
00074                               std::vector<GenParticle*>& hepevt_particle, 
00075                               GenEvent* evt,
00076                               bool printInconsistencyErrors );
00077   void buildEndVertex( int i, std::vector<GenParticle*>& hepevt_particle, 
00078                        GenEvent* evt,
00079                        bool printInconsistencyErrors );
00080   int  find( const std::map<GenParticle*,int>& m, GenParticle* p);
00081 
00082 };      // CBhepevt
00083 
00084 }       // HepMC
00085 
00086 #include "CLHEP/HepMC/CBhepevt.icc"
00087 #include "CLHEP/HepMC/GenEventtoHEPEVT.icc"
00088 #include "CLHEP/HepMC/HEPEVTtoGenEvent.icc"
00089 
00090 #endif // CBHEPEVT_H

Class Library for High Energy Physics (version 1.8)