CMS 3D CMS Logo

TrackInformation.h
Go to the documentation of this file.
1 #ifndef SimG4Core_TrackInformation_H
2 #define SimG4Core_TrackInformation_H
3 
4 #include "G4VUserTrackInformation.hh"
5 
6 #include "G4Allocator.hh"
7 
8 class TrackInformation : public G4VUserTrackInformation {
9 
10 public:
11  virtual ~TrackInformation() {}
12  inline void * operator new(size_t);
13  inline void operator delete(void * TrackInformation);
14 
15  bool storeTrack() const { return storeTrack_; }
17  void storeTrack(bool v)
18  { if (v) storeTrack_ = v; if (v == true) putInHistory(); }
19 
20  bool isPrimary() const { return isPrimary_; }
21  void isPrimary(bool v) { isPrimary_ = v; }
22 
23  bool hasHits() const { return hasHits_; }
24  void hasHits(bool v) { hasHits_ = v; }
25 
28 
29  bool isInHistory() const { return isInHistory_; }
30  void putInHistory() { isInHistory_= true; }
31 
32  bool isAncestor() const { return flagAncestor_; }
33  void setAncestor() { flagAncestor_ = true; }
34 
35  // Calo section
36  int getIDonCaloSurface() const { return idOnCaloSurface_; }
37  void setIDonCaloSurface(int id, int ical, int last, int pdgID, double p) {
40  int getIDCaloVolume() const { return idCaloVolume_; }
41  int getIDLastVolume() const { return idLastVolume_; }
42  bool caloIDChecked() const { return caloIDChecked_; }
43  void setCaloIDChecked(bool f) { caloIDChecked_ = f; }
46  double caloSurfaceParticleP() const { return caloSurfaceParticleP_; }
48 
49  // Generator information
50  int genParticlePID() const { return genParticlePID_; }
51  void setGenParticlePID(int id) { genParticlePID_ = id; }
52  double genParticleP() const { return genParticleP_; }
53  void setGenParticleP(double p) { genParticleP_ = p; }
54 
55  // remember the PID of particle entering the CASTOR detector. This is needed
56  // in order to scale the hadronic response
57  bool hasCastorHit() const { return hasCastorHit_; }
58  void setCastorHitPID(const int pid) { hasCastorHit_=true; castorHitPID_ = pid; }
59  int getCastorHitPID() const { return castorHitPID_; }
60 
61  virtual void Print() const;
62 private:
63  bool storeTrack_;
64  bool isPrimary_;
65  bool hasHits_;
75 
78 
79  // Restrict construction to friends
80  TrackInformation() :G4VUserTrackInformation(),storeTrack_(false),isPrimary_(false),
81  hasHits_(false),isGeneratedSecondary_(false),isInHistory_(false),
82  flagAncestor_(false),idOnCaloSurface_(0),idCaloVolume_(-1),
83  idLastVolume_(-1),caloIDChecked_(false), genParticlePID_(-1),
84  caloSurfaceParticlePID_(0), genParticleP_(0), caloSurfaceParticleP_(0),
85  hasCastorHit_(false), castorHitPID_(0) {}
86  friend class NewTrackAction;
87 };
88 
89 extern G4ThreadLocal G4Allocator<TrackInformation> *fpTrackInformationAllocator;
90 
91 inline void * TrackInformation::operator new(size_t)
92 {
94  new G4Allocator<TrackInformation>;
95  return (void*)fpTrackInformationAllocator->MallocSingle();
96 }
97 
98 inline void TrackInformation::operator delete(void * trkInfo)
99 {
100  fpTrackInformationAllocator->FreeSingle((TrackInformation*) trkInfo);
101 }
102 
103 #endif
int getCastorHitPID() const
bool storeTrack() const
int getIDonCaloSurface() const
virtual ~TrackInformation()
void storeTrack(bool v)
can only be set to true, cannot be reset to false!
double genParticleP() const
void setGenParticlePID(int id)
G4ThreadLocal G4Allocator< TrackInformation > * fpTrackInformationAllocator
void hasHits(bool v)
void isGeneratedSecondary(bool v)
void setCastorHitPID(const int pid)
bool hasHits() const
int getIDCaloVolume() const
bool isGeneratedSecondary() const
int genParticlePID() const
void setCaloSurfaceParticlePID(int id)
bool isAncestor() const
void setCaloSurfaceParticleP(double p)
int caloSurfaceParticlePID() const
double f[11][100]
void isPrimary(bool v)
int getIDLastVolume() const
bool isInHistory() const
bool hasCastorHit() const
double caloSurfaceParticleP_
virtual void Print() const
void setGenParticleP(double p)
bool isPrimary() const
bool caloIDChecked() const
void setCaloIDChecked(bool f)
void setIDonCaloSurface(int id, int ical, int last, int pdgID, double p)
double caloSurfaceParticleP() const