]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/FLOW/Base/AliFlowAnalysisWithMCEventPlane.cxx
Moving/split PWG2/FLOW to PWGCF/FLOW, PWG/FLOW/Base, PWG/FLOW/Tasks, PWG/Glauber
[u/mrichter/AliRoot.git] / PWG / FLOW / Base / AliFlowAnalysisWithMCEventPlane.cxx
CommitLineData
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**************************************************************************/
fbdb53fa 15// AliFlowAnalysisWithMCEventPlane:
16// Description: Maker to analyze Flow from the generated MC reaction plane.
17// This class is used to get the real value of the flow
18// to compare the other methods to when analysing simulated events
19// author: N. van der Kolk (kolk@nikhef.nl)
f1d945a1 20
21#define AliFlowAnalysisWithMCEventPlane_cxx
22
fbdb53fa 23#include "Riostream.h"
24#include "TFile.h"
25#include "TProfile.h"
26#include "TProfile2D.h"
28ca24ad 27#include "TList.h"
fbdb53fa 28#include "TH1F.h"
29#include "TMath.h"
929098e4 30#include "TVector2.h"
f1d945a1 31
fbdb53fa 32#include "AliFlowCommonConstants.h"
f1d945a1 33#include "AliFlowEventSimple.h"
34#include "AliFlowTrackSimple.h"
35#include "AliFlowCommonHist.h"
36#include "AliFlowCommonHistResults.h"
37#include "AliFlowAnalysisWithMCEventPlane.h"
929098e4 38#include "AliFlowVector.h"
f1d945a1 39
40class AliFlowVector;
41
f1d945a1 42ClassImp(AliFlowAnalysisWithMCEventPlane)
43
44 //-----------------------------------------------------------------------
45
46 AliFlowAnalysisWithMCEventPlane::AliFlowAnalysisWithMCEventPlane():
0092f3c2 47 fQsum(NULL),
f1d945a1 48 fQ2sum(0),
49 fEventNumber(0),
f1d945a1 50 fDebug(kFALSE),
28ca24ad 51 fHistList(NULL),
8232a5ec 52 fCommonHists(NULL),
53 fCommonHistsRes(NULL),
45cdbef2 54 fHistRP(NULL),
3963f25c 55 fHistProIntFlow(NULL),
10a70cd5 56 fHistProIntFlowVsM(NULL),
9cc9e6cc 57 fHistProDiffFlowPtEtaRP(NULL),
45cdbef2 58 fHistProDiffFlowPtRP(NULL),
59 fHistProDiffFlowEtaRP(NULL),
9cc9e6cc 60 fHistProDiffFlowPtEtaPOI(NULL),
45cdbef2 61 fHistProDiffFlowPtPOI(NULL),
4f678629 62 fHistProDiffFlowEtaPOI(NULL),
afa4af05 63 fHistSpreadOfFlow(NULL),
b3a29c75 64 fHarmonic(2),
4740c6b8 65 fMixedHarmonicsList(NULL),
dfb33a36 66 fEvaluateMixedHarmonics(kFALSE),
4740c6b8 67 fMixedHarmonicsSettings(NULL),
68 fnBinsMult(10000),
69 fMinMult(0.),
70 fMaxMult(10000.),
71 fNinCorrelator(2),
72 fMinCorrelator(2),
b3a29c75 73 fXinPairAngle(0.5)
f1d945a1 74{
75
76 // Constructor.
28ca24ad 77 fHistList = new TList();
78
0092f3c2 79 fQsum = new TVector2; // flow vector sum
b3a29c75 80
4740c6b8 81 fMixedHarmonicsList = new TList();
82 this->InitalizeArraysForMixedHarmonics();
f1d945a1 83
4740c6b8 84}
f1d945a1 85
4740c6b8 86//-----------------------------------------------------------------------
f1d945a1 87
4740c6b8 88AliFlowAnalysisWithMCEventPlane::~AliFlowAnalysisWithMCEventPlane()
89{
90 //destructor
91 delete fHistList;
92 delete fQsum;
93}
f1d945a1 94
7ebf0358 95//-----------------------------------------------------------------------
96
97void AliFlowAnalysisWithMCEventPlane::WriteHistograms(TString* outputFileName)
98{
99 //store the final results in output .root file
100 TFile *output = new TFile(outputFileName->Data(),"RECREATE");
0fe80f88 101 //output->WriteObject(fHistList, "cobjMCEP","SingleKey");
102 fHistList->SetName("cobjMCEP");
9455e15e 103 fHistList->SetOwner(kTRUE);
0fe80f88 104 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
7ebf0358 105 delete output;
106}
f1d945a1 107
108//-----------------------------------------------------------------------
b0fda271 109
110void AliFlowAnalysisWithMCEventPlane::WriteHistograms(TString outputFileName)
111{
112 //store the final results in output .root file
113 TFile *output = new TFile(outputFileName.Data(),"RECREATE");
0fe80f88 114 //output->WriteObject(fHistList, "cobjMCEP","SingleKey");
115 fHistList->SetName("cobjMCEP");
9455e15e 116 fHistList->SetOwner(kTRUE);
0fe80f88 117 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
b0fda271 118 delete output;
119}
120
ad87ae62 121//-----------------------------------------------------------------------
122
123void AliFlowAnalysisWithMCEventPlane::WriteHistograms(TDirectoryFile *outputFileName)
124{
125 //store the final results in output .root file
126 fHistList->SetName("cobjMCEP");
127 fHistList->SetOwner(kTRUE);
128 outputFileName->Add(fHistList);
129 outputFileName->Write(outputFileName->GetName(), TObject::kSingleKey);
130}
131
b0fda271 132//-----------------------------------------------------------------------
f1d945a1 133void AliFlowAnalysisWithMCEventPlane::Init() {
134
135 //Define all histograms
136 cout<<"---Analysis with the real MC Event Plane---"<<endl;
137
489d5531 138 //save old value and prevent histograms from being added to directory
139 //to avoid name clashes in case multiple analaysis objects are used
140 //in an analysis
141 Bool_t oldHistAddStatus = TH1::AddDirectoryStatus();
142 TH1::AddDirectory(kFALSE);
143
bee2efdc 144 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
145 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
146 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
45cdbef2 147
bee2efdc 148 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
149 Double_t dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();
150 Double_t dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
f1d945a1 151
9d062fe3 152 fCommonHists = new AliFlowCommonHist("AliFlowCommonHistMCEP");
153 fHistList->Add(fCommonHists);
62e36168 154 fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsMCEP","",fHarmonic);
9d062fe3 155 fHistList->Add(fCommonHistsRes);
156
afa4af05 157 // store harmonic in common control histogram:
158 (fCommonHists->GetHarmonic())->Fill(0.5,fHarmonic);
159
9d062fe3 160 fHistRP = new TH1F("Flow_RP_MCEP","Flow_RP_MCEP",100,0.,3.14);
f1d945a1 161 fHistRP->SetXTitle("Reaction Plane Angle");
162 fHistRP->SetYTitle("Counts");
28ca24ad 163 fHistList->Add(fHistRP);
45cdbef2 164
b7cb54d5 165 fHistProIntFlow = new TProfile("FlowPro_V_MCEP","FlowPro_V_MCEP",1,0.,1.);
3963f25c 166 fHistProIntFlow->SetLabelSize(0.06);
10a70cd5 167 (fHistProIntFlow->GetXaxis())->SetBinLabel(1,"v_{n}{MCEP}");
3963f25c 168 fHistProIntFlow->SetYTitle("");
169 fHistList->Add(fHistProIntFlow);
9cc9e6cc 170
10a70cd5 171 fHistProIntFlowVsM = new TProfile("FlowPro_VsM_MCEP","FlowPro_VsM_MCEP",10000,0.,10000.); // to be improved - hardwired 10000
172 //fHistProIntFlowVsM->SetLabelSize(0.06);
173 (fHistProIntFlowVsM->GetXaxis())->SetTitle("M");
174 fHistProIntFlowVsM->SetYTitle("");
175 fHistList->Add(fHistProIntFlowVsM);
176
9cc9e6cc 177 fHistProDiffFlowPtEtaRP = new TProfile2D("FlowPro_VPtEtaRP_MCEP","FlowPro_VPtEtaRP_MCEP",iNbinsPt,dPtMin,dPtMax,iNbinsEta,dEtaMin,dEtaMax);
178 fHistProDiffFlowPtEtaRP->SetXTitle("P_{t}");
179 fHistProDiffFlowPtEtaRP->SetYTitle("#eta");
180 fHistList->Add(fHistProDiffFlowPtEtaRP);
45cdbef2 181
b7cb54d5 182 fHistProDiffFlowPtRP = new TProfile("FlowPro_VPtRP_MCEP","FlowPro_VPtRP_MCEP",iNbinsPt,dPtMin,dPtMax);
45cdbef2 183 fHistProDiffFlowPtRP->SetXTitle("P_{t}");
184 fHistProDiffFlowPtRP->SetYTitle("");
185 fHistList->Add(fHistProDiffFlowPtRP);
186
b7cb54d5 187 fHistProDiffFlowEtaRP = new TProfile("FlowPro_VetaRP_MCEP","FlowPro_VetaRP_MCEP",iNbinsEta,dEtaMin,dEtaMax);
45cdbef2 188 fHistProDiffFlowEtaRP->SetXTitle("#eta");
189 fHistProDiffFlowEtaRP->SetYTitle("");
190 fHistList->Add(fHistProDiffFlowEtaRP);
191
9cc9e6cc 192 fHistProDiffFlowPtEtaPOI = new TProfile2D("FlowPro_VPtEtaPOI_MCEP","FlowPro_VPtEtaPOI_MCEP",iNbinsPt,dPtMin,dPtMax,iNbinsEta,dEtaMin,dEtaMax);
193 fHistProDiffFlowPtEtaPOI->SetXTitle("P_{t}");
194 fHistProDiffFlowPtEtaPOI->SetYTitle("#eta");
195 fHistList->Add(fHistProDiffFlowPtEtaPOI);
196
b7cb54d5 197 fHistProDiffFlowPtPOI = new TProfile("FlowPro_VPtPOI_MCEP","FlowPro_VPtPOI_MCEP",iNbinsPt,dPtMin,dPtMax);
45cdbef2 198 fHistProDiffFlowPtPOI->SetXTitle("P_{t}");
199 fHistProDiffFlowPtPOI->SetYTitle("");
200 fHistList->Add(fHistProDiffFlowPtPOI);
201
b7cb54d5 202 fHistProDiffFlowEtaPOI = new TProfile("FlowPro_VetaPOI_MCEP","FlowPro_VetaPOI_MCEP",iNbinsEta,dEtaMin,dEtaMax);
45cdbef2 203 fHistProDiffFlowEtaPOI->SetXTitle("#eta");
204 fHistProDiffFlowEtaPOI->SetYTitle("");
4f678629 205 fHistList->Add(fHistProDiffFlowEtaPOI);
206
e4059f65 207 fHistSpreadOfFlow = new TH1D("fHistSpreadOfFlow","fHistSpreadOfFlow",1000,-1,1);
4f678629 208 fHistSpreadOfFlow->SetXTitle("v_{2}");
209 fHistSpreadOfFlow->SetYTitle("counts");
210 fHistList->Add(fHistSpreadOfFlow);
f1d945a1 211
212 fEventNumber = 0; //set number of events to zero
b3a29c75 213
4740c6b8 214 if(fEvaluateMixedHarmonics) this->BookObjectsForMixedHarmonics();
afa4af05 215
489d5531 216 TH1::AddDirectory(oldHistAddStatus);
f1d945a1 217}
218
219//-----------------------------------------------------------------------
220
d7671632 221void AliFlowAnalysisWithMCEventPlane::Make(AliFlowEventSimple* anEvent) {
f1d945a1 222
223 //Calculate v2 from the MC reaction plane
8232a5ec 224 if (anEvent) {
d7671632 225
226 // get the MC reaction plane angle
227 Double_t aRP = anEvent->GetMCReactionPlaneAngle();
f1d945a1 228 //fill control histograms
8232a5ec 229 fCommonHists->FillControlHistograms(anEvent);
f1d945a1 230
231 //get the Q vector from the FlowEvent
afa4af05 232 AliFlowVector vQ = anEvent->GetQ(fHarmonic);
00731146 233 //cout<<"vQ.Mod() = " << vQ.Mod() << endl;
f1d945a1 234 //for chi calculation:
00731146 235 *fQsum += vQ;
f1d945a1 236 //cout<<"fQsum.Mod() = "<<fQsum.Mod()<<endl;
00731146 237 fQ2sum += vQ.Mod2();
9d062fe3 238 //cout<<"fQ2sum = "<<fQ2sum<<endl;
f1d945a1 239
00731146 240 fHistRP->Fill(aRP);
45cdbef2 241
242 Double_t dPhi = 0.;
afa4af05 243 Double_t dv = 0.;
45cdbef2 244 Double_t dPt = 0.;
245 Double_t dEta = 0.;
4f678629 246 //Double_t dPi = TMath::Pi();
247
248 // profile to calculate flow e-b-y:
249 TProfile *flowEBE = new TProfile("flowEBE","flowEBE",1,0,1);
250
f1d945a1 251 //calculate flow
252 //loop over the tracks of the event
00731146 253 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
10a70cd5 254 Int_t iNumberOfRPs = anEvent->GetEventNSelTracksRP();
00731146 255 for (Int_t i=0;i<iNumberOfTracks;i++)
f1d945a1 256 {
00731146 257 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
258 if (pTrack){
b7cb54d5 259 if (pTrack->InRPSelection()){
45cdbef2 260 dPhi = pTrack->Phi();
afa4af05 261 dv = TMath::Cos(fHarmonic*(dPhi-aRP));
4f678629 262 dPt = pTrack->Pt();
263 dEta = pTrack->Eta();
10a70cd5 264 //reference flow:
afa4af05 265 fHistProIntFlow->Fill(0.,dv);
10a70cd5 266 //reference flow versus multiplicity:
267 fHistProIntFlowVsM->Fill(iNumberOfRPs+0.5,dv);
268 //reference flow e-b-e:
afa4af05 269 flowEBE->Fill(0.,dv);
9cc9e6cc 270 //differential flow (Pt, Eta, RP):
afa4af05 271 fHistProDiffFlowPtEtaRP->Fill(dPt,dEta,dv,1.);
45cdbef2 272 //differential flow (Pt, RP):
afa4af05 273 fHistProDiffFlowPtRP->Fill(dPt,dv,1.);
45cdbef2 274 //differential flow (Eta, RP):
afa4af05 275 fHistProDiffFlowEtaRP->Fill(dEta,dv,1.);
45cdbef2 276 }
b7cb54d5 277 if (pTrack->InPOISelection()) {
45cdbef2 278 dPhi = pTrack->Phi();
00731146 279 //if (dPhi<0.) dPhi+=2*TMath::Pi();
f1d945a1 280 //calculate flow v2:
afa4af05 281 dv = TMath::Cos(fHarmonic*(dPhi-aRP));
b7cb54d5 282 dPt = pTrack->Pt();
45cdbef2 283 dEta = pTrack->Eta();
9cc9e6cc 284 //differential flow (Pt, Eta, POI):
afa4af05 285 fHistProDiffFlowPtEtaPOI->Fill(dPt,dEta,dv,1.);
45cdbef2 286 //differential flow (Pt, POI):
afa4af05 287 fHistProDiffFlowPtPOI->Fill(dPt,dv,1.);
45cdbef2 288 //differential flow (Eta, POI):
afa4af05 289 fHistProDiffFlowEtaPOI->Fill(dEta,dv,1.);
45cdbef2 290 }
f1d945a1 291 }//track selected
292 }//loop over tracks
293
294 fEventNumber++;
deebd72f 295 // cout<<"@@@@@ "<<fEventNumber<<" events processed"<<endl;
4f678629 296
297 // store flow value for this event:
e4059f65 298 fHistSpreadOfFlow->Fill(flowEBE->GetBinContent(1),flowEBE->GetBinEntries(1));
4f678629 299 delete flowEBE;
b3a29c75 300
4740c6b8 301 if(fEvaluateMixedHarmonics) EvaluateMixedHarmonics(anEvent);
b3a29c75 302 }
205ff969 303}
304 //--------------------------------------------------------------------
305
306void AliFlowAnalysisWithMCEventPlane::GetOutputHistograms(TList *outputListHistos) {
307 // get the pointers to all output histograms before calling Finish()
308 if (outputListHistos) {
309 //Get the common histograms from the output list
310 AliFlowCommonHist *pCommonHists = dynamic_cast<AliFlowCommonHist*>
311 (outputListHistos->FindObject("AliFlowCommonHistMCEP"));
312 AliFlowCommonHistResults *pCommonHistResults =
313 dynamic_cast<AliFlowCommonHistResults*>
314 (outputListHistos->FindObject("AliFlowCommonHistResultsMCEP"));
315
316 TProfile *pHistProIntFlow = dynamic_cast<TProfile*>
317 (outputListHistos->FindObject("FlowPro_V_MCEP"));
318
319 TProfile2D *pHistProDiffFlowPtEtaRP = dynamic_cast<TProfile2D*>
320 (outputListHistos->FindObject("FlowPro_VPtEtaRP_MCEP"));
321
322 TProfile *pHistProDiffFlowPtRP = dynamic_cast<TProfile*>
323 (outputListHistos->FindObject("FlowPro_VPtRP_MCEP"));
324
325 TProfile *pHistProDiffFlowEtaRP = dynamic_cast<TProfile*>
326 (outputListHistos->FindObject("FlowPro_VetaRP_MCEP"));
327
328 TProfile2D *pHistProDiffFlowPtEtaPOI = dynamic_cast<TProfile2D*>
329 (outputListHistos->FindObject("FlowPro_VPtEtaPOI_MCEP"));
330
331 TProfile *pHistProDiffFlowPtPOI = dynamic_cast<TProfile*>
332 (outputListHistos->FindObject("FlowPro_VPtPOI_MCEP"));
333
334 TProfile *pHistProDiffFlowEtaPOI = dynamic_cast<TProfile*>
335 (outputListHistos->FindObject("FlowPro_VetaPOI_MCEP"));
336
337 if (pCommonHists && pCommonHistResults && pHistProIntFlow &&
338 pHistProDiffFlowPtRP && pHistProDiffFlowEtaRP &&
339 pHistProDiffFlowPtPOI && pHistProDiffFlowEtaPOI) {
340 this->SetCommonHists(pCommonHists);
341 this->SetCommonHistsRes(pCommonHistResults);
342 this->SetHistProIntFlow(pHistProIntFlow);
343 this->SetHistProDiffFlowPtEtaRP(pHistProDiffFlowPtEtaRP);
344 this->SetHistProDiffFlowPtRP(pHistProDiffFlowPtRP);
345 this->SetHistProDiffFlowEtaRP(pHistProDiffFlowEtaRP);
346 this->SetHistProDiffFlowPtEtaPOI(pHistProDiffFlowPtEtaPOI);
347 this->SetHistProDiffFlowPtPOI(pHistProDiffFlowPtPOI);
348 this->SetHistProDiffFlowEtaPOI(pHistProDiffFlowEtaPOI);
349 } else {
350 cout<<"WARNING: Histograms needed to run Finish() are not accessible!"<<endl; }
351
352 //fListHistos->Print();
4740c6b8 353
354 TList *pMixedHarmonicsList = dynamic_cast<TList*>
355 (outputListHistos->FindObject("Mixed Harmonics"));
356 if(pMixedHarmonicsList) {this->GetOutputHistoramsForMixedHarmonics(pMixedHarmonicsList);}
357
205ff969 358 } else { cout << "histogram list pointer is empty" << endl;}
359
f1d945a1 360}
361
4740c6b8 362//--------------------------------------------------------------------
363
364void AliFlowAnalysisWithMCEventPlane::GetOutputHistoramsForMixedHarmonics(TList *mixedHarmonicsList)
365{
366 // Get pointers to all objects relevant for mixed harmonics study.
367
368 if(mixedHarmonicsList)
369 {
370 // ...
371 } else
372 {
373 cout<<endl;
374 cout<<"WARNING (MCEP): mixedHarmonicsList in NULL in MCEP::GetOutputHistoramsForMixedHarmonics() !!!! "<<endl;
375 cout<<endl;
376 }
377
378} // end of void AliFlowAnalysisWithMCEventPlane::GetOutputHistoramsForMixedHarmonics(TList *mixedHarmonicsList)
379
380//--------------------------------------------------------------------
381
f1d945a1 382void AliFlowAnalysisWithMCEventPlane::Finish() {
383
384 //*************make histograms etc.
385 if (fDebug) cout<<"AliFlowAnalysisWithMCEventPlane::Terminate()"<<endl;
9d062fe3 386
bee2efdc 387 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
388 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
afa4af05 389
390 // access harmonic:
489d5531 391 if(fCommonHists && fCommonHists->GetHarmonic())
afa4af05 392 {
393 fHarmonic = (Int_t)(fCommonHists->GetHarmonic())->GetBinContent(1); // to be improved (moved somewhere else?)
394 }
45cdbef2 395
10a70cd5 396 //reference flow :
3963f25c 397 Double_t dV = fHistProIntFlow->GetBinContent(1);
398 Double_t dErrV = fHistProIntFlow->GetBinError(1); // to be improved (treatment of errors for non-Gaussian distribution needed!)
10a70cd5 399 //fill reference flow:
3963f25c 400 fCommonHistsRes->FillIntegratedFlow(dV,dErrV);
afa4af05 401 cout<<"dV"<<fHarmonic<<"{MC} is "<<dV<<" +- "<<dErrV<<endl;
65af4339 402
3963f25c 403 //RP:
0d11c335 404 TH1F* fHistPtRP = NULL;
ca5f47e7 405 if(fCommonHists && fCommonHists->GetHistPtRP())
0d11c335 406 {
407 fHistPtRP = fCommonHists->GetHistPtRP();
408 }
3963f25c 409 Double_t dYieldPtRP = 0.;
410 Double_t dVRP = 0.;
411 Double_t dErrVRP = 0.;
412 Double_t dSumRP = 0.;
413 //differential flow (RP, Pt):
45cdbef2 414 Double_t dvPtRP = 0.;
415 Double_t dErrvPtRP = 0.;
afa4af05 416 for(Int_t b=1;b<=iNbinsPt;b++)
45cdbef2 417 {
3963f25c 418 dvPtRP = fHistProDiffFlowPtRP->GetBinContent(b);
419 dErrvPtRP = fHistProDiffFlowPtRP->GetBinError(b);//to be improved (treatment of errors for non-Gaussian distribution needed!)
420 fCommonHistsRes->FillDifferentialFlowPtRP(b, dvPtRP, dErrvPtRP);
421 if(fHistPtRP){
422 //integrated flow (RP)
423 dYieldPtRP = fHistPtRP->GetBinContent(b);
424 dVRP += dvPtRP*dYieldPtRP;
425 dSumRP += dYieldPtRP;
426 //error on integrated flow
427 dErrVRP += dYieldPtRP*dYieldPtRP*dErrvPtRP*dErrvPtRP;
428 }
45cdbef2 429 }
67e575b6 430
431 if (!(TMath::AreEqualAbs(dSumRP, 0.0, 1e-10)) ) {
3963f25c 432 dVRP /= dSumRP; //because pt distribution should be normalised
433 dErrVRP /= (dSumRP*dSumRP);
434 dErrVRP = TMath::Sqrt(dErrVRP);
435 }
436 // fill integrated flow (RP):
437 fCommonHistsRes->FillIntegratedFlowRP(dVRP,dErrVRP);
afa4af05 438 cout<<"dV"<<fHarmonic<<"{MC} (RP) is "<<dVRP<<" +- "<<dErrVRP<<endl;
65af4339 439
3963f25c 440 //differential flow (RP, Eta):
45cdbef2 441 Double_t dvEtaRP = 0.;
442 Double_t dErrvEtaRP = 0.;
afa4af05 443 for(Int_t b=1;b<=iNbinsEta;b++)
45cdbef2 444 {
3963f25c 445 dvEtaRP = fHistProDiffFlowEtaRP->GetBinContent(b);
446 dErrvEtaRP = fHistProDiffFlowEtaRP->GetBinError(b);//to be improved (treatment of errors for non-Gaussian distribution needed!)
447 fCommonHistsRes->FillDifferentialFlowEtaRP(b, dvEtaRP, dErrvEtaRP);
45cdbef2 448 }
449
450 //POI:
ca5f47e7 451 TH1F* fHistPtPOI = NULL;
452 if(fCommonHists && fCommonHists->GetHistPtPOI())
453 {
454 fHistPtPOI = fCommonHists->GetHistPtPOI();
455 }
3963f25c 456 Double_t dYieldPtPOI = 0.;
457 Double_t dVPOI = 0.;
458 Double_t dErrVPOI = 0.;
459 Double_t dSumPOI = 0.;
afa4af05 460 Double_t dvproPtPOI = 0.;
3963f25c 461 Double_t dErrdifcombPtPOI = 0.;
afa4af05 462 Double_t dvproEtaPOI = 0.;
3963f25c 463 Double_t dErrdifcombEtaPOI = 0.;
45cdbef2 464 //Pt:
b7cb54d5 465 if(fHistProDiffFlowPtPOI) {
afa4af05 466 for(Int_t b=1;b<=iNbinsPt;b++){
467 dvproPtPOI = fHistProDiffFlowPtPOI->GetBinContent(b);
3963f25c 468 dErrdifcombPtPOI = fHistProDiffFlowPtPOI->GetBinError(b);//to be improved (treatment of errors for non-Gaussian distribution needed!)
f1d945a1 469 //fill TH1D
afa4af05 470 fCommonHistsRes->FillDifferentialFlowPtPOI(b, dvproPtPOI, dErrdifcombPtPOI);
3963f25c 471 if (fHistPtPOI){
65af4339 472 //integrated flow (POI)
3963f25c 473 dYieldPtPOI = fHistPtPOI->GetBinContent(b);
afa4af05 474 dVPOI += dvproPtPOI*dYieldPtPOI;
3963f25c 475 dSumPOI += dYieldPtPOI;
f1d945a1 476 //error on integrated flow
3963f25c 477 dErrVPOI += dYieldPtPOI*dYieldPtPOI*dErrdifcombPtPOI*dErrdifcombPtPOI;
f1d945a1 478 }
65af4339 479 }//end of for(Int_t b=0;b<iNbinsPt;b++)
45cdbef2 480 } else { cout<<"fHistProFlow is NULL"<<endl; }
67e575b6 481
482 if (!(TMath::AreEqualAbs(dSumPOI, 0.0, 1e-10)) ) {
3963f25c 483 dVPOI /= dSumPOI; //because pt distribution should be normalised
484 dErrVPOI /= (dSumPOI*dSumPOI);
485 dErrVPOI = TMath::Sqrt(dErrVPOI);
65af4339 486 }
afa4af05 487 cout<<"dV"<<fHarmonic<<"{MC} (POI) is "<<dVPOI<<" +- "<<dErrVPOI<<endl;
3963f25c 488
489 fCommonHistsRes->FillIntegratedFlowPOI(dVPOI,dErrVPOI);
45cdbef2 490
45cdbef2 491 //Eta:
492 if(fHistProDiffFlowEtaPOI)
493 {
afa4af05 494 for(Int_t b=1;b<=iNbinsEta;b++)
45cdbef2 495 {
afa4af05 496 dvproEtaPOI = fHistProDiffFlowEtaPOI->GetBinContent(b);
3963f25c 497 dErrdifcombEtaPOI = fHistProDiffFlowEtaPOI->GetBinError(b);//to be improved (treatment of errors for non-Gaussian distribution needed!)
45cdbef2 498 //fill common hist results:
afa4af05 499 fCommonHistsRes->FillDifferentialFlowEtaPOI(b, dvproEtaPOI, dErrdifcombEtaPOI);
45cdbef2 500 }
65af4339 501 }
3963f25c 502
503 cout<<endl;
b7cb54d5 504 //cout<<".....finished"<<endl;
9d062fe3 505}
f1d945a1 506
4740c6b8 507//-----------------------------------------------------------------------
508
509void AliFlowAnalysisWithMCEventPlane::InitalizeArraysForMixedHarmonics()
b3a29c75 510{
4740c6b8 511 // Iinitialize all arrays for mixed harmonics.
512
513 for(Int_t cs=0;cs<2;cs++) // cos/sin
514 {
515 fPairCorrelator[cs] = NULL;
516 fPairCorrelatorVsM[cs] = NULL;
517 for(Int_t sd=0;sd<2;sd++) // pt sum/difference
518 {
519 fPairCorrelatorVsPtSumDiff[cs][sd] = NULL;
520 }
521 }
522
523} // end of void InitalizeArraysForMixedHarmonics()
524
525//-----------------------------------------------------------------------
526
527void AliFlowAnalysisWithMCEventPlane::BookObjectsForMixedHarmonics()
528{
529 // Book all objects needed for mixed harmonics.
b3a29c75 530
4740c6b8 531 // List holding all objects relevant for mixed harmonics:
532 fMixedHarmonicsList->SetName("Mixed Harmonics");
533 fMixedHarmonicsList->SetOwner(kTRUE);
534 fHistList->Add(fMixedHarmonicsList);
f1d945a1 535
4740c6b8 536 // Profile holding settings relevant for mixed harmonics:
537 TString mixedHarmonicsSettingsName = "fMixedHarmonicsSettings";
538 fMixedHarmonicsSettings = new TProfile(mixedHarmonicsSettingsName.Data(),"Settings for Mixed Harmonics",4,0,4);
539 //fMixedHarmonicsSettings->GetXaxis()->SetLabelSize(0.025);
540 fMixedHarmonicsSettings->GetXaxis()->SetBinLabel(1,"fEvaluateMixedHarmonics");
541 fMixedHarmonicsSettings->Fill(0.5,(Int_t)fEvaluateMixedHarmonics);
542 fMixedHarmonicsSettings->GetXaxis()->SetBinLabel(2,"fNinCorrelator");
543 fMixedHarmonicsSettings->Fill(1.5,(Int_t)fNinCorrelator);
544 fMixedHarmonicsSettings->GetXaxis()->SetBinLabel(3,"fMinCorrelator");
545 fMixedHarmonicsSettings->Fill(2.5,(Int_t)fMinCorrelator);
546 fMixedHarmonicsSettings->GetXaxis()->SetBinLabel(4,"x in #phi_{pair}"); // phi_{pair} = x*phi1+(1-x)*phi2
547 fMixedHarmonicsSettings->Fill(3.5,fXinPairAngle);
548 fMixedHarmonicsList->Add(fMixedHarmonicsSettings);
9d062fe3 549
4740c6b8 550 // Profiles used to calculate <cos[m*phi_{pair}-n*RP]> and <sin[m*phi_{pair}-n*RP]>, where phi_{pair} = x*phi1+(1-x)*phi2:
b3a29c75 551 TString cosSinFlag[2] = {"Cos","Sin"};
4740c6b8 552 TString cosSinTitleFlag[2] = {"cos[m#phi_{pair}-n#psi_{RP}]","sin[m#phi_{pair}-n#psi_{RP}]"};
553 if(fNinCorrelator == 2 && fMinCorrelator == 2 && TMath::Abs(fXinPairAngle-0.5)<1.e-44) // default values
554 {
555 cosSinTitleFlag[0] = "cos[#phi_{1}+#phi_{2}-2#psi_{RP})]";
556 cosSinTitleFlag[1] = "sin[#phi_{1}+#phi_{2}-2#psi_{RP})]";
557 }
558 TString psdFlag[2] = {"Sum","Diff"};
559 TString psdTitleFlag[2] = {"(p_{t,1}+p_{t,2})/2","#left|p_{t,1}-p_{t,2}#right|"};
b3a29c75 560 TString pairCorrelatorName = "fPairCorrelator";
4740c6b8 561 TString pairCorrelatorVsMName = "fPairCorrelatorVsM";
562 TString pairCorrelatorVsPtSumDiffName = "fPairCorrelatorVsPt";
563 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
564 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
565 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
b3a29c75 566 for(Int_t cs=0;cs<2;cs++)
567 {
4740c6b8 568 fPairCorrelator[cs] = new TProfile(Form("%s, %s",pairCorrelatorName.Data(),cosSinFlag[cs].Data()),cosSinTitleFlag[cs].Data(),1,0.,1.);
b3a29c75 569 fPairCorrelator[cs]->GetXaxis()->SetBinLabel(1,cosSinTitleFlag[cs].Data());
4740c6b8 570 fMixedHarmonicsList->Add(fPairCorrelator[cs]);
571
572 fPairCorrelatorVsM[cs] = new TProfile(Form("%s, %s",pairCorrelatorVsMName.Data(),cosSinFlag[cs].Data()),cosSinTitleFlag[cs].Data(),fnBinsMult,fMinMult,fMaxMult);
573 fPairCorrelatorVsM[cs]->GetXaxis()->SetTitle("# of RPs");
574 fMixedHarmonicsList->Add(fPairCorrelatorVsM[cs]);
575
576 for(Int_t sd=0;sd<2;sd++)
577 {
578 fPairCorrelatorVsPtSumDiff[cs][sd] = new TProfile(Form("%s%s, %s",pairCorrelatorVsPtSumDiffName.Data(),psdFlag[sd].Data(),cosSinFlag[cs].Data()),cosSinTitleFlag[cs].Data(),iNbinsPt,dPtMin,dPtMax);
579 fPairCorrelatorVsPtSumDiff[cs][sd]->GetXaxis()->SetTitle(psdTitleFlag[sd].Data());
580 fMixedHarmonicsList->Add(fPairCorrelatorVsPtSumDiff[cs][sd]);
581 } // end of for(Int_t sd=0;sd<2;sd++)
582 } // end of for(Int_t cs=0;cs<2;cs++)
b3a29c75 583
4740c6b8 584} // end of void AliFlowAnalysisWithMCEventPlane::BookObjectsForMixedHarmonics()
b3a29c75 585
4740c6b8 586//-----------------------------------------------------------------------
587
588void AliFlowAnalysisWithMCEventPlane::EvaluateMixedHarmonics(AliFlowEventSimple* anEvent)
b3a29c75 589{
4740c6b8 590 // Evaluate correlators relevant for the mixed harmonics.
b3a29c75 591
592 // Get the MC reaction plane angle:
4740c6b8 593 Double_t dReactionPlane = anEvent->GetMCReactionPlaneAngle();
b3a29c75 594 // Get the number of tracks:
595 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
4740c6b8 596 Int_t nRP = anEvent->GetEventNSelTracksRP(); // number of Reference Particles
b3a29c75 597 AliFlowTrackSimple *pTrack = NULL;
598 Double_t dPhi1 = 0.;
599 Double_t dPhi2 = 0.;
4740c6b8 600 Double_t dPt1 = 0.;
601 Double_t dPt2 = 0.;
602 Double_t n = fNinCorrelator; // shortcut
603 Double_t m = fMinCorrelator; // shortcut
b3a29c75 604 Double_t x = fXinPairAngle; // shortcut
b3a29c75 605 for(Int_t i=0;i<iNumberOfTracks;i++)
606 {
607 pTrack = anEvent->GetTrack(i);
608 if(pTrack && pTrack->InRPSelection())
609 {
610 dPhi1 = pTrack->Phi();
4740c6b8 611 dPt1 = pTrack->Pt();
b3a29c75 612 }
613 for(Int_t j=0;j<iNumberOfTracks;j++)
614 {
615 if(j==i) continue;
616 pTrack = anEvent->GetTrack(j);
4740c6b8 617 if(pTrack && pTrack->InPOISelection())
b3a29c75 618 {
619 dPhi2 = pTrack->Phi();
4740c6b8 620 dPt2 = pTrack->Pt();
b3a29c75 621 }
622 Double_t dPhiPair = x*dPhi1+(1.-x)*dPhi2;
4740c6b8 623 Double_t dPtSum = 0.5*(dPt1+dPt2);
624 Double_t dPtDiff = TMath::Abs(dPt1-dPt2);
625 fPairCorrelator[0]->Fill(0.5,TMath::Cos(m*dPhiPair-n*dReactionPlane),1.);
626 fPairCorrelator[1]->Fill(0.5,TMath::Sin(m*dPhiPair-n*dReactionPlane),1.);
627 fPairCorrelatorVsM[0]->Fill(nRP+0.5,TMath::Cos(m*dPhiPair-n*dReactionPlane),1.);
628 fPairCorrelatorVsM[1]->Fill(nRP+0.5,TMath::Sin(m*dPhiPair-n*dReactionPlane),1.);
629 fPairCorrelatorVsPtSumDiff[0][0]->Fill(dPtSum,TMath::Cos(m*dPhiPair-n*dReactionPlane),1.);
630 fPairCorrelatorVsPtSumDiff[1][0]->Fill(dPtSum,TMath::Sin(m*dPhiPair-n*dReactionPlane),1.);
631 fPairCorrelatorVsPtSumDiff[0][1]->Fill(dPtDiff,TMath::Cos(m*dPhiPair-n*dReactionPlane),1.);
632 fPairCorrelatorVsPtSumDiff[1][1]->Fill(dPtDiff,TMath::Sin(m*dPhiPair-n*dReactionPlane),1.);
b3a29c75 633 } // end of for(Int_t j=i+1;j<iNumberOfTracks;j++)
634 } // end of for(Int_t i=0;i<iNumberOfTracks;i++)
635
4740c6b8 636} // end of void AliFlowAnalysisWithMCEventPlane::EvaluateMixedHarmonics()
637
b3a29c75 638
639