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