LcioHitsCollectionBuilder.hh

Go to the documentation of this file.
00001 // $Header: /cvs/lcd/slic/include/LcioHitsCollectionBuilder.hh,v 1.5 2007/04/27 01:54:32 jeremy Exp $
00002 
00003 #ifndef SLIC_LCIOHITSCOLLECTIONBUILDER_HH
00004 #define SLIC_LCIOHITSCOLLECTIONBUILDER_HH
00005 
00006 // slic
00007 #include "Module.hh"
00008 
00009 // lcdd
00010 #include "G4SensitiveDetector.hh"
00011 #include "G4CalorimeterHit.hh"
00012 #include "G4TrackerHit.hh"
00013 
00014 // lcio
00015 #include "EVENT/LCEvent.h"
00016 #include "IMPL/LCFlagImpl.h"
00017 #include "IMPL/LCEventImpl.h"
00018 #include "IMPL/LCCollectionVec.h"
00019 #include "IMPL/SimCalorimeterHitImpl.h"
00020 #include "IMPL/SimTrackerHitImpl.h"
00021 
00022 // geant4
00023 #include "G4Event.hh"
00024 
00025 namespace slic
00026 {
00027 
00028   class LcioMcpManager;
00029 
00035   class LcioHitsCollectionBuilder : public Module
00036   {
00037   public:
00038     LcioHitsCollectionBuilder();
00039     virtual ~LcioHitsCollectionBuilder();
00040 
00041   public:
00042 
00043     // interface function to create an Lcio event from a G4 event
00044     EVENT::LCEvent* createHCsFromG4Event(const G4Event* g4evt, EVENT::LCEvent* lcevt);
00045 
00046     // flags for hits
00047     void setLongFlag(bool s = true);
00048     void setPDGFlag(bool s = true);
00049 
00050     void setStoreMomentum( bool s = true )
00051     {
00052       m_storeMomentum = s;
00053     }
00054 
00055     bool getStoreMomentum()
00056     {
00057       return m_storeMomentum;
00058     }
00059 
00060   private:
00061     // create the hit collections in Lcio Event from the current G4Event
00062     void createHitCollections();
00063 
00064     // create the LCCollectionVec
00065     IMPL::LCCollectionVec* createCollectionVec(G4VHitsCollection* g4HC,
00066                                                G4SensitiveDetector::EType SDtype);
00067 
00068     // create a tracker coll
00069     IMPL::LCCollectionVec* createTrackerCollectionVec(G4VHitsCollection* g4HC);
00070 
00071     // create a calorimeter coll
00072     IMPL::LCCollectionVec* createCalorimeterCollectionVec(G4VHitsCollection* g4HC);
00073 
00074     // save cal hits
00075     void saveHits(G4CalorimeterHitsCollection* calHits,
00076                   IMPL::LCCollectionVec* lcioColl);
00077 
00078     // save trk hits
00079     void saveHits(G4TrackerHitsCollection* trkHits,
00080                   IMPL::LCCollectionVec* lcioColl);
00081 
00082     // create cal hit from G4 cal hit
00083     IMPL::SimCalorimeterHitImpl* createHit(G4CalorimeterHit* calHit);
00084 
00085     // create trk hit from G4 trk hit
00086     IMPL::SimTrackerHitImpl* createHit(G4TrackerHit* trkHit);
00087 
00088     // copy MCParticle hit contributions from G4 cal hit to the LCIO cal hit
00089     void addMcpContribs( G4CalorimeterHit*, IMPL::SimCalorimeterHitImpl* );
00090 
00091     // setup default flag settings; called in ctor
00092     void setCalFlagDefaults();
00093 
00094     // combine Mcp hit contribs using track ID
00095     void combineMcpHitContribs(const McpHitContribList& long_contrib,
00096                                McpHitContribList& combined_contrib);
00097 
00098     // find single contrib by track ID in the combined list
00099     McpHitContrib* findMcpHitContribByTrackID(int trk_id,
00100                                               McpHitContribList& contribs);
00101 
00102     // set endcap bit in trk or cal flag depending on SD type
00103     void setEndcapFlag(G4SensitiveDetector* g4sd);
00104 
00105   private:
00106 
00107     // current Lcio event
00108     EVENT::LCEvent* m_currentLCEvent;
00109 
00110     // current G4 event
00111     const G4Event* m_currentG4Event;
00112 
00113     // default flags
00114     IMPL::LCFlagImpl m_trkCollFlag;
00115     IMPL::LCFlagImpl m_calCollFlag;
00116 
00117     // store momentum
00118     bool m_storeMomentum;
00119 
00120     // ptr to Lcio Mcp manager for lkp of Mcp data
00121     LcioMcpManager* m_mcpManager;
00122   };
00123 }
00124 
00125 #endif

Generated on Thu Nov 15 15:24:16 2007 for Simulator for the Linear Collider by  doxygen 1.5.4