CMS 3D CMS Logo

PSimHit.h
Go to the documentation of this file.
1 #ifndef PSimHit_H
2 #define PSimHit_H
3 
7 
8 class TrackingSlaveSD; // for friend declaration only
9 
15 class PSimHit {
16 public:
17  static constexpr unsigned int k_tidOffset = 200000000;
18 
20 
22  const Local3DPoint& exit,
23  float pabs,
24  float tof,
25  float eloss,
26  int particleType,
27  unsigned int detId,
28  unsigned int trackId,
29  float theta,
30  float phi,
31  unsigned short processType = 0)
34  thePabs(pabs),
35  theEnergyLoss(eloss),
38  theTof(tof),
43 
46 
49 
54  Local3DPoint localPosition() const { return theEntryPoint + 0.5 * theSegment; }
55 
58 
61 
64 
67 
69  float pabs() const { return thePabs; }
70 
75  float timeOfFlight() const { return tof(); }
76 
78  float tof() const { return theTof; }
79 
81  float energyLoss() const { return theEnergyLoss; }
82 
91  int particleType() const { return theParticleType; }
92 
99  unsigned int detUnitId() const { return theDetUnitId; }
100 
108  unsigned int trackId() const { return theTrackId; }
109 
113  unsigned int originalTrackId() const { return theTrackId % k_tidOffset; }
114 
115  unsigned int offsetTrackId() const { return theTrackId / k_tidOffset; }
116 
117  static unsigned int addTrackIdOffset(unsigned int tId, unsigned int offset) { return offset * k_tidOffset + tId; }
118 
119  EncodedEventId eventId() const { return theEventId; }
120 
122 
131  unsigned short processType() const { return theProcessType; }
132 
133  void setTof(float tof) { theTof = tof; }
134 
135 protected:
136  // properties
137  Local3DPoint theEntryPoint; // position at entry
138  Local3DVector theSegment; // exitPos - entryPos
139  float thePabs; // momentum
140  float theEnergyLoss; // Energy loss
143 
144  float theTof; // Time Of Flight
146  unsigned short theProcessType; // ID of the process which created the track
147  // which created the PSimHit
148 
149  // association
150  unsigned int theDetUnitId;
151  unsigned int theTrackId;
153 
154  friend class TrackingSlaveSD;
155 };
156 
157 std::ostream& operator<<(std::ostream& o, const PSimHit& hit);
158 
159 #endif // PSimHit_H
Local3DVector LocalVector
Definition: LocalVector.h:12
float thePabs
Definition: PSimHit.h:139
unsigned int theTrackId
Definition: PSimHit.h:151
LocalVector localDirection() const
Obsolete. Same as momentumAtEntry().unit(), for backward compatibility.
Definition: PSimHit.h:60
unsigned int detUnitId() const
Definition: PSimHit.h:99
Local3DPoint theEntryPoint
Definition: PSimHit.h:137
unsigned int theDetUnitId
Definition: PSimHit.h:150
unsigned int originalTrackId() const
Definition: PSimHit.h:113
static unsigned int addTrackIdOffset(unsigned int tId, unsigned int offset)
Definition: PSimHit.h:117
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:48
PSimHit(const Local3DPoint &entry, const Local3DPoint &exit, float pabs, float tof, float eloss, int particleType, unsigned int detId, unsigned int trackId, float theta, float phi, unsigned short processType=0)
Definition: PSimHit.h:21
float theTof
Definition: PSimHit.h:144
float thePhiAtEntry
Definition: PSimHit.h:142
unsigned short theProcessType
Definition: PSimHit.h:146
float theEnergyLoss
Definition: PSimHit.h:140
static constexpr unsigned int k_tidOffset
Definition: PSimHit.h:17
unsigned short processType() const
Definition: PSimHit.h:131
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:45
double f[11][100]
unsigned int trackId() const
Definition: PSimHit.h:108
EncodedEventId eventId() const
Definition: PSimHit.h:119
void setTof(float tof)
Definition: PSimHit.h:133
Local3DVector theSegment
Definition: PSimHit.h:138
Local3DPoint localPosition() const
Definition: PSimHit.h:54
float tof() const
deprecated name for timeOfFlight()
Definition: PSimHit.h:78
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:69
int theParticleType
Definition: PSimHit.h:145
float theThetaAtEntry
Definition: PSimHit.h:141
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:81
void setEventId(EncodedEventId e)
Definition: PSimHit.h:121
Geom::Theta< float > thetaAtEntry() const
fast and more accurate access to momentumAtEntry().theta()
Definition: PSimHit.h:63
EncodedEventId theEventId
Definition: PSimHit.h:152
std::ostream & operator<<(std::ostream &o, const PSimHit &hit)
Definition: PSimHit.cc:4
float timeOfFlight() const
Definition: PSimHit.h:75
int particleType() const
Definition: PSimHit.h:91
PSimHit()
Definition: PSimHit.h:19
LocalVector momentumAtEntry() const
The momentum of the track that produced the hit, at entry point.
Definition: PSimHit.h:57
Geom::Theta< T > theta() const
Geom::Phi< float > phiAtEntry() const
fast and more accurate access to momentumAtEntry().phi()
Definition: PSimHit.h:66
def exit(msg="")
unsigned int offsetTrackId() const
Definition: PSimHit.h:115