00001 // ============================================================================ 00002 #ifndef GaussTools_GaussTrackInformation_H 00003 #define GaussTools_GaussTrackInformation_H 1 00004 // ============================================================================ 00006 #include <string> 00007 #include <vector> 00008 // GiGa 00009 #include "GiGa/GiGaUtil.h" 00011 #include "G4VUserTrackInformation.hh" 00013 #include "GaussTools/GaussHitBase.h" 00014 #include "GaussTools/DetTrackInfo.h" 00015 00025 00026 class GaussTrackInformation : public G4VUserTrackInformation 00027 { 00028 public: 00029 // the actual tyep of hit conatiner 00030 typedef std::vector<GaussHitBase*> Hits; 00031 public: 00032 00034 GaussTrackInformation() ; 00035 00039 GaussTrackInformation( const GaussTrackInformation& right ); 00040 00042 virtual ~GaussTrackInformation() ; 00043 00045 virtual GaussTrackInformation* clone() const ; 00046 00048 void* operator new ( size_t ); 00049 00051 void operator delete ( void* ); 00052 00054 virtual void Print () const {}; 00055 00057 const bool appendStep () const { return m_appendStep ; } 00058 00062 GaussTrackInformation& setAppendStep ( const bool value ) 00063 { m_appendStep = value ; return *this ; } 00064 00066 const bool toBeStored () const { return m_toBeStored ; } 00067 00071 GaussTrackInformation& setToBeStored ( const bool value ) 00072 { m_toBeStored = value ; return *this ; } 00073 00075 const bool createdHit() const { return m_createdHit ; } 00076 00080 GaussTrackInformation& setCreatedHit ( const bool value ) 00081 { m_createdHit = value ; return *this ; } 00082 00083 // Retrieve if direct parent particle has been stored or not 00084 const bool directParent() const {return m_directParent;} 00085 00086 // Set if direct parent particle has been stored or not 00087 GaussTrackInformation& setDirectParent(const bool value) 00088 { m_directParent = value; return *this;} 00089 00091 const bool storeHepMC() const {return m_storeHepMC;} 00092 00094 GaussTrackInformation& setStoreHepMC(const bool value) 00095 { m_storeHepMC = value; return *this;} 00096 00100 GaussTrackInformation& addHit ( GaussHitBase* hit ) 00101 { if ( 0 != hit ) { m_hits.push_back( hit ) ; } ; return *this ; } 00102 00106 GaussTrackInformation& addToHits ( GaussHitBase* hit ) 00107 { return addHit( hit ) ; } 00108 00109 // get the container of hits 00110 const Hits& hits() const { return m_hits ; } 00111 00116 GaussTrackInformation& updateHitsTrackID( G4int trackID ) 00117 { 00118 for( Hits::iterator ihit = m_hits.begin() ; m_hits.end() != ihit ; ++ihit ) 00119 { 00120 GaussHitBase* hit = *ihit ; 00121 if( 0 != hit ) { hit->setTrackID( trackID ); } 00122 } 00123 return *this ; 00124 } 00125 00128 DetTrackInfo* detInfo() const { return m_detInfo; } 00129 00133 void setDetInfo ( DetTrackInfo* aDetInfo ) 00134 { m_detInfo = aDetInfo; } 00135 00136 00137 private: 00138 00140 bool m_appendStep ; 00142 bool m_toBeStored ; 00144 bool m_createdHit ; 00147 bool m_directParent; 00148 // flag indicating that the track should be stored in HepMC record 00149 bool m_storeHepMC; 00150 00152 Hits m_hits; 00153 00156 DetTrackInfo* m_detInfo; 00157 00158 }; 00159 // =========================================================================== 00160 00161 // =========================================================================== 00168 // ============================================================================ 00169 inline GaussTrackInformation* 00170 gaussTrackInformation ( G4VUserTrackInformation* g4 ) 00171 { 00172 GiGaUtil::FastCast<G4VUserTrackInformation,GaussTrackInformation> cast; 00173 return cast( g4 ); 00174 }; 00175 // ============================================================================ 00176 00177 // =========================================================================== 00184 // ============================================================================ 00185 inline const GaussTrackInformation* 00186 gaussTrackInformation ( const G4VUserTrackInformation* g4 ) 00187 { 00188 GiGaUtil::FastCast< 00189 const G4VUserTrackInformation,const GaussTrackInformation> cast; 00190 return cast( g4 ); 00191 }; 00192 // ============================================================================ 00193 00194 // ============================================================================ 00195 #endif 00196 // ============================================================================