1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 /////////////////////////////////////////////////////////////////////////////////////////
17 //Description: Maker to analyze Flow using the LeeYangZeros method
18 // Equation numbers are from Big Paper (BP): Nucl. Phys. A 727, 373 (2003)
19 // Practical Guide (PG): J. Phys. G: Nucl. Part. Phys. 30, S1213 (2004)
20 // Adapted from StFlowLeeYangZerosMaker.cxx
21 // by Markus Oldenberg and Art Poskanzer, LBNL
22 // with advice from Jean-Yves Ollitrault and Nicolas Borghini
24 //Author: Naomi van der Kolk (kolk@nikhef.nl)
25 /////////////////////////////////////////////////////////////////////////////////////////
27 #include "Riostream.h"
36 #include "TDirectoryFile.h"
38 #include "AliFlowCommonConstants.h"
39 #include "AliFlowLYZConstants.h"
40 #include "AliFlowAnalysisWithLeeYangZeros.h"
41 #include "AliFlowLYZHist1.h"
42 #include "AliFlowLYZHist2.h"
43 #include "AliFlowCommonHist.h"
44 #include "AliFlowCommonHistResults.h"
45 #include "AliFlowEventSimple.h"
46 #include "AliFlowTrackSimple.h"
47 #include "AliFlowVector.h"
49 ClassImp(AliFlowAnalysisWithLeeYangZeros)
51 //-----------------------------------------------------------------------
53 AliFlowAnalysisWithLeeYangZeros::AliFlowAnalysisWithLeeYangZeros():
65 fHistProVetaPOI(NULL),
68 fHistProR0theta(NULL),
69 fHistProReDenom(NULL),
70 fHistProImDenom(NULL),
71 fHistProReDtheta(NULL),
72 fHistProImDtheta(NULL),
73 fHistQsumforChi(NULL),
79 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::AliFlowAnalysisWithLeeYangZeros default constructor****"<<endl;
81 fHistList = new TList();
82 fFirstRunList = new TList();
84 for(Int_t i = 0;i<5;i++)
91 fQsum = new TVector2();
95 //-----------------------------------------------------------------------
98 AliFlowAnalysisWithLeeYangZeros::~AliFlowAnalysisWithLeeYangZeros()
101 if (fDebug) cout<<"****~AliFlowAnalysisWithLeeYangZeros****"<<endl;
104 delete fFirstRunList;
108 //-----------------------------------------------------------------------
110 void AliFlowAnalysisWithLeeYangZeros::WriteHistograms(TString* outputFileName)
112 //store the final results in output .root file
114 TFile *output = new TFile(outputFileName->Data(),"RECREATE");
116 //output->WriteObject(fHistList, "cobjLYZ1","SingleKey");
117 if (fUseSum) { fHistList->SetName("cobjLYZ1SUM");}
118 else {fHistList->SetName("cobjLYZ1PROD");}
119 fHistList->SetOwner(kTRUE);
120 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
123 //output->WriteObject(fHistList, "cobjLYZ2","SingleKey");
124 if (fUseSum) { fHistList->SetName("cobjLYZ2SUM"); }
125 else { fHistList->SetName("cobjLYZ2PROD"); }
126 fHistList->SetOwner(kTRUE);
127 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
132 //-----------------------------------------------------------------------
134 void AliFlowAnalysisWithLeeYangZeros::WriteHistograms(TString outputFileName)
136 //store the final results in output .root file
138 TFile *output = new TFile(outputFileName.Data(),"RECREATE");
140 //output->WriteObject(fHistList, "cobjLYZ1","SingleKey");
141 if (fUseSum) { fHistList->SetName("cobjLYZ1SUM");}
142 else {fHistList->SetName("cobjLYZ1PROD");}
143 fHistList->SetOwner(kTRUE);
144 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
147 //output->WriteObject(fHistList, "cobjLYZ2","SingleKey");
148 if (fUseSum) { fHistList->SetName("cobjLYZ2SUM"); }
149 else { fHistList->SetName("cobjLYZ2PROD"); }
150 fHistList->SetOwner(kTRUE);
151 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
156 //-----------------------------------------------------------------------
158 void AliFlowAnalysisWithLeeYangZeros::WriteHistograms(TDirectoryFile *outputFileName)
160 //store the final results in output .root file
162 if (fUseSum) { fHistList->SetName("cobjLYZ1SUM");}
163 else {fHistList->SetName("cobjLYZ1PROD");}
164 fHistList->SetOwner(kTRUE);
165 outputFileName->Add(fHistList);
166 outputFileName->Write(outputFileName->GetName(), TObject::kSingleKey);
169 if (fUseSum) { fHistList->SetName("cobjLYZ2SUM"); }
170 else { fHistList->SetName("cobjLYZ2PROD"); }
171 fHistList->SetOwner(kTRUE);
172 outputFileName->Add(fHistList);
173 outputFileName->Write(outputFileName->GetName(), TObject::kSingleKey);
177 //-----------------------------------------------------------------------
179 Bool_t AliFlowAnalysisWithLeeYangZeros::Init()
182 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::Init()****"<<endl;
184 //save old value and prevent histograms from being added to directory
185 //to avoid name clashes in case multiple analaysis objects are used
187 Bool_t oldHistAddStatus = TH1::AddDirectoryStatus();
188 TH1::AddDirectory(kFALSE);
191 Int_t iNtheta = AliFlowLYZConstants::GetMaster()->GetNtheta();
192 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
193 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
195 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
196 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
197 Double_t dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();
198 Double_t dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
200 //for control histograms
202 if (fUseSum) {fCommonHists = new AliFlowCommonHist("AliFlowCommonHistLYZ1SUM");}
203 else {fCommonHists = new AliFlowCommonHist("AliFlowCommonHistLYZ1PROD");}
204 fHistList->Add(fCommonHists);
205 if (fUseSum) {fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsLYZ1SUM");}
206 else {fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsLYZ1PROD");}
207 fHistList->Add(fCommonHistsRes);
210 if (fUseSum) {fCommonHists = new AliFlowCommonHist("AliFlowCommonHistLYZ2SUM");}
211 else {fCommonHists = new AliFlowCommonHist("AliFlowCommonHistLYZ2PROD");}
212 fHistList->Add(fCommonHists);
213 if (fUseSum) {fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsLYZ2SUM");}
214 else {fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsLYZ2PROD");}
215 fHistList->Add(fCommonHistsRes);
219 if (fUseSum) {nameChiHist = "Flow_QsumforChi_LYZSUM";}
220 else {nameChiHist = "Flow_QsumforChi_LYZPROD";}
221 fHistQsumforChi = new TH1F(nameChiHist.Data(),nameChiHist.Data(),3,-1.,2.);
222 fHistQsumforChi->SetXTitle("Qsum.X , Qsum.Y, Q2sum");
223 fHistQsumforChi->SetYTitle("value");
224 fHistList->Add(fHistQsumforChi);
226 //for first loop over events
229 if (fUseSum) {nameR0Hist = "First_FlowPro_r0theta_LYZSUM";}
230 else {nameR0Hist = "First_FlowPro_r0theta_LYZPROD";}
231 fHistProR0theta = new TProfile(nameR0Hist.Data(),nameR0Hist.Data(),iNtheta,-0.5,iNtheta-0.5);
232 fHistProR0theta->SetXTitle("#theta");
233 fHistProR0theta->SetYTitle("r_{0}^{#theta}");
234 fHistList->Add(fHistProR0theta);
237 if (fUseSum) {nameVHist = "First_FlowPro_Vtheta_LYZSUM";}
238 else {nameVHist = "First_FlowPro_Vtheta_LYZPROD";}
239 fHistProVtheta = new TProfile(nameVHist.Data(),nameVHist.Data(),iNtheta,-0.5,iNtheta-0.5);
240 fHistProVtheta->SetXTitle("#theta");
241 fHistProVtheta->SetYTitle("V_{n}^{#theta}");
242 fHistList->Add(fHistProVtheta);
244 //class AliFlowLYZHist1 defines the histograms: fHistProGtheta, fHistProReGtheta, fHistProImGtheta, fHistProR0theta
245 for (Int_t theta=0;theta<iNtheta;theta++) {
247 if (fUseSum) {nameHist1 = "AliFlowLYZHist1_";}
248 else {nameHist1 = "AliFlowLYZHist1_";}
250 fHist1[theta]=new AliFlowLYZHist1(theta, nameHist1, fUseSum);
251 fHistList->Add(fHist1[theta]);
255 //for second loop over events
257 TString nameReDenomHist;
258 if (fUseSum) {nameReDenomHist = "Second_FlowPro_ReDenom_LYZSUM";}
259 else {nameReDenomHist = "Second_FlowPro_ReDenom_LYZPROD";}
260 fHistProReDenom = new TProfile(nameReDenomHist.Data(),nameReDenomHist.Data(), iNtheta, -0.5, iNtheta-0.5);
261 fHistProReDenom->SetXTitle("#theta");
262 fHistProReDenom->SetYTitle("Re(Q^{#theta}e^{ir_{0}^{#theta}Q^{#theta}})");
263 fHistList->Add(fHistProReDenom);
265 TString nameImDenomHist;
266 if (fUseSum) {nameImDenomHist = "Second_FlowPro_ImDenom_LYZSUM";}
267 else {nameImDenomHist = "Second_FlowPro_ImDenom_LYZPROD";}
268 fHistProImDenom = new TProfile(nameImDenomHist.Data(),nameImDenomHist.Data(), iNtheta, -0.5, iNtheta-0.5);
269 fHistProImDenom->SetXTitle("#theta");
270 fHistProImDenom->SetYTitle("Im(Q^{#theta}e^{ir_{0}^{#theta}Q^{#theta}})");
271 fHistList->Add(fHistProImDenom);
273 TString nameVetaRPHist;
274 if (fUseSum) {nameVetaRPHist = "Second_FlowPro_VetaRP_LYZSUM";}
275 else {nameVetaRPHist = "Second_FlowPro_VetaRP_LYZPROD";}
276 fHistProVetaRP = new TProfile(nameVetaRPHist.Data(),nameVetaRPHist.Data(),iNbinsEta,dEtaMin,dEtaMax);
277 fHistProVetaRP->SetXTitle("rapidity");
278 fHistProVetaRP->SetYTitle("v_{2}(#eta) for RP selection");
279 fHistList->Add(fHistProVetaRP);
281 TString nameVetaPOIHist;
282 if (fUseSum) {nameVetaPOIHist = "Second_FlowPro_VetaPOI_LYZSUM";}
283 else {nameVetaPOIHist = "Second_FlowPro_VetaPOI_LYZPROD";}
284 fHistProVetaPOI = new TProfile(nameVetaPOIHist.Data(),nameVetaPOIHist.Data(),iNbinsEta,dEtaMin,dEtaMax);
285 fHistProVetaPOI->SetXTitle("rapidity");
286 fHistProVetaPOI->SetYTitle("v_{2}(#eta) for POI selection");
287 fHistList->Add(fHistProVetaPOI);
289 TString nameVPtRPHist;
290 if (fUseSum) {nameVPtRPHist = "Second_FlowPro_VPtRP_LYZSUM";}
291 else {nameVPtRPHist = "Second_FlowPro_VPtRP_LYZPROD";}
292 fHistProVPtRP = new TProfile(nameVPtRPHist.Data(),nameVPtRPHist.Data(),iNbinsPt,dPtMin,dPtMax);
293 fHistProVPtRP->SetXTitle("Pt");
294 fHistProVPtRP->SetYTitle("v_{2}(p_{T}) for RP selection");
295 fHistList->Add(fHistProVPtRP);
297 TString nameVPtPOIHist;
298 if (fUseSum) {nameVPtPOIHist = "Second_FlowPro_VPtPOI_LYZSUM";}
299 else {nameVPtPOIHist = "Second_FlowPro_VPtPOI_LYZPROD";}
300 fHistProVPtPOI = new TProfile(nameVPtPOIHist.Data(),nameVPtPOIHist.Data(),iNbinsPt,dPtMin,dPtMax);
301 fHistProVPtPOI->SetXTitle("p_{T}");
302 fHistProVPtPOI->SetYTitle("v_{2}(p_{T}) for POI selection");
303 fHistList->Add(fHistProVPtPOI);
305 fHistProReDtheta = new TProfile("Second_FlowPro_ReDtheta_LYZSUM","Second_FlowPro_ReDtheta_LYZSUM",iNtheta, -0.5, iNtheta-0.5);
306 fHistProReDtheta->SetXTitle("#theta");
307 fHistProReDtheta->SetYTitle("Re(D^{#theta})");
308 fHistList->Add(fHistProReDtheta);
310 fHistProImDtheta = new TProfile("Second_FlowPro_ImDtheta_LYZSUM","Second_FlowPro_ImDtheta_LYZSUM",iNtheta, -0.5, iNtheta-0.5);
311 fHistProImDtheta->SetXTitle("#theta");
312 fHistProImDtheta->SetYTitle("Im(D^{#theta})");
313 fHistList->Add(fHistProImDtheta);
316 //class AliFlowLYZHist2 defines the histograms:
317 for (Int_t theta=0;theta<iNtheta;theta++) {
318 TString nameRP = "AliFlowLYZHist2RP_";
320 fHist2RP[theta]=new AliFlowLYZHist2(theta, "RP", nameRP, fUseSum);
321 fHistList->Add(fHist2RP[theta]);
323 TString namePOI = "AliFlowLYZHist2POI_";
325 fHist2POI[theta]=new AliFlowLYZHist2(theta, "POI", namePOI, fUseSum);
326 fHistList->Add(fHist2POI[theta]);
329 //read histogram fHistProR0theta from the first run list
331 if (fUseSum) { fHistProR0theta = (TProfile*)fFirstRunList->FindObject("First_FlowPro_r0theta_LYZSUM");}
332 else{ fHistProR0theta = (TProfile*)fFirstRunList->FindObject("First_FlowPro_r0theta_LYZPROD");}
333 if (!fHistProR0theta) {cout<<"fHistProR0theta has a NULL pointer!"<<endl;}
334 fHistList->Add(fHistProR0theta);
335 } else { cout<<"list is NULL pointer!"<<endl; }
340 if (fDebug) cout<<"****Histograms initialised****"<<endl;
342 fEventNumber = 0; //set event counter to zero
345 TH1::AddDirectory(oldHistAddStatus);
350 //-----------------------------------------------------------------------
352 Bool_t AliFlowAnalysisWithLeeYangZeros::Make(AliFlowEventSimple* anEvent)
355 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::Make()****"<<endl;
357 //get tracks from event
360 fCommonHists->FillControlHistograms(anEvent);
361 FillFromFlowEvent(anEvent);
364 fCommonHists->FillControlHistograms(anEvent);
365 SecondFillFromFlowEvent(anEvent);
370 cout<<"##### FlowLeeYangZero: Stack pointer null"<<endl;
373 // cout<<"^^^^read event "<<fEventNumber<<endl;
380 //-----------------------------------------------------------------------
381 void AliFlowAnalysisWithLeeYangZeros::GetOutputHistograms(TList *outputListHistos) {
382 // get the pointers to all output histograms before calling Finish()
384 const Int_t iNtheta = AliFlowLYZConstants::GetMaster()->GetNtheta();
386 if (outputListHistos) {
388 //define histograms for first and second run
389 AliFlowCommonHist *pCommonHist = NULL;
390 AliFlowCommonHistResults *pCommonHistResults = NULL;
391 TProfile* pHistProR0theta = NULL;
392 TProfile* pHistProVtheta = NULL;
393 TProfile* pHistProReDenom = NULL;
394 TProfile* pHistProImDenom = NULL;
395 TProfile* pHistProVetaRP = NULL;
396 TProfile* pHistProVetaPOI = NULL;
397 TProfile* pHistProVPtRP = NULL;
398 TProfile* pHistProVPtPOI = NULL;
399 TH1F* pHistQsumforChi = NULL;
400 //AliFlowLYZHist1 *pLYZHist1[iNtheta] = {NULL}; //array of pointers to AliFlowLYZHist1
401 //AliFlowLYZHist2 *pLYZHist2RP[iNtheta] = {NULL}; //array of pointers to AliFlowLYZHist2
402 //AliFlowLYZHist2 *pLYZHist2POI[iNtheta] = {NULL}; //array of pointers to AliFlowLYZHist2
403 AliFlowLYZHist1 **pLYZHist1 = new AliFlowLYZHist1*[iNtheta]; //array of pointers to AliFlowLYZHist1
404 AliFlowLYZHist2 **pLYZHist2RP = new AliFlowLYZHist2*[iNtheta]; //array of pointers to AliFlowLYZHist2
405 AliFlowLYZHist2 **pLYZHist2POI = new AliFlowLYZHist2*[iNtheta]; //array of pointers to AliFlowLYZHist2
406 for (Int_t i=0; i<iNtheta; i++)
409 pLYZHist2RP[i] = NULL;
410 pLYZHist2POI[i] = NULL;
413 if (GetFirstRun()) { //first run
414 //Get the common histograms from the output list
416 pCommonHist = dynamic_cast<AliFlowCommonHist*>
417 (outputListHistos->FindObject("AliFlowCommonHistLYZ1SUM"));
418 pCommonHistResults = dynamic_cast<AliFlowCommonHistResults*>
419 (outputListHistos->FindObject("AliFlowCommonHistResultsLYZ1SUM"));
420 //Get the histograms from the output list
421 for(Int_t theta = 0;theta<iNtheta;theta++){
422 TString name = "AliFlowLYZHist1_";
424 pLYZHist1[theta] = dynamic_cast<AliFlowLYZHist1*>
425 (outputListHistos->FindObject(name));
427 pHistProVtheta = dynamic_cast<TProfile*>
428 (outputListHistos->FindObject("First_FlowPro_Vtheta_LYZSUM"));
430 pHistProR0theta = dynamic_cast<TProfile*>
431 (outputListHistos->FindObject("First_FlowPro_r0theta_LYZSUM"));
433 pHistQsumforChi = dynamic_cast<TH1F*>
434 (outputListHistos->FindObject("Flow_QsumforChi_LYZSUM"));
436 //Set the histogram pointers and call Finish()
437 if (pCommonHist && pCommonHistResults && pLYZHist1[0] &&
438 pHistProVtheta && pHistProR0theta && pHistQsumforChi ) {
439 this->SetCommonHists(pCommonHist);
440 this->SetCommonHistsRes(pCommonHistResults);
441 this->SetHist1(pLYZHist1);
442 this->SetHistProVtheta(pHistProVtheta);
443 this->SetHistProR0theta(pHistProR0theta);
444 this->SetHistQsumforChi(pHistQsumforChi);
447 cout<<"WARNING: Histograms needed to run Finish() firstrun (SUM) are not accessable!"<<endl;
451 pCommonHist = dynamic_cast<AliFlowCommonHist*>
452 (outputListHistos->FindObject("AliFlowCommonHistLYZ1PROD"));
453 pCommonHistResults = dynamic_cast<AliFlowCommonHistResults*>
454 (outputListHistos->FindObject("AliFlowCommonHistResultsLYZ1PROD"));
455 //Get the histograms from the output list
456 for(Int_t theta = 0;theta<iNtheta;theta++){
457 TString name = "AliFlowLYZHist1_";
459 pLYZHist1[theta] = dynamic_cast<AliFlowLYZHist1*>
460 (outputListHistos->FindObject(name));
462 pHistProVtheta = dynamic_cast<TProfile*>
463 (outputListHistos->FindObject("First_FlowPro_Vtheta_LYZPROD"));
465 pHistProR0theta = dynamic_cast<TProfile*>
466 (outputListHistos->FindObject("First_FlowPro_r0theta_LYZPROD"));
468 pHistQsumforChi = dynamic_cast<TH1F*>
469 (outputListHistos->FindObject("Flow_QsumforChi_LYZPROD"));
471 //Set the histogram pointers and call Finish()
472 if (pCommonHist && pCommonHistResults && pLYZHist1[0] &&
473 pHistProVtheta && pHistProR0theta && pHistQsumforChi ) {
474 this->SetCommonHists(pCommonHist);
475 this->SetCommonHistsRes(pCommonHistResults);
476 this->SetHist1(pLYZHist1);
477 this->SetHistProVtheta(pHistProVtheta);
478 this->SetHistProR0theta(pHistProR0theta);
479 this->SetHistQsumforChi(pHistQsumforChi);
481 cout<<"WARNING: Histograms needed to run Finish() firstrun (PROD) are not accessable!"<<endl;
486 //Get the common histograms from the output list
488 pCommonHist = dynamic_cast<AliFlowCommonHist*>
489 (outputListHistos->FindObject("AliFlowCommonHistLYZ2SUM"));
490 pCommonHistResults = dynamic_cast<AliFlowCommonHistResults*>
491 (outputListHistos->FindObject("AliFlowCommonHistResultsLYZ2SUM"));
493 pHistProR0theta = dynamic_cast<TProfile*>
494 (outputListHistos->FindObject("First_FlowPro_r0theta_LYZSUM"));
496 pHistQsumforChi = dynamic_cast<TH1F*>
497 (outputListHistos->FindObject("Flow_QsumforChi_LYZSUM"));
499 //Get the histograms from the output list
500 for(Int_t theta = 0;theta<iNtheta;theta++){
501 TString nameRP = "AliFlowLYZHist2RP_";
503 pLYZHist2RP[theta] = dynamic_cast<AliFlowLYZHist2*>
504 (outputListHistos->FindObject(nameRP));
505 TString namePOI = "AliFlowLYZHist2POI_";
507 pLYZHist2POI[theta] = dynamic_cast<AliFlowLYZHist2*>
508 (outputListHistos->FindObject(namePOI));
510 pHistProReDenom = dynamic_cast<TProfile*>
511 (outputListHistos->FindObject("Second_FlowPro_ReDenom_LYZSUM"));
512 pHistProImDenom = dynamic_cast<TProfile*>
513 (outputListHistos->FindObject("Second_FlowPro_ImDenom_LYZSUM"));
515 TProfile* pHistProReDtheta = dynamic_cast<TProfile*>
516 (outputListHistos->FindObject("Second_FlowPro_ReDtheta_LYZSUM"));
517 TProfile* pHistProImDtheta = dynamic_cast<TProfile*>
518 (outputListHistos->FindObject("Second_FlowPro_ImDtheta_LYZSUM"));
520 pHistProVetaRP = dynamic_cast<TProfile*>
521 (outputListHistos->FindObject("Second_FlowPro_VetaRP_LYZSUM"));
522 pHistProVetaPOI = dynamic_cast<TProfile*>
523 (outputListHistos->FindObject("Second_FlowPro_VetaPOI_LYZSUM"));
524 pHistProVPtRP = dynamic_cast<TProfile*>
525 (outputListHistos->FindObject("Second_FlowPro_VPtRP_LYZSUM"));
526 pHistProVPtPOI = dynamic_cast<TProfile*>
527 (outputListHistos->FindObject("Second_FlowPro_VPtPOI_LYZSUM"));
530 //Set the histogram pointers and call Finish()
531 if (pCommonHist && pCommonHistResults && pLYZHist2RP[0] && pLYZHist2POI[0] &&
532 pHistProR0theta && pHistProReDenom && pHistProImDenom && pHistProReDtheta &&
533 pHistProImDtheta && pHistProVetaRP && pHistProVetaPOI && pHistProVPtRP &&
534 pHistProVPtPOI && pHistQsumforChi) {
535 this->SetCommonHists(pCommonHist);
536 this->SetCommonHistsRes(pCommonHistResults);
537 this->SetHist2RP(pLYZHist2RP);
538 this->SetHist2POI(pLYZHist2POI);
539 this->SetHistProR0theta(pHistProR0theta);
540 this->SetHistProReDenom(pHistProReDenom);
541 this->SetHistProImDenom(pHistProImDenom);
542 this->SetHistProReDtheta(pHistProReDtheta);
543 this->SetHistProImDtheta(pHistProImDtheta);
544 this->SetHistProVetaRP(pHistProVetaRP);
545 this->SetHistProVetaPOI(pHistProVetaPOI);
546 this->SetHistProVPtRP(pHistProVPtRP);
547 this->SetHistProVPtPOI(pHistProVPtPOI);
548 this->SetHistQsumforChi(pHistQsumforChi);
551 cout<<"WARNING: Histograms needed to run Finish() secondrun (SUM) are not accessable!"<<endl;
555 pCommonHist = dynamic_cast<AliFlowCommonHist*>
556 (outputListHistos->FindObject("AliFlowCommonHistLYZ2PROD"));
557 pCommonHistResults = dynamic_cast<AliFlowCommonHistResults*>
558 (outputListHistos->FindObject("AliFlowCommonHistResultsLYZ2PROD"));
561 pHistProR0theta = dynamic_cast<TProfile*>
562 (outputListHistos->FindObject("First_FlowPro_r0theta_LYZPROD"));
564 pHistQsumforChi = dynamic_cast<TH1F*>
565 (outputListHistos->FindObject("Flow_QsumforChi_LYZPROD"));
567 //Get the histograms from the output list
568 for(Int_t theta = 0;theta<iNtheta;theta++){
569 TString nameRP = "AliFlowLYZHist2RP_";
571 pLYZHist2RP[theta] = dynamic_cast<AliFlowLYZHist2*>
572 (outputListHistos->FindObject(nameRP));
573 TString namePOI = "AliFlowLYZHist2POI_";
575 pLYZHist2POI[theta] = dynamic_cast<AliFlowLYZHist2*>
576 (outputListHistos->FindObject(namePOI));
578 pHistProReDenom = dynamic_cast<TProfile*>
579 (outputListHistos->FindObject("Second_FlowPro_ReDenom_LYZPROD"));
580 pHistProImDenom = dynamic_cast<TProfile*>
581 (outputListHistos->FindObject("Second_FlowPro_ImDenom_LYZPROD"));
583 pHistProVetaRP = dynamic_cast<TProfile*>
584 (outputListHistos->FindObject("Second_FlowPro_VetaRP_LYZPROD"));
585 pHistProVetaPOI = dynamic_cast<TProfile*>
586 (outputListHistos->FindObject("Second_FlowPro_VetaPOI_LYZPROD"));
587 pHistProVPtRP = dynamic_cast<TProfile*>
588 (outputListHistos->FindObject("Second_FlowPro_VPtRP_LYZPROD"));
589 pHistProVPtPOI = dynamic_cast<TProfile*>
590 (outputListHistos->FindObject("Second_FlowPro_VPtPOI_LYZPROD"));
592 //Set the histogram pointers and call Finish()
593 if (pCommonHist && pCommonHistResults && pLYZHist2RP[0] && pLYZHist2POI[0] &&
594 pHistProR0theta && pHistProReDenom && pHistProImDenom && pHistProVetaRP &&
595 pHistProVetaPOI && pHistProVPtRP && pHistProVPtPOI && pHistQsumforChi) {
596 this->SetCommonHists(pCommonHist);
597 this->SetCommonHistsRes(pCommonHistResults);
598 this->SetHist2RP(pLYZHist2RP);
599 this->SetHist2POI(pLYZHist2POI);
600 this->SetHistProR0theta(pHistProR0theta);
601 this->SetHistProReDenom(pHistProReDenom);
602 this->SetHistProImDenom(pHistProImDenom);
603 this->SetHistProVetaRP(pHistProVetaRP);
604 this->SetHistProVetaPOI(pHistProVetaPOI);
605 this->SetHistProVPtRP(pHistProVPtRP);
606 this->SetHistProVPtPOI(pHistProVPtPOI);
607 this->SetHistQsumforChi(pHistQsumforChi);
610 cout<<"WARNING: Histograms needed to run Finish() secondrun (PROD) are not accessable!"<<endl;
614 //outputListHistos->Print();
616 delete [] pLYZHist2RP;
617 delete [] pLYZHist2POI;
620 cout << "histogram list pointer is empty in method AliFlowAnalysisWithLeeYangZeros::GetOutputHistograms() " << endl;}
623 //-----------------------------------------------------------------------
624 Bool_t AliFlowAnalysisWithLeeYangZeros::Finish()
627 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::Finish()****"<<endl;
629 //define variables for both runs
630 Double_t dJ01 = 2.405;
631 Int_t iNtheta = AliFlowLYZConstants::GetMaster()->GetNtheta();
632 //set the event number
633 SetEventNumber((int)fCommonHists->GetHistQ()->GetEntries());
634 //cout<<"number of events processed is "<<fEventNumber<<endl;
636 //Get multiplicity for RP selection
637 Double_t dMultRP = fCommonHists->GetHistMultRP()->GetMean();
638 if (fDebug) cout<<"The average multiplicity is "<<dMultRP<<endl;
640 //set the sum of Q vectors
641 fQsum->Set(fHistQsumforChi->GetBinContent(1),fHistQsumforChi->GetBinContent(2));
642 SetQ2sum(fHistQsumforChi->GetBinContent(3));
646 Double_t dVtheta = 0;
649 for (Int_t theta=0;theta<iNtheta;theta++)
651 //get the first minimum r0
652 fHist1[theta]->FillGtheta();
653 dR0 = fHist1[theta]->GetR0();
655 //calculate integrated flow
656 if (!TMath::AreEqualAbs(dR0, 0., 1e-100)) { dVtheta = dJ01/dR0; }
657 else { cout<<"r0 is not found! Leaving LYZ analysis."<<endl; return kFALSE; }
659 //for estimating systematic error resulting from d0
660 Double_t dBinsize =0.;
661 if (fUseSum){ dBinsize = (AliFlowLYZConstants::GetMaster()->GetMaxSUM())/(AliFlowLYZConstants::GetMaster()->GetNbins());}
662 else { dBinsize = (AliFlowLYZConstants::GetMaster()->GetMaxPROD())/(AliFlowLYZConstants::GetMaster()->GetNbins());}
663 Double_t dVplus = -1.;
664 Double_t dVmin = -1.;
665 if (!TMath::AreEqualAbs(dR0+dBinsize, 0., 1e-100)) {dVplus = dJ01/(dR0+dBinsize);}
666 if (!TMath::AreEqualAbs(dR0-dBinsize, 0., 1e-100)) {dVmin = dJ01/(dR0-dBinsize);}
668 Double_t dvplus = -1.;
671 //for SUM: V=v because the Q-vector is scaled by 1/M
677 if (!TMath::AreEqualAbs(dMultRP, 0., 1e-100)){
678 dv = dVtheta/dMultRP;
679 dvplus = dVplus/dMultRP;
680 dvmin = dVmin/dMultRP; }}
682 if (fDebug) cout<<"dv = "<<dv<<" and dvplus = "<<dvplus<< " and dvmin = "<<dvmin<<endl;
684 //fill the histograms
685 fHistProR0theta->Fill(theta,dR0);
686 fHistProVtheta->Fill(theta,dVtheta);
687 //get average value of fVtheta = fV
689 } //end of loop over theta
691 //get average value of fVtheta = fV
693 if (!fUseSum) { if (dMultRP!=0.){dV /=dMultRP;}} //scale with multiplicity for PRODUCT
696 Double_t dSigma2 = 0;
698 if (fEventNumber!=0) {
699 *fQsum /= fEventNumber;
700 //cout<<"fQsum is "<<fQsum->X()<<" "<<fQsum->Y()<<endl;
701 fQ2sum /= fEventNumber;
702 //cout<<"fQ2sum is "<<fQ2sum<<endl;
703 dSigma2 = fQ2sum - TMath::Power(fQsum->X(),2.) - TMath::Power(fQsum->Y(),2.) - TMath::Power(dV,2.); //BP eq. 62
704 //cout<<"dSigma2 is "<<dSigma2<<endl;
705 if (dSigma2>0) dChi = dV/TMath::Sqrt(dSigma2);
707 fCommonHistsRes->FillChiRP(dChi);
709 cout<<"*************************************"<<endl;
710 cout<<"*************************************"<<endl;
711 cout<<" Integrated flow from "<<endl;
713 cout<<" Lee-Yang Zeroes SUM "<<endl;}
715 cout<<" Lee-Yang Zeroes PRODUCT "<<endl;}
717 cout<<"Chi = "<<dChi<<endl;
721 // recalculate statistical errors on integrated flow
722 //combining 5 theta angles to 1 relative error BP eq. 89
723 Double_t dRelErr2comb = 0.;
724 Int_t iEvts = fEventNumber;
726 for (Int_t theta=0;theta<iNtheta;theta++){
727 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
728 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
730 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
732 dRelErr2comb += (1/(2*iEvts*(dJ01*dJ01)*TMath::BesselJ1(dJ01)*
733 TMath::BesselJ1(dJ01)))*
734 (dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2)) +
735 dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2)));
737 dRelErr2comb /= iNtheta;
739 Double_t dRelErrcomb = TMath::Sqrt(dRelErr2comb);
741 //copy content of profile into TH1D and add error
742 Double_t dv2pro = dV; //in the case that fv is equal to fV
743 Double_t dv2Err = dv2pro*dRelErrcomb ;
744 cout<<"dV = "<<dv2pro<<" +- "<<dv2Err<<endl;
746 cout<<"*************************************"<<endl;
747 cout<<"*************************************"<<endl;
748 fCommonHistsRes->FillIntegratedFlow(dv2pro, dv2Err);
751 if (fDebug) cout<<"****histograms filled****"<<endl;
754 fEventNumber =0; //set to zero for second round over events
760 //calculate differential flow
762 TComplex cDenom, cNumerRP, cNumerPOI, cDtheta;
764 TComplex i = TComplex::I();
765 Double_t dBesselRatio[3] = {1., 1.202, 2.69};
766 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
767 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
769 Double_t dEtaRP, dPtRP, dReRatioRP, dVetaRP, dVPtRP, dEtaPOI, dPtPOI, dReRatioPOI, dVetaPOI, dVPtPOI;
772 Double_t dVtheta = 0.;
774 Double_t dReDenom = 0.;
775 Double_t dImDenom = 0.;
776 for (Int_t theta=0;theta<iNtheta;theta++) { //loop over theta
777 if (!fHistProR0theta) {
778 cout << "Hist pointer R0theta in file does not exist" <<endl;
780 dR0 = fHistProR0theta->GetBinContent(theta+1); //histogram starts at bin 1
781 if (fDebug) cerr<<"dR0 = "<<dR0<<endl;
782 if (!TMath::AreEqualAbs(dR0, 0., 1e-100)) dVtheta = dJ01/dR0;
784 // BP Eq. 9 -> Vn^theta = j01/r0^theta
785 if (!fHistProReDenom && !fHistProImDenom) {
786 cout << "Hist pointer fDenom in file does not exist" <<endl;
788 dReDenom = fHistProReDenom->GetBinContent(theta+1);
789 dImDenom = fHistProImDenom->GetBinContent(theta+1);
790 cDenom(dReDenom,dImDenom);
792 //for new method and use by others (only with the sum generating function):
794 cDtheta = dR0*cDenom/dJ01;
795 fHistProReDtheta->Fill(theta,cDtheta.Re());
796 fHistProImDtheta->Fill(theta,cDtheta.Im());
799 cDenom *= TComplex::Power(i, m-1);
800 //cerr<<"TComplex::Power(i, m-1) = "<<TComplex::Power(i, m-1).Rho()<<endl; //checked ok
802 //v as a function of eta for RP selection
803 for (Int_t be=1;be<=iNbinsEta;be++) {
804 dEtaRP = fHist2RP[theta]->GetBinCenter(be);
805 cNumerRP = fHist2RP[theta]->GetNumerEta(be);
806 if (cNumerRP.Rho()==0) {
807 if (fDebug) cerr<<"WARNING: modulus of cNumerRP is zero in Finish()"<<endl;
810 else if (TMath::AreEqualAbs(cDenom.Rho(), 0, 1e-100)) {
811 if (fDebug) cerr<<"WARNING: modulus of cDenom is zero"<<endl;
815 dReRatioRP = (cNumerRP/cDenom).Re();
817 dVetaRP = dBesselRatio[m-1]*dReRatioRP*dVtheta; //BP eq. 12
818 fHistProVetaRP->Fill(dEtaRP,dVetaRP);
819 } //loop over bins be
822 //v as a function of eta for POI selection
823 for (Int_t be=1;be<=iNbinsEta;be++) {
824 dEtaPOI = fHist2POI[theta]->GetBinCenter(be);
825 cNumerPOI = fHist2POI[theta]->GetNumerEta(be);
826 if (cNumerPOI.Rho()==0) {
827 if (fDebug) cerr<<"WARNING: modulus of cNumerPOI is zero in Finish()"<<endl;
830 else if (cDenom.Rho()==0) {
831 if (fDebug) cerr<<"WARNING: modulus of cDenom is zero"<<endl;
835 dReRatioPOI = (cNumerPOI/cDenom).Re();
837 dVetaPOI = dBesselRatio[m-1]*dReRatioPOI*dVtheta; //BP eq. 12
838 fHistProVetaPOI->Fill(dEtaPOI,dVetaPOI);
839 } //loop over bins be
842 //v as a function of Pt for RP selection
843 for (Int_t bp=1;bp<=iNbinsPt;bp++) {
844 dPtRP = fHist2RP[theta]->GetBinCenterPt(bp);
845 cNumerRP = fHist2RP[theta]->GetNumerPt(bp);
846 if (cNumerRP.Rho()==0) {
847 if (fDebug) cerr<<"WARNING: modulus of cNumerRP is zero"<<endl;
850 else if (cDenom.Rho()==0) {
851 if (fDebug) cerr<<"WARNING: modulus of cDenom is zero"<<endl;
855 dReRatioRP = (cNumerRP/cDenom).Re();
857 dVPtRP = dBesselRatio[m-1]*dReRatioRP*dVtheta; //BP eq. 12
858 fHistProVPtRP->Fill(dPtRP,dVPtRP);
859 } //loop over bins bp
863 //v as a function of Pt for POI selection
864 for (Int_t bp=1;bp<=iNbinsPt;bp++) {
865 dPtPOI = fHist2POI[theta]->GetBinCenterPt(bp);
866 cNumerPOI = fHist2POI[theta]->GetNumerPt(bp);
867 if (cNumerPOI.Rho()==0) {
868 if (fDebug) cerr<<"WARNING: modulus of cNumerPOI is zero"<<endl;
871 else if (cDenom.Rho()==0) {
872 if (fDebug) cerr<<"WARNING: modulus of cDenom is zero"<<endl;
876 dReRatioPOI = (cNumerPOI/cDenom).Re();
878 dVPtPOI = dBesselRatio[m-1]*dReRatioPOI*dVtheta; //BP eq. 12
879 fHistProVPtPOI->Fill(dPtPOI,dVPtPOI);
880 } //loop over bins bp
885 }//end of loop over theta
887 //calculate the average of fVtheta = fV
889 if (!fUseSum) { if (dMultRP!=0.) { dV /=dMultRP; }} //scale by the multiplicity for PRODUCT
890 if (TMath::AreEqualAbs(dV, 0., 1e-100)) { cout<<"dV = 0! Leaving LYZ analysis."<<endl; return kFALSE; }
892 //sigma2 and chi (for statistical error calculations)
893 Double_t dSigma2 = 0;
895 if (fEventNumber!=0) {
896 *fQsum /= fEventNumber;
897 //cerr<<"fQsum.X() = "<<fQsum.X()<<endl;
898 //cerr<<"fQsum.Y() = "<<fQsum.Y()<<endl;
899 fQ2sum /= fEventNumber;
900 //cout<<"fQ2sum = "<<fQ2sum<<endl;
901 dSigma2 = fQ2sum - TMath::Power(fQsum->X(),2.) - TMath::Power(fQsum->Y(),2.) - TMath::Power(dV,2.); //BP eq. 62
902 if (dSigma2>0) dChi = dV/TMath::Sqrt(dSigma2);
904 fCommonHistsRes->FillChiRP(dChi);
906 // recalculate statistical errors on integrated flow
907 //combining 5 theta angles to 1 relative error BP eq. 89
908 Double_t dRelErr2comb = 0.;
909 Int_t iEvts = fEventNumber;
911 for (Int_t theta=0;theta<iNtheta;theta++){
912 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
913 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
915 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
917 dRelErr2comb += (1/(2*iEvts*(dJ01*dJ01)*TMath::BesselJ1(dJ01)*
918 TMath::BesselJ1(dJ01)))*
919 (dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2)) +
920 dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2)));
922 dRelErr2comb /= iNtheta;
924 Double_t dRelErrcomb = TMath::Sqrt(dRelErr2comb);
925 Double_t dVErr = dV*dRelErrcomb ;
926 fCommonHistsRes->FillIntegratedFlow(dV,dVErr);
928 cout<<"*************************************"<<endl;
929 cout<<"*************************************"<<endl;
930 cout<<" Integrated flow from "<<endl;
932 cout<<" Lee-Yang Zeroes SUM "<<endl;}
934 cout<<" Lee-Yang Zeroes PRODUCT "<<endl;}
936 cout<<"Chi = "<<dChi<<endl;
937 cout<<"dV = "<<dV<<" +- "<<dVErr<<endl;
941 //copy content of profile into TH1D and add error and fill the AliFlowCommonHistResults
943 //v as a function of eta for RP selection
944 for(Int_t b=0;b<iNbinsEta;b++) {
945 Double_t dv2pro = fHistProVetaRP->GetBinContent(b);
946 Double_t dNprime = fCommonHists->GetEntriesInEtaBinRP(b);
947 Double_t dErrdifcomb = 0.; //set error to zero
948 Double_t dErr2difcomb = 0.; //set error to zero
950 if (!TMath::AreEqualAbs(dNprime, 0., 1e-100)) {
951 for (Int_t theta=0;theta<iNtheta;theta++) {
952 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
953 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
955 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
957 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
958 TMath::BesselJ1(dJ01)))*
959 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
960 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
964 if (!TMath::AreEqualAbs(dErr2difcomb, 0., 1e-100)) {
965 dErr2difcomb /= iNtheta;
966 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
968 else {dErrdifcomb = 0.;}
970 fCommonHistsRes->FillDifferentialFlowEtaRP(b, dv2pro, dErrdifcomb);
974 //v as a function of eta for POI selection
975 for(Int_t b=0;b<iNbinsEta;b++) {
976 Double_t dv2pro = fHistProVetaPOI->GetBinContent(b);
977 Double_t dNprime = fCommonHists->GetEntriesInEtaBinPOI(b);
978 Double_t dErrdifcomb = 0.; //set error to zero
979 Double_t dErr2difcomb = 0.; //set error to zero
982 for (Int_t theta=0;theta<iNtheta;theta++) {
983 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
984 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
986 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
988 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
989 TMath::BesselJ1(dJ01)))*
990 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
991 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
995 if (dErr2difcomb!=0.) {
996 dErr2difcomb /= iNtheta;
997 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
999 else {dErrdifcomb = 0.;}
1001 fCommonHistsRes->FillDifferentialFlowEtaPOI(b, dv2pro, dErrdifcomb);
1002 } //loop over bins b
1006 //v as a function of Pt for RP selection
1007 TH1F* fHistPtRP = fCommonHists->GetHistPtRP(); //for calculating integrated flow
1011 for(Int_t b=0;b<iNbinsPt;b++) {
1012 Double_t dv2pro = fHistProVPtRP->GetBinContent(b);
1013 Double_t dNprime = fCommonHists->GetEntriesInPtBinRP(b);
1014 Double_t dErrdifcomb = 0.; //set error to zero
1015 Double_t dErr2difcomb = 0.; //set error to zero
1018 for (Int_t theta=0;theta<iNtheta;theta++) {
1019 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
1020 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
1021 TMath::Cos(dTheta));
1022 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
1023 TMath::Cos(dTheta));
1024 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
1025 TMath::BesselJ1(dJ01)))*
1026 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
1027 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
1031 if (dErr2difcomb!=0.) {
1032 dErr2difcomb /= iNtheta;
1033 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
1034 //cerr<<"dErrdifcomb = "<<dErrdifcomb<<endl;
1036 else {dErrdifcomb = 0.;}
1039 fCommonHistsRes->FillDifferentialFlowPtRP(b, dv2pro, dErrdifcomb);
1040 //calculate integrated flow for RP selection
1042 Double_t dYieldPt = fHistPtRP->GetBinContent(b);
1043 dVRP += dv2pro*dYieldPt;
1045 dErrV += dYieldPt*dYieldPt*dErrdifcomb*dErrdifcomb;
1046 } else { cout<<"fHistPtRP is NULL"<<endl; }
1047 } //loop over bins b
1049 if (!TMath::AreEqualAbs(dSum, 0., 1e-100)) {
1050 dVRP /= dSum; //the pt distribution should be normalised
1051 dErrV /= (dSum*dSum);
1052 dErrV = TMath::Sqrt(dErrV);
1054 cout<<"dV(RP) = "<<dVRP<<" +- "<<dErrV<<endl;
1056 fCommonHistsRes->FillIntegratedFlowRP(dVRP,dErrV);
1059 //v as a function of Pt for POI selection
1060 TH1F* fHistPtPOI = fCommonHists->GetHistPtPOI(); //for calculating integrated flow
1061 Double_t dVPOI = 0.;
1065 for(Int_t b=0;b<iNbinsPt;b++) {
1066 Double_t dv2pro = fHistProVPtPOI->GetBinContent(b);
1067 Double_t dNprime = fCommonHists->GetEntriesInPtBinPOI(b);
1068 Double_t dErrdifcomb = 0.; //set error to zero
1069 Double_t dErr2difcomb = 0.; //set error to zero
1072 for (Int_t theta=0;theta<iNtheta;theta++) {
1073 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
1074 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
1075 TMath::Cos(dTheta));
1076 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
1077 TMath::Cos(dTheta));
1078 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
1079 TMath::BesselJ1(dJ01)))*
1080 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
1081 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
1085 if (dErr2difcomb!=0.) {
1086 dErr2difcomb /= iNtheta;
1087 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
1088 //cerr<<"dErrdifcomb = "<<dErrdifcomb<<endl;
1090 else {dErrdifcomb = 0.;}
1093 fCommonHistsRes->FillDifferentialFlowPtPOI(b, dv2pro, dErrdifcomb);
1094 //calculate integrated flow for POI selection
1096 Double_t dYieldPt = fHistPtPOI->GetBinContent(b);
1097 dVPOI += dv2pro*dYieldPt;
1099 dErrV += dYieldPt*dYieldPt*dErrdifcomb*dErrdifcomb;
1100 } else { cout<<"fHistPtPOI is NULL"<<endl; }
1101 } //loop over bins b
1104 dVPOI /= dSum; //the pt distribution should be normalised
1105 dErrV /= (dSum*dSum);
1106 dErrV = TMath::Sqrt(dErrV);
1108 cout<<"dV(POI) = "<<dVPOI<<" +- "<<dErrV<<endl;
1110 cout<<"*************************************"<<endl;
1111 cout<<"*************************************"<<endl;
1112 fCommonHistsRes->FillIntegratedFlowPOI(dVPOI,dErrV);
1116 //cout<<"----LYZ analysis finished....----"<<endl<<endl;
1122 //-----------------------------------------------------------------------
1124 Bool_t AliFlowAnalysisWithLeeYangZeros::FillFromFlowEvent(AliFlowEventSimple* anEvent)
1126 // Get event quantities from AliFlowEvent for all particles
1128 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::FillFromFlowEvent()****"<<endl;
1131 cout<<"##### FlowLeeYangZero: FlowEvent pointer null"<<endl;
1136 TComplex cExpo, cGtheta, cGthetaNew, cZ;
1137 Int_t iNtheta = AliFlowLYZConstants::GetMaster()->GetNtheta();
1138 Int_t iNbins = AliFlowLYZConstants::GetMaster()->GetNbins();
1142 Double_t dOrder = 2.;
1145 AliFlowVector vQ = anEvent->GetQ();
1146 //weight by the multiplicity
1149 if (!TMath::AreEqualAbs(vQ.GetMult(), 0., 1e-100)) {
1150 dQX = vQ.X()/vQ.GetMult();
1151 dQY = vQ.Y()/vQ.GetMult();
1155 //for chi calculation:
1157 fHistQsumforChi->SetBinContent(1,fQsum->X());
1158 fHistQsumforChi->SetBinContent(2,fQsum->Y());
1159 fQ2sum += vQ.Mod2();
1160 fHistQsumforChi->SetBinContent(3,fQ2sum);
1161 //cerr<<"fQ2sum = "<<fQ2sum<<endl;
1163 for (Int_t theta=0;theta<iNtheta;theta++)
1165 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi()/dOrder;
1167 //calculate dQtheta = cos(dOrder*(fPhi-dTheta);the projection of the Q vector on the reference direction dTheta
1168 Double_t dQtheta = GetQtheta(vQ, dTheta);
1170 for (Int_t bin=1;bin<=iNbins;bin++)
1172 Double_t dR = fHist1[theta]->GetBinCenter(bin); //bincentre of bins in histogram //FIXED???
1173 //if (theta == 0) cerr<<"cerr::dR = "<<dR<<endl;
1176 //calculate the sum generating function
1177 cExpo(0.,dR*dQtheta); //Re=0 ; Im=dR*dQtheta
1178 cGtheta = TComplex::Exp(cExpo);
1182 //calculate the product generating function
1183 cGtheta = GetGrtheta(anEvent, dR, dTheta);
1184 if (cGtheta.Rho2() > 100.) break;
1187 fHist1[theta]->Fill(dR,cGtheta); //fill real and imaginary part of cGtheta
1198 //-----------------------------------------------------------------------
1199 Bool_t AliFlowAnalysisWithLeeYangZeros::SecondFillFromFlowEvent(AliFlowEventSimple* anEvent)
1201 //for differential flow
1203 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::SecondFillFromFlowEvent()****"<<endl;
1206 cout<<"##### FlowLeeYangZero: FlowEvent pointer null"<<endl;
1211 TComplex cExpo, cDenom, cNumerRP, cNumerPOI, cCosTermComplex;
1212 Double_t dPhi, dEta, dPt;
1214 Double_t dCosTermRP = 0.;
1215 Double_t dCosTermPOI = 0.;
1217 Double_t dOrder = 2.;
1218 Int_t iNtheta = AliFlowLYZConstants::GetMaster()->GetNtheta();
1222 AliFlowVector vQ = anEvent->GetQ();
1223 //weight by the multiplicity
1226 if (vQ.GetMult() != 0) {
1227 dQX = vQ.X()/vQ.GetMult();
1228 dQY = vQ.Y()/vQ.GetMult();
1232 //for chi calculation:
1234 fHistQsumforChi->SetBinContent(1,fQsum->X());
1235 fHistQsumforChi->SetBinContent(2,fQsum->Y());
1236 fQ2sum += vQ.Mod2();
1237 fHistQsumforChi->SetBinContent(3,fQ2sum);
1239 for (Int_t theta=0;theta<iNtheta;theta++)
1241 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi()/dOrder;
1243 //calculate dQtheta = cos(dOrder*(dPhi-dTheta);the projection of the Q vector on the reference direction dTheta
1244 Double_t dQtheta = GetQtheta(vQ, dTheta);
1245 //cerr<<"dQtheta for fdenom = "<<dQtheta<<endl;
1247 //denominator for differential v
1248 if (fHistProR0theta) {
1249 dR0 = fHistProR0theta->GetBinContent(theta+1);
1252 cout <<"pointer fHistProR0theta does not exist" << endl;
1254 //cerr<<"dR0 = "<<dR0 <<endl;
1256 if (fUseSum) //sum generating function
1258 cExpo(0.,dR0*dQtheta);
1259 cDenom = dQtheta*(TComplex::Exp(cExpo)); //BP eq 12
1260 //loop over tracks in event
1261 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
1262 for (Int_t i=0;i<iNumberOfTracks;i++) {
1263 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i);
1265 dEta = pTrack->Eta();
1267 dPhi = pTrack->Phi();
1268 if (pTrack->InRPSelection()) { // RP selection
1269 dCosTermRP = cos(m*dOrder*(dPhi-dTheta));
1270 cNumerRP = dCosTermRP*(TComplex::Exp(cExpo));
1271 if (cNumerRP.Rho()==0) {cerr<<"WARNING: modulus of cNumerRP is zero in SecondFillFromFlowEvent"<<endl;}
1272 if (fDebug) cerr<<"modulus of cNumerRP is "<<cNumerRP.Rho()<<endl;
1273 if (fHist2RP[theta]) {
1274 fHist2RP[theta]->Fill(dEta,dPt,cNumerRP); }
1276 if (pTrack->InPOISelection()) { //POI selection
1277 dCosTermPOI = cos(m*dOrder*(dPhi-dTheta));
1278 cNumerPOI = dCosTermPOI*(TComplex::Exp(cExpo));
1279 if (cNumerPOI.Rho()==0) {cerr<<"WARNING: modulus of cNumerPOI is zero in SecondFillFromFlowEvent"<<endl;}
1280 if (fDebug) cerr<<"modulus of cNumerPOI is "<<cNumerPOI.Rho()<<endl;
1281 if (fHist2POI[theta]) {
1282 fHist2POI[theta]->Fill(dEta,dPt,cNumerPOI); }
1285 // cout << "fHist2 pointer mising" <<endl;
1288 else {cerr << "no particle!!!"<<endl;}
1289 } //loop over tracks
1292 else //product generating function
1294 cDenom = GetDiffFlow(anEvent, dR0, theta);
1297 if (fHistProReDenom && fHistProImDenom) {
1298 fHistProReDenom->Fill(theta,cDenom.Re()); //fill the real part of fDenom
1299 fHistProImDenom->Fill(theta,cDenom.Im()); //fill the imaginary part of fDenom
1302 cout << "Pointers to cDenom mising" << endl;
1305 }//end of loop over theta
1311 //-----------------------------------------------------------------------
1312 Double_t AliFlowAnalysisWithLeeYangZeros::GetQtheta(AliFlowVector aQ, Double_t aTheta)
1314 //calculate Qtheta. Qtheta is the sum over all particles of cos(dOrder*(dPhi-dTheta)) BP eq. 3
1315 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::GetQtheta()****"<<endl;
1317 Double_t dQtheta = 0.;
1318 Double_t dOrder = 2.;
1320 dQtheta = aQ.X()*cos(dOrder*aTheta)+aQ.Y()*sin(dOrder*aTheta);
1327 //-----------------------------------------------------------------------
1328 TComplex AliFlowAnalysisWithLeeYangZeros::GetGrtheta(AliFlowEventSimple* const anEvent, Double_t aR, Double_t aTheta)
1330 // Product Generating Function for LeeYangZeros method
1331 // PG Eq. 3 (J. Phys. G Nucl. Part. Phys 30 S1213 (2004))
1333 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::GetGrtheta()****"<<endl;
1336 TComplex cG = TComplex::One();
1337 Double_t dOrder = 2.;
1339 //Double_t dWgt = 1./anEvent->GetEventNSelTracksRP(); //weight with the multiplicity
1341 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
1343 for (Int_t i=0;i<iNumberOfTracks;i++) //loop over tracks in event
1345 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
1347 if (pTrack->InRPSelection()) {
1348 Double_t dPhi = pTrack->Phi();
1349 Double_t dGIm = aR * dWgt*cos(dOrder*(dPhi - aTheta));
1350 TComplex cGi(1., dGIm);
1351 cG *= cGi; //product over all tracks
1354 else {cerr << "no particle pointer !!!"<<endl;}
1362 //-----------------------------------------------------------------------
1363 TComplex AliFlowAnalysisWithLeeYangZeros::GetDiffFlow(AliFlowEventSimple* const anEvent, Double_t aR0, Int_t theta)
1365 // Sum for the denominator for diff. flow for the Product Generating Function for LeeYangZeros method
1366 // PG Eq. 9 (J. Phys. G Nucl. Part. Phys 30 S1213 (2004))
1367 // Also for v1 mixed harmonics: DF Eq. 5
1368 // It is the deriverative of Grtheta at r0 divided by Grtheta at r0
1370 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::GetGrtheta()****"<<endl;
1372 TComplex cG = TComplex::One();
1373 TComplex cdGr0(0.,0.);
1374 Double_t dOrder = 2.;
1376 //Double_t dWgt = 1./anEvent->GetEventNSelTracksRP(); //weight with the multiplicity
1378 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
1380 Int_t iNtheta = AliFlowLYZConstants::GetMaster()->GetNtheta();
1381 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi()/dOrder;
1383 //for the denominator (use all RP selected particles)
1384 for (Int_t i=0;i<iNumberOfTracks;i++) //loop over tracks in event
1386 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
1388 if (pTrack->InRPSelection()) {
1389 Double_t dPhi = pTrack->Phi();
1390 Double_t dCosTerm = dWgt*cos(dOrder*(dPhi - dTheta));
1392 Double_t dGIm = aR0 * dCosTerm;
1393 TComplex cGi(1., dGIm);
1394 TComplex cCosTermComplex(1., aR0*dCosTerm);
1395 cG *= cGi; //product over all tracks
1397 cdGr0 +=(dCosTerm / cCosTermComplex); //sum over all tracks
1400 else {cerr << "no particle!!!"<<endl;}
1404 for (Int_t i=0;i<iNumberOfTracks;i++)
1406 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
1408 Double_t dEta = pTrack->Eta();
1409 Double_t dPt = pTrack->Pt();
1410 Double_t dPhi = pTrack->Phi();
1411 Double_t dCosTerm = cos(dOrder*(dPhi-dTheta));
1412 TComplex cCosTermComplex(1.,aR0*dCosTerm);
1414 if (pTrack->InRPSelection()) {
1415 TComplex cNumerRP = cG*dCosTerm/cCosTermComplex; //PG Eq. 9
1416 fHist2RP[theta]->Fill(dEta,dPt,cNumerRP);
1419 if (pTrack->InPOISelection()) {
1420 TComplex cNumerPOI = cG*dCosTerm/cCosTermComplex; //PG Eq. 9
1421 fHist2POI[theta]->Fill(dEta,dPt,cNumerPOI);
1424 else {cerr << "no particle pointer!!!"<<endl;}
1427 TComplex cDenom = cG*cdGr0;
1432 //-----------------------------------------------------------------------