1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: ALICE Offline. *
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 // AliEbyE Analysis for Particle Ratio Fluctuation //
18 // Deepika Rathee | Satyajit Jena //
19 // drathee@cern.ch | sjena@cern.ch //
20 // Date: Wed Jul 9 18:38:30 CEST 2014 //
21 // New approch to find particle ratio to reduce memory //
23 //=========================================================================//
32 #include "AliMCEvent.h"
33 #include "AliMCParticle.h"
34 #include "AliESDtrackCuts.h"
35 #include "AliESDInputHandler.h"
36 #include "AliESDpid.h"
37 #include "AliAODInputHandler.h"
38 #include "AliAODEvent.h"
39 #include "AliAODMCParticle.h"
40 #include "AliCentrality.h"
41 #include "AliTracker.h"
43 #include "AliEbyEPidRatioHelper.h"
48 ClassImp(AliEbyEPidRatioHelper)
49 //________________________________________________________________________
50 AliEbyEPidRatioHelper::AliEbyEPidRatioHelper() :
53 fInputEventHandler(NULL),
58 fAODtrackCutBit(1024),
64 fCentralityPercentile(-1.),
70 fPhiMax(TMath::TwoPi()),
71 fMinTrackLengthMC(70.),
80 fMinPtForTOFRequired(0.69),
81 fMaxPtForTPClow(0.69),
90 fHCentralityStat(NULL),
96 AliLog::SetClassDebugLevel("AliEbyEPidRatioHelper",10);
99 const Float_t AliEbyEPidRatioHelper::fgkfHistBinWitdthRap = 0.075;
100 const Float_t AliEbyEPidRatioHelper::fgkfHistBinWitdthPt = 0.3; // 0.08 // 300 MeV // was 80 MeV
102 const Float_t AliEbyEPidRatioHelper::fgkfHistRangeCent[] = {-0.5, 10.5};
103 const Int_t AliEbyEPidRatioHelper::fgkfHistNBinsCent = 11 ;
105 const Float_t AliEbyEPidRatioHelper::fgkfHistRangeEta[] = {-0.9, 0.9};
106 const Int_t AliEbyEPidRatioHelper::fgkfHistNBinsEta = Int_t((AliEbyEPidRatioHelper::fgkfHistRangeEta[1] -
107 AliEbyEPidRatioHelper::fgkfHistRangeEta[0]) /
108 AliEbyEPidRatioHelper::fgkfHistBinWitdthRap) +1;
110 const Float_t AliEbyEPidRatioHelper::fgkfHistRangeRap[] = {-0.5, 0.5};
111 const Int_t AliEbyEPidRatioHelper::fgkfHistNBinsRap = Int_t((AliEbyEPidRatioHelper::fgkfHistRangeRap[1] - AliEbyEPidRatioHelper::fgkfHistRangeRap[0]) / AliEbyEPidRatioHelper::fgkfHistBinWitdthRap) +1;
113 const Float_t AliEbyEPidRatioHelper::fgkfHistRangePhi[] = {0.0, TMath::TwoPi()};
114 const Int_t AliEbyEPidRatioHelper::fgkfHistNBinsPhi = 42 ;
116 const Float_t AliEbyEPidRatioHelper::fgkfHistRangePt[] = {0.2, 2.9}; // {0.2, 5.}; // was {0.3, 2.22}
117 const Int_t AliEbyEPidRatioHelper::fgkfHistNBinsPt = Int_t((AliEbyEPidRatioHelper::fgkfHistRangePt[1] - AliEbyEPidRatioHelper::fgkfHistRangePt[0]) / AliEbyEPidRatioHelper::fgkfHistBinWitdthPt);
119 const Float_t AliEbyEPidRatioHelper::fgkfHistRangeSign[] = {-1.5, 1.5};
120 const Int_t AliEbyEPidRatioHelper::fgkfHistNBinsSign = 3;
122 const Char_t* AliEbyEPidRatioHelper::fgkEventNames[] = {"All", "IsTriggered", "HasVertex", "Vz<Vz_{Max}", "Centrality [0,90]%"};
123 const Char_t* AliEbyEPidRatioHelper::fgkCentralityMaxNames[] = {"5", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100"};
124 const Char_t* AliEbyEPidRatioHelper::fgkTriggerNames[] = {"kMB", "kCentral", "kSemiCentral", "kEMCEJE", "kEMCEGA" };
125 const Char_t* AliEbyEPidRatioHelper::fgkCentralityNames[] = {"0-5%", "5-10%", "10-20%", "20-30%", "30-40%", "40-50%","50-60%", "60-70%", "70-80%", "80-90%", "90-100%"};
127 const Char_t* AliEbyEPidRatioHelper::fgkPidName[4] = {"Nch","Npi","Nka","Npr"};
128 const Char_t* AliEbyEPidRatioHelper::fgkPidLatex[4][2] = {{"N_{-}","N_{+}"}, {"N_{#pi^{-}}","N_{#pi^{+}}"},{"N_{K^{-}}","N_{K^{+}}"}, {"N_{#bar{p}}","N_{p}"}};
129 const Char_t* AliEbyEPidRatioHelper::fgkPidTitles[4][2] = {{"Negative","Positive"},{"Anti-Pions","Pions"},{"Anti-Kaons","Kaons"}, {"Anti-Protons","Protons"}};
133 //________________________________________________________________________
134 AliEbyEPidRatioHelper::~AliEbyEPidRatioHelper() {
143 //________________________________________________________________________
144 void AliEbyEPidRatioHelper::SetPhiRange(Float_t f1, Float_t f2) {
145 // -- Set phi range and adopt to phi-histogram
148 fPhiMax = (f1 < f2) ? f2 : f2+TMath::TwoPi();
150 Float_t phiMin = fPhiMin;
151 Float_t phiMax = fPhiMax;
154 Float_t binWidth = (AliEbyEPidRatioHelper::fgkfHistRangePhi[1] - AliEbyEPidRatioHelper::fgkfHistRangePhi[0]) /
155 Float_t(AliEbyEPidRatioHelper::fgkfHistNBinsPhi);
157 Float_t lowEdge = AliEbyEPidRatioHelper::fgkfHistRangePhi[0] - binWidth;
158 Float_t highEdge = AliEbyEPidRatioHelper::fgkfHistRangePhi[0];
160 for (Int_t ii = 1; ii <= AliEbyEPidRatioHelper::fgkfHistNBinsPhi; ++ii) {
162 highEdge += binWidth;
164 if (phiMin >= lowEdge && phiMin < highEdge )
166 if (phiMax > lowEdge && phiMax <= highEdge )
170 printf(">>>> Update Phi Range : [%f,%f] -> [%f,%f]\n", fPhiMin, fPhiMax, phiMin, phiMax);
177 //________________________________________________________________________
178 Int_t AliEbyEPidRatioHelper::Initialize(AliESDtrackCuts *cuts, Bool_t isMC, Int_t trackCutBit, Int_t modeDistCreation) {
179 // -- Initialize helper
184 fESDTrackCuts = cuts;
189 // -- AOD track filter bit
190 fAODtrackCutBit = trackCutBit;
192 // -- mode Distribution creation
193 fModeDistCreation = modeDistCreation;
195 // -- Setup event cut statistics
196 InitializeEventStats();
198 // -- Setup trigger statistics
199 InitializeTriggerStats();
201 // -- Setup centrality statistics
202 InitializeCentralityStats();
204 // -- PRINT PID Strategy
205 // 0 : TPC(TPClow+TPCHigh)
208 // 3 : ITS+TPC(TPClow+TPCHigh)
209 // 4 : TPC(TPClow+TPCHigh)+TOF
210 // 5 : TPC(TPClow+TPCHigh)+TOF for pT >= fMinPtForTOFRequired TOF is required, below, only used if there
211 // 6 : TPC(TPClow+TPCHigh)+ITS+TOF with TOF only for those tracks which have TOF information
212 // 7 : TPC(TPClow+TPCHigh)+ITS+TOF for pT >= fMinPtForTOFRequired TOF is required, below, only used if there
213 // 8 : TPC(TPClow+TPCHigh)+ITS+TOF
214 printf(">>>> PID STRATEGY: %d || sigmaMax: ITS %.2f TPC %.2f TOF %.2f \n", fPIDStrategy, fNSigmaMaxITS, fNSigmaMaxTPC, fNSigmaMaxTOF);
216 // -- Initialize random number generator
217 fRandom = new TRandom3();
223 //________________________________________________________________________
224 Int_t AliEbyEPidRatioHelper::SetupEvent(AliESDInputHandler *esdHandler, AliAODInputHandler *aodHandler, AliMCEvent *mcEvent) {
227 // -- Get ESD objects
229 fInputEventHandler = static_cast<AliInputEventHandler*>(esdHandler);
230 fESD = dynamic_cast<AliESDEvent*>(fInputEventHandler->GetEvent());
232 AliError("ESD event handler not available");
237 // -- Get AOD objects
239 fInputEventHandler = static_cast<AliInputEventHandler*>(aodHandler);
240 fAOD = dynamic_cast<AliAODEvent*>(fInputEventHandler->GetEvent());
242 AliError("AOD event handler not available");
247 // -- Get Common objects
248 fPIDResponse = fInputEventHandler->GetPIDResponse();
253 fStack = fMCEvent->Stack();
255 // -- Get event centrality
256 // > 0-5|5-10|10-20|20-30|30-40|40-50|50-60|60-70|70-80|80-90 --> 10 bins
257 // > 0 1 2 3 4 5 6 7 8 9
259 AliCentrality *centrality = NULL;
262 centrality = fESD->GetCentrality();
264 centrality = fAOD->GetHeader()->GetCentralityP();
267 AliError("Centrality not available");
271 Int_t centBin = centrality->GetCentralityClass10("V0M");
273 fCentralityBin = centrality->GetCentralityClass5("V0M");
274 else if (centBin == 10 || centBin == -1.)
276 else if (centBin > 0 && centBin < fNCentralityBins)
277 fCentralityBin = centBin + 1;
281 // -- Stay within the max centrality bin
282 if (fCentralityBin >= fCentralityBinMax)
285 fCentralityPercentile = centrality->GetCentralityPercentile("V0M");
290 //________________________________________________________________________
291 Bool_t AliEbyEPidRatioHelper::IsEventTriggered() {
292 // -- Check if Event is triggered and fill Trigger Histogram
294 Bool_t *aTriggerFired = new Bool_t[fNTriggers];
295 for (Int_t ii = 0; ii < fNTriggers; ++ii)
296 aTriggerFired[ii] = kFALSE;
298 if ((fInputEventHandler->IsEventSelected() & AliVEvent::kMB)) aTriggerFired[0] = kTRUE;
299 if ((fInputEventHandler->IsEventSelected() & AliVEvent::kCentral)) aTriggerFired[1] = kTRUE;
300 if ((fInputEventHandler->IsEventSelected() & AliVEvent::kSemiCentral)) aTriggerFired[2] = kTRUE;
301 if ((fInputEventHandler->IsEventSelected() & AliVEvent::kEMCEJE)) aTriggerFired[3] = kTRUE;
302 if ((fInputEventHandler->IsEventSelected() & AliVEvent::kEMCEGA)) aTriggerFired[4] = kTRUE;
304 Bool_t isTriggered = kFALSE;
306 for (Int_t ii=0; ii<fNTriggers; ++ii) {
307 if(aTriggerFired[ii]) {
309 fHTriggerStat->Fill(ii);
313 delete[] aTriggerFired;
318 //________________________________________________________________________
319 Bool_t AliEbyEPidRatioHelper::IsEventRejected() {
320 // -- Evaluate event statistics histograms
322 Int_t *aEventCuts = new Int_t[fHEventStatMax];
323 // set aEventCuts[ii] to 1 in case of reject
325 for (Int_t ii=0;ii<fHEventStatMax; ++ii)
330 // -- 0 - Before Physics Selection
331 aEventCuts[iCut] = 0;
333 // -- 1 - No Trigger fired
335 if (!IsEventTriggered())
336 aEventCuts[iCut] = 1;
340 const AliESDVertex* vtxESD = NULL;
341 const AliAODVertex* vtxAOD = NULL;
343 vtxESD = fESD->GetPrimaryVertexTracks();
345 aEventCuts[iCut] = 1;
348 vtxAOD = fAOD->GetPrimaryVertex();
350 aEventCuts[iCut] = 1;
353 // -- 3 - Vertex z outside cut window
356 if(TMath::Abs(vtxESD->GetZv()) > fVertexZMax)
357 aEventCuts[iCut] = 1;
360 if(TMath::Abs(vtxAOD->GetZ()) > fVertexZMax)
361 aEventCuts[iCut] = 1;
364 aEventCuts[iCut] = 1;
366 // -- 4 - Centrality = -1 (no centrality or not hadronic)
368 if(fCentralityBin == -1.)
369 aEventCuts[iCut] = 1;
371 // -- 5 - Centrality < fCentralityMax
373 if(fCentralityBin == -2.)
374 aEventCuts[iCut] = 1;
376 // -- Fill statistics / reject event
377 Bool_t isRejected = FillEventStats(aEventCuts);
382 //cout << isRejected << endl;
387 //________________________________________________________________________
388 Bool_t AliEbyEPidRatioHelper::IsParticleAcceptedBasicCharged(AliVParticle *particle, Int_t idxMC) {
389 // -- Check if MC particle is accepted for basic parameters
394 // -- check if charged
395 if (particle->Charge() == 0.0)
398 // -- check if physical primary - ESD
400 if(!fStack->IsPhysicalPrimary(idxMC))
403 // -- check if physical primary - AOD
405 if(!(static_cast<AliAODMCParticle*>(particle))->IsPhysicalPrimary())
412 //________________________________________________________________________
413 Bool_t AliEbyEPidRatioHelper::IsParticleAcceptedBasicNeutral(AliVParticle *particle, Int_t idxMC) {
414 // -- Check if MC particle is accepted for basic parameters
419 // -- check if charged
420 if (particle->Charge() != 0.0)
423 // -- check if physical primary - ESD
425 if(!fStack->IsPhysicalPrimary(idxMC))
428 // -- check if physical primary - AOD
430 if(!(static_cast<AliAODMCParticle*>(particle))->IsPhysicalPrimary())
437 //________________________________________________________________________
438 Bool_t AliEbyEPidRatioHelper::IsParticleAcceptedRapidity(AliVParticle *particle, Double_t &yP, Int_t gCurPid) {
439 // -- Check if particle is accepted
441 // > if no pid : return kTRUE, yP = eta
442 // > return 0 if not accepted
445 yP = particle->Eta();
450 if(gCurPid == 1) mP = AliPID::ParticleMass(AliPID::kPion);
451 if(gCurPid == 2) mP = AliPID::ParticleMass(AliPID::kKaon);
452 if(gCurPid == 3) mP = AliPID::ParticleMass(AliPID::kProton);
454 // -- Calculate rapidities and kinematics
455 Double_t p = particle->P();
456 Double_t pz = particle->Pz();
458 Double_t eP = TMath::Sqrt(p*p + mP*mP);
459 yP = 0.5 * TMath::Log((eP + pz) / (eP - pz));
461 // -- Check Rapidity window
462 if (TMath::Abs(yP) > fRapidityMax)
468 //________________________________________________________________________
469 Bool_t AliEbyEPidRatioHelper::IsParticleAcceptedPhi(AliVParticle *particle) {
470 // -- Check if particle is accepted
472 // > return 0 if not accepted
474 if (particle->Phi() > fPhiMin && particle->Phi() <= fPhiMax)
476 else if (particle->Phi() < fPhiMin && (particle->Phi() + TMath::TwoPi()) <= fPhiMax)
482 //_____________________________________________________________________________
483 Bool_t AliEbyEPidRatioHelper::IsParticleFindable(Int_t label) {
484 // -- Check if MC particle is findable tracks
486 AliMCParticle *mcParticle = static_cast<AliMCParticle*>(fMCEvent->GetTrack(label));
491 Float_t tpcTrackLength = mcParticle->GetTPCTrackLength(AliTracker::GetBz(), 0.05, counter, 3.0);
493 return (tpcTrackLength > fMinTrackLengthMC);
495 //________________________________________________________________________
496 Bool_t AliEbyEPidRatioHelper::IsTrackAcceptedBasicCharged(AliVTrack* track) {
497 // -- Check if track is accepted
498 // > for basic parameters
503 if (track->Charge() == 0)
509 //________________________________________________________________________
510 Bool_t AliEbyEPidRatioHelper::IsTrackAcceptedRapidity(AliVTrack *track, Double_t &yP, Int_t gCurPid) {
517 if(gCurPid == 1) mP = AliPID::ParticleMass(AliPID::kPion);
518 if(gCurPid == 2) mP = AliPID::ParticleMass(AliPID::kKaon);
519 if(gCurPid == 3) mP = AliPID::ParticleMass(AliPID::kProton);
521 // -- Calculate rapidities and kinematics
523 track->GetPxPyPz(pvec);
525 Double_t p = track->P();
526 Double_t eP = TMath::Sqrt(p*p + mP*mP);
527 yP = 0.5 * TMath::Log((eP + pvec[2]) / (eP - pvec[2]));
529 // -- Check Rapidity window
530 if (TMath::Abs(yP) > fRapidityMax)
536 //________________________________________________________________________
537 Bool_t AliEbyEPidRatioHelper::IsTrackAcceptedDCA(AliVTrack *vTrack) {
538 Bool_t isAccepted = kTRUE;
543 AliESDtrack* track = dynamic_cast<AliESDtrack*>(vTrack);
548 if (track->HasPointOnITSLayer(0) && track->HasPointOnITSLayer(1)) {
550 // -- Get DCA nSigmas
551 Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
552 track->GetImpactParameters(dca,cov);
554 Float_t nSigmaCdd = (cov[0] != 0.) ? dca[0]/TMath::Sqrt(cov[0]) : -9.99;
555 Float_t nSigmaCzz = (cov[2] != 0.) ? dca[1]/TMath::Sqrt(cov[2]) : -9.99;
557 if (fNSigmaMaxCdd != 0.) {
558 if (TMath::Abs(nSigmaCdd) > fNSigmaMaxCdd)
562 if (fNSigmaMaxCzz != 0.) {
563 if (TMath::Abs(nSigmaCzz) > fNSigmaMaxCzz)
571 //________________________________________________________________________
572 Bool_t AliEbyEPidRatioHelper::IsTrackAcceptedPID(AliVTrack *track, Double_t* pid, AliPID::EParticleType gCurPid) {
574 Bool_t isAcceptedITS = kFALSE;
575 Bool_t isAcceptedTPC = kFALSE;
576 Bool_t isAcceptedTPClow = kFALSE;
577 Bool_t isAcceptedTOF = kFALSE;
578 Bool_t isAccepted = kFALSE;
580 // -- In case not PID is used
588 if (fPIDResponse->NumberOfSigmas(AliPIDResponse::kITS, track, gCurPid, pid[0]) == AliPIDResponse::kDetPidOk) {
589 if (TMath::Abs(pid[0]) < fNSigmaMaxITS)
590 isAcceptedITS = kTRUE;
593 if (fPIDResponse->NumberOfSigmas(AliPIDResponse::kTPC, track, gCurPid, pid[1]) == AliPIDResponse::kDetPidOk) {
594 if (TMath::Abs(pid[1]) < fNSigmaMaxTPC)
595 isAcceptedTPC = kTRUE;
596 if (TMath::Abs(pid[1]) < fNSigmaMaxTPClow)
597 isAcceptedTPClow = kTRUE;
598 if (track->Pt() < fMaxPtForTPClow)
599 isAcceptedTPC = isAcceptedTPClow;
602 Bool_t hasPIDTOF = kFALSE;
603 if (fPIDResponse->NumberOfSigmas(AliPIDResponse::kTOF, track, gCurPid, pid[2]) == AliPIDResponse::kDetPidOk) {
605 if (TMath::Abs(pid[2]) < fNSigmaMaxTOF)
606 isAcceptedTOF = kTRUE;
609 // -- Check TOF missmatch for MC
612 if (fIsMC && isAcceptedTOF) {
614 // AliESDtrack* track = dynamic_cast<AliESDtrack*>(vTrack);
615 // TODO add code for AOD
617 (dynamic_cast<AliESDtrack*>(track))->GetTOFLabel(tofLabel);
619 Bool_t hasMatchTOF = kTRUE;
620 if (TMath::Abs(track->GetLabel()) != TMath::Abs(tofLabel[0]) || tofLabel[1] > 0)
621 hasMatchTOF = kFALSE;
623 TParticle *matchedTrack = fStack->Particle(TMath::Abs(tofLabel[0]));
624 if (TMath::Abs(matchedTrack->GetFirstMother()) == TMath::Abs(track->GetLabel()))
627 isAcceptedTOF = hasMatchTOF;
630 // 0 : TPC(TPClow+TPCHigh)
633 // 3 : ITS+TPC(TPClow+TPCHigh)
634 // 4 : TPC(TPClow+TPCHigh)+TOF
635 // 5 : TPC(TPClow+TPCHigh)+TOF for pT >= fMinPtForTOFRequired TOF is required, below, only used if there
636 // 6 : TPC(TPClow+TPCHigh)+ITS+TOF with TOF only for those tracks which have TOF information
637 // 7 : TPC(TPClow+TPCHigh)+ITS+TOF for pT >= fMinPtForTOFRequired TOF is required, below, only used if there
638 // 8 : TPC(TPClow+TPCHigh)+ITS+TOF
639 if (fPIDStrategy == 0) { // TPC PID
640 isAccepted = isAcceptedTPC;
642 else if (fPIDStrategy == 1) { // ITS PID
643 isAccepted = isAcceptedITS;
645 else if (fPIDStrategy == 2) { // TOF PID
646 isAccepted = isAcceptedTOF;
648 else if (fPIDStrategy == 3) { // TPC+ITS PID
649 isAccepted = isAcceptedTPC && isAcceptedITS;
651 else if (fPIDStrategy == 4) { // TPC+TOF PID
652 isAccepted = isAcceptedTPC && isAcceptedTOF;
654 else if (fPIDStrategy == 5) { // TPC+TOF PID -- for pT >= fMinPtForTOFRequired TOF is required
655 if (!hasPIDTOF && track->Pt() < fMinPtForTOFRequired)
656 isAcceptedTOF = kTRUE;
657 isAccepted = isAcceptedTPC && isAcceptedTOF;
659 else if (fPIDStrategy == 6) { // ITS+TPC+TOF PID -- TOF only for those tracks which have TOF information
660 isAccepted = isAcceptedTPC && isAcceptedITS;
662 isAccepted = isAccepted && isAcceptedTOF;
664 else if (fPIDStrategy == 7) { // ITS+TPC+TOF PID -- for pT >= fMinPtForTOFRequired TOF is required
665 if (!hasPIDTOF && track->Pt() < fMinPtForTOFRequired)
666 isAcceptedTOF = kTRUE;
667 isAccepted = isAcceptedITS && isAcceptedTPC && isAcceptedTOF;
669 else if (fPIDStrategy == 8) { // ITS+TPC+TOF PID
670 isAccepted = isAcceptedITS && isAcceptedTPC && isAcceptedTOF;
676 //________________________________________________________________________
677 Bool_t AliEbyEPidRatioHelper::IsTrackAcceptedPhi(AliVTrack *track) {
678 // -- Check if track is accepted
680 // > return 0 if not accepted
682 if (track->Phi() > fPhiMin && track->Phi() <= fPhiMax)
684 else if (track->Phi() < fPhiMin && (track->Phi() + TMath::TwoPi()) <= fPhiMax)
690 //________________________________________________________________________
691 void AliEbyEPidRatioHelper::BinLogAxis(const THnBase *hn, Int_t axisNumber, AliESDtrackCuts* cuts) {
692 AliESDtrackCuts* esdTrackCuts = (cuts) ? cuts : fESDTrackCuts;
694 // -- Make logarithmic binning
695 TAxis *axis = hn->GetAxis(axisNumber);
696 Int_t nBins = axis->GetNbins();
698 Double_t from = axis->GetXmin();
699 Double_t to = axis->GetXmax();
700 Double_t *newBins = new Double_t[nBins + 1];
703 Double_t factor = TMath::Power(to/from, 1./nBins);
705 for (int ii = 1; ii <= nBins; ii++)
706 newBins[ii] = factor * newBins[ii-1];
708 axis->Set(nBins, newBins);
713 // ------------------
715 Float_t oldPtRange[2];
716 esdTrackCuts->GetPtRange(ptRange[0],ptRange[1]);
717 esdTrackCuts->GetPtRange(oldPtRange[0],oldPtRange[1]);
719 Float_t minPtForTOFRequired = fMinPtForTOFRequired;
720 Float_t maxPtForTPClow = fMaxPtForTPClow;
722 // -- Update minPt Cut
723 Int_t bin = axis->FindBin(ptRange[0]+10e-6);
724 ptRange[0] = axis->GetBinLowEdge(bin);
726 // -- Update maxPt Cut
727 bin = axis->FindBin(ptRange[1]-10e-6);
728 ptRange[1] = axis->GetBinUpEdge(bin);
730 if (ptRange[0] != oldPtRange[0] || ptRange[1] != oldPtRange[1]) {
731 printf(">>>> Update Pt Range : [%f,%f] -> [%f,%f]\n", oldPtRange[0], oldPtRange[1], ptRange[0], ptRange[1]);
732 esdTrackCuts->SetPtRange(ptRange[0],ptRange[1]);
735 // -- Update MinPtForTOFRequired
736 bin = axis->FindBin(minPtForTOFRequired-10e-6);
737 minPtForTOFRequired = axis->GetBinUpEdge(bin);
739 if (minPtForTOFRequired != fMinPtForTOFRequired) {
740 printf(">>>> Update Min Pt for TOF : %f -> %f\n", fMinPtForTOFRequired, minPtForTOFRequired);
741 fMinPtForTOFRequired = minPtForTOFRequired;
744 // -- Update MaxPtForTPClow
745 bin = axis->FindBin(maxPtForTPClow-10e-6);
746 maxPtForTPClow = axis->GetBinUpEdge(bin);
748 if (maxPtForTPClow != fMaxPtForTPClow) {
749 printf(">>>> Update Max Pt for TPC Low : %f -> %f\n", fMaxPtForTPClow, maxPtForTPClow);
750 fMaxPtForTPClow = maxPtForTPClow;
754 //________________________________________________________________________
755 void AliEbyEPidRatioHelper::InitializeEventStats() {
756 // -- Initialize event statistics histograms
758 fHEventStat0 = new TH1F("hEventStat0","Event cut statistics 0;Event Cuts;Events", fHEventStatMax,-0.5,fHEventStatMax-0.5);
759 fHEventStat1 = new TH1F("hEventStat1","Event cut statistics 1;Event Cuts;Events", fHEventStatMax,-0.5,fHEventStatMax-0.5);
761 for ( Int_t ii=0; ii < fHEventStatMax-1; ii++ ) {
762 fHEventStat0->GetXaxis()->SetBinLabel(ii+1, AliEbyEPidRatioHelper::fgkEventNames[ii]);
763 fHEventStat1->GetXaxis()->SetBinLabel(ii+1, AliEbyEPidRatioHelper::fgkEventNames[ii]);
766 fHEventStat0->GetXaxis()->SetBinLabel(fHEventStatMax, Form("Centrality [0-%s]%%", AliEbyEPidRatioHelper::fgkCentralityMaxNames[fCentralityBinMax-1]));
767 fHEventStat1->GetXaxis()->SetBinLabel(fHEventStatMax, Form("Centrality [0-%s]%%", AliEbyEPidRatioHelper::fgkCentralityMaxNames[fCentralityBinMax-1]));
770 //________________________________________________________________________
771 void AliEbyEPidRatioHelper::InitializeTriggerStats() {
772 // -- Initialize trigger statistics histograms
774 fHTriggerStat = new TH1F("hTriggerStat","Trigger statistics;Trigger;Events", fNTriggers,-0.5,fNTriggers-0.5);
776 for ( Int_t ii=0; ii < fNTriggers; ii++ )
777 fHTriggerStat->GetXaxis()->SetBinLabel(ii+1, AliEbyEPidRatioHelper::fgkTriggerNames[ii]);
780 //________________________________________________________________________
781 void AliEbyEPidRatioHelper::InitializeCentralityStats() {
782 // -- Initialize trigger statistics histograms
784 fHCentralityStat = new TH1F("hCentralityStat","Centrality statistics;Centrality Bins;Events",
785 fNCentralityBins,-0.5,fNCentralityBins-0.5);
787 for ( Int_t ii=0; ii < fNCentralityBins; ii++ )
788 fHCentralityStat->GetXaxis()->SetBinLabel(ii+1, AliEbyEPidRatioHelper::fgkCentralityNames[ii]);
790 //________________________________________________________________________
791 Bool_t AliEbyEPidRatioHelper::FillEventStats(Int_t *aEventCuts) {
792 // -- Fill event / centrality statistics
794 Bool_t isRejected = kFALSE;
796 // -- Fill event statistics
797 for (Int_t idx = 0; idx < fHEventStatMax ; ++idx) {
802 fHEventStat0->Fill(idx);
805 for (Int_t idx = 0; idx < fHEventStatMax; ++idx) {
808 fHEventStat1->Fill(idx);
811 // -- Fill centrality statistics of accepted events
813 fHCentralityStat->Fill(fCentralityBin);