CMS 3D CMS Logo

Particle.h
Go to the documentation of this file.
1 #ifndef FASTSIM_PARTICLE_H
2 #define FASTSIM_PARTICLE_H
3 
5 
6 
8 // Author: L. Vanelderen, S. Kurz
9 // Date: 29 May 2017
11 
12 
13 namespace fastsim
14 {
16 
19  class Particle
20  {
21  public:
23 
31  : pdgId_(pdgId)
32  , charge_(-999.)
33  , position_(position)
34  , momentum_(momentum)
35  , remainingProperLifeTimeC_(-999.) // lifetime in ct
36  , simTrackIndex_(-1)
37  , simVertexIndex_(-1)
38  , genParticleIndex_(-1)
40  , isOnLayerIndex_(-1)
41  , energyDeposit_(0)
42  , isLooper_(false)
43  , motherDeltaR_(-1)
44  , motherPpdId_(0)
45  , motherSimTrackIndex_(-999)
46  {;}
47 
48 
50  // setters
52 
55 
58 
61 
64 
66 
70 
72  void setCharge(double charge) {charge_ = charge;}
73 
75  void setOnLayer(bool isForward, int index){
78  }
79 
81  void resetOnLayer(){
82  isOnLayerIndex_ = -1;
83  }
84 
86 
92  void setEnergyDeposit(double energyDeposit) {energyDeposit_ = energyDeposit;}
93 
95 
99  void setLooper(){isLooper_ = true;}
100 
102 
107  void setMotherDeltaR(const math::XYZTLorentzVector & motherMomentum){
108  motherDeltaR_ = (momentum_.Vect().Unit().Cross(motherMomentum.Vect().Unit())).R();
109  }
110 
112 
117  void setMotherPdgId(int motherPpdId) {motherPpdId_ = motherPpdId;}
118 
120 
126 
129 
130 
132  // ordinary getters
134 
136  int pdgId() const {return pdgId_;}
137 
139  double charge() const {return charge_;}
140 
142  const math::XYZTLorentzVector & position() const {return position_;}
143 
145  const math::XYZTLorentzVector & momentum() const {return momentum_;}
146 
148 
153 
155  int simTrackIndex() const {return simTrackIndex_;}
156 
158 
161  int simVertexIndex() const {return simVertexIndex_;}
162 
164 
167  int genParticleIndex() const {return genParticleIndex_;}
168 
170  bool isOnLayer(bool isForward, int index){
171  return isOnForwardLayer_ == isForward && isOnLayerIndex_ == index;
172  }
173 
175  bool isStable() const {return remainingProperLifeTimeC_ == -1.;}
176 
178  bool chargeIsSet() const {return charge_!=-999.;}
179 
182 
184  double gamma() const { return momentum().Gamma();}
185 
187 
192  double getEnergyDeposit() const {return energyDeposit_;}
193 
195 
199  double isLooper() const {return isLooper_;}
200 
202 
206  double getMotherDeltaR() const {return motherDeltaR_;}
207 
209 
213  int getMotherPdgId() const {return motherPpdId_;}
214 
216 
221 
222 
224  // non-const getters
226 
229 
232 
233  friend std::ostream& operator << (std::ostream& os , const Particle & particle);
234 
235  private:
236  const int pdgId_;
237  double charge_;
246  double energyDeposit_;
247  bool isLooper_;
248  double motherDeltaR_;
251  };
252 
254  std::ostream& operator << (std::ostream& os , const Particle & particle);
255 
256 }
257 
258 #endif
math::XYZTLorentzVector & position()
Return position of the particle.
Definition: Particle.h:228
void resetMother()
Reset all information stored about the mother particle.
Definition: Particle.h:128
Particle(int pdgId, const math::XYZTLorentzVector &position, const math::XYZTLorentzVector &momentum)
Constructor.
Definition: Particle.h:28
int motherSimTrackIndex_
simTrack index of mother particle if both charged
Definition: Particle.h:250
const math::XYZTLorentzVector & position() const
Return position of the particle.
Definition: Particle.h:142
int simVertexIndex_
index of the origin vertex
Definition: Particle.h:242
int getMotherPdgId() const
Get pdgIdto mother particle (only makes sense if mother and daughter charged).
Definition: Particle.h:213
void setStable()
Particle is stable.
Definition: Particle.h:63
double remainingProperLifeTimeC() const
Return the particle&#39;s remaining proper lifetime[in ct].
Definition: Particle.h:152
int genParticleIndex() const
Return index of the particle in the genParticle vector.
Definition: Particle.h:167
bool isForward(DetId const &)
void setGenParticleIndex(int index)
Set index of the particle in the genParticle vector (if applies).
Definition: Particle.h:60
int pdgId() const
Return pdgId of the particle.
Definition: Particle.h:136
int simTrackIndex_
index of the simTrack
Definition: Particle.h:241
int isOnLayerIndex_
the layer this particle is currently on: the index of the layer
Definition: Particle.h:245
void setRemainingProperLifeTimeC(double remainingProperLifeTimeC)
Set the particle&#39;s remaining proper lifetime if not stable [in ct].
Definition: Particle.h:69
void setSimTrackIndex(int index)
Set the index of the SimTrack of this particle.
Definition: Particle.h:54
double isLooper() const
Check if this particle is about to do a loop in the tracker or the direction of the momentum is going...
Definition: Particle.h:199
math::XYZTLorentzVector momentum_
momentum of the particle
Definition: Particle.h:239
double motherDeltaR_
delta R to mother particle if both charged
Definition: Particle.h:248
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
int simVertexIndex() const
Return index of the origin vertex.
Definition: Particle.h:161
void resetOnLayer()
Reset layer this particle is currently on (i.e. particle is not on a layer anyomre) ...
Definition: Particle.h:81
void setLooper()
This particle is about to do a loop in the tracker or the direction of the momentum is going inwards...
Definition: Particle.h:99
bool isLooper_
this particle is about to do a loop or momentum goes inwards
Definition: Particle.h:247
const int pdgId_
pdgId of the particle
Definition: Particle.h:236
bool isOnForwardLayer_
the layer this particle is currently on: is it a ForwardLayer
Definition: Particle.h:244
void setSimVertexIndex(int index)
Set the index of the origin SimVertex of this particle.
Definition: Particle.h:57
int simTrackIndex() const
Return index of the SimTrack.
Definition: Particle.h:155
int genParticleIndex_
index of the particle in the vector of genParticles (if applies)
Definition: Particle.h:243
double energyDeposit_
energy deposit through ionization in the previous tracker layer
Definition: Particle.h:246
double getMotherDeltaR() const
Get delta R to mother particle (only makes sense if mother and daughter charged). ...
Definition: Particle.h:206
double remainingProperLifeTimeC_
remaining proper lifetime of the particle in units of t*c
Definition: Particle.h:240
void setCharge(double charge)
Set the charge of the particle.
Definition: Particle.h:72
double charge() const
Return charge of the particle.
Definition: Particle.h:139
bool remainingProperLifeTimeIsSet() const
Check if remaining proper lifetime of particle is set.
Definition: Particle.h:181
void setMotherPdgId(int motherPpdId)
Set pdgId of the mother particle (only necessary if mother and daughter charged). ...
Definition: Particle.h:117
math::XYZTLorentzVector position_
position of the particle
Definition: Particle.h:238
double getEnergyDeposit() const
Return the energy the particle deposited in the tracker layer that was last hit (ionization).
Definition: Particle.h:192
bool isStable() const
Returns true if particle is considered stable.
Definition: Particle.h:175
void setOnLayer(bool isForward, int index)
Set layer this particle is currently on.
Definition: Particle.h:75
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
Definition: Particle.h:145
void setMotherDeltaR(const math::XYZTLorentzVector &motherMomentum)
Set delta R to mother particle (only necessary if mother and daughter charged).
Definition: Particle.h:107
int getMotherSimTrackIndex() const
Get index of simTrack of mother particle (only makes sense if mother and daughter charged)...
Definition: Particle.h:220
int motherPpdId_
pdgId of mother particle if both charged
Definition: Particle.h:249
double gamma() const
Return Lorentz&#39; gamma factor.
Definition: Particle.h:184
friend std::ostream & operator<<(std::ostream &os, const Particle &particle)
Some basic output.
math::XYZTLorentzVector & momentum()
Return momentum of the particle.
Definition: Particle.h:231
bool chargeIsSet() const
Check if charge of particle was set.
Definition: Particle.h:178
void setEnergyDeposit(double energyDeposit)
Set the energy the particle deposited in the tracker layer that was last hit (ionization).
Definition: Particle.h:92
bool isOnLayer(bool isForward, int index)
Check if particle is on layer.
Definition: Particle.h:170
double charge_
charge of the particle in elemntary units
Definition: Particle.h:237
void setMotherSimTrackIndex(int id)
Set the index of the SimTrack of the mother particle (only necessary if mother and daughter charged)...
Definition: Particle.h:125