ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtTPCIonGeneratorGaussian.cxx
Go to the documentation of this file.
2 
3 #include <TRandom.h>
4 
5 #include <algorithm> // for clamp
6 #include <cmath> // for cos, sin, asin
7 
9 
10 void AtTPCIonGeneratorGaussian::SetBeamLimits(Double32_t r, Double32_t z, Double_t theta)
11 {
12  fR = r;
13  fz = z;
14  fTheta = theta;
15 }
16 
18 {
19  double pi = 2 * asin(1.0);
20 
21  Double_t radius = std::clamp(gRandom->Gaus(0, fR / 3), 0.0, fR);
22  Double_t phi_R = gRandom->Uniform(0, 2 * pi);
23  fVx = radius * cos(phi_R);
24  fVy = radius * sin(phi_R);
25 
26  Double_t theta = gRandom->Uniform(0, fTheta);
27  Double_t pr = fPz * sin(theta);
28  fPz *= cos(theta);
29  fPx = pr * cos(phi_R);
30  fPy = pr * sin(phi_R);
31 }
AtTPCIonGeneratorGaussian.h
AtTPCIonGenerator::fR
Double32_t fR
Definition: AtTPCIonGenerator.h:28
AtTPCIonGeneratorGaussian
Definition: AtTPCIonGeneratorGaussian.h:12
AtTPCIonGenerator::fPx
Double_t fPx
Definition: AtTPCIonGenerator.h:26
ClassImp
ClassImp(AtTPCIonGeneratorGaussian)
AtTPCIonGenerator::fPz
Double_t fPz
Definition: AtTPCIonGenerator.h:26
AtTPCIonGeneratorGaussian::SetBeamLimits
void SetBeamLimits(Double32_t r=0, Double32_t z=0, Double_t theta=0)
Definition: AtTPCIonGeneratorGaussian.cxx:10
AtTPCIonGeneratorGaussian::fTheta
Double_t fTheta
Definition: AtTPCIonGeneratorGaussian.h:14
AtTPCIonGeneratorGaussian::SetVertexCoordinates
virtual void SetVertexCoordinates() override
Sets fVx, fVy, fVz depending on the type of ion generator.
Definition: AtTPCIonGeneratorGaussian.cxx:17
AtTPCIonGenerator::fPy
Double_t fPy
Definition: AtTPCIonGenerator.h:26
AtTPCIonGenerator::fVx
Double_t fVx
Definition: AtTPCIonGenerator.h:29
AtTPCIonGenerator::fz
Double32_t fz
Definition: AtTPCIonGenerator.h:28
AtTPCIonGenerator::fVy
Double_t fVy
Definition: AtTPCIonGenerator.h:29