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 **************************************************************************/
17 #include "Riostream.h" //needed as include
18 #include "AliFlowCommonConstants.h" //needed as include
19 #include "AliFlowLYZConstants.h" //needed as include
20 #include "AliFlowAnalysisWithLeeYangZeros.h"
21 #include "AliFlowLYZHist1.h" //needed as include
22 #include "AliFlowLYZHist2.h" //needed as include
23 #include "AliFlowCommonHist.h" //needed as include
24 #include "AliFlowCommonHistResults.h" //needed as include
25 #include "AliFlowEventSimple.h" //needed as include
26 #include "AliFlowTrackSimple.h" //needed as include
30 #include "TMath.h" //needed as include
31 #include "TFile.h" //needed as include
40 //Description: Maker to analyze Flow using the LeeYangZeros method
41 // Equation numbers are from Big Paper (BP): Nucl. Phys. A 727, 373 (2003)
42 // Practical Guide (PG): J. Phys. G: Nucl. Part. Phys. 30, S1213 (2004)
43 // Adapted from StFlowLeeYangZerosMaker.cxx
44 // by Markus Oldenberg and Art Poskanzer, LBNL
45 // with advice from Jean-Yves Ollitrault and Nicolas Borghini
47 //Author: Naomi van der Kolk (kolk@nikhef.nl)
51 ClassImp(AliFlowAnalysisWithLeeYangZeros)
53 //-----------------------------------------------------------------------
55 AliFlowAnalysisWithLeeYangZeros::AliFlowAnalysisWithLeeYangZeros():
69 fHistProR0theta(NULL),
70 fHistProReDenom(NULL),
71 fHistProImDenom(NULL),
72 fHistProReDtheta(NULL),
73 fHistProImDtheta(NULL),
79 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::AliFlowAnalysisWithLeeYangZeros default constructor****"<<endl;
81 fHistList = new TList();
83 for(Int_t i = 0;i<5;i++)
89 fQsum = new TVector2();
93 //-----------------------------------------------------------------------
96 AliFlowAnalysisWithLeeYangZeros::~AliFlowAnalysisWithLeeYangZeros()
99 if (fDebug) cout<<"****~AliFlowAnalysisWithLeeYangZeros****"<<endl;
104 //-----------------------------------------------------------------------
106 Bool_t AliFlowAnalysisWithLeeYangZeros::Init()
109 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::Init()****"<<endl;
112 Int_t iNtheta = AliFlowLYZConstants::kTheta;
113 Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
114 Int_t iNbinsEta = AliFlowCommonConstants::GetNbinsEta();
116 Double_t dPtMin = AliFlowCommonConstants::GetPtMin();
117 Double_t dPtMax = AliFlowCommonConstants::GetPtMax();
118 Double_t dEtaMin = AliFlowCommonConstants::GetEtaMin();
119 Double_t dEtaMax = AliFlowCommonConstants::GetEtaMax();
122 //for control histograms
123 fCommonHists = new AliFlowCommonHist("LYZ");
124 //fHistList->Add(fCommonHists->GetHistList());
125 fHistList->Add(fCommonHists->GetHistMultOrig());
126 fHistList->Add(fCommonHists->GetHistMultInt());
127 fHistList->Add(fCommonHists->GetHistMultDiff());
128 fHistList->Add(fCommonHists->GetHistPtInt());
129 fHistList->Add(fCommonHists->GetHistPtDiff());
130 fHistList->Add(fCommonHists->GetHistPhiInt());
131 fHistList->Add(fCommonHists->GetHistPhiDiff());
132 fHistList->Add(fCommonHists->GetHistEtaInt());
133 fHistList->Add(fCommonHists->GetHistEtaDiff());
134 fHistList->Add(fCommonHists->GetHistProMeanPtperBin());
135 fHistList->Add(fCommonHists->GetHistQ());
136 fCommonHistsRes = new AliFlowCommonHistResults("LYZ");
137 //fHistList->Add(fCommonHistsRes->GetHistList());
138 fHistList->Add(fCommonHistsRes->GetHistDiffFlow());
139 fHistList->Add(fCommonHistsRes->GetHistChi());
140 fHistList->Add(fCommonHistsRes->GetHistIntFlow());
142 //for first loop over events
144 fHistProR0theta = new TProfile("First_FlowPro_r0theta_LYZ","First_FlowPro_r0theta_LYZ",iNtheta,-0.5,iNtheta-0.5);
145 fHistProR0theta->SetXTitle("#theta");
146 fHistProR0theta->SetYTitle("r_{0}^{#theta}");
147 fHistList->Add(fHistProR0theta);
149 fHistProVtheta = new TProfile("First_FlowPro_Vtheta_LYZ","First_FlowPro_Vtheta_LYZ",iNtheta,-0.5,iNtheta-0.5);
150 fHistProVtheta->SetXTitle("#theta");
151 fHistProVtheta->SetYTitle("V_{n}^{#theta}");
152 fHistList->Add(fHistProVtheta);
154 //class AliFlowLYZHist1 defines the histograms: fHistProGtheta, fHistProReGtheta, fHistProImGtheta, fHistProR0theta
155 for (Int_t theta=0;theta<iNtheta;theta++) {
156 fHist1[theta]=new AliFlowLYZHist1(theta);
157 //fHistList->Add(fHist1[theta]->GetHistList() );
158 fHistList->Add(fHist1[theta]->GetHistGtheta() );
159 fHistList->Add(fHist1[theta]->GetHistProReGtheta() );
160 fHistList->Add(fHist1[theta]->GetHistProImGtheta() );
164 //for second loop over events
166 fHistProReDenom = new TProfile("Second_FlowPro_ReDenom_LYZ","Second_FlowPro_ReDenom_LYZ" , iNtheta, -0.5, iNtheta-0.5);
167 fHistProReDenom->SetXTitle("#theta");
168 fHistProReDenom->SetYTitle("Re(Q^{#theta}e^{ir_{0}^{#theta}Q^{#theta}})");
169 fHistList->Add(fHistProReDenom);
171 fHistProImDenom = new TProfile("Second_FlowPro_ImDenom_LYZ","Second_FlowPro_ImDenom_LYZ" , iNtheta, -0.5, iNtheta-0.5);
172 fHistProImDenom->SetXTitle("#theta");
173 fHistProImDenom->SetYTitle("Im(Q^{#theta}e^{ir_{0}^{#theta}Q^{#theta}})");
174 fHistList->Add(fHistProImDenom);
176 fHistProVeta = new TProfile("Second_FlowPro_Veta_LYZ","Second_FlowPro_Veta_LYZ",iNbinsEta,dEtaMin,dEtaMax);
177 fHistProVeta->SetXTitle("rapidity");
178 fHistProVeta->SetYTitle("v (%)");
179 fHistList->Add(fHistProVeta);
181 fHistProVPt = new TProfile("Second_FlowPro_VPt_LYZ","Second_FlowPro_VPt_LYZ",iNbinsPt,dPtMin,dPtMax);
182 fHistProVPt->SetXTitle("Pt");
183 fHistProVPt->SetYTitle("v (%)");
184 fHistList->Add(fHistProVPt);
186 fHistProReDtheta = new TProfile("Second_FlowPro_ReDtheta_LYZ","Second_FlowPro_ReDtheta_LYZ",iNtheta, -0.5, iNtheta-0.5);
187 fHistProReDtheta->SetXTitle("#theta");
188 fHistProReDtheta->SetYTitle("Re(D^{#theta})");
189 fHistList->Add(fHistProReDtheta);
191 fHistProImDtheta = new TProfile("Second_FlowPro_ImDtheta_LYZ","Second_FlowPro_ImDtheta_LYZ",iNtheta, -0.5, iNtheta-0.5);
192 fHistProImDtheta->SetXTitle("#theta");
193 fHistProImDtheta->SetYTitle("Im(D^{#theta})");
194 fHistList->Add(fHistProImDtheta);
196 //class AliFlowLYZHist2 defines the histograms:
197 for (Int_t theta=0;theta<iNtheta;theta++) {
198 fHist2[theta]=new AliFlowLYZHist2(theta);
199 //fHistList->Add(fHist2[theta]->GetHistList() );
200 fHistList->Add(fHist2[theta]->GetHistProReNumer() );
201 fHistList->Add(fHist2[theta]->GetHistProImNumer() );
202 fHistList->Add(fHist2[theta]->GetHistProReNumerPt() );
203 fHistList->Add(fHist2[theta]->GetHistProImNumerPt() );
204 //fHistList->Add(fHist2[theta]->GetHistProReNumer2D() ); //gives error in compilation
205 //fHistList->Add(fHist2[theta]->GetHistProImNumer2D() ); //gives error in compilation
208 //read hists from first run file
209 //firstRunFile = new TFile("fof_flowLYZAnal_firstrun.root","READ"); //default is read
210 if (firstRunFile->IsZombie()){ //check if file exists
211 cout << "Error opening file, run first with fFirstrun = kTRUE" << endl;
213 } else if (firstRunFile->IsOpen()){
214 cout<<"----firstRunFile is open----"<<endl<<endl;
215 TList* list = (TList*)firstRunFile->Get("cobj1");
216 if (!list) {cout<<"list is NULL pointer!"<<endl;}
217 fHistProR0theta = (TProfile*)list->FindObject("First_FlowPro_r0theta_LYZ");
218 if (!fHistProR0theta) {cout<<"fHistProR0theta has a NULL pointer!"<<endl;}
219 fHistList->Add(fHistProR0theta);
224 if (fDebug) cout<<"****Histograms initialised****"<<endl;
226 fEventNumber = 0; //set event counter to zero
231 //-----------------------------------------------------------------------
233 Bool_t AliFlowAnalysisWithLeeYangZeros::Make(AliFlowEventSimple* anEvent)
236 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::Make()****"<<endl;
238 //get tracks from event
241 fCommonHists->FillControlHistograms(anEvent);
242 FillFromFlowEvent(anEvent);
245 fCommonHists->FillControlHistograms(anEvent);
246 SecondFillFromFlowEvent(anEvent);
251 cout<<"##### FlowLeeYangZero: Stack pointer null"<<endl;
254 cout<<"^^^^read event "<<fEventNumber<<endl;
262 //-----------------------------------------------------------------------
263 Bool_t AliFlowAnalysisWithLeeYangZeros::Finish()
266 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::Finish()****"<<endl;
268 //define variables for both runs
269 Double_t dJ01 = 2.405;
270 Int_t iNtheta = AliFlowLYZConstants::kTheta;
274 Double_t dVtheta = 0;
277 for (Int_t theta=0;theta<iNtheta;theta++)
279 //get the first minimum r0
280 fHist1[theta]->FillGtheta();
281 dR0 = fHist1[theta]->GetR0();
283 //calculate integrated flow
284 if (dR0!=0) dVtheta = dJ01/dR0;
285 //for estimating systematic error resulting from d0
286 Double_t dBinsize = (AliFlowLYZConstants::fgMax)/(AliFlowLYZConstants::kNbins);
287 Double_t dVplus = dJ01/(dR0+dBinsize);
288 Double_t dVmin = dJ01/(dR0-dBinsize);
290 Double_t dvplus = dVplus;
291 Double_t dvmin = dVmin;
292 cout<<"dv = "<<dv<<" and dvplus = "<<dvplus<< " and dvmin = "<<dvmin<<endl;
294 //fill the histograms
295 fHistProR0theta->Fill(theta,dR0);
296 fHistProVtheta->Fill(theta,dVtheta);
297 //get average value of fVtheta = fV
299 } //end of loop over theta
301 //get average value of fVtheta = fV
305 Double_t dSigma2 = 0;
307 if (fEventNumber!=0) {
308 *fQsum /= fEventNumber;
309 fQ2sum /= fEventNumber;
310 dSigma2 = fQ2sum - TMath::Power(fQsum->X(),2.) - TMath::Power(fQsum->Y(),2.) - TMath::Power(dV,2.); //BP eq. 62
311 if (dSigma2>0) dChi = dV/TMath::Sqrt(dSigma2);
313 fCommonHistsRes->FillChi(dChi);
314 cout<<"dV = "<<dV<<" and chi = "<<dChi<<endl;
317 // recalculate statistical errors on integrated flow
318 //combining 5 theta angles to 1 relative error BP eq. 89
319 Double_t dRelErr2comb = 0.;
320 Int_t iEvts = fEventNumber;
321 for (Int_t theta=0;theta<iNtheta;theta++){
322 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
323 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
325 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
327 dRelErr2comb += (1/(2*iEvts*(dJ01*dJ01)*TMath::BesselJ1(dJ01)*
328 TMath::BesselJ1(dJ01)))*
329 (dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2)) +
330 dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2)));
332 dRelErr2comb /= iNtheta;
333 Double_t dRelErrcomb = TMath::Sqrt(dRelErr2comb);
334 cout<<"dRelErrcomb = "<<dRelErrcomb<<endl;
336 //copy content of profile into TH1D and add error
337 Double_t dv2pro = dV; //in the case that fv is equal to fV
338 Double_t dv2Err = dv2pro*dRelErrcomb ;
339 cout<<"dv2pro +- dv2Err = "<<dv2pro<<" +- "<<dv2Err<<endl;
340 fCommonHistsRes->FillIntegratedFlow(dv2pro, dv2Err);
343 if (fDebug) cout<<"****histograms filled****"<<endl;
346 fEventNumber =0; //set to zero for second round over events
352 //calculate differential flow
354 TComplex cDenom, cNumer, cDtheta;
356 TComplex i = TComplex::I();
357 Double_t dBesselRatio[3] = {1., 1.202, 2.69};
358 Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
359 Int_t iNbinsEta = AliFlowCommonConstants::GetNbinsEta();
361 Double_t dEta, dPt, dReRatio, dVeta, dVPt;
365 Double_t dVtheta = 0.;
367 Double_t dReDenom = 0.;
368 Double_t dImDenom = 0.;
369 for (Int_t theta=0;theta<iNtheta;theta++) { //loop over theta
370 if (fHistProR0theta) {
371 dR0 = fHistProR0theta->GetBinContent(theta+1);
372 if (fDebug) cerr<<"dR0 = "<<dR0<<endl;
373 if (dR0!=0) dVtheta = dJ01/dR0;
375 // BP Eq. 9 -> Vn^theta = j01/r0^theta
376 if (fHistProReDenom && fHistProImDenom) {
377 dReDenom = fHistProReDenom->GetBinContent(theta+1);
378 dImDenom = fHistProImDenom->GetBinContent(theta+1);
381 cout << "Hist pointer fDenom in file does not exist" <<endl;
386 cout << "Hist pointer R0theta in file does not exist" <<endl;
388 //} //loop over theta
390 cDenom(dReDenom,dImDenom);
393 //for new method and use by others (only with the sum generating function):
395 dR0 = fHistProR0theta->GetBinContent(theta+1);
396 cDtheta = dR0*cDenom/dJ01;
397 fHistProReDtheta->Fill(theta,cDtheta.Re());
398 fHistProImDtheta->Fill(theta,cDtheta.Im());
401 cDenom *= TComplex::Power(i, m-1);
402 //cerr<<"TComplex::Power(i, m-1) = "<<TComplex::Power(i, m-1).Rho()<<endl; //checked ok
404 //v as a function of eta
405 for (Int_t be=1;be<=iNbinsEta;be++) {
406 dEta = fHist2[theta]->GetBinCenter(be);
407 cNumer = fHist2[theta]->GetNumerEta(be);
408 if (cNumer.Rho()==0) {
409 if (fDebug) cerr<<"WARNING: modulus of cNumer is zero in Finish()"<<endl;
412 else if (cDenom.Rho()==0) {
413 if (fDebug) cerr<<"WARNING: modulus of cDenom is zero"<<endl;
417 //if ( j==1 && theta==0) cerr<<"modulus of cNumer = "<<cNumer.Rho() <<endl; //always a number smaller than 1, or 0.
418 dReRatio = (cNumer/cDenom).Re();
421 dVeta = dBesselRatio[m-1]*dReRatio*dVtheta*100.; //BP eq. 12
422 //if ( j==1 && theta==0) cerr<<"eta = "<<dEta<<" cerr::dReRatio for eta = "<<dReRatio<<" cerr::dVeta for eta = "<<dVeta<<endl;
424 fHistProVeta->Fill(dEta,dVeta);
425 } //loop over bins be
427 //v as a function of Pt
428 for (Int_t bp=1;bp<=iNbinsPt;bp++) {
429 dPt = fHist2[theta]->GetBinCenterPt(bp);
430 cNumer = fHist2[theta]->GetNumerPt(bp);
431 if (cNumer.Rho()==0) {
432 if (fDebug) cerr<<"modulus of cNumer is zero"<<endl;
435 else if (cDenom.Rho()==0) {
436 if (fDebug) cerr<<"modulus of cDenom is zero"<<endl;
440 //if ( j==1 && theta==0) cerr<<"modulus of fNumer = "<<fNumer.Rho() <<endl; //always a number smaller than 1, or 0.
441 dReRatio = (cNumer/cDenom).Re();
444 dVPt = dBesselRatio[m-1]*dReRatio*dVtheta*100.; //BP eq. 12
446 fHistProVPt->Fill(dPt,dVPt);
447 } //loop over bins bp
449 }//end of loop over theta
451 //calculate the average of fVtheta = fV
454 //sigma2 and chi (for statistical error calculations)
455 Double_t dSigma2 = 0;
457 if (fEventNumber!=0) {
458 *fQsum /= fEventNumber;
459 //cerr<<"fQsum.X() = "<<fQsum.X()<<endl;
460 //cerr<<"fQsum.Y() = "<<fQsum.Y()<<endl;
461 fQ2sum /= fEventNumber;
462 //cout<<"fQ2sum = "<<fQ2sum<<endl;
463 dSigma2 = fQ2sum - TMath::Power(fQsum->X(),2.) - TMath::Power(fQsum->Y(),2.) - TMath::Power(dV,2.); //BP eq. 62
464 if (dSigma2>0) dChi = dV/TMath::Sqrt(dSigma2);
466 fCommonHistsRes->FillChi(dChi);
467 cout<<"dV = "<<dV<<" and chi = "<<dChi<<endl;
470 //copy content of profile into TH1D and add error
471 for(Int_t b=0;b<iNbinsPt;b++) {
472 Double_t dv2pro = fHistProVPt->GetBinContent(b);
473 Double_t dNprime = fCommonHists->GetEntriesInPtBin(b);
474 Double_t dErrdifcomb = 0.; //set error to zero
475 Double_t dErr2difcomb = 0.; //set error to zero
478 for (Int_t theta=0;theta<iNtheta;theta++) {
479 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
480 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
482 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
484 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
485 TMath::BesselJ1(dJ01)))*
486 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
487 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
491 if (dErr2difcomb!=0.) {
492 dErr2difcomb /= iNtheta;
493 dErrdifcomb = TMath::Sqrt(dErr2difcomb)*100;
494 //cerr<<"dErrdifcomb = "<<dErrdifcomb<<endl;
496 else {dErrdifcomb = 0.;}
499 fCommonHistsRes->FillDifferentialFlow(b, dv2pro, dErrdifcomb);
503 //close the first run file
504 //firstRunFile->Close(); //gives error when writing to TList
509 cout<<"----LYZ analysis finished....----"<<endl<<endl;
515 //-----------------------------------------------------------------------
517 Bool_t AliFlowAnalysisWithLeeYangZeros::FillFromFlowEvent(AliFlowEventSimple* anEvent)
519 // Get event quantities from AliFlowEvent for all particles
521 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::FillFromFlowEvent()****"<<endl;
524 cout<<"##### FlowLeeYangZero: FlowEvent pointer null"<<endl;
529 TComplex cExpo, cGtheta, cGthetaNew, cZ;
530 Int_t iNtheta = AliFlowLYZConstants::kTheta;
531 Int_t iNbins = AliFlowLYZConstants::kNbins;
535 Double_t dOrder = 2.;
538 AliFlowVector vQ = anEvent->GetQ();
539 //weight by the multiplicity
542 if (vQ.GetMult() != 0) {
543 dQX = vQ.X()/vQ.GetMult();
544 dQY = vQ.Y()/vQ.GetMult();
547 //for chi calculation:
550 //cerr<<"fQ2sum = "<<fQ2sum<<endl;
552 for (Int_t theta=0;theta<iNtheta;theta++)
554 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi()/dOrder;
556 //calculate dQtheta = cos(dOrder*(fPhi-dTheta);the projection of the Q vector on the reference direction dTheta
557 Double_t dQtheta = GetQtheta(vQ, dTheta);
559 for (Int_t bin=1;bin<=iNbins;bin++)
561 Double_t dR = fHist1[theta]->GetBinCenter(bin); //bincentre of bins in histogram //FIXED???
562 //if (theta == 0) cerr<<"cerr::dR = "<<dR<<endl;
565 //calculate the sum generating function
566 cExpo(0.,dR*dQtheta); //Re=0 ; Im=dR*dQtheta
567 cGtheta = TComplex::Exp(cExpo);
571 //calculate the product generating function
572 cGtheta = GetGrtheta(anEvent, dR, dTheta); //make this function
573 if (cGtheta.Rho2() > 100.) break;
576 fHist1[theta]->Fill(dR,cGtheta); //fill real and imaginary part of cGtheta
587 //-----------------------------------------------------------------------
588 Bool_t AliFlowAnalysisWithLeeYangZeros::SecondFillFromFlowEvent(AliFlowEventSimple* anEvent)
590 //for differential flow
592 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::SecondFillFromFlowEvent()****"<<endl;
595 cout<<"##### FlowLeeYangZero: FlowEvent pointer null"<<endl;
600 TComplex cExpo, cDenom, cNumer,cCosTermComplex;
601 Double_t dPhi, dEta, dPt;
605 Double_t dOrder = 2.;
606 Int_t iNtheta = AliFlowLYZConstants::kTheta;
610 AliFlowVector vQ = anEvent->GetQ();
611 //weight by the multiplicity
614 if (vQ.GetMult() != 0) {
615 dQX = vQ.X()/vQ.GetMult();
616 dQY = vQ.Y()/vQ.GetMult();
619 //for chi calculation:
623 for (Int_t theta=0;theta<iNtheta;theta++)
625 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi()/dOrder;
627 //calculate dQtheta = cos(dOrder*(dPhi-dTheta);the projection of the Q vector on the reference direction dTheta
628 Double_t dQtheta = GetQtheta(vQ, dTheta);
629 //cerr<<"dQtheta for fdenom = "<<dQtheta<<endl;
631 //denominator for differential v
632 if (fHistProR0theta) {
633 dR0 = fHistProR0theta->GetBinContent(theta+1);
636 cout <<"pointer fHistProR0theta does not exist" << endl;
638 //cerr<<"dR0 = "<<dR0 <<endl;
640 if (fUseSum) //sum generating function
642 cExpo(0.,dR0*dQtheta);
643 cDenom = dQtheta*(TComplex::Exp(cExpo)); //BP eq 12
644 //loop over tracks in event
645 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
646 for (Int_t i=0;i<iNumberOfTracks;i++) {
647 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i);
649 if (pTrack->UseForDifferentialFlow()) {
650 dEta = pTrack->Eta();
652 dPhi = pTrack->Phi();
653 dCosTerm = cos(m*dOrder*(dPhi-dTheta));
654 //cerr<<"dCosTerm = "<<dCosTerm <<endl;
655 cNumer = dCosTerm*(TComplex::Exp(cExpo));
656 if (cNumer.Rho()==0) {cerr<<"WARNING: modulus of cNumer is zero in SecondFillFromFlowEvent"<<endl;}
657 if (fDebug) cerr<<"modulus of cNumer is "<<cNumer.Rho()<<endl;
659 fHist2[theta]->Fill(dEta,dPt,cNumer);
662 cout << "fHist2 pointer mising" <<endl;
666 else {cerr << "no particle!!!"<<endl;}
670 else //product generating function
672 cDenom = GetDiffFlow(anEvent, dR0, theta);
675 if (fHistProReDenom && fHistProImDenom) {
676 fHistProReDenom->Fill(theta,cDenom.Re()); //fill the real part of fDenom
677 fHistProImDenom->Fill(theta,cDenom.Im()); //fill the imaginary part of fDenom
680 cout << "Pointers to cDenom mising" << endl;
683 }//end of loop over theta
689 //-----------------------------------------------------------------------
690 Double_t AliFlowAnalysisWithLeeYangZeros::GetQtheta(AliFlowVector aQ, Double_t aTheta)
692 //calculate Qtheta. Qtheta is the sum over all particles of cos(dOrder*(dPhi-dTheta)) BP eq. 3
693 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::GetQtheta()****"<<endl;
695 Double_t dQtheta = 0.;
696 Double_t dOrder = 2.;
698 dQtheta = aQ.X()*cos(dOrder*aTheta)+aQ.Y()*sin(dOrder*aTheta);
705 //-----------------------------------------------------------------------
706 TComplex AliFlowAnalysisWithLeeYangZeros::GetGrtheta(AliFlowEventSimple* anEvent, Double_t aR, Double_t aTheta)
708 // Product Generating Function for LeeYangZeros method
709 // PG Eq. 3 (J. Phys. G Nucl. Part. Phys 30 S1213 (2004))
711 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::GetGrtheta()****"<<endl;
714 TComplex cG = TComplex::One();
715 Double_t dOrder = 2.;
718 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
720 for (Int_t i=0;i<iNumberOfTracks;i++) //loop over tracks in event
722 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
724 if (pTrack->UseForIntegratedFlow()) {
725 Double_t dPhi = pTrack->Phi();
726 Double_t dGIm = aR * dWgt*cos(dOrder*(dPhi - aTheta));
727 TComplex cGi(1., dGIm);
728 cG *= cGi; //product over all tracks
731 else {cerr << "no particle pointer !!!"<<endl;}
739 //-----------------------------------------------------------------------
740 TComplex AliFlowAnalysisWithLeeYangZeros::GetDiffFlow(AliFlowEventSimple* anEvent, Double_t aR0, Int_t theta)
742 // Sum for the denominator for diff. flow for the Product Generating Function for LeeYangZeros method
743 // PG Eq. 9 (J. Phys. G Nucl. Part. Phys 30 S1213 (2004))
744 // Also for v1 mixed harmonics: DF Eq. 5
745 // It is the deriverative of Grtheta at r0 divided by Grtheta at r0
747 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::GetGrtheta()****"<<endl;
749 TComplex cG = TComplex::One();
750 TComplex cdGr0(0.,0.);
751 Double_t dOrder = 2.;
754 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
756 Int_t iNtheta = AliFlowLYZConstants::kTheta;
757 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi()/dOrder;
759 for (Int_t i=0;i<iNumberOfTracks;i++) //loop over tracks in event
761 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
763 if (pTrack->UseForDifferentialFlow()) {
764 Double_t dPhi = pTrack->Phi();
765 Double_t dCosTerm = dWgt*cos(dOrder*(dPhi - dTheta));
767 Double_t dGIm = aR0 * dCosTerm;
768 TComplex cGi(1., dGIm);
769 cG *= cGi; //product over all tracks
771 TComplex cCosTermComplex(1., aR0*dCosTerm);
772 cdGr0 +=(dCosTerm / cCosTermComplex); //sum over all tracks
775 else {cerr << "no particle!!!"<<endl;}
779 for (Int_t i=0;i<iNumberOfTracks;i++)
781 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
783 if (pTrack->UseForDifferentialFlow()) {
784 Double_t dEta = pTrack->Eta();
785 Double_t dPt = pTrack->Pt();
786 Double_t dPhi = pTrack->Phi();
787 Double_t dCosTerm = cos(dOrder*(dPhi-dTheta));
788 TComplex cCosTermComplex(1.,aR0*dCosTerm);
789 TComplex cNumer = cG*dCosTerm/cCosTermComplex; //PG Eq. 9
790 fHist2[theta]->Fill(dEta,dPt,cNumer);
793 else {cerr << "no particle pointer!!!"<<endl;}
796 TComplex cDenom = cG*cdGr0;
801 //-----------------------------------------------------------------------