1 #include "AliFlowAnalysis.h"
2 //________________________________
3 ///////////////////////////////////////////////////////////
5 // class AliFlowAnalysis
11 // Piotr.Skowronski@cern.ch
13 ///////////////////////////////////////////////////////////
14 /*********************************************************/
17 #include <TParticle.h>
21 #include <AliVAODParticle.h>
22 #include <AliAODParticleCut.h>
24 #include <AliESDtrack.h>
27 ClassImp(AliFlowAnalysis)
29 AliFlowAnalysis::AliFlowAnalysis():
34 /*********************************************************/
36 AliFlowAnalysis::~AliFlowAnalysis()
41 /*********************************************************/
43 Int_t AliFlowAnalysis::Init()
49 /*********************************************************/
51 Int_t AliFlowAnalysis::ProcessEvent(AliAOD* aodrec, AliAOD* aodsim)
54 Info("ProcessEvent","Sim AOD address %#x",aodsim);
55 Double_t psi = 0, v2 = 0;
58 GetFlow(aodrec,v2,psi);
59 Info("ProcessEvent","Reconstructed Event: Event plane is %f, V2 is %f",psi,v2);
64 GetFlow(aodsim,v2,psi);
65 Info("ProcessEvent","Simulated Event: Event plane is %f, V2 is %f",psi,v2);
71 /*********************************************************/
73 Int_t AliFlowAnalysis::Finish()
75 //Finish analysis and writes results
76 Info("Init","Finish");
79 /*********************************************************/
81 Double_t AliFlowAnalysis::GetEventPlane(AliAOD* aod)
83 //returns event plane in degrees
86 Error("AliFlowAnalysis::GetFlow","Pointer to AOD is NULL");
91 Int_t mult = aod->GetNumberOfParticles();
93 Double_t ssin = 0, scos = 0;
95 for (Int_t i=0; i<mult; i++)
97 AliVAODParticle* aodtrack = aod->GetParticle(i);
100 Error("AliFlowAnalysis::GetEventPlane","Can not get track %d", i);
105 if (fPartCut->Rejected(aodtrack))
108 Double_t phi = TMath::Pi()+TMath::ATan2(-aodtrack->Py(),-aodtrack->Px());
110 ssin += TMath::Sin( 2.0 * phi );
111 scos += TMath::Cos( 2.0 * phi );
114 psi = atan2 (ssin, scos) / 2.0;
115 psi = psi * 180. / TMath::Pi();
120 /*********************************************************/
122 void AliFlowAnalysis::GetFlow(AliAOD* aod,Double_t& v2,Double_t& psi)
124 //returns flow parameters: v2 and event plane
127 Error("AliFlowAnalysis::GetFlow","Pointer to AOD is NULL");
131 psi = GetEventPlane(aod);
132 Int_t mult = aod->GetNumberOfParticles();
134 Double_t ssin = 0, scos = 0;
136 for (Int_t i=0; i<mult; i++)
138 AliVAODParticle* aodtrack = aod->GetParticle(i);
141 Error("AliFlowAnalysis::GetEventPlane","Can not get track %d", i);
145 if (fPartCut->Rejected(aodtrack))
148 Double_t phi = TMath::Pi()+TMath::ATan2(-aodtrack->Py(),-aodtrack->Px());
149 ssin += TMath::Sin( 2.0 * (phi - psi));
150 scos += TMath::Cos( 2.0 * (phi - psi));
153 v2 = TMath::Hypot(ssin,scos);
157 /*********************************************************/
159 Double_t AliFlowAnalysis::GetEventPlane(AliESD* esd)
161 //returns event plane
164 ::Error("AliFlowAnalysis::GetFlow","Pointer to ESD is NULL");
169 Int_t mult = esd->GetNumberOfTracks();
171 Double_t ssin = 0, scos = 0;
173 for (Int_t i=0; i<mult; i++)
175 AliESDtrack* esdtrack = esd->GetTrack(i);
178 ::Error("AliFlowAnalysis::GetEventPlane","Can not get track %d", i);
182 Double_t mom[3];//momentum
183 esdtrack->GetPxPyPz(mom);
184 Double_t phi = TMath::Pi()+TMath::ATan2(-mom[1],-mom[0]);
186 ssin += TMath::Sin( 2.0 * phi );
187 scos += TMath::Cos( 2.0 * phi );
190 psi = atan2 (ssin, scos) / 2.0;
191 psi = psi * 180. / TMath::Pi();
196 /*********************************************************/
198 void AliFlowAnalysis::GetFlow(AliESD* esd,Double_t& v2,Double_t& psi)
200 //returns flow parameters: v2 and event plane
203 ::Error("AliFlowAnalysis::GetFlow","Pointer to ESD is NULL");
207 psi = GetEventPlane(esd);
208 Int_t mult = esd->GetNumberOfTracks();
210 Double_t ssin = 0, scos = 0;
212 for (Int_t i=0; i<mult; i++)
214 AliESDtrack* esdtrack = esd->GetTrack(i);
217 ::Error("AliFlowAnalysis::GetEventPlane","Can not get track %d", i);
221 Double_t mom[3];//momentum
222 esdtrack->GetPxPyPz(mom);
223 Double_t phi = TMath::Pi()+TMath::ATan2(-mom[1],-mom[0]);
225 ssin += TMath::Sin( 2.0 * (phi - psi));
226 scos += TMath::Cos( 2.0 * (phi - psi));
229 v2 = TMath::Hypot(ssin,scos);
231 /*********************************************************/