1 #include "AliFlowAnalysis.h"
3 //*********************************************************
4 // class AliFlowAnalysis
7 // Piotr.Skowronski@cern.ch
8 //*********************************************************
11 #include <AliVAODParticle.h>
12 #include <AliAODParticleCut.h>
14 #include <AliESDtrack.h>
17 ClassImp(AliFlowAnalysis)
19 AliFlowAnalysis::AliFlowAnalysis():
24 /*********************************************************/
26 AliFlowAnalysis::~AliFlowAnalysis()
31 /*********************************************************/
33 Int_t AliFlowAnalysis::Init()
39 /*********************************************************/
41 Int_t AliFlowAnalysis::ProcessEvent(AliAOD* aodrec, AliAOD* aodsim)
43 // Process AOD events containing the reconstructed and simulated information
44 Info("ProcessEvent","Sim AOD address %#x",aodsim);
45 Double_t psi = 0, v2 = 0;
48 GetFlow(aodrec,v2,psi);
49 Info("ProcessEvent","Reconstructed Event: Event plane is %f, V2 is %f",psi,v2);
54 GetFlow(aodsim,v2,psi);
55 Info("ProcessEvent","Simulated Event: Event plane is %f, V2 is %f",psi,v2);
61 /*********************************************************/
63 Int_t AliFlowAnalysis::Finish()
65 //Finish analysis and writes results
66 Info("Init","Finish");
69 /*********************************************************/
71 Double_t AliFlowAnalysis::GetEventPlane(AliAOD* aod)
73 //returns event plane in degrees
76 Error("AliFlowAnalysis::GetFlow","Pointer to AOD is NULL");
81 Int_t mult = aod->GetNumberOfParticles();
83 Double_t ssin = 0, scos = 0;
85 for (Int_t i=0; i<mult; i++)
87 AliVAODParticle* aodtrack = aod->GetParticle(i);
90 Error("AliFlowAnalysis::GetEventPlane","Can not get track %d", i);
95 if (fPartCut->Rejected(aodtrack))
98 Double_t phi = TMath::Pi()+TMath::ATan2(-aodtrack->Py(),-aodtrack->Px());
100 ssin += TMath::Sin( 2.0 * phi );
101 scos += TMath::Cos( 2.0 * phi );
104 psi = atan2 (ssin, scos) / 2.0;
105 psi = psi * 180. / TMath::Pi();
110 /*********************************************************/
112 void AliFlowAnalysis::GetFlow(AliAOD* aod,Double_t& v2,Double_t& psi)
114 //returns flow parameters: v2 and event plane
117 Error("AliFlowAnalysis::GetFlow","Pointer to AOD is NULL");
121 psi = GetEventPlane(aod);
122 Int_t mult = aod->GetNumberOfParticles();
124 Double_t ssin = 0, scos = 0;
126 for (Int_t i=0; i<mult; i++)
128 AliVAODParticle* aodtrack = aod->GetParticle(i);
131 Error("AliFlowAnalysis::GetEventPlane","Can not get track %d", i);
135 if (fPartCut->Rejected(aodtrack))
138 Double_t phi = TMath::Pi()+TMath::ATan2(-aodtrack->Py(),-aodtrack->Px());
139 ssin += TMath::Sin( 2.0 * (phi - psi));
140 scos += TMath::Cos( 2.0 * (phi - psi));
143 v2 = TMath::Hypot(ssin,scos);
147 /*********************************************************/
149 Double_t AliFlowAnalysis::GetEventPlane(AliESD* esd)
151 //returns event plane
154 ::Error("AliFlowAnalysis::GetFlow","Pointer to ESD is NULL");
159 Int_t mult = esd->GetNumberOfTracks();
161 Double_t ssin = 0, scos = 0;
163 for (Int_t i=0; i<mult; i++)
165 AliESDtrack* esdtrack = esd->GetTrack(i);
168 ::Error("AliFlowAnalysis::GetEventPlane","Can not get track %d", i);
172 Double_t mom[3];//momentum
173 esdtrack->GetPxPyPz(mom);
174 Double_t phi = TMath::Pi()+TMath::ATan2(-mom[1],-mom[0]);
176 ssin += TMath::Sin( 2.0 * phi );
177 scos += TMath::Cos( 2.0 * phi );
180 psi = atan2 (ssin, scos) / 2.0;
181 psi = psi * 180. / TMath::Pi();
186 /*********************************************************/
188 void AliFlowAnalysis::GetFlow(AliESD* esd,Double_t& v2,Double_t& psi)
190 //returns flow parameters: v2 and event plane
193 ::Error("AliFlowAnalysis::GetFlow","Pointer to ESD is NULL");
197 psi = GetEventPlane(esd);
198 Int_t mult = esd->GetNumberOfTracks();
200 Double_t ssin = 0, scos = 0;
202 for (Int_t i=0; i<mult; i++)
204 AliESDtrack* esdtrack = esd->GetTrack(i);
207 ::Error("AliFlowAnalysis::GetEventPlane","Can not get track %d", i);
211 Double_t mom[3];//momentum
212 esdtrack->GetPxPyPz(mom);
213 Double_t phi = TMath::Pi()+TMath::ATan2(-mom[1],-mom[0]);
215 ssin += TMath::Sin( 2.0 * (phi - psi));
216 scos += TMath::Cos( 2.0 * (phi - psi));
219 v2 = TMath::Hypot(ssin,scos);
221 /*********************************************************/