1 /*************************************************************************
2 * Copyright(c) 1998-2008, 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 **************************************************************************/
16 #define AliFlowAnalysisWithMCEventPlane_cxx
18 #include "Riostream.h" //needed as include
19 #include "TFile.h" //needed as include
20 #include "TProfile.h" //needed as include
21 #include "TComplex.h" //needed as include
26 #include "AliFlowCommonConstants.h" //needed as include
27 #include "AliFlowEventSimple.h"
28 #include "AliFlowTrackSimple.h"
29 #include "AliFlowCommonHist.h"
30 #include "AliFlowCommonHistResults.h"
31 #include "AliFlowAnalysisWithMCEventPlane.h"
35 // AliFlowAnalysisWithMCEventPlane:
36 // Description: Maker to analyze Flow from the generated MC reaction plane.
37 // This class is used to get the real value of the flow
38 // to compare the other methods to when analysing simulated events
39 // author: N. van der Kolk (kolk@nikhef.nl)
41 ClassImp(AliFlowAnalysisWithMCEventPlane)
43 //-----------------------------------------------------------------------
45 AliFlowAnalysisWithMCEventPlane::AliFlowAnalysisWithMCEventPlane():
52 fCommonHistsRes(NULL),
59 fHistList = new TList();
61 fQsum = new TVector2; // flow vector sum
65 //-----------------------------------------------------------------------
68 AliFlowAnalysisWithMCEventPlane::~AliFlowAnalysisWithMCEventPlane()
76 //-----------------------------------------------------------------------
77 void AliFlowAnalysisWithMCEventPlane::Init() {
79 //Define all histograms
80 cout<<"---Analysis with the real MC Event Plane---"<<endl;
82 Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
83 Double_t dPtMin = AliFlowCommonConstants::GetPtMin();
84 Double_t dPtMax = AliFlowCommonConstants::GetPtMax();
86 fCommonHists = new AliFlowCommonHist("AliFlowCommonHistMCEP");
87 fHistList->Add(fCommonHists);
88 fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsMCEP");
89 fHistList->Add(fCommonHistsRes);
91 fHistProFlow = new TProfile("FlowPro_VPt_MCEP","FlowPro_VPt_MCEP",iNbinsPt,dPtMin,dPtMax);
92 fHistProFlow->SetXTitle("Pt");
93 fHistProFlow->SetYTitle("v2 (%)");
94 fHistList->Add(fHistProFlow);
96 fHistRP = new TH1F("Flow_RP_MCEP","Flow_RP_MCEP",100,0.,3.14);
97 fHistRP->SetXTitle("Reaction Plane Angle");
98 fHistRP->SetYTitle("Counts");
99 fHistList->Add(fHistRP);
102 fEventNumber = 0; //set number of events to zero
106 //-----------------------------------------------------------------------
108 void AliFlowAnalysisWithMCEventPlane::Make(AliFlowEventSimple* anEvent, Double_t aRP) {
110 //Calculate v2 from the MC reaction plane
113 //fill control histograms
114 fCommonHists->FillControlHistograms(anEvent);
116 //get the Q vector from the FlowEvent
117 AliFlowVector vQ = anEvent->GetQ();
118 //cout<<"vQ.Mod() = " << vQ.Mod() << endl;
119 //for chi calculation:
121 //cout<<"fQsum.Mod() = "<<fQsum.Mod()<<endl;
123 //cout<<"fQ2sum = "<<fQ2sum<<endl;
128 //loop over the tracks of the event
129 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
130 for (Int_t i=0;i<iNumberOfTracks;i++)
132 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
134 if (pTrack->UseForDifferentialFlow()) {
135 Double_t dPhi = pTrack->Phi();
136 //if (dPhi<0.) dPhi+=2*TMath::Pi();
138 Double_t dv2 = TMath::Cos(2*(dPhi-aRP));
139 Double_t dPt = pTrack->Pt();
141 fHistProFlow->Fill(dPt,100*dv2);
147 cout<<"@@@@@ "<<fEventNumber<<" events processed"<<endl;
151 //--------------------------------------------------------------------
152 void AliFlowAnalysisWithMCEventPlane::Finish() {
154 //*************make histograms etc.
155 if (fDebug) cout<<"AliFlowAnalysisWithMCEventPlane::Terminate()"<<endl;
157 Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
160 TH1F* fHistPtDiff = fCommonHists->GetHistPtDiff();
164 for(Int_t b=0;b<iNbinsPt;b++){
165 Double_t dv2pro = 0.;
166 Double_t dErrdifcomb = 0.;
168 dv2pro = fHistProFlow->GetBinContent(b);
169 dErrdifcomb = fHistProFlow->GetBinError(b); //in case error from profile is correct
171 fCommonHistsRes->FillDifferentialFlow(b, dv2pro, dErrdifcomb);
174 Double_t dYield = fHistPtDiff->GetBinContent(b);
175 dV += dv2pro/100*dYield ;
177 //error on integrated flow
178 dErrV += dYield*dYield*(dErrdifcomb/100)*(dErrdifcomb/100);
180 } else { cout<<"fHistProFlow is NULL"<<endl; }
183 dV /= dSum; //because pt distribution should be normalised
185 dErrV = TMath::Sqrt(dErrV); }
186 cout<<"dV is "<<dV<<" +- "<<dErrV<<endl;
187 fCommonHistsRes->FillIntegratedFlow(dV,dErrV);
189 cout<<".....finished"<<endl;