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" //needed as include
28 #include "TObject.h" //needed as include
29 #include "AliFlowCommonConstants.h" //needed as include
30 #include "AliFlowLYZConstants.h" //needed as include
31 #include "AliFlowAnalysisWithLeeYangZeros.h"
32 #include "AliFlowLYZHist1.h" //needed as include
33 #include "AliFlowLYZHist2.h" //needed as include
34 #include "AliFlowCommonHist.h" //needed as include
35 #include "AliFlowCommonHistResults.h" //needed as include
36 #include "AliFlowEventSimple.h" //needed as include
37 #include "AliFlowTrackSimple.h" //needed as include
41 #include "TMath.h" //needed as include
42 #include "TFile.h" //needed as include
51 ClassImp(AliFlowAnalysisWithLeeYangZeros)
53 //-----------------------------------------------------------------------
55 AliFlowAnalysisWithLeeYangZeros::AliFlowAnalysisWithLeeYangZeros():
67 fHistProVetaPOI(NULL),
70 fHistProR0theta(NULL),
71 fHistProReDenom(NULL),
72 fHistProImDenom(NULL),
73 fHistProReDtheta(NULL),
74 fHistProImDtheta(NULL),
75 fHistQsumforChi(NULL),
81 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::AliFlowAnalysisWithLeeYangZeros default constructor****"<<endl;
83 fHistList = new TList();
84 fFirstRunList = new TList();
86 for(Int_t i = 0;i<5;i++)
93 fQsum = new TVector2();
97 //-----------------------------------------------------------------------
100 AliFlowAnalysisWithLeeYangZeros::~AliFlowAnalysisWithLeeYangZeros()
103 if (fDebug) cout<<"****~AliFlowAnalysisWithLeeYangZeros****"<<endl;
106 delete fFirstRunList;
110 //-----------------------------------------------------------------------
112 void AliFlowAnalysisWithLeeYangZeros::WriteHistograms(TString* outputFileName)
114 //store the final results in output .root file
116 TFile *output = new TFile(outputFileName->Data(),"RECREATE");
118 //output->WriteObject(fHistList, "cobjLYZ1","SingleKey");
119 fHistList->SetName("cobjLYZ1");
120 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
123 //output->WriteObject(fHistList, "cobjLYZ2","SingleKey");
124 fHistList->SetName("cobjLYZ2");
125 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
130 //-----------------------------------------------------------------------
132 void AliFlowAnalysisWithLeeYangZeros::WriteHistograms(TString outputFileName)
134 //store the final results in output .root file
136 TFile *output = new TFile(outputFileName.Data(),"RECREATE");
138 //output->WriteObject(fHistList, "cobjLYZ1","SingleKey");
139 fHistList->SetName("cobjLYZ1");
140 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
143 //output->WriteObject(fHistList, "cobjLYZ2","SingleKey");
144 fHistList->SetName("cobjLYZ2");
145 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
150 //-----------------------------------------------------------------------
152 Bool_t AliFlowAnalysisWithLeeYangZeros::Init()
155 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::Init()****"<<endl;
158 Int_t iNtheta = AliFlowLYZConstants::kTheta;
159 Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
160 Int_t iNbinsEta = AliFlowCommonConstants::GetNbinsEta();
162 Double_t dPtMin = AliFlowCommonConstants::GetPtMin();
163 Double_t dPtMax = AliFlowCommonConstants::GetPtMax();
164 Double_t dEtaMin = AliFlowCommonConstants::GetEtaMin();
165 Double_t dEtaMax = AliFlowCommonConstants::GetEtaMax();
167 //for control histograms
168 if (fFirstRun){ fCommonHists = new AliFlowCommonHist("AliFlowCommonHistLYZ1");
169 fHistList->Add(fCommonHists);
170 fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsLYZ1");
171 fHistList->Add(fCommonHistsRes);
173 else { fCommonHists = new AliFlowCommonHist("AliFlowCommonHistLYZ2");
174 fHistList->Add(fCommonHists);
175 fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsLYZ2");
176 fHistList->Add(fCommonHistsRes);
179 fHistQsumforChi = new TH1F("Flow_QsumforChi_LYZ","Flow_QsumforChi_LYZ",3,-1.,2.);
180 fHistQsumforChi->SetXTitle("Qsum.X , Qsum.Y, Q2sum");
181 fHistQsumforChi->SetYTitle("value");
182 fHistList->Add(fHistQsumforChi);
184 //for first loop over events
186 fHistProR0theta = new TProfile("First_FlowPro_r0theta_LYZ","First_FlowPro_r0theta_LYZ",iNtheta,-0.5,iNtheta-0.5);
187 fHistProR0theta->SetXTitle("#theta");
188 fHistProR0theta->SetYTitle("r_{0}^{#theta}");
189 fHistList->Add(fHistProR0theta);
191 fHistProVtheta = new TProfile("First_FlowPro_Vtheta_LYZ","First_FlowPro_Vtheta_LYZ",iNtheta,-0.5,iNtheta-0.5);
192 fHistProVtheta->SetXTitle("#theta");
193 fHistProVtheta->SetYTitle("V_{n}^{#theta}");
194 fHistList->Add(fHistProVtheta);
196 //class AliFlowLYZHist1 defines the histograms: fHistProGtheta, fHistProReGtheta, fHistProImGtheta, fHistProR0theta
197 for (Int_t theta=0;theta<iNtheta;theta++) {
198 TString name = "AliFlowLYZHist1_";
200 fHist1[theta]=new AliFlowLYZHist1(theta, name);
201 fHistList->Add(fHist1[theta]);
205 //for second loop over events
207 fHistProReDenom = new TProfile("Second_FlowPro_ReDenom_LYZ","Second_FlowPro_ReDenom_LYZ" , iNtheta, -0.5, iNtheta-0.5);
208 fHistProReDenom->SetXTitle("#theta");
209 fHistProReDenom->SetYTitle("Re(Q^{#theta}e^{ir_{0}^{#theta}Q^{#theta}})");
210 fHistList->Add(fHistProReDenom);
212 fHistProImDenom = new TProfile("Second_FlowPro_ImDenom_LYZ","Second_FlowPro_ImDenom_LYZ" , iNtheta, -0.5, iNtheta-0.5);
213 fHistProImDenom->SetXTitle("#theta");
214 fHistProImDenom->SetYTitle("Im(Q^{#theta}e^{ir_{0}^{#theta}Q^{#theta}})");
215 fHistList->Add(fHistProImDenom);
217 fHistProVetaRP = new TProfile("Second_FlowPro_VetaRP_LYZ","Second_FlowPro_VetaRP_LYZ",iNbinsEta,dEtaMin,dEtaMax);
218 fHistProVetaRP->SetXTitle("rapidity");
219 fHistProVetaRP->SetYTitle("v_{2}(#eta) for RP selection");
220 fHistList->Add(fHistProVetaRP);
222 fHistProVetaPOI = new TProfile("Second_FlowPro_VetaPOI_LYZ","Second_FlowPro_VetaPOI_LYZ",iNbinsEta,dEtaMin,dEtaMax);
223 fHistProVetaPOI->SetXTitle("rapidity");
224 fHistProVetaPOI->SetYTitle("v_{2}(#eta) for POI selection");
225 fHistList->Add(fHistProVetaPOI);
227 fHistProVPtRP = new TProfile("Second_FlowPro_VPtRP_LYZ","Second_FlowPro_VPtRP_LYZ",iNbinsPt,dPtMin,dPtMax);
228 fHistProVPtRP->SetXTitle("Pt");
229 fHistProVPtRP->SetYTitle("v_{2}(p_{T}) for RP selection");
230 fHistList->Add(fHistProVPtRP);
232 fHistProVPtPOI = new TProfile("Second_FlowPro_VPtPOI_LYZ","Second_FlowPro_VPtPOI_LYZ",iNbinsPt,dPtMin,dPtMax);
233 fHistProVPtPOI->SetXTitle("p_{T}");
234 fHistProVPtPOI->SetYTitle("v_{2}(p_{T}) for POI selection");
235 fHistList->Add(fHistProVPtPOI);
237 fHistProReDtheta = new TProfile("Second_FlowPro_ReDtheta_LYZ","Second_FlowPro_ReDtheta_LYZ",iNtheta, -0.5, iNtheta-0.5);
238 fHistProReDtheta->SetXTitle("#theta");
239 fHistProReDtheta->SetYTitle("Re(D^{#theta})");
240 fHistList->Add(fHistProReDtheta);
242 fHistProImDtheta = new TProfile("Second_FlowPro_ImDtheta_LYZ","Second_FlowPro_ImDtheta_LYZ",iNtheta, -0.5, iNtheta-0.5);
243 fHistProImDtheta->SetXTitle("#theta");
244 fHistProImDtheta->SetYTitle("Im(D^{#theta})");
245 fHistList->Add(fHistProImDtheta);
247 //class AliFlowLYZHist2 defines the histograms:
248 for (Int_t theta=0;theta<iNtheta;theta++) {
249 TString nameRP = "AliFlowLYZHist2RP_";
251 fHist2RP[theta]=new AliFlowLYZHist2(theta, "RP", nameRP);
252 fHistList->Add(fHist2RP[theta]);
254 TString namePOI = "AliFlowLYZHist2POI_";
256 fHist2POI[theta]=new AliFlowLYZHist2(theta, "POI", namePOI);
257 fHistList->Add(fHist2POI[theta]);
260 //read histogram fHistProR0theta from the first run list
262 fHistProR0theta = (TProfile*)fFirstRunList->FindObject("First_FlowPro_r0theta_LYZ");
263 if (!fHistProR0theta) {cout<<"fHistProR0theta has a NULL pointer!"<<endl;}
264 fHistList->Add(fHistProR0theta);
265 } else { cout<<"list is NULL pointer!"<<endl; }
270 if (fDebug) cout<<"****Histograms initialised****"<<endl;
272 fEventNumber = 0; //set event counter to zero
277 //-----------------------------------------------------------------------
279 Bool_t AliFlowAnalysisWithLeeYangZeros::Make(AliFlowEventSimple* anEvent)
282 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::Make()****"<<endl;
284 //get tracks from event
287 fCommonHists->FillControlHistograms(anEvent);
288 FillFromFlowEvent(anEvent);
291 fCommonHists->FillControlHistograms(anEvent);
292 SecondFillFromFlowEvent(anEvent);
297 cout<<"##### FlowLeeYangZero: Stack pointer null"<<endl;
300 // cout<<"^^^^read event "<<fEventNumber<<endl;
308 //-----------------------------------------------------------------------
309 Bool_t AliFlowAnalysisWithLeeYangZeros::Finish()
312 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::Finish()****"<<endl;
314 //define variables for both runs
315 Double_t dJ01 = 2.405;
316 Int_t iNtheta = AliFlowLYZConstants::kTheta;
317 //set the event number
318 SetEventNumber((int)fCommonHists->GetHistMultOrig()->GetEntries());
319 //cout<<"number of events processed is "<<fEventNumber<<endl;
321 //set the sum of Q vectors
322 fQsum->Set(fHistQsumforChi->GetBinContent(1),fHistQsumforChi->GetBinContent(2));
323 SetQ2sum(fHistQsumforChi->GetBinContent(3));
327 Double_t dVtheta = 0;
330 for (Int_t theta=0;theta<iNtheta;theta++)
332 //get the first minimum r0
333 fHist1[theta]->FillGtheta();
334 dR0 = fHist1[theta]->GetR0();
336 //calculate integrated flow
337 if (dR0!=0.) { dVtheta = dJ01/dR0; }
338 else { cout<<"r0 is not found! Leaving LYZ analysis."<<endl; return kFALSE; }
340 //for estimating systematic error resulting from d0
341 Double_t dBinsize = (AliFlowLYZConstants::fgMax)/(AliFlowLYZConstants::kNbins);
342 Double_t dVplus = -1.;
343 Double_t dVmin = -1.;
344 if (dR0+dBinsize!=0.) {dVplus = dJ01/(dR0+dBinsize);}
345 if (dR0-dBinsize!=0.) {dVmin = dJ01/(dR0-dBinsize);}
346 //convert V to v (normally v = V/M, but here V=v because the Q-vector is scaled by 1/M)
348 Double_t dvplus = dVplus;
349 Double_t dvmin = dVmin;
350 if (fDebug) cout<<"dv = "<<dv<<" and dvplus = "<<dvplus<< " and dvmin = "<<dvmin<<endl;
352 //fill the histograms
353 fHistProR0theta->Fill(theta,dR0);
354 fHistProVtheta->Fill(theta,dVtheta);
355 //get average value of fVtheta = fV
357 } //end of loop over theta
359 //get average value of fVtheta = fV
363 Double_t dSigma2 = 0;
365 if (fEventNumber!=0) {
366 *fQsum /= fEventNumber;
367 fQ2sum /= fEventNumber;
368 dSigma2 = fQ2sum - TMath::Power(fQsum->X(),2.) - TMath::Power(fQsum->Y(),2.) - TMath::Power(dV,2.); //BP eq. 62
369 if (dSigma2>0) dChi = dV/TMath::Sqrt(dSigma2);
371 fCommonHistsRes->FillChiRP(dChi);
373 cout<<"*************************************"<<endl;
374 cout<<"*************************************"<<endl;
375 cout<<" Integrated flow from "<<endl;
376 cout<<" Lee-Yang Zeroes "<<endl;
378 cout<<"Chi = "<<dChi<<endl;
382 // recalculate statistical errors on integrated flow
383 //combining 5 theta angles to 1 relative error BP eq. 89
384 Double_t dRelErr2comb = 0.;
385 Int_t iEvts = fEventNumber;
387 for (Int_t theta=0;theta<iNtheta;theta++){
388 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
389 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
391 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
393 dRelErr2comb += (1/(2*iEvts*(dJ01*dJ01)*TMath::BesselJ1(dJ01)*
394 TMath::BesselJ1(dJ01)))*
395 (dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2)) +
396 dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2)));
398 dRelErr2comb /= iNtheta;
400 Double_t dRelErrcomb = TMath::Sqrt(dRelErr2comb);
402 //copy content of profile into TH1D and add error
403 Double_t dv2pro = dV; //in the case that fv is equal to fV
404 Double_t dv2Err = dv2pro*dRelErrcomb ;
405 cout<<"dV = "<<dv2pro<<" +- "<<dv2Err<<endl;
407 cout<<"*************************************"<<endl;
408 cout<<"*************************************"<<endl;
409 fCommonHistsRes->FillIntegratedFlow(dv2pro, dv2Err);
412 if (fDebug) cout<<"****histograms filled****"<<endl;
415 fEventNumber =0; //set to zero for second round over events
421 //calculate differential flow
423 TComplex cDenom, cNumerRP, cNumerPOI, cDtheta;
425 TComplex i = TComplex::I();
426 Double_t dBesselRatio[3] = {1., 1.202, 2.69};
427 Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
428 Int_t iNbinsEta = AliFlowCommonConstants::GetNbinsEta();
430 Double_t dEtaRP, dPtRP, dReRatioRP, dVetaRP, dVPtRP, dEtaPOI, dPtPOI, dReRatioPOI, dVetaPOI, dVPtPOI;
433 Double_t dVtheta = 0.;
435 Double_t dReDenom = 0.;
436 Double_t dImDenom = 0.;
437 for (Int_t theta=0;theta<iNtheta;theta++) { //loop over theta
438 if (!fHistProR0theta) {
439 cout << "Hist pointer R0theta in file does not exist" <<endl;
441 dR0 = fHistProR0theta->GetBinContent(theta+1); //histogram starts at bin 1
442 if (fDebug) cerr<<"dR0 = "<<dR0<<endl;
443 if (dR0!=0) dVtheta = dJ01/dR0;
445 // BP Eq. 9 -> Vn^theta = j01/r0^theta
446 if (!fHistProReDenom && !fHistProImDenom) {
447 cout << "Hist pointer fDenom in file does not exist" <<endl;
449 dReDenom = fHistProReDenom->GetBinContent(theta+1);
450 dImDenom = fHistProImDenom->GetBinContent(theta+1);
451 cDenom(dReDenom,dImDenom);
453 //for new method and use by others (only with the sum generating function):
455 cDtheta = dR0*cDenom/dJ01;
456 fHistProReDtheta->Fill(theta,cDtheta.Re());
457 fHistProImDtheta->Fill(theta,cDtheta.Im());
460 cDenom *= TComplex::Power(i, m-1);
461 //cerr<<"TComplex::Power(i, m-1) = "<<TComplex::Power(i, m-1).Rho()<<endl; //checked ok
463 //v as a function of eta for RP selection
464 for (Int_t be=1;be<=iNbinsEta;be++) {
465 dEtaRP = fHist2RP[theta]->GetBinCenter(be);
466 cNumerRP = fHist2RP[theta]->GetNumerEta(be);
467 if (cNumerRP.Rho()==0) {
468 if (fDebug) cerr<<"WARNING: modulus of cNumerRP is zero in Finish()"<<endl;
471 else if (cDenom.Rho()==0) {
472 if (fDebug) cerr<<"WARNING: modulus of cDenom is zero"<<endl;
476 dReRatioRP = (cNumerRP/cDenom).Re();
478 dVetaRP = dBesselRatio[m-1]*dReRatioRP*dVtheta; //BP eq. 12
479 fHistProVetaRP->Fill(dEtaRP,dVetaRP);
480 } //loop over bins be
483 //v as a function of eta for POI selection
484 for (Int_t be=1;be<=iNbinsEta;be++) {
485 dEtaPOI = fHist2POI[theta]->GetBinCenter(be);
486 cNumerPOI = fHist2POI[theta]->GetNumerEta(be);
487 if (cNumerPOI.Rho()==0) {
488 if (fDebug) cerr<<"WARNING: modulus of cNumerPOI is zero in Finish()"<<endl;
491 else if (cDenom.Rho()==0) {
492 if (fDebug) cerr<<"WARNING: modulus of cDenom is zero"<<endl;
496 dReRatioPOI = (cNumerPOI/cDenom).Re();
498 dVetaPOI = dBesselRatio[m-1]*dReRatioPOI*dVtheta; //BP eq. 12
499 fHistProVetaPOI->Fill(dEtaPOI,dVetaPOI);
500 } //loop over bins be
503 //v as a function of Pt for RP selection
504 for (Int_t bp=1;bp<=iNbinsPt;bp++) {
505 dPtRP = fHist2RP[theta]->GetBinCenterPt(bp);
506 cNumerRP = fHist2RP[theta]->GetNumerPt(bp);
507 if (cNumerRP.Rho()==0) {
508 if (fDebug) cerr<<"WARNING: modulus of cNumerRP is zero"<<endl;
511 else if (cDenom.Rho()==0) {
512 if (fDebug) cerr<<"WARNING: modulus of cDenom is zero"<<endl;
516 dReRatioRP = (cNumerRP/cDenom).Re();
518 dVPtRP = dBesselRatio[m-1]*dReRatioRP*dVtheta; //BP eq. 12
519 fHistProVPtRP->Fill(dPtRP,dVPtRP);
520 } //loop over bins bp
524 //v as a function of Pt for POI selection
525 for (Int_t bp=1;bp<=iNbinsPt;bp++) {
526 dPtPOI = fHist2POI[theta]->GetBinCenterPt(bp);
527 cNumerPOI = fHist2POI[theta]->GetNumerPt(bp);
528 if (cNumerPOI.Rho()==0) {
529 if (fDebug) cerr<<"WARNING: modulus of cNumerPOI is zero"<<endl;
532 else if (cDenom.Rho()==0) {
533 if (fDebug) cerr<<"WARNING: modulus of cDenom is zero"<<endl;
537 dReRatioPOI = (cNumerPOI/cDenom).Re();
539 dVPtPOI = dBesselRatio[m-1]*dReRatioPOI*dVtheta; //BP eq. 12
540 fHistProVPtPOI->Fill(dPtPOI,dVPtPOI);
541 } //loop over bins bp
546 }//end of loop over theta
548 //calculate the average of fVtheta = fV
550 if (dV==0.) { cout<<"dV = 0! Leaving LYZ analysis."<<endl; return kFALSE; }
552 //sigma2 and chi (for statistical error calculations)
553 Double_t dSigma2 = 0;
555 if (fEventNumber!=0) {
556 *fQsum /= fEventNumber;
557 //cerr<<"fQsum.X() = "<<fQsum.X()<<endl;
558 //cerr<<"fQsum.Y() = "<<fQsum.Y()<<endl;
559 fQ2sum /= fEventNumber;
560 //cout<<"fQ2sum = "<<fQ2sum<<endl;
561 dSigma2 = fQ2sum - TMath::Power(fQsum->X(),2.) - TMath::Power(fQsum->Y(),2.) - TMath::Power(dV,2.); //BP eq. 62
562 if (dSigma2>0) dChi = dV/TMath::Sqrt(dSigma2);
564 fCommonHistsRes->FillChiRP(dChi);
566 // recalculate statistical errors on integrated flow
567 //combining 5 theta angles to 1 relative error BP eq. 89
568 Double_t dRelErr2comb = 0.;
569 Int_t iEvts = fEventNumber;
571 for (Int_t theta=0;theta<iNtheta;theta++){
572 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
573 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
575 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
577 dRelErr2comb += (1/(2*iEvts*(dJ01*dJ01)*TMath::BesselJ1(dJ01)*
578 TMath::BesselJ1(dJ01)))*
579 (dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2)) +
580 dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2)));
582 dRelErr2comb /= iNtheta;
584 Double_t dRelErrcomb = TMath::Sqrt(dRelErr2comb);
585 Double_t dVErr = dV*dRelErrcomb ;
586 fCommonHistsRes->FillIntegratedFlow(dV,dVErr);
588 cout<<"*************************************"<<endl;
589 cout<<"*************************************"<<endl;
590 cout<<" Integrated flow from "<<endl;
591 cout<<" Lee-Yang Zeroes "<<endl;
593 cout<<"Chi = "<<dChi<<endl;
594 cout<<"dV = "<<dV<<" +- "<<dVErr<<endl;
598 //copy content of profile into TH1D and add error and fill the AliFlowCommonHistResults
600 //v as a function of eta for RP selection
601 for(Int_t b=0;b<iNbinsEta;b++) {
602 Double_t dv2pro = fHistProVetaRP->GetBinContent(b);
603 Double_t dNprime = fCommonHists->GetEntriesInEtaBinRP(b);
604 Double_t dErrdifcomb = 0.; //set error to zero
605 Double_t dErr2difcomb = 0.; //set error to zero
608 for (Int_t theta=0;theta<iNtheta;theta++) {
609 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
610 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
612 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
614 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
615 TMath::BesselJ1(dJ01)))*
616 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
617 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
621 if (dErr2difcomb!=0.) {
622 dErr2difcomb /= iNtheta;
623 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
625 else {dErrdifcomb = 0.;}
627 fCommonHistsRes->FillDifferentialFlowEtaRP(b, dv2pro, dErrdifcomb);
631 //v as a function of eta for POI selection
632 for(Int_t b=0;b<iNbinsEta;b++) {
633 Double_t dv2pro = fHistProVetaPOI->GetBinContent(b);
634 Double_t dNprime = fCommonHists->GetEntriesInEtaBinPOI(b);
635 Double_t dErrdifcomb = 0.; //set error to zero
636 Double_t dErr2difcomb = 0.; //set error to zero
639 for (Int_t theta=0;theta<iNtheta;theta++) {
640 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
641 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
643 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
645 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
646 TMath::BesselJ1(dJ01)))*
647 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
648 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
652 if (dErr2difcomb!=0.) {
653 dErr2difcomb /= iNtheta;
654 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
656 else {dErrdifcomb = 0.;}
658 fCommonHistsRes->FillDifferentialFlowEtaPOI(b, dv2pro, dErrdifcomb);
663 //v as a function of Pt for RP selection
664 TH1F* fHistPtRP = fCommonHists->GetHistPtRP(); //for calculating integrated flow
668 for(Int_t b=0;b<iNbinsPt;b++) {
669 Double_t dv2pro = fHistProVPtRP->GetBinContent(b);
670 Double_t dNprime = fCommonHists->GetEntriesInPtBinRP(b);
671 Double_t dErrdifcomb = 0.; //set error to zero
672 Double_t dErr2difcomb = 0.; //set error to zero
675 for (Int_t theta=0;theta<iNtheta;theta++) {
676 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
677 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
679 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
681 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
682 TMath::BesselJ1(dJ01)))*
683 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
684 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
688 if (dErr2difcomb!=0.) {
689 dErr2difcomb /= iNtheta;
690 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
691 //cerr<<"dErrdifcomb = "<<dErrdifcomb<<endl;
693 else {dErrdifcomb = 0.;}
696 fCommonHistsRes->FillDifferentialFlowPtRP(b, dv2pro, dErrdifcomb);
697 //calculate integrated flow for RP selection
699 Double_t dYieldPt = fHistPtRP->GetBinContent(b);
700 dVRP += dv2pro*dYieldPt;
702 dErrV += dYieldPt*dYieldPt*dErrdifcomb*dErrdifcomb;
703 } else { cout<<"fHistPtRP is NULL"<<endl; }
707 dVRP /= dSum; //the pt distribution should be normalised
708 dErrV /= (dSum*dSum);
709 dErrV = TMath::Sqrt(dErrV);
711 cout<<"dV(RP) = "<<dVRP<<" +- "<<dErrV<<endl;
713 fCommonHistsRes->FillIntegratedFlowRP(dVRP,dErrV);
716 //v as a function of Pt for POI selection
717 TH1F* fHistPtPOI = fCommonHists->GetHistPtPOI(); //for calculating integrated flow
722 for(Int_t b=0;b<iNbinsPt;b++) {
723 Double_t dv2pro = fHistProVPtPOI->GetBinContent(b);
724 Double_t dNprime = fCommonHists->GetEntriesInPtBinPOI(b);
725 Double_t dErrdifcomb = 0.; //set error to zero
726 Double_t dErr2difcomb = 0.; //set error to zero
729 for (Int_t theta=0;theta<iNtheta;theta++) {
730 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
731 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
733 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
735 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
736 TMath::BesselJ1(dJ01)))*
737 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
738 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
742 if (dErr2difcomb!=0.) {
743 dErr2difcomb /= iNtheta;
744 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
745 //cerr<<"dErrdifcomb = "<<dErrdifcomb<<endl;
747 else {dErrdifcomb = 0.;}
750 fCommonHistsRes->FillDifferentialFlowPtPOI(b, dv2pro, dErrdifcomb);
751 //calculate integrated flow for POI selection
753 Double_t dYieldPt = fHistPtPOI->GetBinContent(b);
754 dVPOI += dv2pro*dYieldPt;
756 dErrV += dYieldPt*dYieldPt*dErrdifcomb*dErrdifcomb;
757 } else { cout<<"fHistPtPOI is NULL"<<endl; }
761 dVPOI /= dSum; //the pt distribution should be normalised
762 dErrV /= (dSum*dSum);
763 dErrV = TMath::Sqrt(dErrV);
765 cout<<"dV(POI) = "<<dVPOI<<" +- "<<dErrV<<endl;
767 cout<<"*************************************"<<endl;
768 cout<<"*************************************"<<endl;
769 fCommonHistsRes->FillIntegratedFlowPOI(dVPOI,dErrV);
773 //cout<<"----LYZ analysis finished....----"<<endl<<endl;
779 //-----------------------------------------------------------------------
781 Bool_t AliFlowAnalysisWithLeeYangZeros::FillFromFlowEvent(AliFlowEventSimple* anEvent)
783 // Get event quantities from AliFlowEvent for all particles
785 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::FillFromFlowEvent()****"<<endl;
788 cout<<"##### FlowLeeYangZero: FlowEvent pointer null"<<endl;
793 TComplex cExpo, cGtheta, cGthetaNew, cZ;
794 Int_t iNtheta = AliFlowLYZConstants::kTheta;
795 Int_t iNbins = AliFlowLYZConstants::kNbins;
799 Double_t dOrder = 2.;
802 AliFlowVector vQ = anEvent->GetQ();
803 //weight by the multiplicity
806 if (vQ.GetMult() != 0) {
807 dQX = vQ.X()/vQ.GetMult();
808 dQY = vQ.Y()/vQ.GetMult();
812 //for chi calculation:
814 fHistQsumforChi->SetBinContent(1,fQsum->X());
815 fHistQsumforChi->SetBinContent(2,fQsum->Y());
817 fHistQsumforChi->SetBinContent(3,fQ2sum);
818 //cerr<<"fQ2sum = "<<fQ2sum<<endl;
820 for (Int_t theta=0;theta<iNtheta;theta++)
822 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi()/dOrder;
824 //calculate dQtheta = cos(dOrder*(fPhi-dTheta);the projection of the Q vector on the reference direction dTheta
825 Double_t dQtheta = GetQtheta(vQ, dTheta);
827 for (Int_t bin=1;bin<=iNbins;bin++)
829 Double_t dR = fHist1[theta]->GetBinCenter(bin); //bincentre of bins in histogram //FIXED???
830 //if (theta == 0) cerr<<"cerr::dR = "<<dR<<endl;
833 //calculate the sum generating function
834 cExpo(0.,dR*dQtheta); //Re=0 ; Im=dR*dQtheta
835 cGtheta = TComplex::Exp(cExpo);
839 //calculate the product generating function
840 cGtheta = GetGrtheta(anEvent, dR, dTheta);
841 if (cGtheta.Rho2() > 100.) break;
844 fHist1[theta]->Fill(dR,cGtheta); //fill real and imaginary part of cGtheta
855 //-----------------------------------------------------------------------
856 Bool_t AliFlowAnalysisWithLeeYangZeros::SecondFillFromFlowEvent(AliFlowEventSimple* anEvent)
858 //for differential flow
860 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::SecondFillFromFlowEvent()****"<<endl;
863 cout<<"##### FlowLeeYangZero: FlowEvent pointer null"<<endl;
868 TComplex cExpo, cDenom, cNumerRP, cNumerPOI, cCosTermComplex;
869 Double_t dPhi, dEta, dPt;
871 Double_t dCosTermRP = 0.;
872 Double_t dCosTermPOI = 0.;
874 Double_t dOrder = 2.;
875 Int_t iNtheta = AliFlowLYZConstants::kTheta;
879 AliFlowVector vQ = anEvent->GetQ();
880 //weight by the multiplicity
883 if (vQ.GetMult() != 0) {
884 dQX = vQ.X()/vQ.GetMult();
885 dQY = vQ.Y()/vQ.GetMult();
889 //for chi calculation:
891 fHistQsumforChi->SetBinContent(1,fQsum->X());
892 fHistQsumforChi->SetBinContent(2,fQsum->Y());
894 fHistQsumforChi->SetBinContent(3,fQ2sum);
896 for (Int_t theta=0;theta<iNtheta;theta++)
898 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi()/dOrder;
900 //calculate dQtheta = cos(dOrder*(dPhi-dTheta);the projection of the Q vector on the reference direction dTheta
901 Double_t dQtheta = GetQtheta(vQ, dTheta);
902 //cerr<<"dQtheta for fdenom = "<<dQtheta<<endl;
904 //denominator for differential v
905 if (fHistProR0theta) {
906 dR0 = fHistProR0theta->GetBinContent(theta+1);
909 cout <<"pointer fHistProR0theta does not exist" << endl;
911 //cerr<<"dR0 = "<<dR0 <<endl;
913 if (fUseSum) //sum generating function
915 cExpo(0.,dR0*dQtheta);
916 cDenom = dQtheta*(TComplex::Exp(cExpo)); //BP eq 12
917 //loop over tracks in event
918 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
919 for (Int_t i=0;i<iNumberOfTracks;i++) {
920 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i);
922 dEta = pTrack->Eta();
924 dPhi = pTrack->Phi();
925 if (pTrack->InRPSelection()) { // RP selection
926 dCosTermRP = cos(m*dOrder*(dPhi-dTheta));
927 cNumerRP = dCosTermRP*(TComplex::Exp(cExpo));
928 if (cNumerRP.Rho()==0) {cerr<<"WARNING: modulus of cNumerRP is zero in SecondFillFromFlowEvent"<<endl;}
929 if (fDebug) cerr<<"modulus of cNumerRP is "<<cNumerRP.Rho()<<endl;
930 if (fHist2RP[theta]) {
931 fHist2RP[theta]->Fill(dEta,dPt,cNumerRP); }
933 if (pTrack->InPOISelection()) { //POI selection
934 dCosTermPOI = cos(m*dOrder*(dPhi-dTheta));
935 cNumerPOI = dCosTermPOI*(TComplex::Exp(cExpo));
936 if (cNumerPOI.Rho()==0) {cerr<<"WARNING: modulus of cNumerPOI is zero in SecondFillFromFlowEvent"<<endl;}
937 if (fDebug) cerr<<"modulus of cNumerPOI is "<<cNumerPOI.Rho()<<endl;
938 if (fHist2POI[theta]) {
939 fHist2POI[theta]->Fill(dEta,dPt,cNumerPOI); }
942 // cout << "fHist2 pointer mising" <<endl;
945 else {cerr << "no particle!!!"<<endl;}
949 else //product generating function
951 cDenom = GetDiffFlow(anEvent, dR0, theta);
954 if (fHistProReDenom && fHistProImDenom) {
955 fHistProReDenom->Fill(theta,cDenom.Re()); //fill the real part of fDenom
956 fHistProImDenom->Fill(theta,cDenom.Im()); //fill the imaginary part of fDenom
959 cout << "Pointers to cDenom mising" << endl;
962 }//end of loop over theta
968 //-----------------------------------------------------------------------
969 Double_t AliFlowAnalysisWithLeeYangZeros::GetQtheta(AliFlowVector aQ, Double_t aTheta)
971 //calculate Qtheta. Qtheta is the sum over all particles of cos(dOrder*(dPhi-dTheta)) BP eq. 3
972 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::GetQtheta()****"<<endl;
974 Double_t dQtheta = 0.;
975 Double_t dOrder = 2.;
977 dQtheta = aQ.X()*cos(dOrder*aTheta)+aQ.Y()*sin(dOrder*aTheta);
984 //-----------------------------------------------------------------------
985 TComplex AliFlowAnalysisWithLeeYangZeros::GetGrtheta(AliFlowEventSimple* const anEvent, Double_t aR, Double_t aTheta)
987 // Product Generating Function for LeeYangZeros method
988 // PG Eq. 3 (J. Phys. G Nucl. Part. Phys 30 S1213 (2004))
990 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::GetGrtheta()****"<<endl;
993 TComplex cG = TComplex::One();
994 Double_t dOrder = 2.;
995 Double_t dWgt = 1./anEvent->GetEventNSelTracksRP(); //weight with the multiplicity
997 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
999 for (Int_t i=0;i<iNumberOfTracks;i++) //loop over tracks in event
1001 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
1003 if (pTrack->InRPSelection()) {
1004 Double_t dPhi = pTrack->Phi();
1005 Double_t dGIm = aR * dWgt*cos(dOrder*(dPhi - aTheta));
1006 TComplex cGi(1., dGIm);
1007 cG *= cGi; //product over all tracks
1010 else {cerr << "no particle pointer !!!"<<endl;}
1018 //-----------------------------------------------------------------------
1019 TComplex AliFlowAnalysisWithLeeYangZeros::GetDiffFlow(AliFlowEventSimple* const anEvent, Double_t aR0, Int_t theta)
1021 // Sum for the denominator for diff. flow for the Product Generating Function for LeeYangZeros method
1022 // PG Eq. 9 (J. Phys. G Nucl. Part. Phys 30 S1213 (2004))
1023 // Also for v1 mixed harmonics: DF Eq. 5
1024 // It is the deriverative of Grtheta at r0 divided by Grtheta at r0
1026 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::GetGrtheta()****"<<endl;
1028 TComplex cG = TComplex::One();
1029 TComplex cdGr0(0.,0.);
1030 Double_t dOrder = 2.;
1033 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
1035 Int_t iNtheta = AliFlowLYZConstants::kTheta;
1036 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi()/dOrder;
1038 //for the denominator (use all RP selected particles)
1039 for (Int_t i=0;i<iNumberOfTracks;i++) //loop over tracks in event
1041 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
1043 if (pTrack->InRPSelection()) {
1044 Double_t dPhi = pTrack->Phi();
1045 Double_t dCosTerm = dWgt*cos(dOrder*(dPhi - dTheta));
1047 Double_t dGIm = aR0 * dCosTerm;
1048 TComplex cGi(1., dGIm);
1049 TComplex cCosTermComplex(1., aR0*dCosTerm);
1050 cG *= cGi; //product over all tracks
1052 cdGr0 +=(dCosTerm / cCosTermComplex); //sum over all tracks
1055 else {cerr << "no particle!!!"<<endl;}
1059 for (Int_t i=0;i<iNumberOfTracks;i++)
1061 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
1063 Double_t dEta = pTrack->Eta();
1064 Double_t dPt = pTrack->Pt();
1065 Double_t dPhi = pTrack->Phi();
1066 Double_t dCosTerm = cos(dOrder*(dPhi-dTheta));
1067 TComplex cCosTermComplex(1.,aR0*dCosTerm);
1069 if (pTrack->InRPSelection()) {
1070 TComplex cNumerRP = cG*dCosTerm/cCosTermComplex; //PG Eq. 9
1071 fHist2RP[theta]->Fill(dEta,dPt,cNumerRP);
1074 if (pTrack->InPOISelection()) {
1075 TComplex cNumerPOI = cG*dCosTerm/cCosTermComplex; //PG Eq. 9
1076 fHist2POI[theta]->Fill(dEta,dPt,cNumerPOI);
1079 else {cerr << "no particle pointer!!!"<<endl;}
1082 TComplex cDenom = cG*cdGr0;
1087 //-----------------------------------------------------------------------