1 /*************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 // AliFlowAnalysisWithLYZEventPlane:
18 // Class to do flow analysis with the event plane from the LYZ method
20 // author: N. van der Kolk (kolk@nikhef.nl)
26 //#define AliFlowAnalysisWithLYZEventPlane_cxx
28 #include "Riostream.h" //needed as include
29 #include "TMath.h" //needed as include
30 #include "TProfile.h" //needed as include
36 #include "AliFlowLYZConstants.h" //needed as include
37 #include "AliFlowCommonConstants.h" //needed as include
38 #include "AliFlowEventSimple.h"
39 #include "AliFlowTrackSimple.h"
40 #include "AliFlowCommonHist.h"
41 #include "AliFlowCommonHistResults.h"
42 #include "AliFlowLYZEventPlane.h"
43 #include "AliFlowAnalysisWithLYZEventPlane.h"
44 #include "AliFlowVector.h"
47 ClassImp(AliFlowAnalysisWithLYZEventPlane)
49 //-----------------------------------------------------------------------
51 AliFlowAnalysisWithLYZEventPlane::AliFlowAnalysisWithLYZEventPlane():
54 fSecondReDtheta(NULL),
55 fSecondImDtheta(NULL),
58 fHistProVetaPOI(NULL),
63 fHistQsumforChi(NULL),
66 fHistDeltaPhihere(NULL),
72 fCommonHistsRes(NULL),
79 fQsum = new TVector2(); // flow vector sum
81 fHistList = new TList();
82 fSecondRunList = new TList();
87 //-----------------------------------------------------------------------
90 AliFlowAnalysisWithLYZEventPlane::~AliFlowAnalysisWithLYZEventPlane()
95 delete fSecondRunList;
99 //-----------------------------------------------------------------------
101 void AliFlowAnalysisWithLYZEventPlane::WriteHistograms(TString* outputFileName)
103 //store the final results in output .root file
105 TFile *output = new TFile(outputFileName->Data(),"RECREATE");
106 //output->WriteObject(fHistList, "cobjLYZEP","SingleKey");
107 fHistList->SetName("cobjLYZEP");
108 fHistList->SetOwner(kTRUE);
109 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
113 //-----------------------------------------------------------------------
115 void AliFlowAnalysisWithLYZEventPlane::WriteHistograms(TString outputFileName)
117 //store the final results in output .root file
119 TFile *output = new TFile(outputFileName.Data(),"RECREATE");
120 //output->WriteObject(fHistList, "cobjLYZEP","SingleKey");
121 fHistList->SetName("cobjLYZEP");
122 fHistList->SetOwner(kTRUE);
123 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
127 //-----------------------------------------------------------------------
129 void AliFlowAnalysisWithLYZEventPlane::WriteHistograms(TDirectoryFile *outputFileName)
131 //store the final results in output .root file
132 fHistList->SetName("cobjLYZEP");
133 fHistList->SetOwner(kTRUE);
134 outputFileName->Add(fHistList);
135 outputFileName->Write(outputFileName->GetName(), TObject::kSingleKey);
138 //-----------------------------------------------------------------------
140 void AliFlowAnalysisWithLYZEventPlane::Init() {
142 //Initialise all histograms
143 cout<<"---Analysis with Lee Yang Zeros Event Plane Method---"<<endl;
145 //save old value and prevent histograms from being added to directory
146 //to avoid name clashes in case multiple analaysis objects are used
148 Bool_t oldHistAddStatus = TH1::AddDirectoryStatus();
149 TH1::AddDirectory(kFALSE);
152 if (fSecondRunList) {
153 fSecondReDtheta = (TProfile*)fSecondRunList->FindObject("Second_FlowPro_ReDtheta_LYZSUM");
154 fHistList->Add(fSecondReDtheta);
156 fSecondImDtheta = (TProfile*)fSecondRunList->FindObject("Second_FlowPro_ImDtheta_LYZSUM");
157 fHistList->Add(fSecondImDtheta);
159 fFirstr0theta = (TProfile*)fSecondRunList->FindObject("First_FlowPro_r0theta_LYZSUM");
160 fHistList->Add(fFirstr0theta);
163 if (!fSecondReDtheta) {cout<<"fSecondReDtheta is NULL!"<<endl; }
164 if (!fSecondImDtheta) {cout<<"fSecondImDtheta is NULL!"<<endl; }
165 if (!fFirstr0theta) {cout<<"fFirstr0theta is NULL!"<<endl; }
169 fCommonHists = new AliFlowCommonHist("AliFlowCommonHistLYZEP");
170 fHistList->Add(fCommonHists);
172 fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsLYZEP");
173 fHistList->Add(fCommonHistsRes);
175 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
176 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
177 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
178 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
179 Double_t dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();
180 Double_t dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
182 fHistProVetaRP = new TProfile("FlowPro_VetaRP_LYZEP","FlowPro_VetaRP_LYZEP",iNbinsEta,dEtaMin,dEtaMax);
183 fHistProVetaRP->SetXTitle("rapidity");
184 fHistProVetaRP->SetYTitle("v_{2}(#eta) for RP selection");
185 fHistList->Add(fHistProVetaRP);
187 fHistProVetaPOI = new TProfile("FlowPro_VetaPOI_LYZEP","FlowPro_VetaPOI_LYZEP",iNbinsEta,dEtaMin,dEtaMax);
188 fHistProVetaPOI->SetXTitle("rapidity");
189 fHistProVetaPOI->SetYTitle("v_{2}(#eta) for POI selection");
190 fHistList->Add(fHistProVetaPOI);
192 fHistProVPtRP = new TProfile("FlowPro_VPtRP_LYZEP","FlowPro_VPtRP_LYZEP",iNbinsPt,dPtMin,dPtMax);
193 fHistProVPtRP->SetXTitle("Pt");
194 fHistProVPtRP->SetYTitle("v_{2}(p_{T}) for RP selection");
195 fHistList->Add(fHistProVPtRP);
197 fHistProVPtPOI = new TProfile("FlowPro_VPtPOI_LYZEP","FlowPro_VPtPOI_LYZEP",iNbinsPt,dPtMin,dPtMax);
198 fHistProVPtPOI->SetXTitle("p_{T}");
199 fHistProVPtPOI->SetYTitle("v_{2}(p_{T}) for POI selection");
200 fHistList->Add(fHistProVPtPOI);
202 fHistProWr = new TProfile("FlowPro_Wr_LYZEP","FlowPro_Wr_LYZEP",100,0.,0.25);
203 fHistProWr->SetXTitle("Q");
204 fHistProWr->SetYTitle("Wr");
205 fHistList->Add(fHistProWr);
207 fHistQsumforChi = new TH1F("Flow_QsumforChi_LYZEP","Flow_QsumforChi_LYZEP",3,-1.,2.);
208 fHistQsumforChi->SetXTitle("Qsum.X , Qsum.Y, Q2sum");
209 fHistQsumforChi->SetYTitle("value");
210 fHistList->Add(fHistQsumforChi);
212 fHistDeltaPhi = new TH1F("Flow_DeltaPhi_LYZEP","Flow_DeltaPhi_LYZEP",100,0.,3.14);
213 fHistDeltaPhi->SetXTitle("DeltaPhi");
214 fHistDeltaPhi->SetYTitle("Counts");
215 fHistList->Add(fHistDeltaPhi);
217 fHistPhiLYZ = new TH1F("Flow_PhiLYZ_LYZEP","Flow_PhiLYZ_LYZEP",100,0.,3.14);
218 fHistPhiLYZ->SetXTitle("Phi from LYZ");
219 fHistPhiLYZ->SetYTitle("Counts");
220 fHistList->Add(fHistPhiLYZ);
222 fHistPhiEP = new TH1F("Flow_PhiEP_LYZEP","Flow_PhiEP_LYZEP",100,0.,3.14);
223 fHistPhiEP->SetXTitle("Phi from EP");
224 fHistPhiEP->SetYTitle("Counts");
225 fHistList->Add(fHistPhiEP);
227 fEventNumber = 0; //set number of events to zero
230 TH1::AddDirectory(oldHistAddStatus);
233 //-----------------------------------------------------------------------
235 void AliFlowAnalysisWithLYZEventPlane::Make(AliFlowEventSimple* anEvent, AliFlowLYZEventPlane* aLYZEP) {
237 //Get the event plane and weight for each event
240 //fill control histograms
241 fCommonHists->FillControlHistograms(anEvent);
243 //get the Q vector from the FlowEvent
244 AliFlowVector vQ = anEvent->GetQ();
245 //if (vQ.X()== 0. && vQ.Y()== 0. ) { cout<<"Q vector is NULL!"<<endl; } //coding violation
246 //Weight with the multiplicity
249 if (TMath::AreEqualAbs(vQ.GetMult(),0.0,1e-10)) {
250 dQX = vQ.X()/vQ.GetMult();
251 dQY = vQ.Y()/vQ.GetMult();
252 } else {cerr<<"vQ.GetMult() is zero!"<<endl; }
254 //cout<<"vQ("<<dQX<<","<<dQY<<")"<<endl;
256 //for chi calculation:
258 fHistQsumforChi->SetBinContent(1,fQsum->X());
259 fHistQsumforChi->SetBinContent(2,fQsum->Y());
261 fHistQsumforChi->SetBinContent(3,fQ2sum);
262 //cout<<"fQ2sum = "<<fQ2sum<<endl;
264 //call AliFlowLYZEventPlane::CalculateRPandW() here!
265 aLYZEP->CalculateRPandW(vQ);
267 Double_t dWR = aLYZEP->GetWR();
268 Double_t dRP = aLYZEP->GetPsi();
270 //fHistProWr->Fill(vQ.Mod(),dWR); //this weight is always positive
271 fHistPhiLYZ->Fill(dRP);
273 //plot difference between event plane from EP-method and LYZ-method
274 Double_t dRPEP = vQ.Phi()/2; //gives distribution from (0 to pi)
275 //Double_t dRPEP = 0.5*TMath::ATan2(vQ.Y(),vQ.X()); //gives distribution from (-pi/2 to pi/2)
276 //cout<<"dRPEP = "<< dRPEP <<endl;
277 fHistPhiEP->Fill(dRPEP);
279 Double_t dDeltaPhi = dRPEP - dRP;
280 if (dDeltaPhi < 0.) { dDeltaPhi += TMath::Pi(); } //to shift distribution from (-pi/2 to pi/2) to (0 to pi)
281 //cout<<"dDeltaPhi = "<<dDeltaPhi<<endl;
282 fHistDeltaPhi->Fill(dDeltaPhi);
285 Double_t dLow = TMath::Pi()/4.;
286 Double_t dHigh = 3.*(TMath::Pi()/4.);
287 if ((dDeltaPhi > dLow) && (dDeltaPhi < dHigh)){
288 dRP -= (TMath::Pi()/2);
290 cerr<<"*** dRP modified ***"<<endl;
292 fHistProWr->Fill(vQ.Mod(),dWR); //corrected weight
294 //calculate flow for RP and POI selections
295 //loop over the tracks of the event
296 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
297 for (Int_t i=0;i<iNumberOfTracks;i++)
299 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
301 Double_t dPhi = pTrack->Phi();
302 //if (dPhi<0.) fPhi+=2*TMath::Pi();
303 Double_t dPt = pTrack->Pt();
304 Double_t dEta = pTrack->Eta();
306 Double_t dv2 = dWR * TMath::Cos(2*(dPhi-dRP));
307 if (pTrack->InRPSelection()) {
308 //fill histograms for RP selection
309 fHistProVetaRP -> Fill(dEta,dv2);
310 fHistProVPtRP -> Fill(dPt,dv2);
312 if (pTrack->InPOISelection()) {
313 //fill histograms for POI selection
314 fHistProVetaPOI -> Fill(dEta,dv2);
315 fHistProVPtPOI -> Fill(dPt,dv2);
321 // cout<<"@@@@@ "<<fEventNumber<<" events processed"<<endl;
325 //--------------------------------------------------------------------
326 void AliFlowAnalysisWithLYZEventPlane::GetOutputHistograms(TList *outputListHistos){
327 //get pointers to all output histograms (called before Finish())
328 if (outputListHistos) {
329 //Get the common histograms from the output list
330 AliFlowCommonHist *pCommonHist = dynamic_cast<AliFlowCommonHist*>
331 (outputListHistos->FindObject("AliFlowCommonHistLYZEP"));
332 AliFlowCommonHistResults *pCommonHistResults = dynamic_cast<AliFlowCommonHistResults*>
333 (outputListHistos->FindObject("AliFlowCommonHistResultsLYZEP"));
335 TProfile* pHistProR0theta = dynamic_cast<TProfile*>
336 (outputListHistos->FindObject("First_FlowPro_r0theta_LYZSUM"));
338 TProfile* pHistProVetaRP = dynamic_cast<TProfile*>
339 (outputListHistos->FindObject("FlowPro_VetaRP_LYZEP"));
340 TProfile* pHistProVetaPOI = dynamic_cast<TProfile*>
341 (outputListHistos->FindObject("FlowPro_VetaPOI_LYZEP"));
342 TProfile* pHistProVPtRP = dynamic_cast<TProfile*>
343 (outputListHistos->FindObject("FlowPro_VPtRP_LYZEP"));
344 TProfile* pHistProVPtPOI = dynamic_cast<TProfile*>
345 (outputListHistos->FindObject("FlowPro_VPtPOI_LYZEP"));
347 TH1F* pHistQsumforChi = dynamic_cast<TH1F*>
348 (outputListHistos->FindObject("Flow_QsumforChi_LYZEP"));
350 if (pCommonHist && pCommonHistResults && pHistProR0theta &&
351 pHistProVetaRP && pHistProVetaPOI && pHistProVPtRP &&
352 pHistProVPtPOI && pHistQsumforChi ) {
353 this -> SetCommonHists(pCommonHist);
354 this -> SetCommonHistsRes(pCommonHistResults);
355 this -> SetFirstr0theta(pHistProR0theta);
356 this -> SetHistProVetaRP(pHistProVetaRP);
357 this -> SetHistProVetaPOI(pHistProVetaPOI);
358 this -> SetHistProVPtRP(pHistProVPtRP);
359 this -> SetHistProVPtPOI(pHistProVPtPOI);
360 this -> SetHistQsumforChi(pHistQsumforChi);
363 cout<<"WARNING: Histograms needed to run Finish() are not accessable!"<<endl;
367 //--------------------------------------------------------------------
368 void AliFlowAnalysisWithLYZEventPlane::Finish() {
370 //plot histograms etc.
371 cout<<"AliFlowAnalysisWithLYZEventPlane::Finish()"<<endl;
374 Double_t dJ01 = 2.405;
375 Int_t iNtheta = AliFlowLYZConstants::GetMaster()->GetNtheta();
376 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
377 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
378 //set the event number
380 SetEventNumber((int)fCommonHists->GetHistQ()->GetEntries());
381 //cout<<"number of events processed is "<<fEventNumber<<endl;
384 //set the sum of Q vectors
385 fQsum->Set(fHistQsumforChi->GetBinContent(1),fHistQsumforChi->GetBinContent(2));
386 SetQ2sum(fHistQsumforChi->GetBinContent(3));
388 //calculate dV the mean of dVtheta
389 Double_t dVtheta = 0;
391 for (Int_t theta=0;theta<iNtheta;theta++) {
392 Double_t dR0 = fFirstr0theta->GetBinContent(theta+1);
393 if (TMath::AreEqualAbs(dR0,0.0,1e-10)) { dVtheta = dJ01/dR0 ;}
399 Double_t dSigma2 = 0;
401 if (fEventNumber!=0) {
402 *fQsum /= fEventNumber;
403 //cerr<<"fQsum->X() = "<<fQsum->X()<<endl;
404 //cerr<<"fQsum->Y() = "<<fQsum->Y()<<endl;
405 fQ2sum /= fEventNumber;
406 //cerr<<"fEventNumber = "<<fEventNumber<<endl;
407 //cerr<<"fQ2sum = "<<fQ2sum<<endl;
408 dSigma2 = fQ2sum - TMath::Power(fQsum->X(),2.) - TMath::Power(fQsum->Y(),2.) - TMath::Power(dV,2.); //BP eq. 62
409 //cerr<<"dSigma2"<<dSigma2<<endl;
410 if (dSigma2>0) dChi = dV/TMath::Sqrt(dSigma2);
412 fCommonHistsRes->FillChiRP(dChi);
414 // recalculate statistical errors on integrated flow
415 //combining 5 theta angles to 1 relative error BP eq. 89
416 Double_t dRelErr2comb = 0.;
417 Int_t iEvts = fEventNumber;
419 for (Int_t theta=0;theta<iNtheta;theta++){
420 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
421 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
423 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
425 dRelErr2comb += (1/(2*iEvts*(dJ01*dJ01)*TMath::BesselJ1(dJ01)*
426 TMath::BesselJ1(dJ01)))*
427 (dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2)) +
428 dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2)));
430 dRelErr2comb /= iNtheta;
432 Double_t dRelErrcomb = TMath::Sqrt(dRelErr2comb);
433 Double_t dVErr = dV*dRelErrcomb ;
434 fCommonHistsRes->FillIntegratedFlow(dV, dVErr);
436 cout<<"*************************************"<<endl;
437 cout<<"*************************************"<<endl;
438 cout<<" Integrated flow from "<<endl;
439 cout<<" Lee-Yang Zeroes Event Plane "<<endl;
441 cout<<"dChi = "<<dChi<<endl;
442 cout<<"dV = "<<dV<<" +- "<<dVErr<<endl;
447 //copy content of profile into TH1D, add error and fill the AliFlowCommonHistResults
449 //v as a function of eta for RP selection
450 for(Int_t b=0;b<iNbinsEta;b++) {
451 Double_t dv2pro = fHistProVetaRP->GetBinContent(b);
452 Double_t dNprime = fCommonHists->GetEntriesInEtaBinRP(b);
453 Double_t dErrdifcomb = 0.; //set error to zero
454 Double_t dErr2difcomb = 0.; //set error to zero
456 if (TMath::AreEqualAbs(dNprime,0.0,1e-10)) {
457 for (Int_t theta=0;theta<iNtheta;theta++) {
458 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
459 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
461 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
463 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
464 TMath::BesselJ1(dJ01)))*
465 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
466 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
470 if (TMath::AreEqualAbs(dErr2difcomb, 0.0, 1e-10)) {
471 dErr2difcomb /= iNtheta;
472 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
474 else {dErrdifcomb = 0.;}
476 fCommonHistsRes->FillDifferentialFlowEtaRP(b, dv2pro, dErrdifcomb);
480 //v as a function of eta for POI selection
481 for(Int_t b=0;b<iNbinsEta;b++) {
482 Double_t dv2pro = fHistProVetaPOI->GetBinContent(b);
483 Double_t dNprime = fCommonHists->GetEntriesInEtaBinPOI(b);
484 Double_t dErrdifcomb = 0.; //set error to zero
485 Double_t dErr2difcomb = 0.; //set error to zero
488 for (Int_t theta=0;theta<iNtheta;theta++) {
489 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
490 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
492 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
494 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
495 TMath::BesselJ1(dJ01)))*
496 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
497 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
501 if (dErr2difcomb!=0.) {
502 dErr2difcomb /= iNtheta;
503 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
505 else {dErrdifcomb = 0.;}
507 fCommonHistsRes->FillDifferentialFlowEtaPOI(b, dv2pro, dErrdifcomb);
510 //v as a function of Pt for RP selection
511 TH1F* fHistPtRP = fCommonHists->GetHistPtRP(); //for calculating integrated flow
516 for(Int_t b=0;b<iNbinsPt;b++) {
517 Double_t dv2pro = fHistProVPtRP->GetBinContent(b);
518 Double_t dNprime = fCommonHists->GetEntriesInPtBinRP(b);
519 Double_t dErrdifcomb = 0.; //set error to zero
520 Double_t dErr2difcomb = 0.; //set error to zero
523 for (Int_t theta=0;theta<iNtheta;theta++) {
524 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
525 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
527 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
529 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
530 TMath::BesselJ1(dJ01)))*
531 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
532 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
536 if (dErr2difcomb!=0.) {
537 dErr2difcomb /= iNtheta;
538 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
539 //cerr<<"dErrdifcomb = "<<dErrdifcomb<<endl;
541 else {dErrdifcomb = 0.;}
544 fCommonHistsRes->FillDifferentialFlowPtRP(b, dv2pro, dErrdifcomb);
545 //calculate integrated flow for RP selection
547 Double_t dYieldPt = fHistPtRP->GetBinContent(b);
548 dVRP += dv2pro*dYieldPt;
550 dErrV += dYieldPt*dYieldPt*dErrdifcomb*dErrdifcomb;
551 } else { cout<<"fHistPtRP is NULL"<<endl; }
555 if (TMath::AreEqualAbs(dSum, 0.0, 1e-10)) {
556 dVRP /= dSum; //the pt distribution should be normalised
557 dErrV /= (dSum*dSum);
558 dErrV = TMath::Sqrt(dErrV);
560 fCommonHistsRes->FillIntegratedFlowRP(dVRP,dErrV);
562 cout<<"dV(RP) = "<<dVRP<<" +- "<<dErrV<<endl;
566 //v as a function of Pt for POI selection
567 TH1F* fHistPtPOI = fCommonHists->GetHistPtPOI(); //for calculating integrated flow
572 for(Int_t b=0;b<iNbinsPt;b++) {
573 Double_t dv2pro = fHistProVPtPOI->GetBinContent(b);
574 Double_t dNprime = fCommonHists->GetEntriesInPtBinPOI(b);
576 //cerr<<"dNprime = "<<dNprime<<endl;
577 //Int_t iNprime = TMath::Nint(fHistProVPtPOI->GetBinEntries(b));
578 //cerr<<"iNprime = "<<iNprime<<endl;
580 Double_t dErrdifcomb = 0.; //set error to zero
581 Double_t dErr2difcomb = 0.; //set error to zero
584 for (Int_t theta=0;theta<iNtheta;theta++) {
585 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
586 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
588 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
590 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
591 TMath::BesselJ1(dJ01)))*
592 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
593 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
597 if (dErr2difcomb!=0.) {
598 dErr2difcomb /= iNtheta;
599 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
600 //cerr<<"dErrdifcomb = "<<dErrdifcomb<<endl;
602 else {dErrdifcomb = 0.;}
605 fCommonHistsRes->FillDifferentialFlowPtPOI(b, dv2pro, dErrdifcomb);
607 //calculate integrated flow for POI selection
609 Double_t dYieldPt = fHistPtPOI->GetBinContent(b);
610 dVPOI += dv2pro*dYieldPt;
612 dErrV += dYieldPt*dYieldPt*dErrdifcomb*dErrdifcomb;
613 } else { cout<<"fHistPtPOI is NULL"<<endl; }
617 dVPOI /= dSum; //the pt distribution should be normalised
618 dErrV /= (dSum*dSum);
619 dErrV = TMath::Sqrt(dErrV);
621 fCommonHistsRes->FillIntegratedFlowPOI(dVPOI,dErrV);
623 cout<<"dV(POI) = "<<dVPOI<<" +- "<<dErrV<<endl;
625 cout<<"*************************************"<<endl;
626 cout<<"*************************************"<<endl;
628 //cout<<".....finished"<<endl;