CMS 3D CMS Logo

RawParticle.h
Go to the documentation of this file.
1 #ifndef CommonTools_BaseParticlePropagator_RawParticle_h
2 #define CommonTools_BaseParticlePropagator_RawParticle_h
3 
6 
7 #include "Math/GenVector/RotationX.h"
8 #include "Math/GenVector/RotationY.h"
9 #include "Math/GenVector/RotationZ.h"
10 #include "Math/GenVector/Rotation3D.h"
11 #include "Math/GenVector/AxisAngle.h"
12 #include "Math/GenVector/Boost.h"
13 
14 #include <string>
15 #include <iosfwd>
16 
17 #include <memory>
18 
27 
28 class RawParticle;
29 
30 namespace rawparticle {
34  RawParticle makeMuon(bool isParticle, const XYZTLorentzVector& p, const XYZTLorentzVector& xStart);
35 } // namespace rawparticle
36 
37 class RawParticle {
38 public:
40  friend RawParticle unchecked_makeParticle(int id, const math::XYZTLorentzVector& p, double mass, double charge);
42  int id, const math::XYZTLorentzVector& p, const math::XYZTLorentzVector& xStart, double mass, double charge);
43 
44  typedef ROOT::Math::AxisAngle Rotation;
45  typedef ROOT::Math::Rotation3D Rotation3D;
46  typedef ROOT::Math::RotationX RotationX;
47  typedef ROOT::Math::RotationY RotationY;
48  typedef ROOT::Math::RotationZ RotationZ;
49  typedef ROOT::Math::Boost Boost;
50 
51  RawParticle() = default;
52 
57 
61  RawParticle(const XYZTLorentzVector& p, const XYZTLorentzVector& xStart, double charge = 0.);
62 
66  RawParticle(double px, double py, double pz, double e, double charge = 0.);
67 
69  RawParticle(const RawParticle& p) = default;
70  RawParticle(RawParticle&& p) = default;
71 
73  RawParticle& operator=(const RawParticle& rhs) = default;
74  RawParticle& operator=(RawParticle&& rhs) = default;
75 
76 public:
81  void setStatus(int istat);
82 
84  void setMass(float m);
85 
87  void setCharge(float q);
88 
90  void setT(const double t);
91 
93  void setVertex(const XYZTLorentzVector& vtx);
94  void setVertex(double xv, double yv, double zv, double tv);
95 
97  void setMomentum(const XYZTLorentzVector& vtx);
98  void setMomentum(double xv, double yv, double zv, double tv);
99 
100  void SetPx(double);
101  void SetPy(double);
102  void SetPz(double);
103  void SetE(double);
104 
105  /*** methods to be overloaded to include vertex ***/
106 
111  void boost(double bx, double by, double bz);
112  void boost(const Boost& b);
113 
114  // inline void boost(const Hep3Vector<double> &bv );
115 
121  void rotate(double rphi, const XYZVector& raxis);
122  void rotate(const Rotation& r);
123  void rotate(const Rotation3D& r);
124 
126  // void rotateUz(Hep3Vector &nuz);
127 
131  void rotateX(double rphi);
132  void rotate(const RotationX& r);
133 
138  void rotateY(double rphi);
139  void rotate(const RotationY& r);
144  void rotateZ(double rphi);
145  void rotate(const RotationZ& r);
146 
148  void translate(const XYZVector& t);
149 
150  // inline RawParticle & transform(const HepRotation &rot);
151  // inline RawParticle & transform(const HepLorentzRotation &rot);
152 
157  void chargeConjugate();
158 
159  int pid() const;
160 
161  int status() const;
162 
163  double charge() const;
164 
165  double mass() const;
166 
170  double eta() const;
171 
173  double cos2Theta() const;
174  double cos2ThetaV() const;
175 
176  double et() const;
177 
178  double x() const;
179  double X() const;
180 
181  double y() const;
182  double Y() const;
183 
184  double z() const;
185  double Z() const;
186 
187  double t() const;
188  double T() const;
189 
190  double r() const;
191  double R() const;
192 
193  double r2() const;
194  double R2() const;
195 
196  const XYZTLorentzVector& vertex() const;
197 
198  double px() const;
199  double Px() const;
200 
201  double py() const;
202  double Py() const;
203 
204  double pz() const;
205  double Pz() const;
206 
207  double e() const;
208  double E() const;
209 
210  double Pt() const;
211  double pt() const;
212 
213  double Perp2() const;
214 
215  double mag() const;
216 
217  double theta() const;
218  double phi() const;
219 
220  double M2() const;
221 
222  const XYZTLorentzVector& momentum() const;
224 
225  XYZVector Vect() const;
226 
232  void printName() const;
233 
238  void print() const;
239 
244  int isUsed() const { return myUsed; }
245 
248  void use() { myUsed = 1; }
249 
252  void reUse() { myUsed = 0; }
253 
254 private:
258  RawParticle(const int id, const XYZTLorentzVector& p, double mass, double charge);
259 
263  RawParticle(const int id, const XYZTLorentzVector& p, const XYZTLorentzVector& xStart, double mass, double charge);
264 
265 private:
268  double myCharge = 0.;
269  double myMass = 0.;
270  int myId = 0;
271  int myStatus = 99;
272  int myUsed = 0;
273 };
274 
275 std::ostream& operator<<(std::ostream& o, const RawParticle& p);
276 
277 inline int RawParticle::pid() const { return myId; }
278 inline int RawParticle::status() const { return myStatus; }
279 inline double RawParticle::eta() const { return -std::log(std::tan(this->theta() / 2.)); }
280 inline double RawParticle::cos2Theta() const { return Pz() * Pz() / myMomentum.Vect().Mag2(); }
281 inline double RawParticle::cos2ThetaV() const { return Z() * Z() / myVertex.Vect().Mag2(); }
282 inline double RawParticle::x() const { return myVertex.Px(); }
283 inline double RawParticle::y() const { return myVertex.Py(); }
284 inline double RawParticle::z() const { return myVertex.Pz(); }
285 inline double RawParticle::t() const { return myVertex.E(); }
286 inline double RawParticle::X() const { return myVertex.Px(); }
287 inline double RawParticle::Y() const { return myVertex.Py(); }
288 inline double RawParticle::Z() const { return myVertex.Pz(); }
289 inline double RawParticle::T() const { return myVertex.E(); }
290 inline double RawParticle::R() const { return std::sqrt(R2()); }
291 inline double RawParticle::R2() const { return myVertex.Perp2(); }
292 inline double RawParticle::r() const { return std::sqrt(r2()); }
293 inline double RawParticle::r2() const { return myVertex.Perp2(); }
294 inline double RawParticle::charge() const { return myCharge; }
295 inline double RawParticle::mass() const { return myMass; }
296 inline double RawParticle::px() const { return myMomentum.px(); }
297 inline double RawParticle::Px() const { return myMomentum.Px(); }
298 
299 inline double RawParticle::py() const { return myMomentum.py(); }
300 inline double RawParticle::Py() const { return myMomentum.Py(); }
301 
302 inline double RawParticle::pz() const { return myMomentum.pz(); }
303 inline double RawParticle::Pz() const { return myMomentum.Pz(); }
304 
305 inline double RawParticle::e() const { return myMomentum.e(); }
306 inline double RawParticle::E() const { return myMomentum.E(); }
307 
308 inline double RawParticle::Pt() const { return myMomentum.Pt(); }
309 inline double RawParticle::pt() const { return myMomentum.pt(); }
310 
311 inline double RawParticle::Perp2() const { return myMomentum.Perp2(); }
312 
313 inline double RawParticle::mag() const { return myMomentum.mag(); }
314 
315 inline double RawParticle::theta() const { return myMomentum.theta(); }
316 inline double RawParticle::phi() const { return myMomentum.phi(); }
317 
318 inline double RawParticle::M2() const { return myMomentum.M2(); }
319 
320 inline const XYZTLorentzVector& RawParticle::vertex() const { return myVertex; }
321 inline const XYZTLorentzVector& RawParticle::momentum() const { return myMomentum; }
323 inline XYZVector RawParticle::Vect() const { return myMomentum.Vect(); }
324 
326 inline void RawParticle::setVertex(double a, double b, double c, double d) { myVertex.SetXYZT(a, b, c, d); }
327 
329 inline void RawParticle::setMomentum(double a, double b, double c, double d) { myMomentum.SetXYZT(a, b, c, d); }
330 
331 inline void RawParticle::SetPx(double px) { myMomentum.SetPx(px); }
332 inline void RawParticle::SetPy(double py) { myMomentum.SetPy(py); }
333 inline void RawParticle::SetPz(double pz) { myMomentum.SetPz(pz); }
334 inline void RawParticle::SetE(double e) { myMomentum.SetE(e); }
335 
337  XYZVector v(r(myMomentum.Vect()));
338  setMomentum(v.X(), v.Y(), v.Z(), E());
339 }
340 
342  XYZVector v(r(myMomentum.Vect()));
343  setMomentum(v.X(), v.Y(), v.Z(), E());
344 }
345 
347  XYZVector v(r(myMomentum.Vect()));
348  setMomentum(v.X(), v.Y(), v.Z(), E());
349 }
350 
352  XYZVector v(r(myMomentum.Vect()));
353  setMomentum(v.X(), v.Y(), v.Z(), E());
354 }
355 
357  XYZVector v(r(myMomentum.Vect()));
358  setMomentum(v.X(), v.Y(), v.Z(), E());
359 }
360 
363  setMomentum(p.Px(), p.Py(), p.Pz(), p.E());
364 }
365 
366 inline void RawParticle::translate(const XYZVector& tr) {
367  myVertex.SetXYZT(X() + tr.X(), Y() + tr.Y(), Z() + tr.Z(), T());
368 }
369 
370 #endif
RawParticle::x
double x() const
x of vertex
Definition: RawParticle.h:282
rawparticle::makeMuon
RawParticle makeMuon(bool isParticle, const math::XYZTLorentzVector &p, const math::XYZTLorentzVector &xStart)
Definition: makeMuon.cc:20
RawParticle
Definition: RawParticle.h:37
RawParticle::phi
double phi() const
phi of momentum vector
Definition: RawParticle.h:316
RawParticle::et
double et() const
get the transverse energy
Definition: RawParticle.cc:82
RawParticle::translate
void translate(const XYZVector &t)
Definition: RawParticle.h:366
RawParticle::boost
void boost(double bx, double by, double bz)
Definition: RawParticle.cc:65
rawparticle
Definition: makeMuon.h:29
RawParticle::rotateZ
void rotateZ(double rphi)
Definition: RawParticle.cc:59
RawParticle::E
double E() const
energy of the momentum
Definition: RawParticle.h:306
RawParticle::momentum
const XYZTLorentzVector & momentum() const
the momentum fourvector
Definition: RawParticle.h:321
RawParticle::setT
void setT(const double t)
set the time of creation
Definition: RawParticle.cc:39
RawParticle::mag
double mag() const
the magnitude of the momentum
Definition: RawParticle.h:313
RawParticle::use
void use()
Definition: RawParticle.h:248
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
RawParticle::vertex
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:320
RawParticle::t
double t() const
vertex time
Definition: RawParticle.h:285
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
RawParticle::Boost
ROOT::Math::Boost Boost
Definition: RawParticle.h:49
RawParticle::R2
double R2() const
vertex radius**2
Definition: RawParticle.h:291
RawParticle::setCharge
void setCharge(float q)
set the MEASURED charge
Definition: RawParticle.cc:32
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
RawParticle::printName
void printName() const
RawParticle::Rotation3D
ROOT::Math::Rotation3D Rotation3D
Definition: RawParticle.h:45
RawParticle::unchecked_makeParticle
friend RawParticle unchecked_makeParticle(int id, const math::XYZTLorentzVector &p, double mass, double charge)
Definition: makeParticle.cc:19
XYZVector
math::XYZVector XYZVector
Definition: RawParticle.h:26
RawParticle::pid
int pid() const
get the HEP particle ID number
Definition: RawParticle.h:277
RawParticle::cos2Theta
double cos2Theta() const
Cos**2(theta) is faster to determine than eta.
Definition: RawParticle.h:280
RawParticle::Pt
double Pt() const
transverse momentum
Definition: RawParticle.h:308
RawParticle::myMass
double myMass
the RECONSTRUCTED mass
Definition: RawParticle.h:269
XYZTLorentzVector
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25
findQualityFiles.v
v
Definition: findQualityFiles.py:179
RawParticle::RotationZ
ROOT::Math::RotationZ RotationZ
Definition: RawParticle.h:48
RawParticle::charge
double charge() const
get the MEASURED charge
Definition: RawParticle.h:294
RawParticle::print
void print() const
RawParticle::myId
int myId
the particle id number HEP-PID
Definition: RawParticle.h:270
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:36
RawParticle::myStatus
int myStatus
the status code according to PYTHIA
Definition: RawParticle.h:271
RawParticle::SetE
void SetE(double)
Definition: RawParticle.h:334
RawParticle::Z
double Z() const
z of vertex
Definition: RawParticle.h:288
RawParticle::myMomentum
XYZTLorentzVector myMomentum
the four vector of the momentum
Definition: RawParticle.h:266
RawParticle::r
double r() const
vertex radius
Definition: RawParticle.h:292
RawParticle::RotationY
ROOT::Math::RotationY RotationY
Definition: RawParticle.h:47
RawParticle::px
double px() const
x of the momentum
Definition: RawParticle.h:296
RawParticle::setMass
void setMass(float m)
set the RECONSTRUCTED mass
Definition: RawParticle.cc:30
RawParticle::py
double py() const
y of the momentum
Definition: RawParticle.h:299
RawParticle::operator=
RawParticle & operator=(const RawParticle &rhs)=default
RawParticle::eta
double eta() const
Definition: RawParticle.h:279
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
RawParticle::pt
double pt() const
transverse momentum
Definition: RawParticle.h:309
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
RawParticle::chargeConjugate
void chargeConjugate()
Definition: RawParticle.cc:34
RawParticle::RotationX
ROOT::Math::RotationX RotationX
Definition: RawParticle.h:46
operator<<
std::ostream & operator<<(std::ostream &o, const RawParticle &p)
Definition: RawParticle.cc:71
RawParticle::z
double z() const
z of vertex
Definition: RawParticle.h:284
b
double b
Definition: hdecay.h:118
RawParticle::Vect
XYZVector Vect() const
the momentum threevector
Definition: RawParticle.h:323
RawParticle::myCharge
double myCharge
the MEASURED charge
Definition: RawParticle.h:268
RawParticle::SetPx
void SetPx(double)
Definition: RawParticle.h:331
a
double a
Definition: hdecay.h:119
RawParticle::M2
double M2() const
mass squared
Definition: RawParticle.h:318
RawParticle::pz
double pz() const
z of the momentum
Definition: RawParticle.h:302
RawParticle::rotateX
void rotateX(double rphi)
Definition: RawParticle.cc:47
RawParticle::cos2ThetaV
double cos2ThetaV() const
Definition: RawParticle.h:281
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
RawParticle::T
double T() const
vertex time
Definition: RawParticle.h:289
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
LorentzVector.h
RawParticle::Y
double Y() const
y of vertex
Definition: RawParticle.h:287
p4
double p4[4]
Definition: TauolaWrapper.h:92
RawParticle::Py
double Py() const
y of the momentum
Definition: RawParticle.h:300
RawParticle::setStatus
void setStatus(int istat)
Definition: RawParticle.cc:28
RawParticle::mass
double mass() const
get the MEASURED mass
Definition: RawParticle.h:295
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
RawParticle::isUsed
int isUsed() const
Definition: RawParticle.h:244
RawParticle::Perp2
double Perp2() const
perpendicular momentum squared
Definition: RawParticle.h:311
RawParticle::r2
double r2() const
vertex radius**2
Definition: RawParticle.h:293
RawParticle::R
double R() const
vertex radius
Definition: RawParticle.h:290
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
RawParticle::SetPy
void SetPy(double)
Definition: RawParticle.h:332
RawParticle::rotate
void rotate(double rphi, const XYZVector &raxis)
Definition: RawParticle.cc:41
alignCSCRings.r
r
Definition: alignCSCRings.py:93
RawParticle::y
double y() const
y of vertex
Definition: RawParticle.h:283
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
RawParticle::SetPz
void SetPz(double)
Definition: RawParticle.h:333
RawParticle::e
double e() const
energy of the momentum
Definition: RawParticle.h:305
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
RawParticle::myUsed
int myUsed
status of the locking
Definition: RawParticle.h:272
RawParticle::Rotation
ROOT::Math::AxisAngle Rotation
Definition: RawParticle.h:44
RawParticle::X
double X() const
x of vertex
Definition: RawParticle.h:286
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
RawParticle::setVertex
void setVertex(const XYZTLorentzVector &vtx)
set the vertex
Definition: RawParticle.h:325
RawParticle::reUse
void reUse()
Definition: RawParticle.h:252
RawParticle::status
int status() const
get the particle status
Definition: RawParticle.h:278
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
RawParticle::RawParticle
RawParticle()=default
RawParticle::setMomentum
void setMomentum(const XYZTLorentzVector &vtx)
set the momentum
Definition: RawParticle.h:328
ztail.d
d
Definition: ztail.py:151
RawParticle::theta
double theta() const
theta of momentum vector
Definition: RawParticle.h:315
RawParticle::myVertex
XYZTLorentzVector myVertex
the four vector of the vertex
Definition: RawParticle.h:267
Vector3D.h
RawParticle::Px
double Px() const
x of the momentum
Definition: RawParticle.h:297
RawParticle::Pz
double Pz() const
z of the momentum
Definition: RawParticle.h:303
RawParticle::rotateY
void rotateY(double rphi)
Definition: RawParticle.cc:53
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37