00001 #ifndef SimG4Core_TrackInformation_H
00002 #define SimG4Core_TrackInformation_H
00003
00004 #include "G4VUserTrackInformation.hh"
00005
00006 #include "G4Allocator.hh"
00007
00008 class TrackInformation : public G4VUserTrackInformation
00009 {
00010 public:
00011 virtual ~TrackInformation() {}
00012 inline void * operator new(size_t);
00013 inline void operator delete(void * TrackInformation);
00014
00015 bool storeTrack() const { return storeTrack_; }
00017 void storeTrack(bool v)
00018 { if (v) storeTrack_ = v; if (v == true) putInHistory(); }
00019
00020 bool isPrimary() const { return isPrimary_; }
00021 void isPrimary(bool v) { isPrimary_ = v; }
00022
00023 bool hasHits() const { return hasHits_; }
00024 void hasHits(bool v) { hasHits_ = v; }
00025
00026 bool isGeneratedSecondary() const { return isGeneratedSecondary_; }
00027 void isGeneratedSecondary(bool v) { isGeneratedSecondary_ = v; }
00028
00029 bool isInHistory() const { return isInHistory_; }
00030 void putInHistory() { isInHistory_= true; }
00031
00032
00033 int getIDonCaloSurface() const { return idOnCaloSurface_; }
00034 void setIDonCaloSurface(int id, int ical, int last)
00035 { idOnCaloSurface_ = id; idCaloVolume_ = ical; idLastVolume_ = last; }
00036 int getIDCaloVolume() const { return idCaloVolume_; }
00037 int getIDLastVolume() const { return idLastVolume_; }
00038 bool caloIDChecked() const { return caloIDChecked_; }
00039 void setCaloIDChecked(bool f) { caloIDChecked_ = f; }
00040
00041 virtual void Print() const;
00042 private:
00043 bool storeTrack_;
00044 bool isPrimary_;
00045 bool hasHits_;
00046 bool isGeneratedSecondary_;
00047 bool isInHistory_;
00048 int idOnCaloSurface_;
00049 int idCaloVolume_;
00050 int idLastVolume_;
00051 bool caloIDChecked_;
00052
00053
00054 TrackInformation() :G4VUserTrackInformation(),storeTrack_(false),isPrimary_(false),
00055 hasHits_(false),isGeneratedSecondary_(false),isInHistory_(false),
00056 idOnCaloSurface_(0),idCaloVolume_(-1),idLastVolume_(-1),
00057 caloIDChecked_(false) {}
00058 friend class NewTrackAction;
00059 };
00060
00061 extern G4Allocator<TrackInformation> TrackInformationAllocator;
00062
00063 inline void * TrackInformation::operator new(size_t)
00064 {
00065 void * trkInfo;
00066 trkInfo = (void *) TrackInformationAllocator.MallocSingle();
00067 return trkInfo;
00068 }
00069
00070 inline void TrackInformation::operator delete(void * trkInfo)
00071 { TrackInformationAllocator.FreeSingle((TrackInformation*) trkInfo); }
00072
00073 #endif