]>
Commit | Line | Data |
---|---|---|
88cb7938 | 1 | #include "AliHBTPositionRandomizer.h" |
abe00f6f | 2 | //___________________________________________________ |
3 | //////////////////////////////////////////////////////////////////////////////// | |
4 | // | |
5 | // class AliHBTPositionRandomizer | |
6 | // | |
7 | // These class randomizes particle vertex positions | |
8 | // Piotr.Skowronski@cern.ch | |
9 | // | |
10 | //////////////////////////////////////////////////////////////////////////////// | |
11 | ||
88cb7938 | 12 | #include <TRandom.h> |
415b66b5 | 13 | #include "AliAOD.h" |
14 | #include "AliVAODParticle.h" | |
88cb7938 | 15 | |
16 | ||
17 | ClassImp(AliHBTPositionRandomizer) | |
18 | ||
19 | /*********************************************************************/ | |
20 | ||
21 | AliHBTPositionRandomizer::AliHBTPositionRandomizer(): | |
22 | fReader(0x0), | |
23 | fRandomizer(0x0), | |
24 | fModel(0), | |
25 | fAddToExistingPos(kFALSE), | |
26 | fOnlyParticlesFromVertex(kFALSE), | |
3a3bc78a | 27 | fRandomizeTracks(kFALSE), |
88cb7938 | 28 | fVX(0.0), |
29 | fVY(0.0), | |
30 | fVZ(0.0) | |
31 | { | |
32 | //constructor | |
33 | } | |
34 | /*********************************************************************/ | |
35 | ||
415b66b5 | 36 | AliHBTPositionRandomizer::AliHBTPositionRandomizer(AliReader* reader): |
88cb7938 | 37 | fReader(reader), |
38 | fRandomizer(new AliHBTRndmGaussBall(8.0)), | |
39 | fModel(0), | |
40 | fAddToExistingPos(kFALSE), | |
41 | fOnlyParticlesFromVertex(kFALSE), | |
3a3bc78a | 42 | fRandomizeTracks(kFALSE), |
88cb7938 | 43 | fVX(0.0), |
44 | fVY(0.0), | |
45 | fVZ(0.0) | |
46 | { | |
47 | //constructor | |
48 | } | |
49 | /*********************************************************************/ | |
50 | ||
abe00f6f | 51 | AliHBTPositionRandomizer::AliHBTPositionRandomizer(const AliHBTPositionRandomizer& in): |
415b66b5 | 52 | AliReader(in), |
abe00f6f | 53 | fReader(), |
54 | fRandomizer(0x0), | |
55 | fModel(0), | |
56 | fAddToExistingPos(kFALSE), | |
57 | fOnlyParticlesFromVertex(kFALSE), | |
3a3bc78a | 58 | fRandomizeTracks(kFALSE), |
abe00f6f | 59 | fVX(0.0), |
60 | fVY(0.0), | |
61 | fVZ(0.0) | |
62 | { | |
63 | //cpy constructor | |
64 | in.Copy(*this); | |
65 | } | |
66 | /*********************************************************************/ | |
67 | AliHBTPositionRandomizer::~AliHBTPositionRandomizer() | |
68 | { | |
69 | //dtor | |
70 | delete fReader; | |
71 | delete fRandomizer; | |
72 | } | |
73 | /*********************************************************************/ | |
34914285 | 74 | AliHBTPositionRandomizer& AliHBTPositionRandomizer::operator=(const AliHBTPositionRandomizer& in) |
abe00f6f | 75 | { |
76 | //assigment operator | |
77 | in.Copy(*this); | |
78 | return *this; | |
79 | } | |
80 | /*********************************************************************/ | |
81 | ||
415b66b5 | 82 | AliAOD* AliHBTPositionRandomizer::GetEventSim() |
efaf00f8 | 83 | { |
84 | // gets from fReader and randomizes current particle event | |
85 | if (fReader == 0x0) return 0x0; | |
415b66b5 | 86 | AliAOD *e = fReader->GetEventSim(); |
efaf00f8 | 87 | if (e->IsRandomized() == kFALSE) Randomize(e); |
88 | return e; | |
89 | } | |
90 | /*********************************************************************/ | |
91 | ||
415b66b5 | 92 | AliAOD* AliHBTPositionRandomizer::GetEventRec() |
efaf00f8 | 93 | { |
94 | // gets from fReader and randomizes current track event | |
95 | if (fReader == 0x0) return 0x0; | |
415b66b5 | 96 | AliAOD *e = fReader->GetEventRec(); |
3a3bc78a | 97 | if (fRandomizeTracks) if (e->IsRandomized() == kFALSE) Randomize(e); |
efaf00f8 | 98 | return e; |
99 | } | |
100 | /*********************************************************************/ | |
101 | ||
415b66b5 | 102 | AliAOD* AliHBTPositionRandomizer::GetEventSim(Int_t n) |
88cb7938 | 103 | { |
104 | //returns event n | |
105 | if (fReader == 0x0) return 0x0; | |
415b66b5 | 106 | AliAOD *e = fReader->GetEventSim(n); |
88cb7938 | 107 | if (e->IsRandomized() == kFALSE) Randomize(e); |
108 | return e; | |
109 | } | |
110 | ||
111 | /*********************************************************************/ | |
415b66b5 | 112 | void AliHBTPositionRandomizer::Randomize(AliAOD* event) const |
88cb7938 | 113 | { |
114 | // randomizes postions of all particles in the event | |
abe00f6f | 115 | static const Double_t kfmtocm = 1.e-13; |
415b66b5 | 116 | if (AliVAODParticle::GetDebug() > 5) Info("Randomize(AliAOD*)",""); |
88cb7938 | 117 | if (event == 0x0) return; |
118 | ||
119 | for (Int_t i = 0; i < event->GetNumberOfParticles(); i++) | |
120 | { | |
415b66b5 | 121 | AliVAODParticle* p = event->GetParticle(i); |
88cb7938 | 122 | Double_t x,y,z,t=0.0; |
123 | fRandomizer->Randomize(x,y,z,p); | |
3a3bc78a | 124 | |
125 | Double_t nx = x*kfmtocm; | |
126 | Double_t ny = y*kfmtocm; | |
127 | Double_t nz = z*kfmtocm; | |
128 | Double_t nt = t*kfmtocm; | |
129 | ||
130 | if (fAddToExistingPos) | |
131 | { | |
132 | nx += p->Vx(); | |
133 | ny += p->Vy(); | |
134 | nz += p->Vz(); | |
135 | nt += p->T(); | |
136 | } | |
137 | p->SetProductionVertex(nx,ny,nz,nt); | |
88cb7938 | 138 | } |
139 | event->SetRandomized(); | |
140 | } | |
141 | /*********************************************************************/ | |
142 | ||
143 | void AliHBTPositionRandomizer::SetGaussianBall(Double_t r) | |
144 | { | |
abe00f6f | 145 | //Sets Gaussian Ball Model |
88cb7938 | 146 | SetGaussianBall(r,r,r); |
147 | } | |
148 | /*********************************************************************/ | |
149 | ||
150 | void AliHBTPositionRandomizer::SetGaussianBall(Double_t rx, Double_t ry, Double_t rz) | |
151 | { | |
abe00f6f | 152 | //Sets Gaussian Ball Model |
88cb7938 | 153 | delete fRandomizer; |
154 | fRandomizer = new AliHBTRndmGaussBall(rx,ry,rz); | |
155 | } | |
156 | /*********************************************************************/ | |
157 | ||
158 | void AliHBTPositionRandomizer::SetCyllinderSurface(Double_t r, Double_t l) | |
159 | { | |
abe00f6f | 160 | //Sets Cylinder Surface Model |
88cb7938 | 161 | delete fRandomizer; |
162 | fRandomizer = new AliHBTRndmCyllSurf(r,l); | |
163 | } | |
164 | /*********************************************************************/ | |
165 | ||
166 | void AliHBTPositionRandomizer::SetEventVertex(Double_t x, Double_t y,Double_t z) | |
167 | { | |
168 | //sets event vertex position | |
169 | fVX = x; | |
170 | fVY = y; | |
171 | fVZ = z; | |
172 | } | |
173 | /*********************************************************************/ | |
174 | //_____________________________________________________________________ | |
175 | /////////////////////////////////////////////////////////////////////// | |
176 | // // | |
177 | // class AliHBTRndmGaussBall // | |
178 | // // | |
179 | /////////////////////////////////////////////////////////////////////// | |
180 | ||
181 | AliHBTRndmGaussBall::AliHBTRndmGaussBall(): | |
182 | fRx(0.0), | |
183 | fRy(0.0), | |
184 | fRz(0.0) | |
185 | { | |
186 | //constructor | |
187 | } | |
188 | /*********************************************************************/ | |
189 | ||
190 | AliHBTRndmGaussBall::AliHBTRndmGaussBall(Float_t r): | |
191 | fRx(r), | |
192 | fRy(r), | |
193 | fRz(r) | |
194 | { | |
195 | //constructor | |
196 | } | |
197 | /*********************************************************************/ | |
198 | ||
199 | AliHBTRndmGaussBall::AliHBTRndmGaussBall(Float_t rx, Float_t ry, Float_t rz): | |
200 | fRx(rx), | |
201 | fRy(ry), | |
202 | fRz(rz) | |
203 | { | |
204 | //constructor | |
205 | } | |
206 | /*********************************************************************/ | |
207 | ||
415b66b5 | 208 | void AliHBTRndmGaussBall::Randomize(Double_t& x,Double_t& y,Double_t&z, AliVAODParticle*/*particle*/) const |
88cb7938 | 209 | { |
210 | //randomizez gauss for each coordinate separately | |
211 | x = gRandom->Gaus(0.0,fRx); | |
212 | y = gRandom->Gaus(0.0,fRy); | |
213 | z = gRandom->Gaus(0.0,fRz); | |
214 | } | |
215 | /*********************************************************************/ | |
216 | //_____________________________________________________________________ | |
217 | /////////////////////////////////////////////////////////////////////// | |
218 | // // | |
219 | // class AliHBTRndmGaussBall // | |
220 | // // | |
221 | /////////////////////////////////////////////////////////////////////// | |
222 | ||
415b66b5 | 223 | void AliHBTRndmCyllSurf::Randomize(Double_t& x,Double_t& y,Double_t&z, AliVAODParticle* particle) const |
88cb7938 | 224 | { |
abe00f6f | 225 | //Randomizes x,y,z |
568f8a1a | 226 | Double_t r = fR + gRandom->Gaus(0.0, 1.0); |
bed069a4 | 227 | Double_t sf = r/particle->Pt();//scaling factor for position transformation -> |
88cb7938 | 228 | //we move direction of string momentum but legth defined by r |
bed069a4 | 229 | x = sf*particle->Px(); |
230 | y = sf*particle->Py(); | |
88cb7938 | 231 | z = gRandom->Uniform(-fL,fL); |
88cb7938 | 232 | } |