ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtVertexPropagator.cxx
Go to the documentation of this file.
1 #include "AtVertexPropagator.h"
2 
3 #include <Rtypes.h>
4 #include <TRandom.h>
5 #include <TVector3.h>
6 
7 #include <cmath>
8 #include <utility>
9 
10 // Allow us use std::make_unique using a protected constructor this struct
11 // is only defined in this translation unit (.cpp file)
12 namespace {
13 struct concrete_AtVertexPropagator : public AtVertexPropagator {
14 };
15 } // namespace
16 std::unique_ptr<AtVertexPropagator> AtVertexPropagator::fInstance = nullptr;
17 
19 {
20  if (fInstance == nullptr)
21  fInstance = std::make_unique<concrete_AtVertexPropagator>();
22  return fInstance.get();
23 }
24 
26  : fGlobalEvtCnt(0), fBeamEvtCnt(0), fDecayEvtCnt(0), fVx(0.), fVy(0.), fVz(0.), fPx(0.), fPy(0.), fPz(0.), fE(0.),
27  fBeamMass(0), fRndELoss(0), fBeamNomE(0), fInVx(0), fInVy(0), fInVz(0), fRecoilE(0), fRecoilA(0), fScatterE(0),
28  fScatterA(0), fBURes1E(0), fBURes1A(0), fBURes2E(0), fBURes2A(0), fIsValidKine(false), fAiso(0), fZiso(0),
29  fExEjectile(0), fIsd2HeEvt(false)
30 {
31 
32  fScatP(0) = 0.0;
33  fScatP(1) = 0.0;
34  fScatP(2) = 0.0;
35  fd2HeVtx(0) = 0.0;
36  fd2HeVtx(1) = 0.0;
37  fd2HeVtx(2) = 0.0;
38 }
39 
40 void AtVertexPropagator::SetVertex(Double_t vx, Double_t vy, Double_t vz, Double_t invx, Double_t invy, Double_t invz,
41  Double_t px, Double_t py, Double_t pz, Double_t E)
42 {
43  fVx = vx;
44  fVy = vy;
45  fVz = vz;
46  fInVx = invx;
47  fInVy = invy;
48  fInVz = invz;
49  fPx = px;
50  fPy = py;
51  fPz = pz;
52  fE = E;
53 }
54 
55 void AtVertexPropagator::SetRndELoss(Double_t eloss)
56 {
57  fRndELoss = eloss;
58 }
59 
61 {
62  fBeamNomE = nome;
63 }
64 
66 {
67 
68  fVx = 0.0;
69  fVy = 0.0;
70  fVz = 0.0;
71  fInVx = 0.0;
72  fInVy = 0.0;
73  fInVz = 0.0;
74  fPx = 0.0;
75  fPy = 0.0;
76  fPz = 0.0;
77  fE = 0.0;
78  fScatP(0) = 0.0;
79  fScatP(1) = 0.0;
80  fScatP(2) = 0.0;
81  fIsValidKine = kTRUE;
82 
83  fTrackAngle.clear();
84  fTrackEn.clear();
85 }
86 
88 {
89  fBeamMass = m;
90 }
91 
92 void AtVertexPropagator::SetTrackEnergy(int trackID, double energy)
93 {
94  fTrackEn[trackID] = energy;
95 }
96 void AtVertexPropagator::SetTrackAngle(int trackID, double angle)
97 {
98  fTrackAngle[trackID] = angle;
99 }
100 
102 {
103  auto it = fTrackAngle.find(trackID);
104  if (it == fTrackAngle.end())
105  return 0;
106  else
107  return it->second;
108 }
110 {
111  auto it = fTrackEn.find(trackID);
112  if (it == fTrackEn.end())
113  return 0;
114  else
115  return it->second;
116 }
117 
118 /*
119 void AtVertexPropagator::SetRecoilE(Double_t val)
120 {
121  fRecoilE = val;
122 }
123 void AtVertexPropagator::SetRecoilA(Double_t val)
124 {
125  fRecoilA = val;
126 }
127 void AtVertexPropagator::SetScatterE(Double_t val)
128 {
129  fScatterE = val;
130 }
131 void AtVertexPropagator::SetScatterA(Double_t val)
132 {
133  fScatterA = val;
134 }
135 void AtVertexPropagator::SetBURes1E(Double_t val)
136 {
137  fBURes1E = val;
138 }
139 void AtVertexPropagator::SetBURes1A(Double_t val)
140 {
141  fBURes1A = val;
142 }
143 void AtVertexPropagator::SetBURes2E(Double_t val)
144 {
145  fBURes2E = val;
146 }
147 void AtVertexPropagator::SetBURes2A(Double_t val)
148 {
149  fBURes2A = val;
150 }
151 */
152 
154 {
155  fAiso = mnum;
156 }
158 {
159  fZiso = anum;
160 }
162 {
163  fScatP = avec;
164 }
166 {
167  fExEjectile = val;
168 }
170 {
171  fd2HeVtx = avec;
172  fIsd2HeEvt = kTRUE;
173 }
174 void AtVertexPropagator::Setd2HeVtx(Double_t x0, Double_t y0, Double_t Ax, Double_t Ay)
175 {
176  Double_t vx, vy, vz;
177  vz = 100.0 * (gRandom->Uniform()); // cm
178  vx = x0 + vz * tan(Ax);
179  vy = y0 + sqrt(pow(vz, 2) + pow(vx - x0, 2)) * tan(Ay);
180  fd2HeVtx.SetXYZ(vx, vy, vz);
181  fIsd2HeEvt = kTRUE;
182 }
183 
185 {
186  return fGlobalEvtCnt;
187 }
189 {
190  return fBeamEvtCnt;
191 }
193 {
194  return fDecayEvtCnt;
195 }
197 {
198  return fVx;
199 }
201 {
202  return fVy;
203 }
205 {
206  return fVz;
207 }
209 {
210  return fInVx;
211 }
213 {
214  return fInVy;
215 }
217 {
218  return fInVz;
219 }
221 {
222  return fPx;
223 }
225 {
226  return fPy;
227 }
229 {
230  return fPz;
231 }
233 {
234  return fE;
235 }
237 {
238  return fBeamMass;
239 }
241 {
242  return fRndELoss;
243 }
245 {
246  return fBeamNomE;
247 }
248 
249 /*
250 Double_t AtVertexPropagator::GetRecoilE()
251 {
252  return fRecoilE;
253 }
254 Double_t AtVertexPropagator::GetRecoilA()
255 {
256  return fRecoilA;
257 }
258 Double_t AtVertexPropagator::GetScatterE()
259 {
260  return fScatterE;
261 }
262 Double_t AtVertexPropagator::GetScatterA()
263 {
264  return fScatterA;
265 }
266 Double_t AtVertexPropagator::GetBURes1E()
267 {
268  return fBURes1E;
269 }
270 Double_t AtVertexPropagator::GetBURes1A()
271 {
272  return fBURes1A;
273 }
274 Double_t AtVertexPropagator::GetBURes2E()
275 {
276  return fBURes2E;
277 }
278 Double_t AtVertexPropagator::GetBURes2A()
279 {
280  return fBURes2A;
281 }
282 */
283 
285 {
286  return fIsd2HeEvt;
287 }
289 {
290  return fIsValidKine;
291 }
293 {
294  return fAiso;
295 }
297 {
298  return fZiso;
299 }
301 {
302  return fScatP;
303 }
305 {
306  return fExEjectile;
307 }
309 {
310  return fd2HeVtx;
311 }
312 
314 {
315  fGlobalEvtCnt++;
316 }
318 {
319  fBeamEvtCnt++;
320 }
322 {
323  fDecayEvtCnt++;
324 }
326 {
327  fIsValidKine = val;
328 }
329 
AtVertexPropagator
Definition: AtVertexPropagator.h:15
AtVertexPropagator::SetValidKine
void SetValidKine(Bool_t val)
Definition: AtVertexPropagator.cxx:325
AtVertexPropagator::GetVx
Double_t GetVx()
Definition: AtVertexPropagator.cxx:196
AtVertexPropagator::GetVz
Double_t GetVz()
Definition: AtVertexPropagator.cxx:204
ClassImp
ClassImp(AtVertexPropagator)
AtVertexPropagator::GetPx
Double_t GetPx()
Definition: AtVertexPropagator.cxx:220
AtVertexPropagator::GetPz
Double_t GetPz()
Definition: AtVertexPropagator.cxx:228
AtVertexPropagator::GetPy
Double_t GetPy()
Definition: AtVertexPropagator.cxx:224
AtVertexPropagator::GetScatterEx
Double_t GetScatterEx()
Definition: AtVertexPropagator.cxx:304
AtVertexPropagator::GetDecayEvtCnt
Int_t GetDecayEvtCnt()
Definition: AtVertexPropagator.cxx:192
AtVertexPropagator::ResetVertex
void ResetVertex()
Definition: AtVertexPropagator.cxx:65
AtVertexPropagator::GetAtomicNum
Int_t GetAtomicNum()
Definition: AtVertexPropagator.cxx:296
AtVertexPropagator::GetGlobalEvtCnt
Int_t GetGlobalEvtCnt()
Definition: AtVertexPropagator.cxx:184
AtVertexPropagator::SetScatterP
void SetScatterP(TVector3 val)
Definition: AtVertexPropagator.cxx:161
AtVertexPropagator::GetValidKine
Bool_t GetValidKine()
Definition: AtVertexPropagator.cxx:288
AtVertexPropagator::IncGlobalEvtCnt
void IncGlobalEvtCnt()
Definition: AtVertexPropagator.cxx:313
AtVertexPropagator::GetBeamEvtCnt
Int_t GetBeamEvtCnt()
Definition: AtVertexPropagator.cxx:188
AtVertexPropagator::Getd2HeEvt
Bool_t Getd2HeEvt()
Definition: AtVertexPropagator.cxx:284
AtVertexPropagator::GetVy
Double_t GetVy()
Definition: AtVertexPropagator.cxx:200
AtVertexPropagator::Setd2HeVtx
void Setd2HeVtx(TVector3 val)
Definition: AtVertexPropagator.cxx:169
AtVertexPropagator::Getd2HeVtx
TVector3 Getd2HeVtx()
Definition: AtVertexPropagator.cxx:308
AtVertexPropagator::GetEnergy
Double_t GetEnergy()
Definition: AtVertexPropagator.cxx:232
AtVertexPropagator.h
AtVertexPropagator::GetInVx
Double_t GetInVx()
Definition: AtVertexPropagator.cxx:208
AtVertexPropagator::GetInVz
Double_t GetInVz()
Definition: AtVertexPropagator.cxx:216
AtVertexPropagator::SetAtomicNum
void SetAtomicNum(Int_t anum)
Definition: AtVertexPropagator.cxx:157
AtVertexPropagator::SetTrackEnergy
void SetTrackEnergy(int trackID, double energy)
Definition: AtVertexPropagator.cxx:92
AtVertexPropagator::SetBeamMass
void SetBeamMass(Double_t m)
Definition: AtVertexPropagator.cxx:87
AtVertexPropagator::AtVertexPropagator
AtVertexPropagator()
Definition: AtVertexPropagator.cxx:25
AtVertexPropagator::GetMassNum
Int_t GetMassNum()
Definition: AtVertexPropagator.cxx:292
AtVertexPropagator::GetBeamMass
Double_t GetBeamMass()
Definition: AtVertexPropagator.cxx:236
AtVertexPropagator::SetVertex
void SetVertex(Double_t vx, Double_t vy, Double_t vz, Double_t invx, Double_t invy, Double_t invz, Double_t px, Double_t py, Double_t pz, Double_t E)
Definition: AtVertexPropagator.cxx:40
AtVertexPropagator::GetRndELoss
Double_t GetRndELoss()
Definition: AtVertexPropagator.cxx:240
AtVertexPropagator::SetMassNum
void SetMassNum(Int_t mnum)
Definition: AtVertexPropagator.cxx:153
AtVertexPropagator::SetTrackAngle
void SetTrackAngle(int trackID, double angle)
Definition: AtVertexPropagator.cxx:96
AtVertexPropagator::GetScatterP
TVector3 GetScatterP()
Definition: AtVertexPropagator.cxx:300
AtVertexPropagator::SetBeamNomE
void SetBeamNomE(Double_t ener)
Definition: AtVertexPropagator.cxx:60
AtVertexPropagator::SetScatterEx
void SetScatterEx(Double_t val)
Definition: AtVertexPropagator.cxx:165
AtVertexPropagator::Instance
static AtVertexPropagator * Instance()
Definition: AtVertexPropagator.cxx:18
AtVertexPropagator::GetTrackEnergy
Double_t GetTrackEnergy(int trackID)
Definition: AtVertexPropagator.cxx:109
AtVertexPropagator::SetRndELoss
void SetRndELoss(Double_t eloss)
Definition: AtVertexPropagator.cxx:55
AtVertexPropagator::GetInVy
Double_t GetInVy()
Definition: AtVertexPropagator.cxx:212
AtVertexPropagator::IncBeamEvtCnt
void IncBeamEvtCnt()
Definition: AtVertexPropagator.cxx:317
AtVertexPropagator::IncDecayEvtCnt
void IncDecayEvtCnt()
Definition: AtVertexPropagator.cxx:321
AtVertexPropagator::GetTrackAngle
Double_t GetTrackAngle(int trackID)
Definition: AtVertexPropagator.cxx:101
AtVertexPropagator::GetBeamNomE
Double_t GetBeamNomE()
Definition: AtVertexPropagator.cxx:244