@@ -551,7 +551,7 @@ void CorrelationContainer::resetBinLimits(THnBase* grid)
551551}
552552
553553// ____________________________________________________________________
554- void CorrelationContainer::countEmptyBins (CorrelationContainer::CFStep step, Float_t ptLeadMin , Float_t ptLeadMax )
554+ void CorrelationContainer::countEmptyBins (CorrelationContainer::CFStep step, Float_t ptTriggerMin , Float_t ptTriggerMax )
555555{
556556 // prints the number of empty bins in the track end event histograms in the given step
557557
@@ -573,9 +573,9 @@ void CorrelationContainer::countEmptyBins(CorrelationContainer::CFStep step, Flo
573573 binEnd[1 ] = mPairHist ->getTHn (step)->GetAxis (1 )->FindBin (mPtMax );
574574 }
575575
576- if (ptLeadMax > ptLeadMin ) {
577- binBegin[2 ] = mPairHist ->getTHn (step)->GetAxis (2 )->FindBin (ptLeadMin );
578- binEnd[2 ] = mPairHist ->getTHn (step)->GetAxis (2 )->FindBin (ptLeadMax );
576+ if (ptTriggerMax > ptTriggerMin ) {
577+ binBegin[2 ] = mPairHist ->getTHn (step)->GetAxis (2 )->FindBin (ptTriggerMin );
578+ binEnd[2 ] = mPairHist ->getTHn (step)->GetAxis (2 )->FindBin (ptTriggerMax );
579579 }
580580
581581 // start from multiplicity 1
@@ -616,7 +616,7 @@ void CorrelationContainer::countEmptyBins(CorrelationContainer::CFStep step, Flo
616616}
617617
618618// ____________________________________________________________________
619- void CorrelationContainer::getHistsZVtxMult (CorrelationContainer::CFStep step, Float_t ptLeadMin , Float_t ptLeadMax , THnBase** trackHist, TH2** eventHist)
619+ void CorrelationContainer::getHistsZVtxMult (CorrelationContainer::CFStep step, Float_t ptTriggerMin , Float_t ptTriggerMax , THnBase** trackHist, TH2** eventHist)
620620{
621621 // Calculates a 4d histogram with deltaphi, deltaeta, zvtx, multiplicity on track level and
622622 // a 2d histogram on event level (as fct of zvtx, multiplicity)
@@ -637,9 +637,9 @@ void CorrelationContainer::getHistsZVtxMult(CorrelationContainer::CFStep step, F
637637
638638 setBinLimits (sparse);
639639
640- Int_t firstBin = sparse->GetAxis (2 )->FindBin (ptLeadMin );
641- Int_t lastBin = sparse->GetAxis (2 )->FindBin (ptLeadMax );
642- LOGF (info, " Using pT range %d --> %d" , firstBin, lastBin);
640+ Int_t firstBin = sparse->GetAxis (2 )->FindBin (ptTriggerMin );
641+ Int_t lastBin = sparse->GetAxis (2 )->FindBin (ptTriggerMax );
642+ LOGF (info, " Using trigger pT range %d --> %d" , firstBin, lastBin);
643643 sparse->GetAxis (2 )->SetRange (firstBin, lastBin);
644644 mTriggerHist ->getTHn (step)->GetAxis (0 )->SetRange (firstBin, lastBin);
645645
@@ -716,10 +716,61 @@ void CorrelationContainer::getHistsZVtxMult(CorrelationContainer::CFStep step, F
716716 resetBinLimits (mTriggerHist ->getTHn (step));
717717}
718718
719- // ____________________________________________________________________
720- TH2* CorrelationContainer::getSumOfRatios (CorrelationContainer* mixed, CorrelationContainer::CFStep step, Float_t ptLeadMin, Float_t ptLeadMax, Int_t multBinBegin, Int_t multBinEnd, Bool_t normalizePerTrigger, Int_t stepForMixed, Int_t* trigger)
719+ TH2* CorrelationContainer::getPerTriggerYield (CorrelationContainer::CFStep step, Float_t ptTriggerMin, Float_t ptTriggerMax, Bool_t normalizePerTrigger)
720+ {
721+ // Calculate per trigger yield without considering mixed event
722+ // Sums over all vertex bins, and respects the pT and centrality limits set in the class
723+ //
724+ // returns a 2D histogram: deltaphi, deltaeta
725+ //
726+ // Parameters:
727+ // step: Step for which the histogram is received
728+ // ptTriggerMin, ptTriggerMax: trigger pT range
729+ // normalizePerTrigger: divide through number of triggers
730+
731+ THnBase* trackSameAll = nullptr ;
732+ TH2* eventSameAll = nullptr ;
733+
734+ Long64_t totalEvents = 0 ;
735+ Int_t nCorrelationFunctions = 0 ;
736+
737+ getHistsZVtxMult (step, ptTriggerMin, ptTriggerMax, &trackSameAll, &eventSameAll);
738+
739+ TAxis* multAxis = trackSameAll->GetAxis (3 );
740+ int multBinBegin = 1 ;
741+ int multBinEnd = multAxis->GetNbins ();
742+ if (mCentralityMin < mCentralityMax ) {
743+ multBinBegin = multAxis->FindBin (mCentralityMin + 1e-4 );
744+ multBinEnd = multAxis->FindBin (mCentralityMax - 1e-4 );
745+ LOGF (info, " Using multiplicity range %d --> %d" , multBinBegin, multBinEnd);
746+ }
747+
748+ if (mCentralityMin < mCentralityMax ) {
749+ trackSameAll->GetAxis (3 )->SetRange (multBinBegin, multBinEnd);
750+ }
751+
752+ TH2* yield = trackSameAll->Projection (1 , 0 , " E" );
753+ Float_t triggers = eventSameAll->Integral (1 , eventSameAll->GetXaxis ()->GetNbins (), multBinBegin, multBinEnd);
754+
755+ if (normalizePerTrigger) {
756+ LOGF (info, " Dividing %f tracks by %f triggers" , yield->Integral (), triggers);
757+ if (triggers > 0 )
758+ yield->Scale (1.0 / triggers);
759+ }
760+
761+ // normalizate to dphi width
762+ Float_t normalization = yield->GetXaxis ()->GetBinWidth (1 );
763+ yield->Scale (1.0 / normalization);
764+
765+ delete trackSameAll;
766+ delete eventSameAll;
767+
768+ return yield;
769+ }
770+
771+ TH2* CorrelationContainer::getSumOfRatios (CorrelationContainer* mixed, CorrelationContainer::CFStep step, Float_t ptTriggerMin, Float_t ptTriggerMax, Bool_t normalizePerTrigger, Int_t stepForMixed, Int_t* trigger)
721772{
722- // Calls GetUEHist(...) for *each* vertex bin and multiplicity bin and performs a sum of ratios:
773+ // Extract 2D per trigger yield with mixed event correction. The quantity is calculated for *each* vertex bin and multiplicity bin and then a sum of ratios is performed :
723774 // 1_N [ (same/mixed)_1 + (same/mixed)_2 + (same/mixed)_3 + ... ]
724775 // where N is the total number of events/trigger particles and the subscript is the vertex/multiplicity bin
725776 // where mixed is normalized such that the information about the number of pairs in same is kept
@@ -728,8 +779,9 @@ TH2* CorrelationContainer::getSumOfRatios(CorrelationContainer* mixed, Correlati
728779 //
729780 // Parameters:
730781 // mixed: CorrelationContainer containing mixed event corresponding to this object (the histograms are taken from step <stepForMixed> if defined otherwise from step <step>)
731- // <other parameters> : check documentation of CorrelationContainer::GetUEHist
732- // normalizePerTrigger: divide through number of triggers
782+ // step: Step for which the histogram is received
783+ // ptTriggerMin, ptTriggerMax: trigger pT range
784+ // normalizePerTrigger: divide through number of triggers
733785
734786 // do not add this hists to the directory
735787 Bool_t oldStatus = TH1::AddDirectoryStatus ();
@@ -747,16 +799,16 @@ TH2* CorrelationContainer::getSumOfRatios(CorrelationContainer* mixed, Correlati
747799 Long64_t totalEvents = 0 ;
748800 Int_t nCorrelationFunctions = 0 ;
749801
750- getHistsZVtxMult (step, ptLeadMin, ptLeadMax , &trackSameAll, &eventSameAll);
751- mixed->getHistsZVtxMult ((stepForMixed == -1 ) ? step : (CFStep)stepForMixed, ptLeadMin, ptLeadMax , &trackMixedAll, &eventMixedAll);
802+ getHistsZVtxMult (step, ptTriggerMin, ptTriggerMax , &trackSameAll, &eventSameAll);
803+ mixed->getHistsZVtxMult ((stepForMixed == -1 ) ? step : (CFStep)stepForMixed, ptTriggerMin, ptTriggerMax , &trackMixedAll, &eventMixedAll);
752804
753805 // If we ask for histograms from step8 (TTR cut applied) there is a hole at 0,0; so this cannot be used for the
754806 // mixed-event normalization. If step6 is available, the normalization factor is read out from that one.
755807 // If step6 is not available we fallback to taking the normalization along all delta phi (WARNING requires a
756808 // flat delta phi distribution)
757809 if (stepForMixed == -1 && step == kCFStepBiasStudy && mixed->mTriggerHist ->getTHn (kCFStepReconstructed )->GetEntries () > 0 && !mSkipScaleMixedEvent ) {
758810 LOGF (info, " Using mixed-event normalization factors from step %d" , kCFStepReconstructed );
759- mixed->getHistsZVtxMult (kCFStepReconstructed , ptLeadMin, ptLeadMax , &trackMixedAllStep6, &eventMixedAllStep6);
811+ mixed->getHistsZVtxMult (kCFStepReconstructed , ptTriggerMin, ptTriggerMax , &trackMixedAllStep6, &eventMixedAllStep6);
760812 }
761813
762814 // Printf("%f %f %f %f", trackSameAll->GetEntries(), eventSameAll->GetEntries(), trackMixedAll->GetEntries(), eventMixedAll->GetEntries());
@@ -767,9 +819,11 @@ TH2* CorrelationContainer::getSumOfRatios(CorrelationContainer* mixed, Correlati
767819
768820 TAxis* multAxis = trackSameAll->GetAxis (3 );
769821
770- if (multBinEnd < multBinBegin) {
771- multBinBegin = 1 ;
772- multBinEnd = multAxis->GetNbins ();
822+ int multBinBegin = 1 ;
823+ int multBinEnd = multAxis->GetNbins ();
824+ if (mCentralityMin < mCentralityMax ) {
825+ multBinBegin = multAxis->FindBin (mCentralityMin );
826+ multBinEnd = multAxis->FindBin (mCentralityMax );
773827 }
774828
775829 for (Int_t multBin = TMath::Max (1 , multBinBegin); multBin <= TMath::Min (multAxis->GetNbins (), multBinEnd); multBin++) {
@@ -996,14 +1050,14 @@ TH2* CorrelationContainer::getSumOfRatios(CorrelationContainer* mixed, Correlati
9961050 return totalTracks;
9971051}
9981052
999- TH1* CorrelationContainer::getTriggersAsFunctionOfMultiplicity (CorrelationContainer::CFStep step, Float_t ptLeadMin , Float_t ptLeadMax )
1053+ TH1* CorrelationContainer::getTriggersAsFunctionOfMultiplicity (CorrelationContainer::CFStep step, Float_t ptTriggerMin , Float_t ptTriggerMax )
10001054{
10011055 // returns the distribution of triggers as function of centrality/multiplicity
10021056
10031057 resetBinLimits (mTriggerHist ->getTHn (step));
10041058
1005- Int_t firstBin = mTriggerHist ->getTHn (step)->GetAxis (0 )->FindBin (ptLeadMin );
1006- Int_t lastBin = mTriggerHist ->getTHn (step)->GetAxis (0 )->FindBin (ptLeadMax );
1059+ Int_t firstBin = mTriggerHist ->getTHn (step)->GetAxis (0 )->FindBin (ptTriggerMin );
1060+ Int_t lastBin = mTriggerHist ->getTHn (step)->GetAxis (0 )->FindBin (ptTriggerMax );
10071061 LOGF (info, " Using pT range %d --> %d" , firstBin, lastBin);
10081062 mTriggerHist ->getTHn (step)->GetAxis (0 )->SetRange (firstBin, lastBin);
10091063
@@ -1301,14 +1355,14 @@ TH1* CorrelationContainer::getTrackEfficiency(CFStep step1, CFStep step2, Int_t
13011355}
13021356
13031357// ____________________________________________________________________
1304- TH1* CorrelationContainer::getEventEfficiency (CFStep step1, CFStep step2, Int_t axis1, Int_t axis2, Float_t ptLeadMin , Float_t ptLeadMax )
1358+ TH1* CorrelationContainer::getEventEfficiency (CFStep step1, CFStep step2, Int_t axis1, Int_t axis2, Float_t ptTriggerMin , Float_t ptTriggerMax )
13051359{
13061360 // creates a event-level efficiency by dividing step2 by step1
13071361 // projected to axis1 and axis2 (optional if >= 0)
13081362
1309- if (ptLeadMax > ptLeadMin ) {
1310- mTriggerHist ->getTHn (step1)->GetAxis (0 )->SetRangeUser (ptLeadMin, ptLeadMax );
1311- mTriggerHist ->getTHn (step2)->GetAxis (0 )->SetRangeUser (ptLeadMin, ptLeadMax );
1363+ if (ptTriggerMax > ptTriggerMin ) {
1364+ mTriggerHist ->getTHn (step1)->GetAxis (0 )->SetRangeUser (ptTriggerMin, ptTriggerMax );
1365+ mTriggerHist ->getTHn (step2)->GetAxis (0 )->SetRangeUser (ptTriggerMin, ptTriggerMax );
13121366 }
13131367
13141368 TH1* measured = nullptr ;
@@ -1326,7 +1380,7 @@ TH1* CorrelationContainer::getEventEfficiency(CFStep step1, CFStep step2, Int_t
13261380
13271381 delete generated;
13281382
1329- if (ptLeadMax > ptLeadMin ) {
1383+ if (ptTriggerMax > ptTriggerMin ) {
13301384 mTriggerHist ->getTHn (step1)->GetAxis (0 )->SetRangeUser (0 , -1 );
13311385 mTriggerHist ->getTHn (step2)->GetAxis (0 )->SetRangeUser (0 , -1 );
13321386 }
@@ -1867,7 +1921,7 @@ THnBase* CorrelationContainer::changeToThn(THnBase* sparse)
18671921 return tmpTHn;
18681922}
18691923
1870- void CorrelationContainer::FillEvent (Float_t centrality, CFStep step)
1924+ void CorrelationContainer::fillEvent (Float_t centrality, CFStep step)
18711925{
18721926 // Fill per-event information
18731927 mEventCount ->Fill (step, centrality);
0 commit comments