1 #include "AliFlowAnalysis.h"
2 //________________________________
3 ///////////////////////////////////////////////////////////
5 // class AliFlowAnalysis
11 // Piotr.Skowronski@cern.ch
13 ///////////////////////////////////////////////////////////
14 /*********************************************************/
17 #include <TParticle.h>
20 #include <AliESDtrack.h>
23 ClassImp(AliFlowAnalysis)
25 Int_t AliFlowAnalysis::Init()
32 /*********************************************************/
34 Int_t AliFlowAnalysis::ProcessEvent(AliESD* esd, AliStack* stack)
37 Info("ProcessEvent","Stack address %#x",stack);
38 Double_t psi = GetEventPlane(esd);
39 Info("ProcessEvent","Event plane is %f",psi);
43 /*********************************************************/
45 Int_t AliFlowAnalysis::Finish()
47 //Finish analysis and writes results
48 Info("Init","Finish");
51 /*********************************************************/
53 Double_t AliFlowAnalysis::GetEventPlane(AliESD* esd)
57 Int_t mult = esd->GetNumberOfTracks();
59 Double_t ssin = 0, scos = 0;
61 for (Int_t i=0; i<mult; i++)
63 AliESDtrack* esdtrack = esd->GetTrack(i);
66 ::Error("GetEventPlane","Can not get track %d", i);
70 Double_t mom[3];//momentum
71 esdtrack->GetPxPyPz(mom);
72 Double_t phi = TMath::Pi()+TMath::ATan2(-mom[1],-mom[0]);
74 ssin += TMath::Sin( 2.0 * phi );
75 scos += TMath::Cos( 2.0 * phi );
78 psi = atan2 (ssin, scos) / 2.0;
79 psi = psi * 180. / TMath::Pi();