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