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