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 public:
10  ~TrackInformation() override {}
11  inline void *operator new(size_t);
12  inline void operator delete(void *TrackInformation);
13 
14  bool storeTrack() const { return storeTrack_; }
16  void storeTrack(bool v) {
17  if (v)
18  storeTrack_ = v;
19  if (v == true)
20  putInHistory();
21  }
22 
23  bool isPrimary() const { return isPrimary_; }
24  void isPrimary(bool v) { isPrimary_ = v; }
25 
26  bool hasHits() const { return hasHits_; }
27  void hasHits(bool v) { hasHits_ = v; }
28 
31 
32  bool isInHistory() const { return isInHistory_; }
33  void putInHistory() { isInHistory_ = true; }
34 
35  bool isAncestor() const { return flagAncestor_; }
36  void setAncestor() { flagAncestor_ = true; }
37 
38  // Calo section
39  int getIDonCaloSurface() const { return idOnCaloSurface_; }
40  void setIDonCaloSurface(int id, int ical, int last, int pdgID, double p) {
42  idCaloVolume_ = ical;
46  }
47  int getIDCaloVolume() const { return idCaloVolume_; }
48  int getIDLastVolume() const { return idLastVolume_; }
49  bool caloIDChecked() const { return caloIDChecked_; }
50  void setCaloIDChecked(bool f) { caloIDChecked_ = f; }
53  double caloSurfaceParticleP() const { return caloSurfaceParticleP_; }
55  int getIDfineCalo() const { return ((idFineCalo_ > 0) ? idFineCalo_ : idOnCaloSurface_); }
56  void setIDfineCalo(int id) { idFineCalo_ = id; }
57 
58  // Generator information
59  int genParticlePID() const { return genParticlePID_; }
60  void setGenParticlePID(int id) { genParticlePID_ = id; }
61  double genParticleP() const { return genParticleP_; }
62  void setGenParticleP(double p) { genParticleP_ = p; }
63 
64  // remember the PID of particle entering the CASTOR detector. This is needed
65  // in order to scale the hadronic response
66  bool hasCastorHit() const { return hasCastorHit_; }
67  void setCastorHitPID(const int pid) {
68  hasCastorHit_ = true;
69  castorHitPID_ = pid;
70  }
71  int getCastorHitPID() const { return castorHitPID_; }
72 
73  void Print() const override;
74 
75 private:
77  bool isPrimary_;
78  bool hasHits_;
89 
92 
93  // Restrict construction to friends
95  : G4VUserTrackInformation(),
98  hasHits_(false),
102  idOnCaloSurface_(0),
103  idCaloVolume_(-1),
104  idLastVolume_(-1),
106  idFineCalo_(-1),
107  genParticlePID_(-1),
109  genParticleP_(0),
112  castorHitPID_(0) {}
113  friend class NewTrackAction;
114 };
115 
116 extern G4ThreadLocal G4Allocator<TrackInformation> *fpTrackInformationAllocator;
117 
118 inline void *TrackInformation::operator new(size_t) {
120  fpTrackInformationAllocator = new G4Allocator<TrackInformation>;
121  return (void *)fpTrackInformationAllocator->MallocSingle();
122 }
123 
124 inline void TrackInformation::operator delete(void *trkInfo) {
125  fpTrackInformationAllocator->FreeSingle((TrackInformation *)trkInfo);
126 }
127 
128 #endif
TrackInformation::Print
void Print() const override
Definition: TrackInformation.cc:8
TrackInformation::castorHitPID_
int castorHitPID_
Definition: TrackInformation.h:91
TrackInformation::caloSurfaceParticleP
double caloSurfaceParticleP() const
Definition: TrackInformation.h:53
TrackInformation::idFineCalo_
int idFineCalo_
Definition: TrackInformation.h:86
TrackInformation::isPrimary
void isPrimary(bool v)
Definition: TrackInformation.h:24
TrackInformation::getIDonCaloSurface
int getIDonCaloSurface() const
Definition: TrackInformation.h:39
funct::false
false
Definition: Factorize.h:29
TrackInformation::isGeneratedSecondary
bool isGeneratedSecondary() const
Definition: TrackInformation.h:29
TrackInformation::getIDLastVolume
int getIDLastVolume() const
Definition: TrackInformation.h:48
TrackInformation::hasCastorHit_
bool hasCastorHit_
Definition: TrackInformation.h:90
TrackInformation::caloSurfaceParticleP_
double caloSurfaceParticleP_
Definition: TrackInformation.h:88
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
TrackInformation::setAncestor
void setAncestor()
Definition: TrackInformation.h:36
TrackInformation::flagAncestor_
bool flagAncestor_
Definition: TrackInformation.h:81
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TrackInformation::setIDonCaloSurface
void setIDonCaloSurface(int id, int ical, int last, int pdgID, double p)
Definition: TrackInformation.h:40
TrackInformation::hasHits
bool hasHits() const
Definition: TrackInformation.h:26
TrackInformation::idCaloVolume_
int idCaloVolume_
Definition: TrackInformation.h:83
TrackInformation::~TrackInformation
~TrackInformation() override
Definition: TrackInformation.h:10
TrackInformation::putInHistory
void putInHistory()
Definition: TrackInformation.h:33
TrackInformation::setCaloIDChecked
void setCaloIDChecked(bool f)
Definition: TrackInformation.h:50
findQualityFiles.v
v
Definition: findQualityFiles.py:179
TrackInformation::genParticlePID
int genParticlePID() const
Definition: TrackInformation.h:59
TrackInformation::idOnCaloSurface_
int idOnCaloSurface_
Definition: TrackInformation.h:82
TrackInformation::genParticleP_
double genParticleP_
Definition: TrackInformation.h:88
TrackInformation::storeTrack_
bool storeTrack_
Definition: TrackInformation.h:76
Utilities.operator
operator
Definition: Utilities.py:24
TrackInformation::setIDfineCalo
void setIDfineCalo(int id)
Definition: TrackInformation.h:56
dqmdumpme.last
last
Definition: dqmdumpme.py:56
TrackInformation::setGenParticleP
void setGenParticleP(double p)
Definition: TrackInformation.h:62
TrackInformation::isPrimary
bool isPrimary() const
Definition: TrackInformation.h:23
TrackInformation::idLastVolume_
int idLastVolume_
Definition: TrackInformation.h:84
fpTrackInformationAllocator
G4ThreadLocal G4Allocator< TrackInformation > * fpTrackInformationAllocator
Definition: TrackInformation.cc:6
TrackInformation::caloSurfaceParticlePID_
int caloSurfaceParticlePID_
Definition: TrackInformation.h:87
TrackInformation::hasHits_
bool hasHits_
Definition: TrackInformation.h:78
TrackInformation::getIDCaloVolume
int getIDCaloVolume() const
Definition: TrackInformation.h:47
TrackInformation::isAncestor
bool isAncestor() const
Definition: TrackInformation.h:35
TrackInformation::TrackInformation
TrackInformation()
Definition: TrackInformation.h:94
TrackInformation::isGeneratedSecondary_
bool isGeneratedSecondary_
Definition: TrackInformation.h:79
TrackInformation::getCastorHitPID
int getCastorHitPID() const
Definition: TrackInformation.h:71
TrackInformation::getIDfineCalo
int getIDfineCalo() const
Definition: TrackInformation.h:55
TrackInformation::isPrimary_
bool isPrimary_
Definition: TrackInformation.h:77
TrackInformation::setGenParticlePID
void setGenParticlePID(int id)
Definition: TrackInformation.h:60
TrackInformation
Definition: TrackInformation.h:8
TrackInformation::isInHistory_
bool isInHistory_
Definition: TrackInformation.h:80
TrackInformation::storeTrack
bool storeTrack() const
Definition: TrackInformation.h:14
TrackInformation::genParticleP
double genParticleP() const
Definition: TrackInformation.h:61
TrackInformation::hasCastorHit
bool hasCastorHit() const
Definition: TrackInformation.h:66
TrackInformation::storeTrack
void storeTrack(bool v)
can only be set to true, cannot be reset to false!
Definition: TrackInformation.h:16
TrackInformation::genParticlePID_
int genParticlePID_
Definition: TrackInformation.h:87
NewTrackAction
Definition: NewTrackAction.h:14
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
TrackInformation::caloSurfaceParticlePID
int caloSurfaceParticlePID() const
Definition: TrackInformation.h:51
TrackInformation::isGeneratedSecondary
void isGeneratedSecondary(bool v)
Definition: TrackInformation.h:30
TrackInformation::setCaloSurfaceParticlePID
void setCaloSurfaceParticlePID(int id)
Definition: TrackInformation.h:52
TrackInformation::hasHits
void hasHits(bool v)
Definition: TrackInformation.h:27
TrackInformation::caloIDChecked
bool caloIDChecked() const
Definition: TrackInformation.h:49
TrackInformation::isInHistory
bool isInHistory() const
Definition: TrackInformation.h:32
TrackInformation::setCaloSurfaceParticleP
void setCaloSurfaceParticleP(double p)
Definition: TrackInformation.h:54
TrackInformation::caloIDChecked_
bool caloIDChecked_
Definition: TrackInformation.h:85
TrackInformation::setCastorHitPID
void setCastorHitPID(const int pid)
Definition: TrackInformation.h:67