CbmRoot
CbmLitMCPoint.h
Go to the documentation of this file.
1 
7 #ifndef CBMLITMCPOINT_H_
8 #define CBMLITMCPOINT_H_
9 
10 #include "TObject.h"
11 #include <cmath>
12 #include <sstream>
13 #include <string>
14 
22 public:
23  /*
24  * \brief Constructor.
25  */
27  : fXIn(0.)
28  , fYIn(0.)
29  , fZIn(0.)
30  , fPxIn(0.)
31  , fPyIn(0.)
32  , fPzIn(0.)
33  , fXOut(0.)
34  , fYOut(0.)
35  , fZOut(0.)
36  , fPxOut(0.)
37  , fPyOut(0.)
38  , fPzOut(0.)
39  , fRefId(-1)
40  , fStationId(-1)
41  , fQ(1.) {}
42 
43  /*
44  * \brief Destructor.
45  */
46  virtual ~CbmLitMCPoint() {}
47 
48  /* Getters */
49  Double_t GetX() const { return (fXIn + fXOut) / 2.; }
50  Double_t GetY() const { return (fYIn + fYOut) / 2.; }
51  Double_t GetZ() const { return (fZIn + fZOut) / 2.; }
52  Double_t GetPx() const { return (fPxIn + fPxOut) / 2.; }
53  Double_t GetPy() const { return (fPyIn + fPyOut) / 2.; }
54  Double_t GetPz() const { return (fPzIn + fPzOut) / 2.; }
55  Double_t GetTx() const { return GetPx() / GetPz(); }
56  Double_t GetTy() const { return GetPy() / GetPz(); }
57  Double_t GetP() const {
58  return std::sqrt(GetPx() * GetPx() + GetPy() * GetPy() + GetPz() * GetPz());
59  }
60  Double_t GetQp() const {
61  Double_t p = GetP();
62  Double_t res = (p != 0.) ? fQ / p : 0.;
63  return res;
64  }
65  Double_t GetXIn() const { return fXIn; }
66  Double_t GetYIn() const { return fYIn; }
67  Double_t GetZIn() const { return fZIn; }
68  Double_t GetPxIn() const { return fPxIn; }
69  Double_t GetPyIn() const { return fPyIn; }
70  Double_t GetPzIn() const { return fPzIn; }
71  Double_t GetTxIn() const { return fPxIn / fPzIn; }
72  Double_t GetTyIn() const { return fPyIn / fPzIn; }
73  Double_t GetPIn() const {
74  return std::sqrt(fPxIn * fPxIn + fPyIn * fPyIn + fPzIn * fPzIn);
75  }
76  Double_t GetQpIn() const {
77  Double_t p = GetPIn();
78  Double_t res = (p != 0.) ? fQ / p : 0.;
79  return res;
80  }
81  Double_t GetXOut() const { return fXOut; }
82  Double_t GetYOut() const { return fYOut; }
83  Double_t GetZOut() const { return fZOut; }
84  Double_t GetPxOut() const { return fPxOut; }
85  Double_t GetPyOut() const { return fPyOut; }
86  Double_t GetPzOut() const { return fPzOut; }
87  Double_t GetTxOut() const { return fPxOut / fPzOut; }
88  Double_t GetTyOut() const { return fPyOut / fPzOut; }
89  Double_t GetPOut() const {
90  return std::sqrt(fPxOut * fPxOut + fPyOut * fPyOut + fPzOut * fPzOut);
91  }
92  Double_t GetQpOut() const {
93  Double_t p = GetPOut();
94  Double_t res = (p != 0.) ? fQ / p : 0.;
95  return res;
96  }
97  Int_t GetRefId() const { return fRefId; }
98  Int_t GetStationId() const { return fStationId; }
99 
100 
101  /* Setters */
102  void SetXIn(Double_t x) { fXIn = x; }
103  void SetYIn(Double_t y) { fYIn = y; }
104  void SetZIn(Double_t z) { fZIn = z; }
105  void SetPxIn(Double_t px) { fPxIn = px; }
106  void SetPyIn(Double_t py) { fPyIn = py; }
107  void SetPzIn(Double_t pz) { fPzIn = pz; }
108  void SetXOut(Double_t x) { fXOut = x; }
109  void SetYOut(Double_t y) { fYOut = y; }
110  void SetZOut(Double_t z) { fZOut = z; }
111  void SetPxOut(Double_t px) { fPxOut = px; }
112  void SetPyOut(Double_t py) { fPyOut = py; }
113  void SetPzOut(Double_t pz) { fPzOut = pz; }
114  void SetQ(Double_t q) { fQ = q; }
115  void SetRefId(Int_t refId) { fRefId = refId; }
116  void SetStationId(Int_t stationId) { fStationId = stationId; }
117 
122  virtual std::string ToString() const {
123  std::stringstream ss;
124  ss << "MCPoint: pos=(" << GetX() << "," << GetY() << "," << GetZ() << ") "
125  << "mom=(" << GetPx() << "," << GetPy() << "," << GetPz() << ") "
126  << "refId=" << GetRefId() << " stationId=" << GetStationId()
127  << std::endl;
128  return ss.str();
129  }
130 
135  friend std::ostream& operator<<(std::ostream& strm,
136  const CbmLitMCPoint& point) {
137  strm << point.ToString();
138  return strm;
139  }
140 
141 private:
142  Double_t fXIn, fYIn, fZIn; // Space coordinates on entrance plane [cm].
143  Double_t fPxIn, fPyIn,
144  fPzIn; // Momentum components on entrance plane. [GeV/c]
145  Double_t fXOut, fYOut, fZOut; // Space coordinates on exit plane [cm].
146  Double_t fPxOut, fPyOut,
147  fPzOut; // Momentum components on exit plane. [GeV/c]
148  Int_t fRefId; // Reference index.
149  Int_t fStationId; // Station index.
150  Double_t fQ; // +/-1 - negative or positive charge
151 };
152 
153 #endif /* CBMLITMCPOINT_H_ */
CbmLitMCPoint::fPyOut
Double_t fPyOut
Definition: CbmLitMCPoint.h:146
CbmLitMCPoint::SetYOut
void SetYOut(Double_t y)
Definition: CbmLitMCPoint.h:109
CbmLitMCPoint::GetStationId
Int_t GetStationId() const
Definition: CbmLitMCPoint.h:98
CbmLitMCPoint::operator<<
friend std::ostream & operator<<(std::ostream &strm, const CbmLitMCPoint &point)
Operator << for convenient output to std::ostream.
Definition: CbmLitMCPoint.h:135
CbmLitMCPoint::GetXIn
Double_t GetXIn() const
Definition: CbmLitMCPoint.h:65
CbmLitMCPoint::SetXIn
void SetXIn(Double_t x)
Definition: CbmLitMCPoint.h:102
CbmLitMCPoint::fZOut
Double_t fZOut
Definition: CbmLitMCPoint.h:145
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
CbmLitMCPoint::GetP
Double_t GetP() const
Definition: CbmLitMCPoint.h:57
CbmLitMCPoint::GetPz
Double_t GetPz() const
Definition: CbmLitMCPoint.h:54
CbmLitMCPoint::SetZIn
void SetZIn(Double_t z)
Definition: CbmLitMCPoint.h:104
CbmLitMCPoint::CbmLitMCPoint
CbmLitMCPoint()
Definition: CbmLitMCPoint.h:26
CbmLitMCPoint::SetYIn
void SetYIn(Double_t y)
Definition: CbmLitMCPoint.h:103
CbmLitMCPoint::GetY
Double_t GetY() const
Definition: CbmLitMCPoint.h:50
CbmLitMCPoint::GetQpIn
Double_t GetQpIn() const
Definition: CbmLitMCPoint.h:76
CbmLitMCPoint::SetXOut
void SetXOut(Double_t x)
Definition: CbmLitMCPoint.h:108
CbmLitMCPoint::GetTx
Double_t GetTx() const
Definition: CbmLitMCPoint.h:55
CbmLitMCPoint::SetPzOut
void SetPzOut(Double_t pz)
Definition: CbmLitMCPoint.h:113
CbmLitMCPoint::GetX
Double_t GetX() const
Definition: CbmLitMCPoint.h:49
CbmLitMCPoint::SetQ
void SetQ(Double_t q)
Definition: CbmLitMCPoint.h:114
CbmLitMCPoint::GetPxIn
Double_t GetPxIn() const
Definition: CbmLitMCPoint.h:68
CbmLitMCPoint::GetPyIn
Double_t GetPyIn() const
Definition: CbmLitMCPoint.h:69
CbmLitMCPoint::fPxIn
Double_t fPxIn
Definition: CbmLitMCPoint.h:143
CbmLitMCPoint::GetTxOut
Double_t GetTxOut() const
Definition: CbmLitMCPoint.h:87
CbmLitMCPoint::GetZ
Double_t GetZ() const
Definition: CbmLitMCPoint.h:51
CbmLitMCPoint::GetTyOut
Double_t GetTyOut() const
Definition: CbmLitMCPoint.h:88
CbmLitMCPoint::SetPxOut
void SetPxOut(Double_t px)
Definition: CbmLitMCPoint.h:111
CbmLitMCPoint::GetPIn
Double_t GetPIn() const
Definition: CbmLitMCPoint.h:73
CbmLitMCPoint::SetRefId
void SetRefId(Int_t refId)
Definition: CbmLitMCPoint.h:115
CbmLitMCPoint::GetPx
Double_t GetPx() const
Definition: CbmLitMCPoint.h:52
CbmLitMCPoint::SetZOut
void SetZOut(Double_t z)
Definition: CbmLitMCPoint.h:110
CbmLitMCPoint::fZIn
Double_t fZIn
Definition: CbmLitMCPoint.h:142
CbmLitMCPoint::fPyIn
Double_t fPyIn
Definition: CbmLitMCPoint.h:143
CbmLitMCPoint::fYOut
Double_t fYOut
Definition: CbmLitMCPoint.h:145
CbmLitMCPoint::fXOut
Double_t fXOut
Definition: CbmLitMCPoint.h:145
CbmLitMCPoint::fQ
Double_t fQ
Definition: CbmLitMCPoint.h:150
CbmLitMCPoint
Monte-Carlo point.
Definition: CbmLitMCPoint.h:21
CbmLitMCPoint::GetTyIn
Double_t GetTyIn() const
Definition: CbmLitMCPoint.h:72
CbmLitMCPoint::ToString
virtual std::string ToString() const
Returns std::string representation of the class.
Definition: CbmLitMCPoint.h:122
CbmLitMCPoint::GetZOut
Double_t GetZOut() const
Definition: CbmLitMCPoint.h:83
CbmLitMCPoint::GetPOut
Double_t GetPOut() const
Definition: CbmLitMCPoint.h:89
CbmLitMCPoint::GetZIn
Double_t GetZIn() const
Definition: CbmLitMCPoint.h:67
CbmLitMCPoint::~CbmLitMCPoint
virtual ~CbmLitMCPoint()
Definition: CbmLitMCPoint.h:46
CbmLitMCPoint::GetQp
Double_t GetQp() const
Definition: CbmLitMCPoint.h:60
CbmLitMCPoint::fRefId
Int_t fRefId
Definition: CbmLitMCPoint.h:148
CbmLitMCPoint::GetPzOut
Double_t GetPzOut() const
Definition: CbmLitMCPoint.h:86
CbmLitMCPoint::SetPxIn
void SetPxIn(Double_t px)
Definition: CbmLitMCPoint.h:105
CbmLitMCPoint::SetPyIn
void SetPyIn(Double_t py)
Definition: CbmLitMCPoint.h:106
CbmLitMCPoint::fStationId
Int_t fStationId
Definition: CbmLitMCPoint.h:149
CbmLitMCPoint::fPxOut
Double_t fPxOut
Definition: CbmLitMCPoint.h:146
CbmLitMCPoint::GetYOut
Double_t GetYOut() const
Definition: CbmLitMCPoint.h:82
CbmLitMCPoint::GetTxIn
Double_t GetTxIn() const
Definition: CbmLitMCPoint.h:71
CbmLitMCPoint::GetXOut
Double_t GetXOut() const
Definition: CbmLitMCPoint.h:81
CbmLitMCPoint::GetYIn
Double_t GetYIn() const
Definition: CbmLitMCPoint.h:66
CbmLitMCPoint::fPzOut
Double_t fPzOut
Definition: CbmLitMCPoint.h:147
CbmLitMCPoint::GetRefId
Int_t GetRefId() const
Definition: CbmLitMCPoint.h:97
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmLitMCPoint::fYIn
Double_t fYIn
Definition: CbmLitMCPoint.h:142
CbmLitMCPoint::GetQpOut
Double_t GetQpOut() const
Definition: CbmLitMCPoint.h:92
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmLitMCPoint::SetPzIn
void SetPzIn(Double_t pz)
Definition: CbmLitMCPoint.h:107
CbmLitMCPoint::GetPy
Double_t GetPy() const
Definition: CbmLitMCPoint.h:53
CbmLitMCPoint::GetPzIn
Double_t GetPzIn() const
Definition: CbmLitMCPoint.h:70
CbmLitMCPoint::GetPyOut
Double_t GetPyOut() const
Definition: CbmLitMCPoint.h:85
CbmLitMCPoint::GetPxOut
Double_t GetPxOut() const
Definition: CbmLitMCPoint.h:84
CbmLitMCPoint::fPzIn
Double_t fPzIn
Definition: CbmLitMCPoint.h:144
CbmLitMCPoint::GetTy
Double_t GetTy() const
Definition: CbmLitMCPoint.h:56
CbmLitMCPoint::fXIn
Double_t fXIn
Definition: CbmLitMCPoint.h:142
CbmLitMCPoint::SetPyOut
void SetPyOut(Double_t py)
Definition: CbmLitMCPoint.h:112
CbmLitMCPoint::SetStationId
void SetStationId(Int_t stationId)
Definition: CbmLitMCPoint.h:116