CMS 3D CMS Logo

RawParticle.cc
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // Prototype for a particle class
3 // -----------------------------------------------------------------------------
4 // $Date: 2007/09/07 16:46:22 $
5 // $Revision: 1.13 $
6 // -----------------------------------------------------------------------------
7 // Author: Stephan Wynhoff - RWTH-Aachen (Email: Stephan.Wynhoff@cern.ch)
8 // -----------------------------------------------------------------------------
10 
11 #include <cmath>
12 
14 
15 RawParticle::RawParticle(const int id, const XYZTLorentzVector& p, double mass, double charge)
16  : myMomentum(p), myCharge{charge}, myMass{mass}, myId{id} {}
17 
19  const int id, const XYZTLorentzVector& p, const XYZTLorentzVector& xStart, double mass, double charge)
20  : myMomentum(p), myVertex{xStart}, myCharge{charge}, myMass{mass}, myId{id} {}
21 
23  : myMomentum(p), myVertex{xStart}, myCharge{charge} {}
24 
25 RawParticle::RawParticle(double px, double py, double pz, double e, double charge)
26  : myMomentum(px, py, pz, e), myCharge{charge} {}
27 
28 void RawParticle::setStatus(int istat) { myStatus = istat; }
29 
30 void RawParticle::setMass(float m) { myMass = m; }
31 
32 void RawParticle::setCharge(float q) { myCharge = q; }
33 
35  myId = -myId;
36  myCharge = -1 * myCharge;
37 }
38 
39 void RawParticle::setT(const double t) { myVertex.SetE(t); }
40 
41 void RawParticle::rotate(double angle, const XYZVector& raxis) {
42  Rotation r(raxis, angle);
43  XYZVector v(r * myMomentum.Vect());
44  setMomentum(v.X(), v.Y(), v.Z(), E());
45 }
46 
47 void RawParticle::rotateX(double rphi) {
48  RotationX r(rphi);
49  XYZVector v(r * myMomentum.Vect());
50  setMomentum(v.X(), v.Y(), v.Z(), E());
51 }
52 
53 void RawParticle::rotateY(double rphi) {
54  RotationY r(rphi);
55  XYZVector v(r * myMomentum.Vect());
56  setMomentum(v.X(), v.Y(), v.Z(), E());
57 }
58 
59 void RawParticle::rotateZ(double rphi) {
60  RotationZ r(rphi);
61  XYZVector v(r * myMomentum.Vect());
62  setMomentum(v.X(), v.Y(), v.Z(), E());
63 }
64 
65 void RawParticle::boost(double betax, double betay, double betaz) {
66  Boost b(betax, betay, betaz);
68  setMomentum(p.X(), p.Y(), p.Z(), p.T());
69 }
70 
71 std::ostream& operator<<(std::ostream& o, const RawParticle& p) {
72  o.setf(std::ios::fixed, std::ios::floatfield);
73  o.setf(std::ios::right, std::ios::adjustfield);
74 
75  o << std::setw(4) << std::setprecision(2) << p.pid() << " (";
76  o << std::setw(2) << std::setprecision(2) << p.status() << "): ";
77  o << std::setw(10) << std::setprecision(4) << p.momentum() << " ";
78  o << std::setw(10) << std::setprecision(4) << p.vertex();
79  return o;
80 }
81 
82 double RawParticle::et() const {
83  double mypp, tmpEt = -1.;
84 
85  mypp = std::sqrt(momentum().mag2());
86  if (mypp != 0) {
87  tmpEt = E() * pt() / mypp;
88  }
89  return tmpEt;
90 }
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
RawParticle
Definition: RawParticle.h:37
RawParticle::et
double et() const
get the transverse energy
Definition: RawParticle.cc:82
RawParticle::boost
void boost(double bx, double by, double bz)
Definition: RawParticle.cc:65
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
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
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::setCharge
void setCharge(float q)
set the MEASURED charge
Definition: RawParticle.cc:32
XYZVector
math::XYZVector XYZVector
Definition: RawParticle.h:26
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::myId
int myId
the particle id number HEP-PID
Definition: RawParticle.h:270
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
RawParticle::myStatus
int myStatus
the status code according to PYTHIA
Definition: RawParticle.h:271
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::setMass
void setMass(float m)
set the RECONSTRUCTED mass
Definition: RawParticle.cc:30
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
b
double b
Definition: hdecay.h:118
RawParticle::myCharge
double myCharge
the MEASURED charge
Definition: RawParticle.h:268
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
RawParticle::rotateX
void rotateX(double rphi)
Definition: RawParticle.cc:47
operator<<
std::ostream & operator<<(std::ostream &o, const RawParticle &p)
Definition: RawParticle.cc:71
mag2
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Definition: Basic3DVectorLD.h:124
RawParticle::setStatus
void setStatus(int istat)
Definition: RawParticle.cc:28
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
RawParticle::rotate
void rotate(double rphi, const XYZVector &raxis)
Definition: RawParticle.cc:41
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
RawParticle::Rotation
ROOT::Math::AxisAngle Rotation
Definition: RawParticle.h:44
RawParticle.h
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
angle
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
RawParticle::RawParticle
RawParticle()=default
RawParticle::setMomentum
void setMomentum(const XYZTLorentzVector &vtx)
set the momentum
Definition: RawParticle.h:328
RawParticle::myVertex
XYZTLorentzVector myVertex
the four vector of the vertex
Definition: RawParticle.h:267
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
RawParticle::rotateY
void rotateY(double rphi)
Definition: RawParticle.cc:53
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37