CMS 3D CMS Logo

FSimTrack.h
Go to the documentation of this file.
1 #ifndef FastSimulation_Event_FSimTrack_H
2 #define FastSimulation_Event_FSimTrack_H
3 
4 // HepPDT Headers
6 
7 // CMSSW Headers
10 
11 // FAMOS headers
13 
14 #include <vector>
15 
16 class FSimVertex;
17 class FBaseSimEvent;
18 
19 namespace HepMC {
20  class GenParticle;
21  class GenVertex;
22 } // namespace HepMC
23 
30 class FSimTrack : public SimTrack {
31 public:
33  FSimTrack();
34 
36  FSimTrack(const RawParticle* p, int iv, int ig, int id, FBaseSimEvent* mom, double dt = -1.);
37 
39  FSimTrack(int ipart,
41  int iv,
42  int ig,
43  int id,
44  double charge,
45  const math::XYZTLorentzVector& tkp,
46  const math::XYZTLorentzVector& tkm,
47  const SimVertex& tkv);
48 
50  virtual ~FSimTrack();
51 
53  inline const HepPDT::ParticleData* particleInfo() const { return info_; }
54 
56  inline float charge() const {
57  if (particleInfo() == nullptr)
58  return charge_;
59  return particleInfo()->charge();
60  }
61 
63  inline const FSimVertex vertex() const;
64 
66  inline const FSimVertex& endVertex() const;
67 
69  inline const FSimTrack& mother() const;
70 
72  inline const FSimTrack& daughter(int i) const;
73 
75  inline int nDaughters() const;
76 
78  inline const std::vector<int>& daughters() const;
79 
81  inline bool noEndVertex() const;
82 
84  bool notYetToEndVertex(const XYZTLorentzVector& pos) const;
85 
87  inline bool noMother() const;
88 
90  inline bool noDaughter() const;
91 
93  inline const HepMC::GenParticle* genParticle() const;
94 
96  inline int id() const { return id_; }
97 
101  inline int onLayer1() const { return layer1; }
102 
106  inline int onLayer2() const { return layer2; }
107 
111  inline int onEcal() const { return ecal; }
112 
116  inline int onHcal() const { return hcal; }
117 
121  inline int onVFcal() const { return vfcal; }
122 
126  inline int outHcal() const { return hcalexit; }
127 
128  //The particle was propagated to the HO front face
131  inline int onHO() const { return hoentr; }
132 
134  inline bool propagated() const { return prop; }
135 
137  inline const RawParticle& layer1Entrance() const { return Layer1_Entrance; }
138 
140  inline const RawParticle& layer2Entrance() const { return Layer2_Entrance; }
141 
143  inline const RawParticle& ecalEntrance() const { return ECAL_Entrance; }
144 
146  inline const RawParticle& hcalEntrance() const { return HCAL_Entrance; }
147 
149  inline const RawParticle& vfcalEntrance() const { return VFCAL_Entrance; }
150 
152  inline const RawParticle& hcalExit() const { return HCAL_Exit; }
153 
155  inline const RawParticle& hoEntrance() const { return HO_Entrance; }
156 
158  inline bool isGlobal() const { return isGlobal_; }
159 
161  inline void setGlobal() { isGlobal_ = true; }
162 
164  inline void setOriginVertex(const SimVertex& v) { vertex_ = v; }
165 
167  inline void setEndVertex(int endv) { endv_ = endv; }
168 
170  void setPropagate();
171 
173  void setLayer1(const RawParticle& pp, int success);
174 
176  void setLayer2(const RawParticle& pp, int success);
177 
179  void setEcal(const RawParticle& pp, int success);
180 
182  void setHcal(const RawParticle& pp, int success);
183 
185  void setVFcal(const RawParticle& pp, int success);
186 
188  void setHcalExit(const RawParticle& pp, int success);
189 
191  void setHO(const RawParticle& pp, int success);
192 
194  // void addRecHit(const FamosBasicRecHit* hit, unsigned layer);
195 
197  // void addSimHit(const RawParticle& pp, unsigned layer);
198 
200  inline void addDaughter(int i) { daugh_.push_back(i); }
201 
203  inline void setClosestDaughterId(int id) { closestDaughterId_ = id; }
204 
206  inline int closestDaughterId() const { return closestDaughterId_; }
207 
209  const XYZTLorentzVector& momentum() const { return momentum_; }
210 
212  inline void setMomentum(const math::XYZTLorentzVector& newMomentum) { momentum_ = newMomentum; }
213 
215  inline const SimTrack& simTrack() const { return *this; }
216 
218  inline double decayTime() const { return properDecayTime; }
219 
220 private:
221  // HepMC::GenParticle* me_;
223 
225  // int embd_; // The index in the SimTrack vector
226  int id_; // The index in the FSimTrackVector
227  double charge_; // Charge of the particle
228 
229  int endv_; // The index of the end vertex in FSimVertex
230 
231  int layer1; // 1 if the particle was propagated to preshower layer1
232  int layer2; // 1 if the particle was propagated to preshower layer2
233  int ecal; // 1 if the particle was propagated to ECAL/HCAL barrel
234  int hcal; // 2 if the particle was propagated to ECAL/HCAL endcap
235  int vfcal; // 1 if the particle was propagated to VFCAL
236  int hcalexit; // 2 if the particle was propagated to HCAL Exit point
237  int hoentr; // 1 if the particle was propagated to HO
238 
239  bool prop; // true if the propagation to the calorimeters was done
240 
241  RawParticle Layer1_Entrance; // the particle at preshower Layer1
242  RawParticle Layer2_Entrance; // the particle at preshower Layer2
243  RawParticle ECAL_Entrance; // the particle at ECAL entrance
244  RawParticle HCAL_Entrance; // the particle at HCAL entrance
245  RawParticle VFCAL_Entrance; // the particle at VFCAL entrance
246  RawParticle HCAL_Exit; // the particle at HCAL ezit point
247  RawParticle HO_Entrance; // the particle at HO entrance
248 
249  std::vector<int> daugh_; // The indices of the daughters in FSimTrack
250  int closestDaughterId_; // The index of the closest daughter id
251 
252  const HepPDT::ParticleData* info_; // The PDG info
253 
255 
256  double properDecayTime; // The proper decay time (default is -1)
257 
258  bool isGlobal_; // needed for interfacing the new particle propagator with the old muon sim hit code
259 };
260 
261 #include <iosfwd>
262 std::ostream& operator<<(std::ostream& o, const FSimTrack& t);
263 
264 #include "FastSimulation/Event/interface/FSimTrack.icc"
265 
266 #endif // FSimTrack_H
bool isGlobal() const
particle did not decay before more detectors (useful for newProducer)
Definition: FSimTrack.h:158
bool noMother() const
no mother particle
SimVertex vertex_
Definition: FSimTrack.h:222
float dt
Definition: AMPTWrapper.h:136
int endv_
Definition: FSimTrack.h:229
const RawParticle & vfcalEntrance() const
The particle at VFCAL entrance.
Definition: FSimTrack.h:149
const HepPDT::ParticleData * particleInfo() const
particle info...
Definition: FSimTrack.h:53
const RawParticle & hcalEntrance() const
The particle at HCAL entrance.
Definition: FSimTrack.h:146
int layer2
Definition: FSimTrack.h:232
int ecal
Definition: FSimTrack.h:233
const RawParticle & layer2Entrance() const
The particle at Preshower Layer 2.
Definition: FSimTrack.h:140
RawParticle Layer1_Entrance
Definition: FSimTrack.h:241
double charge_
Definition: FSimTrack.h:227
const HepPDT::ParticleData * info_
Definition: FSimTrack.h:252
RawParticle VFCAL_Entrance
Definition: FSimTrack.h:245
const RawParticle & ecalEntrance() const
The particle at ECAL entrance.
Definition: FSimTrack.h:143
virtual ~FSimTrack()
Destructor.
Definition: FSimTrack.cc:83
int hoentr
Definition: FSimTrack.h:237
void setEcal(const RawParticle &pp, int success)
Set the ecal variables.
Definition: FSimTrack.cc:118
void setGlobal()
particle did not decay before more detectors (useful for newProducer)
Definition: FSimTrack.h:161
RawParticle HO_Entrance
Definition: FSimTrack.h:247
void setPropagate()
The particle has been propgated through the tracker.
Definition: FSimTrack.cc:103
RawParticle HCAL_Exit
Definition: FSimTrack.h:246
void setClosestDaughterId(int id)
Set the index of the closest charged daughter.
Definition: FSimTrack.h:203
void setLayer2(const RawParticle &pp, int success)
Set the preshower layer2 variables.
Definition: FSimTrack.cc:112
int onHcal() const
Definition: FSimTrack.h:116
const HepMC::GenParticle * genParticle() const
The original GenParticle.
const RawParticle & hoEntrance() const
The particle at HCAL exir.
Definition: FSimTrack.h:155
bool noEndVertex() const
no end vertex
const FSimVertex vertex() const
Origin vertex.
const FSimVertex & endVertex() const
end vertex
const FSimTrack & daughter(int i) const
Ith daughter.
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
void setLayer1(const RawParticle &pp, int success)
Set the preshower layer1 variables.
Definition: FSimTrack.cc:106
bool isGlobal_
Definition: FSimTrack.h:258
const XYZTLorentzVector & momentum() const
Temporary (until move of SimTrack to Mathcore) - No! Actually very useful.
Definition: FSimTrack.h:209
const RawParticle & hcalExit() const
The particle at HCAL exir.
Definition: FSimTrack.h:152
float charge() const
charge
Definition: FSimTrack.h:56
int closestDaughterId_
Definition: FSimTrack.h:250
const std::vector< int > & daughters() const
Vector of daughter indices.
int onLayer2() const
Definition: FSimTrack.h:106
int onLayer1() const
Definition: FSimTrack.h:101
bool notYetToEndVertex(const XYZTLorentzVector &pos) const
Compare the end vertex position with another position.
Definition: FSimTrack.cc:85
int vfcal
Definition: FSimTrack.h:235
FSimTrack()
Default constructor.
Definition: FSimTrack.cc:9
HepPDT::ParticleData ParticleData
int onVFcal() const
Definition: FSimTrack.h:121
int layer1
Definition: FSimTrack.h:231
bool propagated() const
The particle was tentatively propagated to calorimeters.
Definition: FSimTrack.h:134
int nDaughters() const
Number of daughters.
int onEcal() const
Definition: FSimTrack.h:111
double decayTime() const
Return the pre-defined decay time.
Definition: FSimTrack.h:218
FBaseSimEvent * mom_
Definition: FSimTrack.h:224
int closestDaughterId() const
Get the index of the closest charged daughter.
Definition: FSimTrack.h:206
RawParticle HCAL_Entrance
Definition: FSimTrack.h:244
int onHO() const
Definition: FSimTrack.h:131
void setHcalExit(const RawParticle &pp, int success)
Set the hcal exit variables.
Definition: FSimTrack.cc:136
void setOriginVertex(const SimVertex &v)
Set origin vertex.
Definition: FSimTrack.h:164
int outHcal() const
Definition: FSimTrack.h:126
bool noDaughter() const
no daughters
std::ostream & operator<<(std::ostream &o, const FSimTrack &t)
Definition: FSimTrack.cc:146
void setEndVertex(int endv)
Set the end vertex.
Definition: FSimTrack.h:167
XYZTLorentzVector momentum_
Definition: FSimTrack.h:254
void addDaughter(int i)
Add a RecHit for a track on a layer.
Definition: FSimTrack.h:200
int hcal
Definition: FSimTrack.h:234
void setHO(const RawParticle &pp, int success)
Set the ho variables.
Definition: FSimTrack.cc:141
const SimTrack & simTrack() const
Simply returns the SimTrack.
Definition: FSimTrack.h:215
void setVFcal(const RawParticle &pp, int success)
Set the hcal variables.
Definition: FSimTrack.cc:130
RawParticle Layer2_Entrance
Definition: FSimTrack.h:242
void setHcal(const RawParticle &pp, int success)
Set the hcal variables.
Definition: FSimTrack.cc:124
double properDecayTime
Definition: FSimTrack.h:256
int hcalexit
Definition: FSimTrack.h:236
bool prop
Definition: FSimTrack.h:239
const RawParticle & layer1Entrance() const
The particle at Preshower Layer 1.
Definition: FSimTrack.h:137
RawParticle ECAL_Entrance
Definition: FSimTrack.h:243
void setMomentum(const math::XYZTLorentzVector &newMomentum)
Reset the momentum (to be used with care)
Definition: FSimTrack.h:212
std::vector< int > daugh_
Definition: FSimTrack.h:249
int id() const
the index in FBaseSimEvent and other vectors
Definition: FSimTrack.h:96
const FSimTrack & mother() const
mother
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25