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