]>
Commit | Line | Data |
---|---|---|
f1d945a1 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
f1d945a1 | 18 | // AliFlowTrackSimple: |
19 | // A simple track class to the the AliFlowEventSimple for flow analysis | |
20 | // | |
21 | // | |
22 | // author: N. van der Kolk (kolk@nikhef.nl) | |
929098e4 | 23 | // mods: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch) |
f1d945a1 | 24 | |
bc231a12 | 25 | #include "TObject.h" |
929098e4 | 26 | #include "TParticle.h" |
701f71c1 | 27 | #include "TParticlePDG.h" |
929098e4 | 28 | #include "AliFlowTrackSimple.h" |
7382279b | 29 | #include "TRandom.h" |
701f71c1 | 30 | #include "TMath.h" |
f1d945a1 | 31 | |
32 | ClassImp(AliFlowTrackSimple) | |
33 | ||
34 | //----------------------------------------------------------------------- | |
929098e4 | 35 | AliFlowTrackSimple::AliFlowTrackSimple(): |
bc231a12 | 36 | TObject(), |
f1d945a1 | 37 | fEta(0), |
38 | fPt(0), | |
39 | fPhi(0), | |
44e060e0 | 40 | fTrackWeight(1.), |
701f71c1 | 41 | fCharge(0), |
60875c3c | 42 | fMass(-1), |
fb03b63f | 43 | fFlowBits(0), |
6e214c87 | 44 | fSubEventBits(0), |
41dc4195 | 45 | fID(-1) |
f1d945a1 | 46 | { |
47 | //constructor | |
929098e4 | 48 | } |
49 | ||
244c607a | 50 | //----------------------------------------------------------------------- |
60875c3c | 51 | AliFlowTrackSimple::AliFlowTrackSimple(Double_t phi, Double_t eta, Double_t pt, Double_t weight, Int_t charge, Double_t mass): |
bc231a12 | 52 | TObject(), |
244c607a | 53 | fEta(eta), |
54 | fPt(pt), | |
55 | fPhi(phi), | |
44e060e0 | 56 | fTrackWeight(weight), |
701f71c1 | 57 | fCharge(charge), |
60875c3c | 58 | fMass(mass), |
244c607a | 59 | fFlowBits(0), |
6e214c87 | 60 | fSubEventBits(0), |
41dc4195 | 61 | fID(-1) |
244c607a | 62 | { |
63 | //constructor | |
64 | } | |
65 | ||
929098e4 | 66 | //----------------------------------------------------------------------- |
701f71c1 | 67 | AliFlowTrackSimple::AliFlowTrackSimple( TParticle* p ): |
bc231a12 | 68 | TObject(), |
929098e4 | 69 | fEta(p->Eta()), |
70 | fPt(p->Pt()), | |
71 | fPhi(p->Phi()), | |
44e060e0 | 72 | fTrackWeight(1.), |
701f71c1 | 73 | fCharge(0), |
60875c3c | 74 | fMass(-1), |
929098e4 | 75 | fFlowBits(0), |
6e214c87 | 76 | fSubEventBits(0), |
41dc4195 | 77 | fID(-1) |
929098e4 | 78 | { |
79 | //ctor | |
701f71c1 | 80 | TParticlePDG* ppdg = p->GetPDG(); |
81 | fCharge = TMath::Nint(ppdg->Charge()/3.0); | |
60875c3c | 82 | fMass = ppdg->Mass(); |
f1d945a1 | 83 | } |
84 | ||
7d27a354 | 85 | //----------------------------------------------------------------------- |
86 | void AliFlowTrackSimple::Set(TParticle* p) | |
87 | { | |
88 | //set from a TParticle | |
89 | fEta = p->Eta(); | |
90 | fPt = p->Pt(); | |
91 | fPhi = p->Phi(); | |
92 | fTrackWeight = 1.; | |
93 | TParticlePDG* ppdg = p->GetPDG(); | |
94 | fCharge = TMath::Nint(ppdg->Charge()/3.0); | |
60875c3c | 95 | fMass = ppdg->Mass(); |
7d27a354 | 96 | } |
97 | ||
bc6b015e | 98 | //----------------------------------------------------------------------- |
bc6b015e | 99 | AliFlowTrackSimple::AliFlowTrackSimple(const AliFlowTrackSimple& aTrack): |
bc231a12 | 100 | TObject(aTrack), |
bc6b015e | 101 | fEta(aTrack.fEta), |
102 | fPt(aTrack.fPt), | |
103 | fPhi(aTrack.fPhi), | |
44e060e0 | 104 | fTrackWeight(aTrack.fTrackWeight), |
701f71c1 | 105 | fCharge(aTrack.fCharge), |
60875c3c | 106 | fMass(aTrack.fMass), |
fb03b63f | 107 | fFlowBits(aTrack.fFlowBits), |
6e214c87 | 108 | fSubEventBits(aTrack.fSubEventBits), |
41dc4195 | 109 | fID(aTrack.fID) |
bc6b015e | 110 | { |
111 | //copy constructor | |
112 | } | |
bc231a12 | 113 | |
bc6b015e | 114 | //----------------------------------------------------------------------- |
65ef7d1a | 115 | AliFlowTrackSimple* AliFlowTrackSimple::Clone(const char* /*option*/) const |
bc231a12 | 116 | { |
117 | //clone "constructor" | |
118 | return new AliFlowTrackSimple(*this); | |
119 | } | |
bc6b015e | 120 | |
bc231a12 | 121 | //----------------------------------------------------------------------- |
bc6b015e | 122 | AliFlowTrackSimple& AliFlowTrackSimple::operator=(const AliFlowTrackSimple& aTrack) |
123 | { | |
cc0afcfc | 124 | //assignment |
2047680a | 125 | if (&aTrack==this) return *this; //handle self assignmnet |
bc6b015e | 126 | fEta = aTrack.fEta; |
127 | fPt = aTrack.fPt; | |
128 | fPhi = aTrack.fPhi; | |
44e060e0 | 129 | fTrackWeight = aTrack.fTrackWeight; |
701f71c1 | 130 | fCharge = aTrack.fCharge; |
60875c3c | 131 | fMass = aTrack.fMass; |
bc6b015e | 132 | fFlowBits = aTrack.fFlowBits; |
fb03b63f | 133 | fSubEventBits = aTrack.fSubEventBits; |
41dc4195 | 134 | fID = aTrack.fID; |
bc6b015e | 135 | |
136 | return *this; | |
bc6b015e | 137 | } |
138 | ||
f1d945a1 | 139 | //----------------------------------------------------------------------- |
f1d945a1 | 140 | AliFlowTrackSimple::~AliFlowTrackSimple() |
141 | { | |
142 | //destructor | |
143 | ||
144 | } | |
145 | ||
7382279b | 146 | //----------------------------------------------------------------------- |
244c607a | 147 | void AliFlowTrackSimple::ResolutionPt(Double_t res) |
7382279b | 148 | { |
244c607a | 149 | //smear the pt by a gaussian with sigma=res |
150 | fPt += gRandom->Gaus(0.,res); | |
7382279b | 151 | } |
152 | ||
153 | //----------------------------------------------------------------------- | |
bc231a12 | 154 | void AliFlowTrackSimple::AddV1( Double_t v1, |
155 | Double_t reactionPlaneAngle, | |
156 | Double_t precisionPhi, | |
157 | Int_t maxNumberOfIterations ) | |
158 | { | |
159 | //afterburner, adds v1, uses Newton-Raphson iteration | |
160 | Double_t phi0=fPhi; | |
c855d803 | 161 | Double_t f=0.; |
162 | Double_t fp=0.; | |
163 | Double_t phiprev=0.; | |
bc231a12 | 164 | |
165 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
166 | { | |
167 | phiprev=fPhi; //store last value for comparison | |
168 | f = fPhi-phi0+2.0*v1*TMath::Sin(fPhi-reactionPlaneAngle); | |
169 | fp = 1.0+2.0*v1*TMath::Cos(fPhi-reactionPlaneAngle); //first derivative | |
170 | fPhi -= f/fp; | |
171 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
172 | } | |
173 | } | |
174 | ||
175 | //----------------------------------------------------------------------- | |
176 | void AliFlowTrackSimple::AddV2( Double_t v2, | |
177 | Double_t reactionPlaneAngle, | |
178 | Double_t precisionPhi, | |
179 | Int_t maxNumberOfIterations ) | |
7382279b | 180 | { |
244c607a | 181 | //afterburner, adds v2, uses Newton-Raphson iteration |
182 | Double_t phi0=fPhi; | |
c855d803 | 183 | Double_t f=0.; |
184 | Double_t fp=0.; | |
185 | Double_t phiprev=0.; | |
bc231a12 | 186 | |
187 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
188 | { | |
189 | phiprev=fPhi; //store last value for comparison | |
190 | f = fPhi-phi0+v2*TMath::Sin(2.*(fPhi-reactionPlaneAngle)); | |
191 | fp = 1.0+2.0*v2*TMath::Cos(2.*(fPhi-reactionPlaneAngle)); //first derivative | |
192 | fPhi -= f/fp; | |
193 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
194 | } | |
195 | } | |
196 | ||
bff213ad | 197 | //----------------------------------------------------------------------- |
198 | void AliFlowTrackSimple::AddV3( Double_t v3, | |
199 | Double_t reactionPlaneAngle, | |
200 | Double_t precisionPhi, | |
201 | Int_t maxNumberOfIterations ) | |
202 | { | |
203 | //afterburner, adds v3, uses Newton-Raphson iteration | |
204 | Double_t phi0=fPhi; | |
205 | Double_t f=0.; | |
206 | Double_t fp=0.; | |
207 | Double_t phiprev=0.; | |
208 | ||
209 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
210 | { | |
211 | phiprev=fPhi; //store last value for comparison | |
212 | f = fPhi-phi0+2./3.*v3*TMath::Sin(3.*(fPhi-reactionPlaneAngle)); | |
213 | fp = 1.0+2.0*v3*TMath::Cos(3.*(fPhi-reactionPlaneAngle)); //first derivative | |
214 | fPhi -= f/fp; | |
215 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
216 | } | |
217 | } | |
218 | ||
bc231a12 | 219 | //----------------------------------------------------------------------- |
220 | void AliFlowTrackSimple::AddV4( Double_t v4, | |
221 | Double_t reactionPlaneAngle, | |
222 | Double_t precisionPhi, | |
223 | Int_t maxNumberOfIterations ) | |
224 | { | |
225 | //afterburner, adds v4, uses Newton-Raphson iteration | |
226 | Double_t phi0=fPhi; | |
c855d803 | 227 | Double_t f=0.; |
228 | Double_t fp=0.; | |
229 | Double_t phiprev=0.; | |
bc231a12 | 230 | |
231 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
232 | { | |
233 | phiprev=fPhi; //store last value for comparison | |
234 | f = fPhi-phi0+0.5*v4*TMath::Sin(4.*(fPhi-reactionPlaneAngle)); | |
235 | fp = 1.0+2.0*v4*TMath::Cos(4.*(fPhi-reactionPlaneAngle)); //first derivative | |
236 | fPhi -= f/fp; | |
237 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
238 | } | |
239 | } | |
240 | ||
1a80f9f6 | 241 | //----------------------------------------------------------------------- |
242 | void AliFlowTrackSimple::AddV5( Double_t v5, | |
243 | Double_t reactionPlaneAngle, | |
244 | Double_t precisionPhi, | |
245 | Int_t maxNumberOfIterations ) | |
246 | { | |
247 | //afterburner, adds v4, uses Newton-Raphson iteration | |
248 | Double_t phi0=fPhi; | |
249 | Double_t f=0.; | |
250 | Double_t fp=0.; | |
251 | Double_t phiprev=0.; | |
252 | ||
253 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
254 | { | |
255 | phiprev=fPhi; //store last value for comparison | |
256 | f = fPhi-phi0+0.4*v5*TMath::Sin(5.*(fPhi-reactionPlaneAngle)); | |
257 | fp = 1.0+2.0*v5*TMath::Cos(5.*(fPhi-reactionPlaneAngle)); //first derivative | |
258 | fPhi -= f/fp; | |
259 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
260 | } | |
261 | } | |
262 | ||
263 | //______________________________________________________________________________ | |
264 | void AliFlowTrackSimple::AddFlow( Double_t v1, | |
265 | Double_t v2, | |
266 | Double_t v3, | |
267 | Double_t v4, | |
268 | Double_t v5, | |
269 | Double_t rp1, | |
270 | Double_t rp2, | |
271 | Double_t rp3, | |
272 | Double_t rp4, | |
273 | Double_t rp5, | |
274 | Double_t precisionPhi, | |
275 | Int_t maxNumberOfIterations ) | |
276 | { | |
277 | //afterburner, adds v1,v2,v4 uses Newton-Raphson iteration | |
278 | Double_t phi0=fPhi; | |
279 | Double_t f=0.; | |
280 | Double_t fp=0.; | |
281 | Double_t phiprev=0.; | |
282 | ||
283 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
284 | { | |
285 | phiprev=fPhi; //store last value for comparison | |
286 | f = fPhi-phi0 | |
287 | +2.0* v1*TMath::Sin( fPhi-rp1) | |
288 | + v2*TMath::Sin(2.*(fPhi-rp2)) | |
289 | +2./3.*v3*TMath::Sin(3.*(fPhi-rp3)) | |
290 | +0.5* v4*TMath::Sin(4.*(fPhi-rp4)) | |
291 | +0.4* v5*TMath::Sin(5.*(fPhi-rp5)) | |
292 | ; | |
293 | fp = 1.0 | |
294 | +2.0*( | |
295 | +v1*TMath::Cos( fPhi-rp1) | |
296 | +v2*TMath::Cos(2.*(fPhi-rp2)) | |
297 | +v3*TMath::Cos(3.*(fPhi-rp3)) | |
298 | +v4*TMath::Cos(4.*(fPhi-rp4)) | |
299 | +v5*TMath::Cos(5.*(fPhi-rp5)) | |
300 | ); //first derivative | |
301 | fPhi -= f/fp; | |
302 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
303 | } | |
304 | } | |
305 | ||
306 | //______________________________________________________________________________ | |
307 | void AliFlowTrackSimple::AddFlow( Double_t v1, | |
308 | Double_t v2, | |
309 | Double_t v3, | |
310 | Double_t v4, | |
311 | Double_t v5, | |
312 | Double_t rp, | |
313 | Double_t precisionPhi, | |
314 | Int_t maxNumberOfIterations ) | |
315 | { | |
316 | //afterburner, adds v1,v2,v4 uses Newton-Raphson iteration | |
317 | AddFlow(v1,v2,v3,v4,v5,rp,rp,rp,rp,rp,precisionPhi,maxNumberOfIterations); | |
318 | } | |
319 | ||
bc231a12 | 320 | //______________________________________________________________________________ |
321 | void AliFlowTrackSimple::AddFlow( Double_t v1, | |
322 | Double_t v2, | |
bff213ad | 323 | Double_t v3, |
bc231a12 | 324 | Double_t v4, |
325 | Double_t reactionPlaneAngle, | |
326 | Double_t precisionPhi, | |
327 | Int_t maxNumberOfIterations ) | |
328 | { | |
329 | //afterburner, adds v1,v2,v4 uses Newton-Raphson iteration | |
330 | Double_t phi0=fPhi; | |
c855d803 | 331 | Double_t f=0.; |
332 | Double_t fp=0.; | |
333 | Double_t phiprev=0.; | |
244c607a | 334 | |
335 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
336 | { | |
337 | phiprev=fPhi; //store last value for comparison | |
bc231a12 | 338 | f = fPhi-phi0 |
bff213ad | 339 | +2.0* v1*TMath::Sin( fPhi-reactionPlaneAngle) |
340 | + v2*TMath::Sin(2.*(fPhi-reactionPlaneAngle)) | |
341 | +2./3.*v3*TMath::Sin(3.*(fPhi-reactionPlaneAngle)) | |
342 | +0.5* v4*TMath::Sin(4.*(fPhi-reactionPlaneAngle)) | |
bc231a12 | 343 | ; |
344 | fp = 1.0 | |
345 | +2.0*( | |
bff213ad | 346 | +v1*TMath::Cos( fPhi-reactionPlaneAngle) |
bc231a12 | 347 | +v2*TMath::Cos(2.*(fPhi-reactionPlaneAngle)) |
bff213ad | 348 | +v3*TMath::Cos(3.*(fPhi-reactionPlaneAngle)) |
bc231a12 | 349 | +v4*TMath::Cos(4.*(fPhi-reactionPlaneAngle)) |
350 | ); //first derivative | |
244c607a | 351 | fPhi -= f/fp; |
352 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
353 | } | |
7382279b | 354 | } |
bc231a12 | 355 | |
356 | //______________________________________________________________________________ | |
65ef7d1a | 357 | void AliFlowTrackSimple::Print( Option_t* /*option*/ ) const |
bc231a12 | 358 | { |
359 | //print stuff | |
44e060e0 | 360 | printf("Phi: %.3f, Eta: %+.3f, Pt: %.3f, weight: %.3f",fPhi,fEta,fPt,fTrackWeight); |
dd91b595 | 361 | if (InRPSelection()) printf(", RP"); |
362 | if (InPOISelection()) printf(", POI"); | |
363 | for (Int_t i=0; i<2; i++) | |
364 | { | |
365 | if (InSubevent(i)) printf(", subevent %i",i); | |
366 | } | |
367 | printf("\n"); | |
bc231a12 | 368 | } |
7d27a354 | 369 | |
370 | //______________________________________________________________________________ | |
371 | void AliFlowTrackSimple::Clear(Option_t*) | |
372 | { | |
373 | //clear track | |
374 | fEta=0.0; | |
375 | fPt=0.0; | |
376 | fPhi=0.0; | |
377 | fTrackWeight=1.0; | |
378 | fCharge=0; | |
60875c3c | 379 | fMass=-1; |
7d27a354 | 380 | fFlowBits.ResetAllBits(); |
381 | fSubEventBits.ResetAllBits(); | |
382 | fID=-1; | |
383 | } |