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("MC");
87 fHistList->Add(fCommonHists->GetHistMultOrig());
88 fHistList->Add(fCommonHists->GetHistMultInt());
89 fHistList->Add(fCommonHists->GetHistMultDiff());
90 fHistList->Add(fCommonHists->GetHistPtInt());
91 fHistList->Add(fCommonHists->GetHistPtDiff());
92 fHistList->Add(fCommonHists->GetHistPhiInt());
93 fHistList->Add(fCommonHists->GetHistPhiDiff());
94 fHistList->Add(fCommonHists->GetHistEtaInt());
95 fHistList->Add(fCommonHists->GetHistEtaDiff());
96 fHistList->Add(fCommonHists->GetHistProMeanPtperBin());
97 fHistList->Add(fCommonHists->GetHistQ());
98 fCommonHistsRes = new AliFlowCommonHistResults("MC");
99 fHistList->Add(fCommonHistsRes->GetHistDiffFlow());
100 fHistList->Add(fCommonHistsRes->GetHistChi());
101 fHistList->Add(fCommonHistsRes->GetHistIntFlow());
103 fHistProFlow = new TProfile("FlowPro_VPt_MC","FlowPro_VPt_MC",iNbinsPt,dPtMin,dPtMax);
104 fHistProFlow->SetXTitle("Pt");
105 fHistProFlow->SetYTitle("v2 (%)");
106 fHistList->Add(fHistProFlow);
108 fHistRP = new TH1F("Flow_RP_MC","Flow_RP_MC",100,0.,3.14);
109 fHistRP->SetXTitle("Reaction Plane Angle");
110 fHistRP->SetYTitle("Counts");
111 fHistList->Add(fHistRP);
114 fEventNumber = 0; //set number of events to zero
118 //-----------------------------------------------------------------------
120 void AliFlowAnalysisWithMCEventPlane::Make(AliFlowEventSimple* anEvent, Double_t aRP) {
122 //Calculate v2 from the MC reaction plane
125 //fill control histograms
126 fCommonHists->FillControlHistograms(anEvent);
128 //get the Q vector from the FlowEvent
129 AliFlowVector vQ = anEvent->GetQ();
130 //cout<<"vQ.Mod() = " << vQ.Mod() << endl;
131 //for chi calculation:
133 //cout<<"fQsum.Mod() = "<<fQsum.Mod()<<endl;
135 cout<<"fQ2sum = "<<fQ2sum<<endl;
140 //loop over the tracks of the event
141 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
142 for (Int_t i=0;i<iNumberOfTracks;i++)
144 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
146 if (pTrack->UseForDifferentialFlow()) {
147 Double_t dPhi = pTrack->Phi();
148 //if (dPhi<0.) dPhi+=2*TMath::Pi();
150 Double_t dv2 = TMath::Cos(2*(dPhi-aRP));
151 Double_t dPt = pTrack->Pt();
153 fHistProFlow->Fill(dPt,100*dv2);
159 cout<<"@@@@@ "<<fEventNumber<<" events processed"<<endl;
163 //--------------------------------------------------------------------
164 void AliFlowAnalysisWithMCEventPlane::Finish() {
166 //*************make histograms etc.
167 if (fDebug) cout<<"AliFlowAnalysisWithMCEventPlane::Terminate()"<<endl;
169 Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
171 TH1F* fHistPtDiff = fCommonHists->GetHistPtDiff();
175 for(Int_t b=0;b<iNbinsPt;b++){
176 Double_t dv2pro = 0.;
177 Double_t dErrdifcomb = 0.; //in case error from profile is correct
179 dv2pro = fHistProFlow->GetBinContent(b);
180 dErrdifcomb = fHistProFlow->GetBinError(b);
182 fCommonHistsRes->FillDifferentialFlow(b, dv2pro, dErrdifcomb);
185 Double_t dYield = fHistPtDiff->GetBinContent(b);
186 dV += dv2pro/100*dYield ;
188 //error on integrated flow
189 dErrV += dYield*dYield*(dErrdifcomb/100)*(dErrdifcomb/100);
193 dV /= dSum; //because pt distribution should be normalised
195 dErrV = TMath::Sqrt(dErrV);
196 cout<<"dV is "<<dV<<" +- "<<dErrV<<endl;
197 fCommonHistsRes->FillIntegratedFlow(dV,dErrV);
199 cout<<".....finished"<<endl;