1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 // AliFlowTrackSimple:
19 // A simple track class to the the AliFlowEventSimple for flow analysis
22 // author: N. van der Kolk (kolk@nikhef.nl)
23 // mods: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
26 #include "TParticle.h"
27 #include "AliFlowTrackSimple.h"
31 ClassImp(AliFlowTrackSimple)
33 //-----------------------------------------------------------------------
34 AliFlowTrackSimple::AliFlowTrackSimple():
45 //-----------------------------------------------------------------------
46 AliFlowTrackSimple::AliFlowTrackSimple(Double_t phi, Double_t eta, Double_t pt):
57 //-----------------------------------------------------------------------
58 AliFlowTrackSimple::AliFlowTrackSimple(const TParticle* p):
69 //-----------------------------------------------------------------------
70 AliFlowTrackSimple::AliFlowTrackSimple(const AliFlowTrackSimple& aTrack):
75 fFlowBits(aTrack.fFlowBits),
76 fSubEventBits(aTrack.fSubEventBits)
81 //-----------------------------------------------------------------------
82 AliFlowTrackSimple* AliFlowTrackSimple::Clone(const char* /*option*/) const
85 return new AliFlowTrackSimple(*this);
88 //-----------------------------------------------------------------------
89 AliFlowTrackSimple& AliFlowTrackSimple::operator=(const AliFlowTrackSimple& aTrack)
94 fFlowBits = aTrack.fFlowBits;
95 fSubEventBits = aTrack.fSubEventBits;
100 //-----------------------------------------------------------------------
101 AliFlowTrackSimple::~AliFlowTrackSimple()
107 //-----------------------------------------------------------------------
108 void AliFlowTrackSimple::ResolutionPt(Double_t res)
110 //smear the pt by a gaussian with sigma=res
111 fPt += gRandom->Gaus(0.,res);
114 //-----------------------------------------------------------------------
115 void AliFlowTrackSimple::AddV1( Double_t v1,
116 Double_t reactionPlaneAngle,
117 Double_t precisionPhi,
118 Int_t maxNumberOfIterations )
120 //afterburner, adds v1, uses Newton-Raphson iteration
122 Double_t f,fp,phiprev;
124 for (Int_t i=0; i<maxNumberOfIterations; i++)
126 phiprev=fPhi; //store last value for comparison
127 f = fPhi-phi0+2.0*v1*TMath::Sin(fPhi-reactionPlaneAngle);
128 fp = 1.0+2.0*v1*TMath::Cos(fPhi-reactionPlaneAngle); //first derivative
130 if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break;
134 //-----------------------------------------------------------------------
135 void AliFlowTrackSimple::AddV2( Double_t v2,
136 Double_t reactionPlaneAngle,
137 Double_t precisionPhi,
138 Int_t maxNumberOfIterations )
140 //afterburner, adds v2, uses Newton-Raphson iteration
142 Double_t f,fp,phiprev;
144 for (Int_t i=0; i<maxNumberOfIterations; i++)
146 phiprev=fPhi; //store last value for comparison
147 f = fPhi-phi0+v2*TMath::Sin(2.*(fPhi-reactionPlaneAngle));
148 fp = 1.0+2.0*v2*TMath::Cos(2.*(fPhi-reactionPlaneAngle)); //first derivative
150 if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break;
154 //-----------------------------------------------------------------------
155 void AliFlowTrackSimple::AddV4( Double_t v4,
156 Double_t reactionPlaneAngle,
157 Double_t precisionPhi,
158 Int_t maxNumberOfIterations )
160 //afterburner, adds v4, uses Newton-Raphson iteration
162 Double_t f,fp,phiprev;
164 for (Int_t i=0; i<maxNumberOfIterations; i++)
166 phiprev=fPhi; //store last value for comparison
167 f = fPhi-phi0+0.5*v4*TMath::Sin(4.*(fPhi-reactionPlaneAngle));
168 fp = 1.0+2.0*v4*TMath::Cos(4.*(fPhi-reactionPlaneAngle)); //first derivative
170 if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break;
174 //______________________________________________________________________________
175 void AliFlowTrackSimple::AddFlow( Double_t v1,
178 Double_t reactionPlaneAngle,
179 Double_t precisionPhi,
180 Int_t maxNumberOfIterations )
182 //afterburner, adds v1,v2,v4 uses Newton-Raphson iteration
184 Double_t f,fp,phiprev;
186 for (Int_t i=0; i<maxNumberOfIterations; i++)
188 phiprev=fPhi; //store last value for comparison
190 +2.0*v1*TMath::Sin(fPhi-reactionPlaneAngle)
191 + v2*TMath::Sin(2.*(fPhi-reactionPlaneAngle))
192 +0.5*v4*TMath::Sin(4.*(fPhi-reactionPlaneAngle))
196 +v1*TMath::Cos(fPhi-reactionPlaneAngle)
197 +v2*TMath::Cos(2.*(fPhi-reactionPlaneAngle))
198 +v4*TMath::Cos(4.*(fPhi-reactionPlaneAngle))
199 ); //first derivative
201 if (TMath::AreEqualAbs(phiprev,fPhi,precisionPhi)) break;
205 //______________________________________________________________________________
206 void AliFlowTrackSimple::Print( Option_t* /*option*/ ) const
209 printf("Phi: %.3f, Eta: %+.3f, Pt: %.3f",fPhi,fEta,fPt);
210 if (InRPSelection()) printf(", RP");
211 if (InPOISelection()) printf(", POI");
212 for (Int_t i=0; i<2; i++)
214 if (InSubevent(i)) printf(", subevent %i",i);