]>
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" |
27 | #include "AliFlowTrackSimple.h" | |
7382279b | 28 | #include "TRandom.h" |
244c607a | 29 | #include "AliLog.h" |
f1d945a1 | 30 | |
31 | ClassImp(AliFlowTrackSimple) | |
32 | ||
33 | //----------------------------------------------------------------------- | |
929098e4 | 34 | AliFlowTrackSimple::AliFlowTrackSimple(): |
bc231a12 | 35 | TObject(), |
f1d945a1 | 36 | fEta(0), |
37 | fPt(0), | |
38 | fPhi(0), | |
44e060e0 | 39 | fTrackWeight(1.), |
fb03b63f | 40 | fFlowBits(0), |
41 | fSubEventBits(0) | |
f1d945a1 | 42 | { |
43 | //constructor | |
929098e4 | 44 | } |
45 | ||
244c607a | 46 | //----------------------------------------------------------------------- |
44e060e0 | 47 | AliFlowTrackSimple::AliFlowTrackSimple(Double_t phi, Double_t eta, Double_t pt, Double_t weight): |
bc231a12 | 48 | TObject(), |
244c607a | 49 | fEta(eta), |
50 | fPt(pt), | |
51 | fPhi(phi), | |
44e060e0 | 52 | fTrackWeight(weight), |
244c607a | 53 | fFlowBits(0), |
54 | fSubEventBits(0) | |
55 | { | |
56 | //constructor | |
57 | } | |
58 | ||
929098e4 | 59 | //----------------------------------------------------------------------- |
60 | AliFlowTrackSimple::AliFlowTrackSimple(const TParticle* p): | |
bc231a12 | 61 | TObject(), |
929098e4 | 62 | fEta(p->Eta()), |
63 | fPt(p->Pt()), | |
64 | fPhi(p->Phi()), | |
44e060e0 | 65 | fTrackWeight(1.), |
929098e4 | 66 | fFlowBits(0), |
67 | fSubEventBits(0) | |
68 | { | |
69 | //ctor | |
f1d945a1 | 70 | } |
71 | ||
bc6b015e | 72 | //----------------------------------------------------------------------- |
bc6b015e | 73 | AliFlowTrackSimple::AliFlowTrackSimple(const AliFlowTrackSimple& aTrack): |
bc231a12 | 74 | TObject(aTrack), |
bc6b015e | 75 | fEta(aTrack.fEta), |
76 | fPt(aTrack.fPt), | |
77 | fPhi(aTrack.fPhi), | |
44e060e0 | 78 | fTrackWeight(aTrack.fTrackWeight), |
fb03b63f | 79 | fFlowBits(aTrack.fFlowBits), |
80 | fSubEventBits(aTrack.fSubEventBits) | |
bc6b015e | 81 | { |
82 | //copy constructor | |
83 | } | |
bc231a12 | 84 | |
bc6b015e | 85 | //----------------------------------------------------------------------- |
65ef7d1a | 86 | AliFlowTrackSimple* AliFlowTrackSimple::Clone(const char* /*option*/) const |
bc231a12 | 87 | { |
88 | //clone "constructor" | |
89 | return new AliFlowTrackSimple(*this); | |
90 | } | |
bc6b015e | 91 | |
bc231a12 | 92 | //----------------------------------------------------------------------- |
bc6b015e | 93 | AliFlowTrackSimple& AliFlowTrackSimple::operator=(const AliFlowTrackSimple& aTrack) |
94 | { | |
95 | fEta = aTrack.fEta; | |
96 | fPt = aTrack.fPt; | |
97 | fPhi = aTrack.fPhi; | |
44e060e0 | 98 | fTrackWeight = aTrack.fTrackWeight; |
bc6b015e | 99 | fFlowBits = aTrack.fFlowBits; |
fb03b63f | 100 | fSubEventBits = aTrack.fSubEventBits; |
bc6b015e | 101 | |
102 | return *this; | |
bc6b015e | 103 | } |
104 | ||
f1d945a1 | 105 | //----------------------------------------------------------------------- |
f1d945a1 | 106 | AliFlowTrackSimple::~AliFlowTrackSimple() |
107 | { | |
108 | //destructor | |
109 | ||
110 | } | |
111 | ||
7382279b | 112 | //----------------------------------------------------------------------- |
244c607a | 113 | void AliFlowTrackSimple::ResolutionPt(Double_t res) |
7382279b | 114 | { |
244c607a | 115 | //smear the pt by a gaussian with sigma=res |
116 | fPt += gRandom->Gaus(0.,res); | |
7382279b | 117 | } |
118 | ||
119 | //----------------------------------------------------------------------- | |
bc231a12 | 120 | void AliFlowTrackSimple::AddV1( Double_t v1, |
121 | Double_t reactionPlaneAngle, | |
122 | Double_t precisionPhi, | |
123 | Int_t maxNumberOfIterations ) | |
124 | { | |
125 | //afterburner, adds v1, uses Newton-Raphson iteration | |
126 | Double_t phi0=fPhi; | |
127 | Double_t f,fp,phiprev; | |
128 | ||
129 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
130 | { | |
131 | phiprev=fPhi; //store last value for comparison | |
132 | f = fPhi-phi0+2.0*v1*TMath::Sin(fPhi-reactionPlaneAngle); | |
133 | fp = 1.0+2.0*v1*TMath::Cos(fPhi-reactionPlaneAngle); //first derivative | |
134 | fPhi -= f/fp; | |
135 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
136 | } | |
137 | } | |
138 | ||
139 | //----------------------------------------------------------------------- | |
140 | void AliFlowTrackSimple::AddV2( Double_t v2, | |
141 | Double_t reactionPlaneAngle, | |
142 | Double_t precisionPhi, | |
143 | Int_t maxNumberOfIterations ) | |
7382279b | 144 | { |
244c607a | 145 | //afterburner, adds v2, uses Newton-Raphson iteration |
146 | Double_t phi0=fPhi; | |
bc231a12 | 147 | Double_t f,fp,phiprev; |
148 | ||
149 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
150 | { | |
151 | phiprev=fPhi; //store last value for comparison | |
152 | f = fPhi-phi0+v2*TMath::Sin(2.*(fPhi-reactionPlaneAngle)); | |
153 | fp = 1.0+2.0*v2*TMath::Cos(2.*(fPhi-reactionPlaneAngle)); //first derivative | |
154 | fPhi -= f/fp; | |
155 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
156 | } | |
157 | } | |
158 | ||
159 | //----------------------------------------------------------------------- | |
160 | void AliFlowTrackSimple::AddV4( Double_t v4, | |
161 | Double_t reactionPlaneAngle, | |
162 | Double_t precisionPhi, | |
163 | Int_t maxNumberOfIterations ) | |
164 | { | |
165 | //afterburner, adds v4, uses Newton-Raphson iteration | |
166 | Double_t phi0=fPhi; | |
167 | Double_t f,fp,phiprev; | |
168 | ||
169 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
170 | { | |
171 | phiprev=fPhi; //store last value for comparison | |
172 | f = fPhi-phi0+0.5*v4*TMath::Sin(4.*(fPhi-reactionPlaneAngle)); | |
173 | fp = 1.0+2.0*v4*TMath::Cos(4.*(fPhi-reactionPlaneAngle)); //first derivative | |
174 | fPhi -= f/fp; | |
175 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
176 | } | |
177 | } | |
178 | ||
179 | //______________________________________________________________________________ | |
180 | void AliFlowTrackSimple::AddFlow( Double_t v1, | |
181 | Double_t v2, | |
182 | Double_t v4, | |
183 | Double_t reactionPlaneAngle, | |
184 | Double_t precisionPhi, | |
185 | Int_t maxNumberOfIterations ) | |
186 | { | |
187 | //afterburner, adds v1,v2,v4 uses Newton-Raphson iteration | |
188 | Double_t phi0=fPhi; | |
189 | Double_t f,fp,phiprev; | |
244c607a | 190 | |
191 | for (Int_t i=0; i<maxNumberOfIterations; i++) | |
192 | { | |
193 | phiprev=fPhi; //store last value for comparison | |
bc231a12 | 194 | f = fPhi-phi0 |
195 | +2.0*v1*TMath::Sin(fPhi-reactionPlaneAngle) | |
196 | + v2*TMath::Sin(2.*(fPhi-reactionPlaneAngle)) | |
197 | +0.5*v4*TMath::Sin(4.*(fPhi-reactionPlaneAngle)) | |
198 | ; | |
199 | fp = 1.0 | |
200 | +2.0*( | |
201 | +v1*TMath::Cos(fPhi-reactionPlaneAngle) | |
202 | +v2*TMath::Cos(2.*(fPhi-reactionPlaneAngle)) | |
203 | +v4*TMath::Cos(4.*(fPhi-reactionPlaneAngle)) | |
204 | ); //first derivative | |
244c607a | 205 | fPhi -= f/fp; |
206 | if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break; | |
207 | } | |
7382279b | 208 | } |
bc231a12 | 209 | |
210 | //______________________________________________________________________________ | |
65ef7d1a | 211 | void AliFlowTrackSimple::Print( Option_t* /*option*/ ) const |
bc231a12 | 212 | { |
213 | //print stuff | |
44e060e0 | 214 | printf("Phi: %.3f, Eta: %+.3f, Pt: %.3f, weight: %.3f",fPhi,fEta,fPt,fTrackWeight); |
dd91b595 | 215 | if (InRPSelection()) printf(", RP"); |
216 | if (InPOISelection()) printf(", POI"); | |
217 | for (Int_t i=0; i<2; i++) | |
218 | { | |
219 | if (InSubevent(i)) printf(", subevent %i",i); | |
220 | } | |
221 | printf("\n"); | |
bc231a12 | 222 | } |