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"
49 ClassImp(AliFlowAnalysisWithLYZEventPlane)
51 //-----------------------------------------------------------------------
53 AliFlowAnalysisWithLYZEventPlane::AliFlowAnalysisWithLYZEventPlane():
56 fSecondReDtheta(NULL),
57 fSecondImDtheta(NULL),
60 fHistProVetaPOI(NULL),
65 fHistQsumforChi(NULL),
68 fHistDeltaPhihere(NULL),
74 fCommonHistsRes(NULL),
81 fQsum = new TVector2(); // flow vector sum
83 fHistList = new TList();
84 fSecondRunList = new TList();
89 //-----------------------------------------------------------------------
92 AliFlowAnalysisWithLYZEventPlane::~AliFlowAnalysisWithLYZEventPlane()
97 delete fSecondRunList;
101 //-----------------------------------------------------------------------
103 void AliFlowAnalysisWithLYZEventPlane::WriteHistograms(TString* outputFileName)
105 //store the final results in output .root file
107 TFile *output = new TFile(outputFileName->Data(),"RECREATE");
108 //output->WriteObject(fHistList, "cobjLYZEP","SingleKey");
109 fHistList->SetName("cobjLYZEP");
110 fHistList->SetOwner(kTRUE);
111 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
115 //-----------------------------------------------------------------------
117 void AliFlowAnalysisWithLYZEventPlane::WriteHistograms(TString outputFileName)
119 //store the final results in output .root file
121 TFile *output = new TFile(outputFileName.Data(),"RECREATE");
122 //output->WriteObject(fHistList, "cobjLYZEP","SingleKey");
123 fHistList->SetName("cobjLYZEP");
124 fHistList->SetOwner(kTRUE);
125 fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
129 //-----------------------------------------------------------------------
131 void AliFlowAnalysisWithLYZEventPlane::WriteHistograms(TDirectoryFile *outputFileName)
133 //store the final results in output .root file
134 fHistList->SetName("cobjLYZEP");
135 fHistList->SetOwner(kTRUE);
136 outputFileName->Add(fHistList);
137 outputFileName->Write(outputFileName->GetName(), TObject::kSingleKey);
140 //-----------------------------------------------------------------------
142 void AliFlowAnalysisWithLYZEventPlane::Init() {
144 //Initialise all histograms
145 cout<<"---Analysis with Lee Yang Zeros Event Plane Method---"<<endl;
147 //save old value and prevent histograms from being added to directory
148 //to avoid name clashes in case multiple analaysis objects are used
150 Bool_t oldHistAddStatus = TH1::AddDirectoryStatus();
151 TH1::AddDirectory(kFALSE);
154 if (fSecondRunList) {
155 fSecondReDtheta = (TProfile*)fSecondRunList->FindObject("Second_FlowPro_ReDtheta_LYZSUM");
156 fHistList->Add(fSecondReDtheta);
158 fSecondImDtheta = (TProfile*)fSecondRunList->FindObject("Second_FlowPro_ImDtheta_LYZSUM");
159 fHistList->Add(fSecondImDtheta);
161 fFirstr0theta = (TProfile*)fSecondRunList->FindObject("First_FlowPro_r0theta_LYZSUM");
162 fHistList->Add(fFirstr0theta);
165 if (!fSecondReDtheta) {cout<<"fSecondReDtheta is NULL!"<<endl; }
166 if (!fSecondImDtheta) {cout<<"fSecondImDtheta is NULL!"<<endl; }
167 if (!fFirstr0theta) {cout<<"fFirstr0theta is NULL!"<<endl; }
171 fCommonHists = new AliFlowCommonHist("AliFlowCommonHistLYZEP");
172 fHistList->Add(fCommonHists);
174 fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsLYZEP");
175 fHistList->Add(fCommonHistsRes);
177 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
178 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
179 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
180 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
181 Double_t dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();
182 Double_t dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
184 fHistProVetaRP = new TProfile("FlowPro_VetaRP_LYZEP","FlowPro_VetaRP_LYZEP",iNbinsEta,dEtaMin,dEtaMax);
185 fHistProVetaRP->SetXTitle("rapidity");
186 fHistProVetaRP->SetYTitle("v_{2}(#eta) for RP selection");
187 fHistList->Add(fHistProVetaRP);
189 fHistProVetaPOI = new TProfile("FlowPro_VetaPOI_LYZEP","FlowPro_VetaPOI_LYZEP",iNbinsEta,dEtaMin,dEtaMax);
190 fHistProVetaPOI->SetXTitle("rapidity");
191 fHistProVetaPOI->SetYTitle("v_{2}(#eta) for POI selection");
192 fHistList->Add(fHistProVetaPOI);
194 fHistProVPtRP = new TProfile("FlowPro_VPtRP_LYZEP","FlowPro_VPtRP_LYZEP",iNbinsPt,dPtMin,dPtMax);
195 fHistProVPtRP->SetXTitle("Pt");
196 fHistProVPtRP->SetYTitle("v_{2}(p_{T}) for RP selection");
197 fHistList->Add(fHistProVPtRP);
199 fHistProVPtPOI = new TProfile("FlowPro_VPtPOI_LYZEP","FlowPro_VPtPOI_LYZEP",iNbinsPt,dPtMin,dPtMax);
200 fHistProVPtPOI->SetXTitle("p_{T}");
201 fHistProVPtPOI->SetYTitle("v_{2}(p_{T}) for POI selection");
202 fHistList->Add(fHistProVPtPOI);
204 fHistProWr = new TProfile("FlowPro_Wr_LYZEP","FlowPro_Wr_LYZEP",100,0.,0.25);
205 fHistProWr->SetXTitle("Q");
206 fHistProWr->SetYTitle("Wr");
207 fHistList->Add(fHistProWr);
209 fHistQsumforChi = new TH1F("Flow_QsumforChi_LYZEP","Flow_QsumforChi_LYZEP",3,-1.,2.);
210 fHistQsumforChi->SetXTitle("Qsum.X , Qsum.Y, Q2sum");
211 fHistQsumforChi->SetYTitle("value");
212 fHistList->Add(fHistQsumforChi);
214 fHistDeltaPhi = new TH1F("Flow_DeltaPhi_LYZEP","Flow_DeltaPhi_LYZEP",100,0.,3.14);
215 fHistDeltaPhi->SetXTitle("DeltaPhi");
216 fHistDeltaPhi->SetYTitle("Counts");
217 fHistList->Add(fHistDeltaPhi);
219 fHistPhiLYZ = new TH1F("Flow_PhiLYZ_LYZEP","Flow_PhiLYZ_LYZEP",100,0.,3.14);
220 fHistPhiLYZ->SetXTitle("Phi from LYZ");
221 fHistPhiLYZ->SetYTitle("Counts");
222 fHistList->Add(fHistPhiLYZ);
224 fHistPhiEP = new TH1F("Flow_PhiEP_LYZEP","Flow_PhiEP_LYZEP",100,0.,3.14);
225 fHistPhiEP->SetXTitle("Phi from EP");
226 fHistPhiEP->SetYTitle("Counts");
227 fHistList->Add(fHistPhiEP);
229 fEventNumber = 0; //set number of events to zero
232 TH1::AddDirectory(oldHistAddStatus);
235 //-----------------------------------------------------------------------
237 void AliFlowAnalysisWithLYZEventPlane::Make(AliFlowEventSimple* anEvent, AliFlowLYZEventPlane* aLYZEP) {
239 //Get the event plane and weight for each event
242 //fill control histograms
243 fCommonHists->FillControlHistograms(anEvent);
245 //get the Q vector from the FlowEvent
246 AliFlowVector vQ = anEvent->GetQ();
247 //if (vQ.X()== 0. && vQ.Y()== 0. ) { cout<<"Q vector is NULL!"<<endl; } //coding violation
248 //Weight with the multiplicity
251 if (TMath::AreEqualAbs(vQ.GetMult(),0.0,1e-10)) {
252 dQX = vQ.X()/vQ.GetMult();
253 dQY = vQ.Y()/vQ.GetMult();
254 } else {cerr<<"vQ.GetMult() is zero!"<<endl; }
256 //cout<<"vQ("<<dQX<<","<<dQY<<")"<<endl;
258 //for chi calculation:
260 fHistQsumforChi->SetBinContent(1,fQsum->X());
261 fHistQsumforChi->SetBinContent(2,fQsum->Y());
263 fHistQsumforChi->SetBinContent(3,fQ2sum);
264 //cout<<"fQ2sum = "<<fQ2sum<<endl;
266 //call AliFlowLYZEventPlane::CalculateRPandW() here!
267 aLYZEP->CalculateRPandW(vQ);
269 Double_t dWR = aLYZEP->GetWR();
270 Double_t dRP = aLYZEP->GetPsi();
272 //fHistProWr->Fill(vQ.Mod(),dWR); //this weight is always positive
273 fHistPhiLYZ->Fill(dRP);
275 //plot difference between event plane from EP-method and LYZ-method
276 Double_t dRPEP = vQ.Phi()/2; //gives distribution from (0 to pi)
277 //Double_t dRPEP = 0.5*TMath::ATan2(vQ.Y(),vQ.X()); //gives distribution from (-pi/2 to pi/2)
278 //cout<<"dRPEP = "<< dRPEP <<endl;
279 fHistPhiEP->Fill(dRPEP);
281 Double_t dDeltaPhi = dRPEP - dRP;
282 if (dDeltaPhi < 0.) { dDeltaPhi += TMath::Pi(); } //to shift distribution from (-pi/2 to pi/2) to (0 to pi)
283 //cout<<"dDeltaPhi = "<<dDeltaPhi<<endl;
284 fHistDeltaPhi->Fill(dDeltaPhi);
287 Double_t dLow = TMath::Pi()/4.;
288 Double_t dHigh = 3.*(TMath::Pi()/4.);
289 if ((dDeltaPhi > dLow) && (dDeltaPhi < dHigh)){
290 dRP -= (TMath::Pi()/2);
292 cerr<<"*** dRP modified ***"<<endl;
294 fHistProWr->Fill(vQ.Mod(),dWR); //corrected weight
296 //calculate flow for RP and POI selections
297 //loop over the tracks of the event
298 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
299 for (Int_t i=0;i<iNumberOfTracks;i++)
301 AliFlowTrackSimple* pTrack = anEvent->GetTrack(i) ;
303 Double_t dPhi = pTrack->Phi();
304 //if (dPhi<0.) fPhi+=2*TMath::Pi();
305 Double_t dPt = pTrack->Pt();
306 Double_t dEta = pTrack->Eta();
308 Double_t dv2 = dWR * TMath::Cos(2*(dPhi-dRP));
309 if (pTrack->InRPSelection()) {
310 //fill histograms for RP selection
311 fHistProVetaRP -> Fill(dEta,dv2);
312 fHistProVPtRP -> Fill(dPt,dv2);
314 if (pTrack->InPOISelection()) {
315 //fill histograms for POI selection
316 fHistProVetaPOI -> Fill(dEta,dv2);
317 fHistProVPtPOI -> Fill(dPt,dv2);
323 // cout<<"@@@@@ "<<fEventNumber<<" events processed"<<endl;
327 //--------------------------------------------------------------------
328 void AliFlowAnalysisWithLYZEventPlane::GetOutputHistograms(TList *outputListHistos){
329 //get pointers to all output histograms (called before Finish())
330 if (outputListHistos) {
331 //Get the common histograms from the output list
332 AliFlowCommonHist *pCommonHist = dynamic_cast<AliFlowCommonHist*>
333 (outputListHistos->FindObject("AliFlowCommonHistLYZEP"));
334 AliFlowCommonHistResults *pCommonHistResults = dynamic_cast<AliFlowCommonHistResults*>
335 (outputListHistos->FindObject("AliFlowCommonHistResultsLYZEP"));
337 TProfile* pHistProR0theta = dynamic_cast<TProfile*>
338 (outputListHistos->FindObject("First_FlowPro_r0theta_LYZSUM"));
340 TProfile* pHistProVetaRP = dynamic_cast<TProfile*>
341 (outputListHistos->FindObject("FlowPro_VetaRP_LYZEP"));
342 TProfile* pHistProVetaPOI = dynamic_cast<TProfile*>
343 (outputListHistos->FindObject("FlowPro_VetaPOI_LYZEP"));
344 TProfile* pHistProVPtRP = dynamic_cast<TProfile*>
345 (outputListHistos->FindObject("FlowPro_VPtRP_LYZEP"));
346 TProfile* pHistProVPtPOI = dynamic_cast<TProfile*>
347 (outputListHistos->FindObject("FlowPro_VPtPOI_LYZEP"));
349 TH1F* pHistQsumforChi = dynamic_cast<TH1F*>
350 (outputListHistos->FindObject("Flow_QsumforChi_LYZEP"));
352 if (pCommonHist && pCommonHistResults && pHistProR0theta &&
353 pHistProVetaRP && pHistProVetaPOI && pHistProVPtRP &&
354 pHistProVPtPOI && pHistQsumforChi ) {
355 this -> SetCommonHists(pCommonHist);
356 this -> SetCommonHistsRes(pCommonHistResults);
357 this -> SetFirstr0theta(pHistProR0theta);
358 this -> SetHistProVetaRP(pHistProVetaRP);
359 this -> SetHistProVetaPOI(pHistProVetaPOI);
360 this -> SetHistProVPtRP(pHistProVPtRP);
361 this -> SetHistProVPtPOI(pHistProVPtPOI);
362 this -> SetHistQsumforChi(pHistQsumforChi);
365 cout<<"WARNING: Histograms needed to run Finish() are not accessable!"<<endl;
369 //--------------------------------------------------------------------
370 void AliFlowAnalysisWithLYZEventPlane::Finish() {
372 //plot histograms etc.
373 cout<<"AliFlowAnalysisWithLYZEventPlane::Finish()"<<endl;
376 Double_t dJ01 = 2.405;
377 Int_t iNtheta = AliFlowLYZConstants::GetMaster()->GetNtheta();
378 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
379 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
380 //set the event number
382 SetEventNumber((int)fCommonHists->GetHistQ()->GetEntries());
383 //cout<<"number of events processed is "<<fEventNumber<<endl;
385 cout<<"Commonhist pointer is NULL."<<endl;
386 cout<<"Leaving LYZ Event plane analysis!"<<endl;
390 //set the sum of Q vectors
391 fQsum->Set(fHistQsumforChi->GetBinContent(1),fHistQsumforChi->GetBinContent(2));
392 SetQ2sum(fHistQsumforChi->GetBinContent(3));
394 //calculate dV the mean of dVtheta
395 Double_t dVtheta = 0;
397 for (Int_t theta=0;theta<iNtheta;theta++) {
398 Double_t dR0 = fFirstr0theta->GetBinContent(theta+1);
399 if (TMath::AreEqualAbs(dR0,0.0,1e-10)) { dVtheta = dJ01/dR0 ;}
405 Double_t dSigma2 = 0;
407 if (fEventNumber!=0) {
408 *fQsum /= fEventNumber;
409 //cerr<<"fQsum->X() = "<<fQsum->X()<<endl;
410 //cerr<<"fQsum->Y() = "<<fQsum->Y()<<endl;
411 fQ2sum /= fEventNumber;
412 //cerr<<"fEventNumber = "<<fEventNumber<<endl;
413 //cerr<<"fQ2sum = "<<fQ2sum<<endl;
414 dSigma2 = fQ2sum - TMath::Power(fQsum->X(),2.) - TMath::Power(fQsum->Y(),2.) - TMath::Power(dV,2.); //BP eq. 62
415 //cerr<<"dSigma2"<<dSigma2<<endl;
416 if (dSigma2>0) dChi = dV/TMath::Sqrt(dSigma2);
418 fCommonHistsRes->FillChi(dChi);
420 // recalculate statistical errors on integrated flow
421 //combining 5 theta angles to 1 relative error BP eq. 89
422 Double_t dRelErr2comb = 0.;
423 Int_t iEvts = fEventNumber;
425 for (Int_t theta=0;theta<iNtheta;theta++){
426 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
427 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
429 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
431 dRelErr2comb += (1/(2*iEvts*(dJ01*dJ01)*TMath::BesselJ1(dJ01)*
432 TMath::BesselJ1(dJ01)))*
433 (dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2)) +
434 dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2)));
436 dRelErr2comb /= iNtheta;
438 Double_t dRelErrcomb = TMath::Sqrt(dRelErr2comb);
439 Double_t dVErr = dV*dRelErrcomb ;
440 fCommonHistsRes->FillIntegratedFlow(dV, dVErr);
442 cout<<"*************************************"<<endl;
443 cout<<"*************************************"<<endl;
444 cout<<" Integrated flow from "<<endl;
445 cout<<" Lee-Yang Zeroes Event Plane "<<endl;
447 cout<<"dChi = "<<dChi<<endl;
448 cout<<"dV = "<<dV<<" +- "<<dVErr<<endl;
453 //copy content of profile into TH1D, add error and fill the AliFlowCommonHistResults
455 //v as a function of eta for RP selection
456 for(Int_t b=0;b<iNbinsEta;b++) {
457 Double_t dv2pro = fHistProVetaRP->GetBinContent(b);
458 Double_t dNprime = fCommonHists->GetEntriesInEtaBinRP(b);
459 Double_t dErrdifcomb = 0.; //set error to zero
460 Double_t dErr2difcomb = 0.; //set error to zero
462 if (TMath::AreEqualAbs(dNprime,0.0,1e-10)) {
463 for (Int_t theta=0;theta<iNtheta;theta++) {
464 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
465 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
467 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
469 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
470 TMath::BesselJ1(dJ01)))*
471 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
472 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
476 if (TMath::AreEqualAbs(dErr2difcomb, 0.0, 1e-10)) {
477 dErr2difcomb /= iNtheta;
478 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
480 else {dErrdifcomb = 0.;}
482 fCommonHistsRes->FillDifferentialFlowEtaRP(b, dv2pro, dErrdifcomb);
486 //v as a function of eta for POI selection
487 for(Int_t b=0;b<iNbinsEta;b++) {
488 Double_t dv2pro = fHistProVetaPOI->GetBinContent(b);
489 Double_t dNprime = fCommonHists->GetEntriesInEtaBinPOI(b);
490 Double_t dErrdifcomb = 0.; //set error to zero
491 Double_t dErr2difcomb = 0.; //set error to zero
494 for (Int_t theta=0;theta<iNtheta;theta++) {
495 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
496 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
498 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
500 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
501 TMath::BesselJ1(dJ01)))*
502 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
503 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
507 if (dErr2difcomb!=0.) {
508 dErr2difcomb /= iNtheta;
509 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
511 else {dErrdifcomb = 0.;}
513 fCommonHistsRes->FillDifferentialFlowEtaPOI(b, dv2pro, dErrdifcomb);
516 //v as a function of Pt for RP selection
517 TH1F* fHistPtRP = fCommonHists->GetHistPtRP(); //for calculating integrated flow
522 for(Int_t b=0;b<iNbinsPt;b++) {
523 Double_t dv2pro = fHistProVPtRP->GetBinContent(b);
524 Double_t dNprime = fCommonHists->GetEntriesInPtBinRP(b);
525 Double_t dErrdifcomb = 0.; //set error to zero
526 Double_t dErr2difcomb = 0.; //set error to zero
529 for (Int_t theta=0;theta<iNtheta;theta++) {
530 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
531 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
533 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
535 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
536 TMath::BesselJ1(dJ01)))*
537 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
538 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
542 if (dErr2difcomb!=0.) {
543 dErr2difcomb /= iNtheta;
544 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
545 //cerr<<"dErrdifcomb = "<<dErrdifcomb<<endl;
547 else {dErrdifcomb = 0.;}
550 fCommonHistsRes->FillDifferentialFlowPtRP(b, dv2pro, dErrdifcomb);
551 //calculate integrated flow for RP selection
553 Double_t dYieldPt = fHistPtRP->GetBinContent(b);
554 dVRP += dv2pro*dYieldPt;
556 dErrV += dYieldPt*dYieldPt*dErrdifcomb*dErrdifcomb;
557 } else { cout<<"fHistPtRP is NULL"<<endl; }
561 if (TMath::AreEqualAbs(dSum, 0.0, 1e-10)) {
562 dVRP /= dSum; //the pt distribution should be normalised
563 dErrV /= (dSum*dSum);
564 dErrV = TMath::Sqrt(dErrV);
566 fCommonHistsRes->FillIntegratedFlowRP(dVRP,dErrV);
568 cout<<"dV(RP) = "<<dVRP<<" +- "<<dErrV<<endl;
572 //v as a function of Pt for POI selection
573 TH1F* fHistPtPOI = fCommonHists->GetHistPtPOI(); //for calculating integrated flow
578 for(Int_t b=0;b<iNbinsPt;b++) {
579 Double_t dv2pro = fHistProVPtPOI->GetBinContent(b);
580 Double_t dNprime = fCommonHists->GetEntriesInPtBinPOI(b);
582 //cerr<<"dNprime = "<<dNprime<<endl;
583 //Int_t iNprime = TMath::Nint(fHistProVPtPOI->GetBinEntries(b));
584 //cerr<<"iNprime = "<<iNprime<<endl;
586 Double_t dErrdifcomb = 0.; //set error to zero
587 Double_t dErr2difcomb = 0.; //set error to zero
590 for (Int_t theta=0;theta<iNtheta;theta++) {
591 Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi();
592 Double_t dApluscomb = TMath::Exp((dJ01*dJ01)/(2*dChi*dChi)*
594 Double_t dAmincomb = TMath::Exp(-(dJ01*dJ01)/(2*dChi*dChi)*
596 dErr2difcomb += (TMath::Cos(dTheta)/(4*dNprime*TMath::BesselJ1(dJ01)*
597 TMath::BesselJ1(dJ01)))*
598 ((dApluscomb*TMath::BesselJ0(2*dJ01*TMath::Sin(dTheta/2))) -
599 (dAmincomb*TMath::BesselJ0(2*dJ01*TMath::Cos(dTheta/2))));
603 if (dErr2difcomb!=0.) {
604 dErr2difcomb /= iNtheta;
605 dErrdifcomb = TMath::Sqrt(dErr2difcomb);
606 //cerr<<"dErrdifcomb = "<<dErrdifcomb<<endl;
608 else {dErrdifcomb = 0.;}
611 fCommonHistsRes->FillDifferentialFlowPtPOI(b, dv2pro, dErrdifcomb);
613 //calculate integrated flow for POI selection
615 Double_t dYieldPt = fHistPtPOI->GetBinContent(b);
616 dVPOI += dv2pro*dYieldPt;
618 dErrV += dYieldPt*dYieldPt*dErrdifcomb*dErrdifcomb;
619 } else { cout<<"fHistPtPOI is NULL"<<endl; }
623 dVPOI /= dSum; //the pt distribution should be normalised
624 dErrV /= (dSum*dSum);
625 dErrV = TMath::Sqrt(dErrV);
627 fCommonHistsRes->FillIntegratedFlowPOI(dVPOI,dErrV);
629 cout<<"dV(POI) = "<<dVPOI<<" +- "<<dErrV<<endl;
631 cout<<"*************************************"<<endl;
632 cout<<"*************************************"<<endl;
634 //cout<<".....finished"<<endl;