]>
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), |
fb03b63f | 42 | fFlowBits(0), |
6e214c87 | 43 | fSubEventBits(0), |
44 | fCollIndex(-1) | |
f1d945a1 | 45 | { |
46 | //constructor | |
929098e4 | 47 | } |
48 | ||
244c607a | 49 | //----------------------------------------------------------------------- |
701f71c1 | 50 | AliFlowTrackSimple::AliFlowTrackSimple(Double_t phi, Double_t eta, Double_t pt, Double_t weight, Int_t charge): |
bc231a12 | 51 | TObject(), |
244c607a | 52 | fEta(eta), |
53 | fPt(pt), | |
54 | fPhi(phi), | |
44e060e0 | 55 | fTrackWeight(weight), |
701f71c1 | 56 | fCharge(charge), |
244c607a | 57 | fFlowBits(0), |
6e214c87 | 58 | fSubEventBits(0), |
59 | fCollIndex(-1) | |
244c607a | 60 | { |
61 | //constructor | |
62 | } | |
63 | ||
929098e4 | 64 | //----------------------------------------------------------------------- |
701f71c1 | 65 | AliFlowTrackSimple::AliFlowTrackSimple( TParticle* p ): |
bc231a12 | 66 | TObject(), |
929098e4 | 67 | fEta(p->Eta()), |
68 | fPt(p->Pt()), | |
69 | fPhi(p->Phi()), | |
44e060e0 | 70 | fTrackWeight(1.), |
701f71c1 | 71 | fCharge(0), |
929098e4 | 72 | fFlowBits(0), |
6e214c87 | 73 | fSubEventBits(0), |
74 | fCollIndex(-1) | |
929098e4 | 75 | { |
76 | //ctor | |
701f71c1 | 77 | TParticlePDG* ppdg = p->GetPDG(); |
78 | fCharge = TMath::Nint(ppdg->Charge()/3.0); | |
f1d945a1 | 79 | } |
80 | ||
bc6b015e | 81 | //----------------------------------------------------------------------- |
bc6b015e | 82 | AliFlowTrackSimple::AliFlowTrackSimple(const AliFlowTrackSimple& aTrack): |
bc231a12 | 83 | TObject(aTrack), |
bc6b015e | 84 | fEta(aTrack.fEta), |
85 | fPt(aTrack.fPt), | |
86 | fPhi(aTrack.fPhi), | |
44e060e0 | 87 | fTrackWeight(aTrack.fTrackWeight), |
701f71c1 | 88 | fCharge(aTrack.fCharge), |
fb03b63f | 89 | fFlowBits(aTrack.fFlowBits), |
6e214c87 | 90 | fSubEventBits(aTrack.fSubEventBits), |
91 | fCollIndex(-1) | |
bc6b015e | 92 | { |
93 | //copy constructor | |
94 | } | |
bc231a12 | 95 | |
bc6b015e | 96 | //----------------------------------------------------------------------- |
65ef7d1a | 97 | AliFlowTrackSimple* AliFlowTrackSimple::Clone(const char* /*option*/) const |
bc231a12 | 98 | { |
99 | //clone "constructor" | |
100 | return new AliFlowTrackSimple(*this); | |
101 | } | |
bc6b015e | 102 | |
bc231a12 | 103 | //----------------------------------------------------------------------- |
bc6b015e | 104 | AliFlowTrackSimple& AliFlowTrackSimple::operator=(const AliFlowTrackSimple& aTrack) |
105 | { | |
106 | fEta = aTrack.fEta; | |
107 | fPt = aTrack.fPt; | |
108 | fPhi = aTrack.fPhi; | |
44e060e0 | 109 | fTrackWeight = aTrack.fTrackWeight; |
701f71c1 | 110 | fCharge = aTrack.fCharge; |
bc6b015e | 111 | fFlowBits = aTrack.fFlowBits; |
fb03b63f | 112 | fSubEventBits = aTrack.fSubEventBits; |
6e214c87 | 113 | fCollIndex = aTrack.fCollIndex; |
bc6b015e | 114 | |
115 | return *this; | |
bc6b015e | 116 | } |
117 | ||
f1d945a1 | 118 | //----------------------------------------------------------------------- |
f1d945a1 | 119 | AliFlowTrackSimple::~AliFlowTrackSimple() |
120 | { | |
121 | //destructor | |
122 | ||
123 | } | |
124 | ||
7382279b | 125 | //----------------------------------------------------------------------- |
244c607a | 126 | void AliFlowTrackSimple::ResolutionPt(Double_t res) |
7382279b | 127 | { |
244c607a | 128 | //smear the pt by a gaussian with sigma=res |
129 | fPt += gRandom->Gaus(0.,res); | |
7382279b | 130 | } |
131 | ||
132 | //----------------------------------------------------------------------- | |
bc231a12 | 133 | void AliFlowTrackSimple::AddV1( Double_t v1, |
134 | Double_t reactionPlaneAngle, | |
135 | Double_t precisionPhi, | |
136 | Int_t maxNumberOfIterations ) | |
137 | { | |
138 | //afterburner, adds v1, uses Newton-Raphson iteration | |
139 | Double_t phi0=fPhi; | |
c855d803 | 140 | Double_t f=0.; |
141 | Double_t fp=0.; | |
142 | Double_t phiprev=0.; | |
bc231a12 | 143 | |
144 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
145 | { | |
146 | phiprev=fPhi; //store last value for comparison | |
147 | f = fPhi-phi0+2.0*v1*TMath::Sin(fPhi-reactionPlaneAngle); | |
148 | fp = 1.0+2.0*v1*TMath::Cos(fPhi-reactionPlaneAngle); //first derivative | |
149 | fPhi -= f/fp; | |
150 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
151 | } | |
152 | } | |
153 | ||
154 | //----------------------------------------------------------------------- | |
155 | void AliFlowTrackSimple::AddV2( Double_t v2, | |
156 | Double_t reactionPlaneAngle, | |
157 | Double_t precisionPhi, | |
158 | Int_t maxNumberOfIterations ) | |
7382279b | 159 | { |
244c607a | 160 | //afterburner, adds v2, uses Newton-Raphson iteration |
161 | Double_t phi0=fPhi; | |
c855d803 | 162 | Double_t f=0.; |
163 | Double_t fp=0.; | |
164 | Double_t phiprev=0.; | |
bc231a12 | 165 | |
166 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
167 | { | |
168 | phiprev=fPhi; //store last value for comparison | |
169 | f = fPhi-phi0+v2*TMath::Sin(2.*(fPhi-reactionPlaneAngle)); | |
170 | fp = 1.0+2.0*v2*TMath::Cos(2.*(fPhi-reactionPlaneAngle)); //first derivative | |
171 | fPhi -= f/fp; | |
172 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
173 | } | |
174 | } | |
175 | ||
bff213ad | 176 | //----------------------------------------------------------------------- |
177 | void AliFlowTrackSimple::AddV3( Double_t v3, | |
178 | Double_t reactionPlaneAngle, | |
179 | Double_t precisionPhi, | |
180 | Int_t maxNumberOfIterations ) | |
181 | { | |
182 | //afterburner, adds v3, uses Newton-Raphson iteration | |
183 | Double_t phi0=fPhi; | |
184 | Double_t f=0.; | |
185 | Double_t fp=0.; | |
186 | Double_t phiprev=0.; | |
187 | ||
188 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
189 | { | |
190 | phiprev=fPhi; //store last value for comparison | |
191 | f = fPhi-phi0+2./3.*v3*TMath::Sin(3.*(fPhi-reactionPlaneAngle)); | |
192 | fp = 1.0+2.0*v3*TMath::Cos(3.*(fPhi-reactionPlaneAngle)); //first derivative | |
193 | fPhi -= f/fp; | |
194 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
195 | } | |
196 | } | |
197 | ||
bc231a12 | 198 | //----------------------------------------------------------------------- |
199 | void AliFlowTrackSimple::AddV4( Double_t v4, | |
200 | Double_t reactionPlaneAngle, | |
201 | Double_t precisionPhi, | |
202 | Int_t maxNumberOfIterations ) | |
203 | { | |
204 | //afterburner, adds v4, uses Newton-Raphson iteration | |
205 | Double_t phi0=fPhi; | |
c855d803 | 206 | Double_t f=0.; |
207 | Double_t fp=0.; | |
208 | Double_t phiprev=0.; | |
bc231a12 | 209 | |
210 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
211 | { | |
212 | phiprev=fPhi; //store last value for comparison | |
213 | f = fPhi-phi0+0.5*v4*TMath::Sin(4.*(fPhi-reactionPlaneAngle)); | |
214 | fp = 1.0+2.0*v4*TMath::Cos(4.*(fPhi-reactionPlaneAngle)); //first derivative | |
215 | fPhi -= f/fp; | |
216 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
217 | } | |
218 | } | |
219 | ||
220 | //______________________________________________________________________________ | |
221 | void AliFlowTrackSimple::AddFlow( Double_t v1, | |
222 | Double_t v2, | |
bff213ad | 223 | Double_t v3, |
bc231a12 | 224 | Double_t v4, |
225 | Double_t reactionPlaneAngle, | |
226 | Double_t precisionPhi, | |
227 | Int_t maxNumberOfIterations ) | |
228 | { | |
229 | //afterburner, adds v1,v2,v4 uses Newton-Raphson iteration | |
230 | Double_t phi0=fPhi; | |
c855d803 | 231 | Double_t f=0.; |
232 | Double_t fp=0.; | |
233 | Double_t phiprev=0.; | |
244c607a | 234 | |
235 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
236 | { | |
237 | phiprev=fPhi; //store last value for comparison | |
bc231a12 | 238 | f = fPhi-phi0 |
bff213ad | 239 | +2.0* v1*TMath::Sin( fPhi-reactionPlaneAngle) |
240 | + v2*TMath::Sin(2.*(fPhi-reactionPlaneAngle)) | |
241 | +2./3.*v3*TMath::Sin(3.*(fPhi-reactionPlaneAngle)) | |
242 | +0.5* v4*TMath::Sin(4.*(fPhi-reactionPlaneAngle)) | |
bc231a12 | 243 | ; |
244 | fp = 1.0 | |
245 | +2.0*( | |
bff213ad | 246 | +v1*TMath::Cos( fPhi-reactionPlaneAngle) |
bc231a12 | 247 | +v2*TMath::Cos(2.*(fPhi-reactionPlaneAngle)) |
bff213ad | 248 | +v3*TMath::Cos(3.*(fPhi-reactionPlaneAngle)) |
bc231a12 | 249 | +v4*TMath::Cos(4.*(fPhi-reactionPlaneAngle)) |
250 | ); //first derivative | |
244c607a | 251 | fPhi -= f/fp; |
252 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
253 | } | |
7382279b | 254 | } |
bc231a12 | 255 | |
256 | //______________________________________________________________________________ | |
65ef7d1a | 257 | void AliFlowTrackSimple::Print( Option_t* /*option*/ ) const |
bc231a12 | 258 | { |
259 | //print stuff | |
44e060e0 | 260 | printf("Phi: %.3f, Eta: %+.3f, Pt: %.3f, weight: %.3f",fPhi,fEta,fPt,fTrackWeight); |
dd91b595 | 261 | if (InRPSelection()) printf(", RP"); |
262 | if (InPOISelection()) printf(", POI"); | |
263 | for (Int_t i=0; i<2; i++) | |
264 | { | |
265 | if (InSubevent(i)) printf(", subevent %i",i); | |
266 | } | |
267 | printf("\n"); | |
bc231a12 | 268 | } |