CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  virtual void Print() const;
56 private:
57  bool storeTrack_;
58  bool isPrimary_;
59  bool hasHits_;
69 
70  // Restrict construction to friends
71  TrackInformation() :G4VUserTrackInformation(),storeTrack_(false),isPrimary_(false),
76  friend class NewTrackAction;
77 };
78 
79 extern G4ThreadLocal G4Allocator<TrackInformation> *fpTrackInformationAllocator;
80 
81 inline void * TrackInformation::operator new(size_t)
82 {
84  new G4Allocator<TrackInformation>;
85  return (void*)fpTrackInformationAllocator->MallocSingle();
86 }
87 
88 inline void TrackInformation::operator delete(void * trkInfo)
89 {
90  fpTrackInformationAllocator->FreeSingle((TrackInformation*) trkInfo);
91 }
92 
93 #endif
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)
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
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
volatile std::atomic< bool > shutdown_flag false