00001 #ifndef SimG4Core_TrackWithHistory_H 00002 #define SimG4Core_TrackWithHistory_H 00003 00004 #include "G4Track.hh" 00005 #include "DataFormats/Math/interface/Vector3D.h" 00006 #include "DataFormats/Math/interface/LorentzVector.h" 00007 00008 #include "G4Allocator.hh" 00009 00010 class G4VProcess; 00011 class G4TrackToParticleID; 00016 class TrackWithHistory 00017 { 00018 public: 00022 TrackWithHistory(const G4Track * g4track); 00023 ~TrackWithHistory() {} 00024 00025 inline void * operator new(size_t); 00026 inline void operator delete(void * TrackWithHistory); 00027 00028 void save() { saved_ = true; } 00029 unsigned int trackID() const { return trackID_; } 00030 int particleID() const { return particleID_; } 00031 int parentID() const { return parentID_; } 00032 int genParticleID() const { return genParticleID_; } 00033 const math::XYZVectorD & momentum() const { return momentum_; } 00034 double totalEnergy() const { return totalEnergy_; } 00035 const math::XYZVectorD & vertexPosition() const { return vertexPosition_; } 00036 double globalTime() const { return globalTime_; } 00037 double localTime() const { return localTime_; } 00038 double properTime() const { return properTime_; } 00039 const G4VProcess * creatorProcess() const { return creatorProcess_; } 00040 double weight() const { return weight_; } 00041 void setTrackID(int i) { trackID_ = i; } 00042 void setParentID(int i) { parentID_ = i; } 00043 void setGenParticleID(int i) { genParticleID_ = i; } 00044 bool storeTrack() const { return storeTrack_; } 00045 bool saved() const { return saved_; } 00051 void checkAtEnd(const G4Track *); 00052 private: 00053 unsigned int trackID_; 00054 int particleID_; 00055 int parentID_; 00056 int genParticleID_; 00057 math::XYZVectorD momentum_; 00058 double totalEnergy_; 00059 math::XYZVectorD vertexPosition_; 00060 double globalTime_; 00061 double localTime_; 00062 double properTime_; 00063 const G4VProcess * creatorProcess_; 00064 double weight_; 00065 bool storeTrack_; 00066 bool saved_; 00067 static G4TrackToParticleID* theG4TrackToParticleID; 00068 int extractGenID(const G4Track * gt) const; 00069 }; 00070 00071 extern G4Allocator<TrackWithHistory> TrackWithHistoryAllocator; 00072 00073 inline void * TrackWithHistory::operator new(size_t) { 00074 void * aTwH; 00075 aTwH = (void *) TrackWithHistoryAllocator.MallocSingle(); 00076 return aTwH; 00077 } 00078 00079 inline void TrackWithHistory::operator delete(void * aTwH) { 00080 TrackWithHistoryAllocator.FreeSingle((TrackWithHistory*) aTwH); 00081 } 00082 00083 00084 #endif