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 **************************************************************************/
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)
21 #define AliFlowAnalysisWithMCEventPlane_cxx
23 #include "Riostream.h"
26 #include "TProfile2D.h"
32 #include "AliFlowCommonConstants.h"
33 #include "AliFlowEventSimple.h"
34 #include "AliFlowTrackSimple.h"
35 #include "AliFlowCommonHist.h"
36 #include "AliFlowCommonHistResults.h"
37 #include "AliFlowAnalysisWithMCEventPlane.h"
38 #include "AliFlowVector.h"
44 ClassImp(AliFlowAnalysisWithMCEventPlane)
46 //-----------------------------------------------------------------------
48 AliFlowAnalysisWithMCEventPlane::AliFlowAnalysisWithMCEventPlane():
55 fCommonHistsRes(NULL),
57 fHistProIntFlow(NULL),
58 fHistProIntFlowVsM(NULL),
59 fHistProDiffFlowPtEtaRP(NULL),
60 fHistProDiffFlowPtRP(NULL),
61 fHistProDiffFlowEtaRP(NULL),
62 fHistProDiffFlowPtEtaPOI(NULL),
63 fHistProDiffFlowPtPOI(NULL),
64 fHistProDiffFlowEtaPOI(NULL),
65 fHistSpreadOfFlow(NULL),
67 fMixedHarmonicsList(NULL),
68 fEvaluateMixedHarmonics(kFALSE),
69 fMixedHarmonicsSettings(NULL),
79 fHistList = new TList();
81 fQsum = new TVector2; // flow vector sum
83 fMixedHarmonicsList = new TList();
84 this->InitalizeArraysForMixedHarmonics();
88 //-----------------------------------------------------------------------
90 AliFlowAnalysisWithMCEventPlane::~AliFlowAnalysisWithMCEventPlane()
97 //-----------------------------------------------------------------------
99 void AliFlowAnalysisWithMCEventPlane::WriteHistograms(TString* outputFileName)
101 //store the final results in output .root file
102 TFile *output = new TFile(outputFileName->Data(),"RECREATE");
103 //output->WriteObject(fHistList, "cobjMCEP","SingleKey");
104 fHistList->SetName("cobjMCEP");
105 fHistList->SetOwner(kTRUE);
106 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
110 //-----------------------------------------------------------------------
112 void AliFlowAnalysisWithMCEventPlane::WriteHistograms(TString outputFileName)
114 //store the final results in output .root file
115 TFile *output = new TFile(outputFileName.Data(),"RECREATE");
116 //output->WriteObject(fHistList, "cobjMCEP","SingleKey");
117 fHistList->SetName("cobjMCEP");
118 fHistList->SetOwner(kTRUE);
119 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
123 //-----------------------------------------------------------------------
125 void AliFlowAnalysisWithMCEventPlane::WriteHistograms(TDirectoryFile *outputFileName)
127 //store the final results in output .root file
128 fHistList->SetName("cobjMCEP");
129 fHistList->SetOwner(kTRUE);
130 outputFileName->Add(fHistList);
131 outputFileName->Write(outputFileName->GetName(), TObject::kSingleKey);
134 //-----------------------------------------------------------------------
135 void AliFlowAnalysisWithMCEventPlane::Init() {
137 //Define all histograms
138 cout<<"---Analysis with the real MC Event Plane---"<<endl;
140 //save old value and prevent histograms from being added to directory
141 //to avoid name clashes in case multiple analaysis objects are used
143 Bool_t oldHistAddStatus = TH1::AddDirectoryStatus();
144 TH1::AddDirectory(kFALSE);
146 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
147 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
148 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
150 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
151 Double_t dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();
152 Double_t dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
154 fCommonHists = new AliFlowCommonHist("AliFlowCommonHistMCEP");
155 fHistList->Add(fCommonHists);
156 fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsMCEP","",fHarmonic);
157 fHistList->Add(fCommonHistsRes);
159 // store harmonic in common control histogram:
160 (fCommonHists->GetHarmonic())->Fill(0.5,fHarmonic);
162 fHistRP = new TH1F("Flow_RP_MCEP","Flow_RP_MCEP",100,0.,3.14);
163 fHistRP->SetXTitle("Reaction Plane Angle");
164 fHistRP->SetYTitle("Counts");
165 fHistList->Add(fHistRP);
167 fHistProIntFlow = new TProfile("FlowPro_V_MCEP","FlowPro_V_MCEP",1,0.,1.);
168 fHistProIntFlow->SetLabelSize(0.06);
169 (fHistProIntFlow->GetXaxis())->SetBinLabel(1,"v_{n}{MCEP}");
170 fHistProIntFlow->SetYTitle("");
171 fHistList->Add(fHistProIntFlow);
173 fHistProIntFlowVsM = new TProfile("FlowPro_VsM_MCEP","FlowPro_VsM_MCEP",10000,0.,10000.); // to be improved - hardwired 10000
174 //fHistProIntFlowVsM->SetLabelSize(0.06);
175 (fHistProIntFlowVsM->GetXaxis())->SetTitle("M");
176 fHistProIntFlowVsM->SetYTitle("");
177 fHistList->Add(fHistProIntFlowVsM);
179 fHistProDiffFlowPtEtaRP = new TProfile2D("FlowPro_VPtEtaRP_MCEP","FlowPro_VPtEtaRP_MCEP",iNbinsPt,dPtMin,dPtMax,iNbinsEta,dEtaMin,dEtaMax);
180 fHistProDiffFlowPtEtaRP->SetXTitle("P_{t}");
181 fHistProDiffFlowPtEtaRP->SetYTitle("#eta");
182 fHistList->Add(fHistProDiffFlowPtEtaRP);
184 fHistProDiffFlowPtRP = new TProfile("FlowPro_VPtRP_MCEP","FlowPro_VPtRP_MCEP",iNbinsPt,dPtMin,dPtMax);
185 fHistProDiffFlowPtRP->SetXTitle("P_{t}");
186 fHistProDiffFlowPtRP->SetYTitle("");
187 fHistList->Add(fHistProDiffFlowPtRP);
189 fHistProDiffFlowEtaRP = new TProfile("FlowPro_VetaRP_MCEP","FlowPro_VetaRP_MCEP",iNbinsEta,dEtaMin,dEtaMax);
190 fHistProDiffFlowEtaRP->SetXTitle("#eta");
191 fHistProDiffFlowEtaRP->SetYTitle("");
192 fHistList->Add(fHistProDiffFlowEtaRP);
194 fHistProDiffFlowPtEtaPOI = new TProfile2D("FlowPro_VPtEtaPOI_MCEP","FlowPro_VPtEtaPOI_MCEP",iNbinsPt,dPtMin,dPtMax,iNbinsEta,dEtaMin,dEtaMax);
195 fHistProDiffFlowPtEtaPOI->SetXTitle("P_{t}");
196 fHistProDiffFlowPtEtaPOI->SetYTitle("#eta");
197 fHistList->Add(fHistProDiffFlowPtEtaPOI);
199 fHistProDiffFlowPtPOI = new TProfile("FlowPro_VPtPOI_MCEP","FlowPro_VPtPOI_MCEP",iNbinsPt,dPtMin,dPtMax);
200 fHistProDiffFlowPtPOI->SetXTitle("P_{t}");
201 fHistProDiffFlowPtPOI->SetYTitle("");
202 fHistList->Add(fHistProDiffFlowPtPOI);
204 fHistProDiffFlowEtaPOI = new TProfile("FlowPro_VetaPOI_MCEP","FlowPro_VetaPOI_MCEP",iNbinsEta,dEtaMin,dEtaMax);
205 fHistProDiffFlowEtaPOI->SetXTitle("#eta");
206 fHistProDiffFlowEtaPOI->SetYTitle("");
207 fHistList->Add(fHistProDiffFlowEtaPOI);
209 fHistSpreadOfFlow = new TH1D("fHistSpreadOfFlow","fHistSpreadOfFlow",1000,-1,1);
210 fHistSpreadOfFlow->SetXTitle("v_{2}");
211 fHistSpreadOfFlow->SetYTitle("counts");
212 fHistList->Add(fHistSpreadOfFlow);
214 fEventNumber = 0; //set number of events to zero
216 if(fEvaluateMixedHarmonics) this->BookObjectsForMixedHarmonics();
218 TH1::AddDirectory(oldHistAddStatus);
221 //-----------------------------------------------------------------------
223 void AliFlowAnalysisWithMCEventPlane::Make(AliFlowEventSimple* anEvent) {
225 //Calculate v2 from the MC reaction plane
228 // get the MC reaction plane angle
229 Double_t aRP = anEvent->GetMCReactionPlaneAngle();
230 //fill control histograms
231 fCommonHists->FillControlHistograms(anEvent);
233 //get the Q vector from the FlowEvent
234 AliFlowVector vQ = anEvent->GetQ(fHarmonic);
235 //cout<<"vQ.Mod() = " << vQ.Mod() << endl;
236 //for chi calculation:
238 //cout<<"fQsum.Mod() = "<<fQsum.Mod()<<endl;
240 //cout<<"fQ2sum = "<<fQ2sum<<endl;
248 //Double_t dPi = TMath::Pi();
250 // profile to calculate flow e-b-y:
251 TProfile *flowEBE = new TProfile("flowEBE","flowEBE",1,0,1);
254 //loop over the tracks of the event
255 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
256 Int_t iNumberOfRPs = anEvent->GetEventNSelTracksRP();
257 for (Int_t i=0;i<iNumberOfTracks;i++)
259 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
261 if (pTrack->InRPSelection()){
262 dPhi = pTrack->Phi();
263 dv = TMath::Cos(fHarmonic*(dPhi-aRP));
265 dEta = pTrack->Eta();
267 fHistProIntFlow->Fill(0.,dv);
268 //reference flow versus multiplicity:
269 fHistProIntFlowVsM->Fill(iNumberOfRPs+0.5,dv);
270 //reference flow e-b-e:
271 flowEBE->Fill(0.,dv);
272 //differential flow (Pt, Eta, RP):
273 fHistProDiffFlowPtEtaRP->Fill(dPt,dEta,dv,1.);
274 //differential flow (Pt, RP):
275 fHistProDiffFlowPtRP->Fill(dPt,dv,1.);
276 //differential flow (Eta, RP):
277 fHistProDiffFlowEtaRP->Fill(dEta,dv,1.);
279 if (pTrack->InPOISelection()) {
280 dPhi = pTrack->Phi();
281 //if (dPhi<0.) dPhi+=2*TMath::Pi();
283 dv = TMath::Cos(fHarmonic*(dPhi-aRP));
285 dEta = pTrack->Eta();
286 //differential flow (Pt, Eta, POI):
287 fHistProDiffFlowPtEtaPOI->Fill(dPt,dEta,dv,1.);
288 //differential flow (Pt, POI):
289 fHistProDiffFlowPtPOI->Fill(dPt,dv,1.);
290 //differential flow (Eta, POI):
291 fHistProDiffFlowEtaPOI->Fill(dEta,dv,1.);
297 // cout<<"@@@@@ "<<fEventNumber<<" events processed"<<endl;
299 // store flow value for this event:
300 fHistSpreadOfFlow->Fill(flowEBE->GetBinContent(1),flowEBE->GetBinEntries(1));
303 if(fEvaluateMixedHarmonics) EvaluateMixedHarmonics(anEvent);
306 //--------------------------------------------------------------------
308 void AliFlowAnalysisWithMCEventPlane::GetOutputHistograms(TList *outputListHistos) {
309 // get the pointers to all output histograms before calling Finish()
310 if (outputListHistos) {
311 //Get the common histograms from the output list
312 AliFlowCommonHist *pCommonHists = dynamic_cast<AliFlowCommonHist*>
313 (outputListHistos->FindObject("AliFlowCommonHistMCEP"));
314 AliFlowCommonHistResults *pCommonHistResults =
315 dynamic_cast<AliFlowCommonHistResults*>
316 (outputListHistos->FindObject("AliFlowCommonHistResultsMCEP"));
318 TProfile *pHistProIntFlow = dynamic_cast<TProfile*>
319 (outputListHistos->FindObject("FlowPro_V_MCEP"));
321 TProfile2D *pHistProDiffFlowPtEtaRP = dynamic_cast<TProfile2D*>
322 (outputListHistos->FindObject("FlowPro_VPtEtaRP_MCEP"));
324 TProfile *pHistProDiffFlowPtRP = dynamic_cast<TProfile*>
325 (outputListHistos->FindObject("FlowPro_VPtRP_MCEP"));
327 TProfile *pHistProDiffFlowEtaRP = dynamic_cast<TProfile*>
328 (outputListHistos->FindObject("FlowPro_VetaRP_MCEP"));
330 TProfile2D *pHistProDiffFlowPtEtaPOI = dynamic_cast<TProfile2D*>
331 (outputListHistos->FindObject("FlowPro_VPtEtaPOI_MCEP"));
333 TProfile *pHistProDiffFlowPtPOI = dynamic_cast<TProfile*>
334 (outputListHistos->FindObject("FlowPro_VPtPOI_MCEP"));
336 TProfile *pHistProDiffFlowEtaPOI = dynamic_cast<TProfile*>
337 (outputListHistos->FindObject("FlowPro_VetaPOI_MCEP"));
339 if (pCommonHists && pCommonHistResults && pHistProIntFlow &&
340 pHistProDiffFlowPtRP && pHistProDiffFlowEtaRP &&
341 pHistProDiffFlowPtPOI && pHistProDiffFlowEtaPOI) {
342 this->SetCommonHists(pCommonHists);
343 this->SetCommonHistsRes(pCommonHistResults);
344 this->SetHistProIntFlow(pHistProIntFlow);
345 this->SetHistProDiffFlowPtEtaRP(pHistProDiffFlowPtEtaRP);
346 this->SetHistProDiffFlowPtRP(pHistProDiffFlowPtRP);
347 this->SetHistProDiffFlowEtaRP(pHistProDiffFlowEtaRP);
348 this->SetHistProDiffFlowPtEtaPOI(pHistProDiffFlowPtEtaPOI);
349 this->SetHistProDiffFlowPtPOI(pHistProDiffFlowPtPOI);
350 this->SetHistProDiffFlowEtaPOI(pHistProDiffFlowEtaPOI);
352 cout<<"WARNING: Histograms needed to run Finish() are not accessible!"<<endl; }
354 //fListHistos->Print();
356 TList *pMixedHarmonicsList = dynamic_cast<TList*>
357 (outputListHistos->FindObject("Mixed Harmonics"));
358 if(pMixedHarmonicsList) {this->GetOutputHistoramsForMixedHarmonics(pMixedHarmonicsList);}
360 } else { cout << "histogram list pointer is empty" << endl;}
364 //--------------------------------------------------------------------
366 void AliFlowAnalysisWithMCEventPlane::GetOutputHistoramsForMixedHarmonics(TList *mixedHarmonicsList)
368 // Get pointers to all objects relevant for mixed harmonics study.
370 if(mixedHarmonicsList)
376 cout<<"WARNING (MCEP): mixedHarmonicsList in NULL in MCEP::GetOutputHistoramsForMixedHarmonics() !!!! "<<endl;
380 } // end of void AliFlowAnalysisWithMCEventPlane::GetOutputHistoramsForMixedHarmonics(TList *mixedHarmonicsList)
382 //--------------------------------------------------------------------
384 void AliFlowAnalysisWithMCEventPlane::Finish() {
386 //*************make histograms etc.
387 if (fDebug) cout<<"AliFlowAnalysisWithMCEventPlane::Terminate()"<<endl;
389 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
390 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
393 if(fCommonHists && fCommonHists->GetHarmonic())
395 fHarmonic = (Int_t)(fCommonHists->GetHarmonic())->GetBinContent(1); // to be improved (moved somewhere else?)
399 Double_t dV = fHistProIntFlow->GetBinContent(1);
400 Double_t dErrV = fHistProIntFlow->GetBinError(1); // to be improved (treatment of errors for non-Gaussian distribution needed!)
401 //fill reference flow:
402 fCommonHistsRes->FillIntegratedFlow(dV,dErrV);
403 cout<<"dV"<<fHarmonic<<"{MC} is "<<dV<<" +- "<<dErrV<<endl;
406 TH1F* fHistPtRP = NULL;
407 if(fCommonHists && fCommonHists->GetHistPtRP())
409 fHistPtRP = fCommonHists->GetHistPtRP();
411 Double_t dYieldPtRP = 0.;
413 Double_t dErrVRP = 0.;
414 Double_t dSumRP = 0.;
415 //differential flow (RP, Pt):
416 Double_t dvPtRP = 0.;
417 Double_t dErrvPtRP = 0.;
418 for(Int_t b=1;b<=iNbinsPt;b++)
420 dvPtRP = fHistProDiffFlowPtRP->GetBinContent(b);
421 dErrvPtRP = fHistProDiffFlowPtRP->GetBinError(b);//to be improved (treatment of errors for non-Gaussian distribution needed!)
422 fCommonHistsRes->FillDifferentialFlowPtRP(b, dvPtRP, dErrvPtRP);
424 //integrated flow (RP)
425 dYieldPtRP = fHistPtRP->GetBinContent(b);
426 dVRP += dvPtRP*dYieldPtRP;
427 dSumRP += dYieldPtRP;
428 //error on integrated flow
429 dErrVRP += dYieldPtRP*dYieldPtRP*dErrvPtRP*dErrvPtRP;
433 if (!(TMath::AreEqualAbs(dSumRP, 0.0, 1e-10)) ) {
434 dVRP /= dSumRP; //because pt distribution should be normalised
435 dErrVRP /= (dSumRP*dSumRP);
436 dErrVRP = TMath::Sqrt(dErrVRP);
438 // fill integrated flow (RP):
439 fCommonHistsRes->FillIntegratedFlowRP(dVRP,dErrVRP);
440 cout<<"dV"<<fHarmonic<<"{MC} (RP) is "<<dVRP<<" +- "<<dErrVRP<<endl;
442 //differential flow (RP, Eta):
443 Double_t dvEtaRP = 0.;
444 Double_t dErrvEtaRP = 0.;
445 for(Int_t b=1;b<=iNbinsEta;b++)
447 dvEtaRP = fHistProDiffFlowEtaRP->GetBinContent(b);
448 dErrvEtaRP = fHistProDiffFlowEtaRP->GetBinError(b);//to be improved (treatment of errors for non-Gaussian distribution needed!)
449 fCommonHistsRes->FillDifferentialFlowEtaRP(b, dvEtaRP, dErrvEtaRP);
453 TH1F* fHistPtPOI = NULL;
454 if(fCommonHists && fCommonHists->GetHistPtPOI())
456 fHistPtPOI = fCommonHists->GetHistPtPOI();
458 Double_t dYieldPtPOI = 0.;
460 Double_t dErrVPOI = 0.;
461 Double_t dSumPOI = 0.;
462 Double_t dvproPtPOI = 0.;
463 Double_t dErrdifcombPtPOI = 0.;
464 Double_t dvproEtaPOI = 0.;
465 Double_t dErrdifcombEtaPOI = 0.;
467 if(fHistProDiffFlowPtPOI) {
468 for(Int_t b=1;b<=iNbinsPt;b++){
469 dvproPtPOI = fHistProDiffFlowPtPOI->GetBinContent(b);
470 dErrdifcombPtPOI = fHistProDiffFlowPtPOI->GetBinError(b);//to be improved (treatment of errors for non-Gaussian distribution needed!)
472 fCommonHistsRes->FillDifferentialFlowPtPOI(b, dvproPtPOI, dErrdifcombPtPOI);
474 //integrated flow (POI)
475 dYieldPtPOI = fHistPtPOI->GetBinContent(b);
476 dVPOI += dvproPtPOI*dYieldPtPOI;
477 dSumPOI += dYieldPtPOI;
478 //error on integrated flow
479 dErrVPOI += dYieldPtPOI*dYieldPtPOI*dErrdifcombPtPOI*dErrdifcombPtPOI;
481 }//end of for(Int_t b=0;b<iNbinsPt;b++)
482 } else { cout<<"fHistProFlow is NULL"<<endl; }
484 if (!(TMath::AreEqualAbs(dSumPOI, 0.0, 1e-10)) ) {
485 dVPOI /= dSumPOI; //because pt distribution should be normalised
486 dErrVPOI /= (dSumPOI*dSumPOI);
487 dErrVPOI = TMath::Sqrt(dErrVPOI);
489 cout<<"dV"<<fHarmonic<<"{MC} (POI) is "<<dVPOI<<" +- "<<dErrVPOI<<endl;
491 fCommonHistsRes->FillIntegratedFlowPOI(dVPOI,dErrVPOI);
494 if(fHistProDiffFlowEtaPOI)
496 for(Int_t b=1;b<=iNbinsEta;b++)
498 dvproEtaPOI = fHistProDiffFlowEtaPOI->GetBinContent(b);
499 dErrdifcombEtaPOI = fHistProDiffFlowEtaPOI->GetBinError(b);//to be improved (treatment of errors for non-Gaussian distribution needed!)
500 //fill common hist results:
501 fCommonHistsRes->FillDifferentialFlowEtaPOI(b, dvproEtaPOI, dErrdifcombEtaPOI);
506 //cout<<".....finished"<<endl;
509 //-----------------------------------------------------------------------
511 void AliFlowAnalysisWithMCEventPlane::InitalizeArraysForMixedHarmonics()
513 // Iinitialize all arrays for mixed harmonics.
515 for(Int_t cs=0;cs<2;cs++) // cos/sin
517 fPairCorrelator[cs] = NULL;
518 fPairCorrelatorVsM[cs] = NULL;
519 for(Int_t sd=0;sd<2;sd++) // pt sum/difference
521 fPairCorrelatorVsPtSumDiff[cs][sd] = NULL;
525 } // end of void InitalizeArraysForMixedHarmonics()
527 //-----------------------------------------------------------------------
529 void AliFlowAnalysisWithMCEventPlane::BookObjectsForMixedHarmonics()
531 // Book all objects needed for mixed harmonics.
533 // List holding all objects relevant for mixed harmonics:
534 fMixedHarmonicsList->SetName("Mixed Harmonics");
535 fMixedHarmonicsList->SetOwner(kTRUE);
536 fHistList->Add(fMixedHarmonicsList);
538 // Profile holding settings relevant for mixed harmonics:
539 TString mixedHarmonicsSettingsName = "fMixedHarmonicsSettings";
540 fMixedHarmonicsSettings = new TProfile(mixedHarmonicsSettingsName.Data(),"Settings for Mixed Harmonics",4,0,4);
541 //fMixedHarmonicsSettings->GetXaxis()->SetLabelSize(0.025);
542 fMixedHarmonicsSettings->GetXaxis()->SetBinLabel(1,"fEvaluateMixedHarmonics");
543 fMixedHarmonicsSettings->Fill(0.5,(Int_t)fEvaluateMixedHarmonics);
544 fMixedHarmonicsSettings->GetXaxis()->SetBinLabel(2,"fNinCorrelator");
545 fMixedHarmonicsSettings->Fill(1.5,(Int_t)fNinCorrelator);
546 fMixedHarmonicsSettings->GetXaxis()->SetBinLabel(3,"fMinCorrelator");
547 fMixedHarmonicsSettings->Fill(2.5,(Int_t)fMinCorrelator);
548 fMixedHarmonicsSettings->GetXaxis()->SetBinLabel(4,"x in #phi_{pair}"); // phi_{pair} = x*phi1+(1-x)*phi2
549 fMixedHarmonicsSettings->Fill(3.5,fXinPairAngle);
550 fMixedHarmonicsList->Add(fMixedHarmonicsSettings);
552 // 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:
553 TString cosSinFlag[2] = {"Cos","Sin"};
554 TString cosSinTitleFlag[2] = {"cos[m#phi_{pair}-n#psi_{RP}]","sin[m#phi_{pair}-n#psi_{RP}]"};
555 if(fNinCorrelator == 2 && fMinCorrelator == 2 && TMath::Abs(fXinPairAngle-0.5)<1.e-44) // default values
557 cosSinTitleFlag[0] = "cos[#phi_{1}+#phi_{2}-2#psi_{RP})]";
558 cosSinTitleFlag[1] = "sin[#phi_{1}+#phi_{2}-2#psi_{RP})]";
560 TString psdFlag[2] = {"Sum","Diff"};
561 TString psdTitleFlag[2] = {"(p_{t,1}+p_{t,2})/2","#left|p_{t,1}-p_{t,2}#right|"};
562 TString pairCorrelatorName = "fPairCorrelator";
563 TString pairCorrelatorVsMName = "fPairCorrelatorVsM";
564 TString pairCorrelatorVsPtSumDiffName = "fPairCorrelatorVsPt";
565 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
566 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
567 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
568 for(Int_t cs=0;cs<2;cs++)
570 fPairCorrelator[cs] = new TProfile(Form("%s, %s",pairCorrelatorName.Data(),cosSinFlag[cs].Data()),cosSinTitleFlag[cs].Data(),1,0.,1.);
571 fPairCorrelator[cs]->GetXaxis()->SetBinLabel(1,cosSinTitleFlag[cs].Data());
572 fMixedHarmonicsList->Add(fPairCorrelator[cs]);
574 fPairCorrelatorVsM[cs] = new TProfile(Form("%s, %s",pairCorrelatorVsMName.Data(),cosSinFlag[cs].Data()),cosSinTitleFlag[cs].Data(),fnBinsMult,fMinMult,fMaxMult);
575 fPairCorrelatorVsM[cs]->GetXaxis()->SetTitle("# of RPs");
576 fMixedHarmonicsList->Add(fPairCorrelatorVsM[cs]);
578 for(Int_t sd=0;sd<2;sd++)
580 fPairCorrelatorVsPtSumDiff[cs][sd] = new TProfile(Form("%s%s, %s",pairCorrelatorVsPtSumDiffName.Data(),psdFlag[sd].Data(),cosSinFlag[cs].Data()),cosSinTitleFlag[cs].Data(),iNbinsPt,dPtMin,dPtMax);
581 fPairCorrelatorVsPtSumDiff[cs][sd]->GetXaxis()->SetTitle(psdTitleFlag[sd].Data());
582 fMixedHarmonicsList->Add(fPairCorrelatorVsPtSumDiff[cs][sd]);
583 } // end of for(Int_t sd=0;sd<2;sd++)
584 } // end of for(Int_t cs=0;cs<2;cs++)
586 } // end of void AliFlowAnalysisWithMCEventPlane::BookObjectsForMixedHarmonics()
588 //-----------------------------------------------------------------------
590 void AliFlowAnalysisWithMCEventPlane::EvaluateMixedHarmonics(AliFlowEventSimple* anEvent)
592 // Evaluate correlators relevant for the mixed harmonics.
594 // Get the MC reaction plane angle:
595 Double_t dReactionPlane = anEvent->GetMCReactionPlaneAngle();
596 // Get the number of tracks:
597 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
598 Int_t nRP = anEvent->GetEventNSelTracksRP(); // number of Reference Particles
599 AliFlowTrackSimple *pTrack = NULL;
604 Double_t n = fNinCorrelator; // shortcut
605 Double_t m = fMinCorrelator; // shortcut
606 Double_t x = fXinPairAngle; // shortcut
607 for(Int_t i=0;i<iNumberOfTracks;i++)
609 pTrack = anEvent->GetTrack(i);
610 if(pTrack && pTrack->InRPSelection())
612 dPhi1 = pTrack->Phi();
615 for(Int_t j=0;j<iNumberOfTracks;j++)
618 pTrack = anEvent->GetTrack(j);
619 if(pTrack && pTrack->InPOISelection())
621 dPhi2 = pTrack->Phi();
624 Double_t dPhiPair = x*dPhi1+(1.-x)*dPhi2;
625 Double_t dPtSum = 0.5*(dPt1+dPt2);
626 Double_t dPtDiff = TMath::Abs(dPt1-dPt2);
627 fPairCorrelator[0]->Fill(0.5,TMath::Cos(m*dPhiPair-n*dReactionPlane),1.);
628 fPairCorrelator[1]->Fill(0.5,TMath::Sin(m*dPhiPair-n*dReactionPlane),1.);
629 fPairCorrelatorVsM[0]->Fill(nRP+0.5,TMath::Cos(m*dPhiPair-n*dReactionPlane),1.);
630 fPairCorrelatorVsM[1]->Fill(nRP+0.5,TMath::Sin(m*dPhiPair-n*dReactionPlane),1.);
631 fPairCorrelatorVsPtSumDiff[0][0]->Fill(dPtSum,TMath::Cos(m*dPhiPair-n*dReactionPlane),1.);
632 fPairCorrelatorVsPtSumDiff[1][0]->Fill(dPtSum,TMath::Sin(m*dPhiPair-n*dReactionPlane),1.);
633 fPairCorrelatorVsPtSumDiff[0][1]->Fill(dPtDiff,TMath::Cos(m*dPhiPair-n*dReactionPlane),1.);
634 fPairCorrelatorVsPtSumDiff[1][1]->Fill(dPtDiff,TMath::Sin(m*dPhiPair-n*dReactionPlane),1.);
635 } // end of for(Int_t j=i+1;j<iNumberOfTracks;j++)
636 } // end of for(Int_t i=0;i<iNumberOfTracks;i++)
638 } // end of void AliFlowAnalysisWithMCEventPlane::EvaluateMixedHarmonics()