Skip to content

Commit 26a3419

Browse files
EloviyoShirajum Monira
andauthored
[PWGCF] FemtoUniverse cascade task -- added efficiency correction for cascade task (#12602)
Co-authored-by: Shirajum Monira <shirajum.monira@cernch>
1 parent 556ea82 commit 26a3419

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232

3333
#include <TPDGCode.h>
3434

35+
#include <memory>
3536
#include <set>
37+
#include <string>
3638
#include <vector>
3739

3840
using namespace o2;
@@ -104,6 +106,9 @@ struct femtoUniversePairTaskTrackCascadeExtended {
104106
ConfigurableAxis confTrkTempFitVarBins{"confTrkTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"};
105107
Configurable<int> confNEventsMix{"confNEventsMix", 5, "Number of events for mixing"};
106108

109+
// Efficiency
110+
Configurable<std::string> confLocalEfficiency{"confLocalEfficiency", "", "Local path to efficiency .root file"};
111+
107112
Filter collisionFilter = (nabs(aod::collision::posZ) < confZVertexCut);
108113
using FilteredFDCollisions = soa::Filtered<o2::aod::FdCollisions>;
109114
using FilteredFDCollision = FilteredFDCollisions::iterator;
@@ -152,6 +157,10 @@ struct femtoUniversePairTaskTrackCascadeExtended {
152157

153158
std::set<int> cascDuplicates;
154159

160+
std::unique_ptr<TFile> plocalEffFile;
161+
std::unique_ptr<TH1> plocalEffp1;
162+
std::unique_ptr<TH1> plocalEffp2;
163+
155164
// Table to select cascade daughters
156165
// Charges: = +--, +--, +-+, +-+
157166
static constexpr unsigned int CascChildTable[][3] = {{0, 1, 2}, {0, 1, 1}, {1, 0, 2}, {1, 0, 1}};
@@ -314,6 +323,21 @@ struct femtoUniversePairTaskTrackCascadeExtended {
314323
if (doprocessSameEventCasc || doprocessSameEventCascBitmask || doprocessMixedEventCasc || doprocessMixedEventCascBitmask)
315324
pairCloseRejectionCasc.init(&resultRegistry, &qaRegistry, confCPRdeltaPhiCutMin.value, confCPRdeltaPhiCutMax.value, confCPRdeltaEtaCutMin.value, confCPRdeltaEtaCutMax.value, confCPRChosenRadii.value, confCPRPlotPerRadii.value, 0, 0, confIsSameSignCPR.value);
316325
}
326+
327+
if (!confLocalEfficiency.value.empty()) {
328+
plocalEffFile = std::unique_ptr<TFile>(TFile::Open(confLocalEfficiency.value.c_str(), "read"));
329+
if (!plocalEffFile || plocalEffFile.get()->IsZombie())
330+
LOGF(fatal, "Could not load efficiency histogram from %s", confLocalEfficiency.value.c_str());
331+
if (doprocessSameEvent || doprocessSameEventBitmask || doprocessMixedEvent || doprocessMixedEventBitmask) {
332+
plocalEffp1 = (confChargePart1 > 0) ? std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("PrPlus")) : std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("PrMinus")); // note: works only for protons for now
333+
plocalEffp2 = (confCascType1 == 0 || confCascType1 == 1) ? std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("Cascade")) : std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("AntiCascade"));
334+
LOGF(info, "Loaded efficiency histograms for track-Cascade.");
335+
} else if (doprocessSameEventCasc || doprocessSameEventCascBitmask || doprocessMixedEventCasc || doprocessMixedEventCascBitmask) {
336+
plocalEffp1 = (confCascType1 == 0 || confCascType1 == 1) ? std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("Cascade")) : std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("AntiCascade"));
337+
plocalEffp2 = (confCascType2 == 0 || confCascType2 == 1) ? std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("Cascade")) : std::unique_ptr<TH1>(plocalEffFile.get()->Get<TH1>("AntiCascade"));
338+
LOGF(info, "Loaded efficiency histograms for Cascade-Cascade.");
339+
}
340+
}
317341
}
318342

319343
void processCascadeQA([[maybe_unused]] const FilteredFDCollision& col, const FemtoFullParticles& parts, const aod::FDCascParticles& fdcascs)
@@ -484,7 +508,10 @@ struct femtoUniversePairTaskTrackCascadeExtended {
484508
if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0)
485509
continue;
486510
}
487-
sameEventCont.setPair<false>(p1, p2, multCol, confUse3D, 1.0f);
511+
float weight = 1.0f;
512+
if (plocalEffp1)
513+
weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta()));
514+
sameEventCont.setPair<false>(p1, p2, multCol, confUse3D, weight);
488515
}
489516
}
490517

@@ -606,7 +633,10 @@ struct femtoUniversePairTaskTrackCascadeExtended {
606633
return;
607634
}
608635

609-
sameEventCont.setPair<false>(p1, p2, multCol, confUse3D, 1.0f);
636+
float weight = 1.0f;
637+
if (plocalEffp1)
638+
weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta()));
639+
sameEventCont.setPair<false>(p1, p2, multCol, confUse3D, weight);
610640
};
611641
cascDuplicates.clear();
612642
if (confCascType1 == confCascType2) {
@@ -698,7 +728,10 @@ struct femtoUniversePairTaskTrackCascadeExtended {
698728
}
699729
}
700730

701-
mixedEventCont.setPair<false>(p1, p2, multCol, confUse3D, 1.0f);
731+
float weight = 1.0f;
732+
if (plocalEffp1)
733+
weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta()));
734+
mixedEventCont.setPair<false>(p1, p2, multCol, confUse3D, weight);
702735
}
703736
};
704737

@@ -794,7 +827,10 @@ struct femtoUniversePairTaskTrackCascadeExtended {
794827
}
795828
}
796829

797-
mixedEventCont.setPair<false>(p1, p2, multCol, confUse3D, 1.0f);
830+
float weight = 1.0f;
831+
if (plocalEffp1)
832+
weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta()));
833+
mixedEventCont.setPair<false>(p1, p2, multCol, confUse3D, weight);
798834
}
799835
}
800836
}

0 commit comments

Comments
 (0)