]>
Commit | Line | Data |
---|---|---|
f1d945a1 | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | #define AliFlowAnalysisWithMCEventPlane_cxx | |
17 | ||
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 | |
28ca24ad | 22 | #include "TList.h" |
f1d945a1 | 23 | |
24 | class TH1F; | |
25 | ||
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" | |
32 | ||
33 | class AliFlowVector; | |
34 | ||
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) | |
40 | ||
41 | ClassImp(AliFlowAnalysisWithMCEventPlane) | |
42 | ||
43 | //----------------------------------------------------------------------- | |
44 | ||
45 | AliFlowAnalysisWithMCEventPlane::AliFlowAnalysisWithMCEventPlane(): | |
0092f3c2 | 46 | fQsum(NULL), |
f1d945a1 | 47 | fQ2sum(0), |
48 | fEventNumber(0), | |
f1d945a1 | 49 | fDebug(kFALSE), |
28ca24ad | 50 | fHistList(NULL), |
8232a5ec | 51 | fCommonHists(NULL), |
52 | fCommonHistsRes(NULL), | |
53 | fHistProFlow(NULL), | |
45cdbef2 | 54 | fHistRP(NULL), |
55 | fHistProIntFlowRP(NULL), | |
56 | fHistProDiffFlowPtRP(NULL), | |
57 | fHistProDiffFlowEtaRP(NULL), | |
58 | fHistProDiffFlowPtPOI(NULL), | |
59 | fHistProDiffFlowEtaPOI(NULL) | |
f1d945a1 | 60 | { |
61 | ||
62 | // Constructor. | |
28ca24ad | 63 | fHistList = new TList(); |
64 | ||
0092f3c2 | 65 | fQsum = new TVector2; // flow vector sum |
f1d945a1 | 66 | } |
67 | ||
68 | ||
69 | //----------------------------------------------------------------------- | |
70 | ||
71 | ||
72 | AliFlowAnalysisWithMCEventPlane::~AliFlowAnalysisWithMCEventPlane() | |
73 | { | |
74 | //destructor | |
28ca24ad | 75 | delete fHistList; |
0092f3c2 | 76 | delete fQsum; |
f1d945a1 | 77 | } |
78 | ||
7ebf0358 | 79 | //----------------------------------------------------------------------- |
80 | ||
81 | void AliFlowAnalysisWithMCEventPlane::WriteHistograms(TString* outputFileName) | |
82 | { | |
83 | //store the final results in output .root file | |
84 | TFile *output = new TFile(outputFileName->Data(),"RECREATE"); | |
7a2c2652 | 85 | output->WriteObject(fHistList, "cobjMCEP","SingleKey"); |
7ebf0358 | 86 | delete output; |
87 | } | |
f1d945a1 | 88 | |
89 | //----------------------------------------------------------------------- | |
90 | void AliFlowAnalysisWithMCEventPlane::Init() { | |
91 | ||
92 | //Define all histograms | |
93 | cout<<"---Analysis with the real MC Event Plane---"<<endl; | |
94 | ||
00731146 | 95 | Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt(); |
45cdbef2 | 96 | Double_t dPtMin = AliFlowCommonConstants::GetPtMin(); |
97 | Double_t dPtMax = AliFlowCommonConstants::GetPtMax(); | |
98 | ||
99 | Int_t iNbinsEta = AliFlowCommonConstants::GetNbinsEta(); | |
100 | Double_t dEtaMin = AliFlowCommonConstants::GetEtaMin(); | |
101 | Double_t dEtaMax = AliFlowCommonConstants::GetEtaMax(); | |
f1d945a1 | 102 | |
9d062fe3 | 103 | fCommonHists = new AliFlowCommonHist("AliFlowCommonHistMCEP"); |
104 | fHistList->Add(fCommonHists); | |
105 | fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsMCEP"); | |
106 | fHistList->Add(fCommonHistsRes); | |
107 | ||
108 | fHistProFlow = new TProfile("FlowPro_VPt_MCEP","FlowPro_VPt_MCEP",iNbinsPt,dPtMin,dPtMax); | |
45cdbef2 | 109 | fHistProFlow->SetXTitle("P_{t}"); |
110 | fHistProFlow->SetYTitle("v_{2}"); | |
28ca24ad | 111 | fHistList->Add(fHistProFlow); |
f1d945a1 | 112 | |
9d062fe3 | 113 | fHistRP = new TH1F("Flow_RP_MCEP","Flow_RP_MCEP",100,0.,3.14); |
f1d945a1 | 114 | fHistRP->SetXTitle("Reaction Plane Angle"); |
115 | fHistRP->SetYTitle("Counts"); | |
28ca24ad | 116 | fHistList->Add(fHistRP); |
45cdbef2 | 117 | |
118 | fHistProIntFlowRP = new TProfile("fHistProIntFlowRP","fHistProIntFlowRP",1,0.,1.); | |
119 | fHistProIntFlowRP->SetLabelSize(0.06); | |
120 | (fHistProIntFlowRP->GetXaxis())->SetBinLabel(1,"v_{n}{2}"); | |
121 | fHistProIntFlowRP->SetYTitle(""); | |
122 | fHistList->Add(fHistProIntFlowRP); | |
123 | ||
124 | fHistProDiffFlowPtRP = new TProfile("fHistProDiffFlowPtRP","fHistProDiffFlowPtRP",iNbinsPt,dPtMin,dPtMax); | |
125 | fHistProDiffFlowPtRP->SetXTitle("P_{t}"); | |
126 | fHistProDiffFlowPtRP->SetYTitle(""); | |
127 | fHistList->Add(fHistProDiffFlowPtRP); | |
128 | ||
129 | fHistProDiffFlowEtaRP = new TProfile("fHistProDiffFlowEtaRP","fHistProDiffFlowEtaRP",iNbinsEta,dEtaMin,dEtaMax); | |
130 | fHistProDiffFlowEtaRP->SetXTitle("#eta"); | |
131 | fHistProDiffFlowEtaRP->SetYTitle(""); | |
132 | fHistList->Add(fHistProDiffFlowEtaRP); | |
133 | ||
134 | fHistProDiffFlowPtPOI = new TProfile("fHistProDiffFlowPtPOI","fHistProDiffFlowPtPOI",iNbinsPt,dPtMin,dPtMax); | |
135 | fHistProDiffFlowPtPOI->SetXTitle("P_{t}"); | |
136 | fHistProDiffFlowPtPOI->SetYTitle(""); | |
137 | fHistList->Add(fHistProDiffFlowPtPOI); | |
138 | ||
139 | fHistProDiffFlowEtaPOI = new TProfile("fHistProDiffFlowEtaPOI","fHistProDiffFlowEtaPOI",iNbinsEta,dEtaMin,dEtaMax); | |
140 | fHistProDiffFlowEtaPOI->SetXTitle("#eta"); | |
141 | fHistProDiffFlowEtaPOI->SetYTitle(""); | |
142 | fHistList->Add(fHistProDiffFlowEtaPOI); | |
f1d945a1 | 143 | |
144 | fEventNumber = 0; //set number of events to zero | |
145 | ||
146 | } | |
147 | ||
148 | //----------------------------------------------------------------------- | |
149 | ||
00731146 | 150 | void AliFlowAnalysisWithMCEventPlane::Make(AliFlowEventSimple* anEvent, Double_t aRP) { |
f1d945a1 | 151 | |
152 | //Calculate v2 from the MC reaction plane | |
8232a5ec | 153 | if (anEvent) { |
f1d945a1 | 154 | |
155 | //fill control histograms | |
8232a5ec | 156 | fCommonHists->FillControlHistograms(anEvent); |
f1d945a1 | 157 | |
158 | //get the Q vector from the FlowEvent | |
00731146 | 159 | AliFlowVector vQ = anEvent->GetQ(); |
160 | //cout<<"vQ.Mod() = " << vQ.Mod() << endl; | |
f1d945a1 | 161 | //for chi calculation: |
00731146 | 162 | *fQsum += vQ; |
f1d945a1 | 163 | //cout<<"fQsum.Mod() = "<<fQsum.Mod()<<endl; |
00731146 | 164 | fQ2sum += vQ.Mod2(); |
9d062fe3 | 165 | //cout<<"fQ2sum = "<<fQ2sum<<endl; |
f1d945a1 | 166 | |
00731146 | 167 | fHistRP->Fill(aRP); |
45cdbef2 | 168 | |
169 | Double_t dPhi = 0.; | |
170 | Double_t dv2 = 0.; | |
171 | Double_t dPt = 0.; | |
172 | Double_t dEta = 0.; | |
173 | //Double_t dPi = TMath::Pi(); | |
174 | ||
f1d945a1 | 175 | //calculate flow |
176 | //loop over the tracks of the event | |
00731146 | 177 | Int_t iNumberOfTracks = anEvent->NumberOfTracks(); |
178 | for (Int_t i=0;i<iNumberOfTracks;i++) | |
f1d945a1 | 179 | { |
00731146 | 180 | AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ; |
181 | if (pTrack){ | |
45cdbef2 | 182 | if (pTrack->UseForIntegratedFlow()){ |
183 | dPhi = pTrack->Phi(); | |
184 | dv2 = TMath::Cos(2*(dPhi-aRP)); | |
185 | dPt = pTrack->Pt(); | |
186 | dEta = pTrack->Eta(); | |
187 | //integrated flow (RP): | |
188 | fHistProIntFlowRP->Fill(0.,dv2); | |
189 | //differential flow (Pt, RP): | |
190 | fHistProDiffFlowPtRP->Fill(dPt,dv2,1.); | |
191 | //differential flow (Eta, RP): | |
192 | fHistProDiffFlowEtaRP->Fill(dEta,dv2,1.); | |
193 | } | |
00731146 | 194 | if (pTrack->UseForDifferentialFlow()) { |
45cdbef2 | 195 | dPhi = pTrack->Phi(); |
00731146 | 196 | //if (dPhi<0.) dPhi+=2*TMath::Pi(); |
f1d945a1 | 197 | //calculate flow v2: |
45cdbef2 | 198 | dv2 = TMath::Cos(2*(dPhi-aRP)); |
199 | dPt = pTrack->Pt(); | |
200 | dEta = pTrack->Eta(); | |
f1d945a1 | 201 | //fill histogram |
45cdbef2 | 202 | fHistProFlow->Fill(dPt,dv2);//to be removed |
203 | //differential flow (Pt, POI): | |
204 | fHistProDiffFlowPtPOI->Fill(dPt,dv2,1.); | |
205 | //differential flow (Eta, POI): | |
206 | fHistProDiffFlowEtaPOI->Fill(dEta,dv2,1.); | |
207 | } | |
f1d945a1 | 208 | }//track selected |
209 | }//loop over tracks | |
210 | ||
211 | fEventNumber++; | |
212 | cout<<"@@@@@ "<<fEventNumber<<" events processed"<<endl; | |
213 | } | |
214 | } | |
215 | ||
216 | //-------------------------------------------------------------------- | |
217 | void AliFlowAnalysisWithMCEventPlane::Finish() { | |
218 | ||
219 | //*************make histograms etc. | |
220 | if (fDebug) cout<<"AliFlowAnalysisWithMCEventPlane::Terminate()"<<endl; | |
9d062fe3 | 221 | |
45cdbef2 | 222 | Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt(); |
223 | Int_t iNbinsEta = AliFlowCommonConstants::GetNbinsEta(); | |
224 | ||
225 | //RP: | |
226 | //integrated flow: | |
227 | Double_t dVRP = fHistProIntFlowRP->GetBinContent(1); | |
228 | Double_t dErrVRP = fHistProIntFlowRP->GetBinError(1); | |
229 | fCommonHistsRes->FillIntegratedFlowRP(dVRP,dErrVRP); | |
230 | //differential flow (Pt): | |
231 | Double_t dvPtRP = 0.; | |
232 | Double_t dErrvPtRP = 0.; | |
233 | for(Int_t b=0;b<iNbinsPt;b++) | |
234 | { | |
235 | dvPtRP = fHistProDiffFlowPtRP->GetBinContent(b+1); | |
236 | dErrvPtRP = fHistProDiffFlowPtRP->GetBinError(b+1); | |
237 | fCommonHistsRes->FillDifferentialFlowPtRP(b, dvPtRP , dErrvPtRP); | |
238 | } | |
239 | //differential flow (Eta): | |
240 | Double_t dvEtaRP = 0.; | |
241 | Double_t dErrvEtaRP = 0.; | |
242 | for(Int_t b=0;b<iNbinsEta;b++) | |
243 | { | |
244 | dvEtaRP = fHistProDiffFlowEtaRP->GetBinContent(b+1); | |
245 | dErrvEtaRP = fHistProDiffFlowEtaRP->GetBinError(b+1); | |
246 | fCommonHistsRes->FillDifferentialFlowEtaRP(b, dvEtaRP , dErrvEtaRP); | |
247 | } | |
248 | ||
249 | //POI: | |
88e00a8a | 250 | TH1F* fHistPtDiff = fCommonHists->GetHistPtDiff(); |
00731146 | 251 | Double_t dV = 0.; |
252 | Double_t dErrV = 0.; | |
253 | Double_t dSum = 0.; | |
45cdbef2 | 254 | Double_t dv2proPt = 0.; |
255 | Double_t dErrdifcombPt = 0.; | |
256 | Double_t dv2proEta = 0.; | |
257 | Double_t dErrdifcombEta = 0.; | |
258 | //Pt: | |
259 | if(fHistProFlow && fHistProDiffFlowPtPOI) {//to be removed (fHistProFlow) | |
260 | for(Int_t b=0;b<iNbinsPt;b++){ | |
261 | //dv2pro = fHistProFlow->GetBinContent(b);//to be removed | |
262 | //dErrdifcomb = fHistProFlow->GetBinError(b);//to be removed | |
263 | dv2proPt = fHistProDiffFlowPtPOI->GetBinContent(b); | |
264 | dErrdifcombPt = fHistProDiffFlowPtPOI->GetBinError(b); //in case error from profile is correct | |
f1d945a1 | 265 | //fill TH1D |
45cdbef2 | 266 | fCommonHistsRes->FillDifferentialFlow(b, dv2proPt, dErrdifcombPt);//to be removed |
267 | fCommonHistsRes->FillDifferentialFlowPtPOI(b, dv2proPt, dErrdifcombPt); | |
f1d945a1 | 268 | if (fHistPtDiff){ |
269 | //integrated flow | |
00731146 | 270 | Double_t dYield = fHistPtDiff->GetBinContent(b); |
45cdbef2 | 271 | dV += dv2proPt*dYield ; |
00731146 | 272 | dSum += dYield; |
f1d945a1 | 273 | //error on integrated flow |
45cdbef2 | 274 | dErrV += dYield*dYield*dErrdifcombPt*dErrdifcombPt; |
f1d945a1 | 275 | } |
45cdbef2 | 276 | } |
277 | } else { cout<<"fHistProFlow is NULL"<<endl; } | |
9d062fe3 | 278 | if (dSum != 0. ) { |
279 | dV /= dSum; //because pt distribution should be normalised | |
280 | dErrV /= dSum*dSum; | |
281 | dErrV = TMath::Sqrt(dErrV); } | |
00731146 | 282 | cout<<"dV is "<<dV<<" +- "<<dErrV<<endl; |
45cdbef2 | 283 | fCommonHistsRes->FillIntegratedFlow(dV,dErrV);//to be removed |
284 | fCommonHistsRes->FillIntegratedFlowPOI(dV,dErrV); | |
285 | ||
286 | ||
287 | //Eta: | |
288 | if(fHistProDiffFlowEtaPOI) | |
289 | { | |
290 | for(Int_t b=0;b<iNbinsEta;b++) | |
291 | { | |
292 | dv2proEta = fHistProDiffFlowEtaPOI->GetBinContent(b); | |
293 | dErrdifcombEta = fHistProDiffFlowEtaPOI->GetBinError(b); //in case error from profile is correct | |
294 | //fill common hist results: | |
295 | fCommonHistsRes->FillDifferentialFlowEtaPOI(b, dv2proEta, dErrdifcombEta); | |
296 | } | |
297 | } | |
298 | ||
f1d945a1 | 299 | cout<<".....finished"<<endl; |
9d062fe3 | 300 | } |
f1d945a1 | 301 | |
302 | ||
9d062fe3 | 303 |