Skip to content

Commit 4ee97ea

Browse files
committed
Optionally disable phi online efficiency + extended pt axes for MCGen
1 parent 8aab04a commit 4ee97ea

File tree

2 files changed

+59
-33
lines changed

2 files changed

+59
-33
lines changed

PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,11 @@ struct PionTrackProducer {
550550
// Configurable<bool> forceTOF{"forceTOF", false, "force the TOF signal for the PID"};
551551
Configurable<float> tofPIDThreshold{"tofPIDThreshold", 0.5, "minimum pT after which TOF PID is applicable"};
552552
Configurable<std::vector<int>> trkPIDspecies{"trkPIDspecies", std::vector<int>{o2::track::PID::Kaon, o2::track::PID::Proton}, "Trk sel: Particles species for PID rejection, kaon, proton"};
553-
Configurable<std::vector<float>> pidTPCMax{"pidTPCMax", std::vector<float>{2.0f, 2.0f}, "maximum nSigma TPC"};
554-
Configurable<std::vector<float>> pidTOFMax{"pidTOFMax", std::vector<float>{2.0f, 2.0f}, "maximum nSigma TOF"};
553+
Configurable<std::pair<float, float>> pidRangeTPCEl{"pidRangeTPCEl", {-3.0f, 5.0f}, "nSigma TPC range for electrons"};
554+
Configurable<float> pidTPCMaxHadrons{"pidTPCMaxHadrons", 3.0f, "maximum nSigma TPC for hadrons"};
555+
Configurable<float> pidTOFMaxHadrons{"pidTOFMaxHadrons", 3.0f, "maximum nSigma TOF for hadrons"};
556+
Configurable<std::vector<float>> pidTPCMax{"pidTPCMax", std::vector<float>{3.0f, 3.0f}, "maximum nSigma TPC"};
557+
Configurable<std::vector<float>> pidTOFMax{"pidTOFMax", std::vector<float>{3.0f, 3.0f}, "maximum nSigma TOF"};
555558

556559
Configurable<float> cfgYAcceptance{"cfgYAcceptance", 0.5f, "Rapidity acceptance"};
557560
} trackConfigs;
@@ -636,20 +639,32 @@ struct PionTrackProducer {
636639
// Electron rejection
637640
auto nSigmaTPCEl = aod::pidutils::tpcNSigma(o2::track::PID::Electron, track);
638641

639-
if (nSigmaTPCEl > -3.0f && nSigmaTPCEl < 5.0f) {
642+
if (nSigmaTPCEl > trackConfigs.pidRangeTPCEl->first && nSigmaTPCEl < trackConfigs.pidRangeTPCEl->second) {
640643
auto nSigmaTPCPi = aod::pidutils::tpcNSigma(o2::track::PID::Pion, track);
641644
auto nSigmaTPCKa = aod::pidutils::tpcNSigma(o2::track::PID::Kaon, track);
642645
auto nSigmaTPCPr = aod::pidutils::tpcNSigma(o2::track::PID::Proton, track);
643646

644-
if (std::abs(nSigmaTPCPi) > 3.0f &&
645-
std::abs(nSigmaTPCKa) > 3.0f &&
646-
std::abs(nSigmaTPCPr) > 3.0f) {
647+
if (std::abs(nSigmaTPCPi) > trackConfigs.pidTPCMaxHadrons &&
648+
std::abs(nSigmaTPCKa) > trackConfigs.pidTPCMaxHadrons &&
649+
std::abs(nSigmaTPCPr) > trackConfigs.pidTPCMaxHadrons) {
647650
return false;
648651
}
649652
}
650653

651654
// Other hadron species rejection
652-
for (size_t speciesIndex = 0; speciesIndex < trackConfigs.trkPIDspecies->size(); ++speciesIndex) {
655+
for (auto pid : {o2::track::PID::Kaon, o2::track::PID::Proton}) {
656+
auto nSigmaTPC = aod::pidutils::tpcNSigma(pid, track);
657+
658+
if (std::abs(nSigmaTPC) < trackConfigs.pidTPCMaxHadrons) {
659+
// Reject if only TPC is within threshold and TOF is unavailable or if both TPC and TOF are within thresholds
660+
if (!track.hasTOF() || std::abs(aod::pidutils::tofNSigma(pid, track)) < trackConfigs.pidTOFMaxHadrons) {
661+
return false;
662+
}
663+
}
664+
}
665+
666+
// Other hadron species rejection
667+
/*for (size_t speciesIndex = 0; speciesIndex < trackConfigs.trkPIDspecies->size(); ++speciesIndex) {
653668
auto const& pid = trackConfigs.trkPIDspecies->at(speciesIndex);
654669
auto nSigmaTPC = aod::pidutils::tpcNSigma(pid, track);
655670
@@ -663,7 +678,7 @@ struct PionTrackProducer {
663678
return false; // Reject if only TPC is within threshold and TOF is unavailable
664679
}
665680
}
666-
}
681+
}*/
667682

668683
return true;
669684
}

PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -241,19 +241,22 @@ struct PhiStrangenessCorrelation {
241241
// Configurables for Pions selection
242242
struct : ConfigurableGroup {
243243
Configurable<bool> selectPionInSigRegion{"selectPionInSigRegion", true, "Select Pion candidates in signal region"};
244-
Configurable<float> pidTPCMax{"pidTPCMax", 2.0f, "Maximum nSigma TPC"};
245-
Configurable<float> pidTOFMax{"pidTOFMax", 2.0f, "Maximum nSigma TOF"};
244+
Configurable<float> pidTPCMax{"pidTPCMax", 3.0f, "Maximum nSigma TPC"};
245+
Configurable<float> pidTOFMax{"pidTOFMax", 3.0f, "Maximum nSigma TOF"};
246246
// Configurable<float> tofPIDThreshold{"tofPIDThreshold", 0.5f, "Minimum pT after which TOF PID is applicable"};
247247
} pionConfigs;
248248

249249
// Configurables on phi pT bins
250250
Configurable<std::vector<double>> binspTPhi{"binspTPhi", {0.4, 0.8, 1.4, 2.0, 2.8, 4.0, 6.0, 10.0}, "pT bin limits for Phi"};
251+
Configurable<std::vector<double>> binspTPhiExt{"binspTPhiExt", {0.0, 0.4, 0.8, 1.4, 2.0, 2.8, 4.0, 6.0, 10.0}, "pT bin limits for Phi extended for MC Gen"};
251252

252253
// Configurable on K0S pT bins
253254
Configurable<std::vector<double>> binspTK0S{"binspTK0S", {0.1, 0.5, 0.8, 1.2, 1.6, 2.0, 2.5, 3.0, 4.0, 6.0}, "pT bin limits for K0S"};
255+
Configurable<std::vector<double>> binspTK0SExt{"binspTK0SExt", {0.0, 0.1, 0.5, 0.8, 1.2, 1.6, 2.0, 2.5, 3.0, 4.0, 6.0}, "pT bin limits for K0S extended for MC Gen"};
254256

255257
// Configurable on pion pT bins
256-
Configurable<std::vector<double>> binspTPi{"binspTPi", {0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.2, 1.5, 2.0, 3.0}, "pT bin limits for pions"};
258+
Configurable<std::vector<double>> binspTPi{"binspTPi", {0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.2, 1.5, 2.0, 3.0}, "pT bin limits for Pions"};
259+
Configurable<std::vector<double>> binspTPiExt{"binspTPiExt", {0.0, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.2, 1.5, 2.0, 3.0}, "pT bin limits for Pions extended for MC Gen"};
257260

258261
struct : ConfigurableGroup {
259262
Configurable<bool> doK0SCorrelation{"doK0SCorrelation", true, "Enable Phi-K0S correlation"};
@@ -270,8 +273,11 @@ struct PhiStrangenessCorrelation {
270273
} yConfigs;
271274

272275
// Configurables to apply efficiency online and how to
273-
Configurable<bool> applyEfficiency{"applyEfficiency", false, "Use efficiency for filling histograms"};
274-
Configurable<bool> useEffInterpolation{"useEffInterpolation", false, "If true, interpolates efficiency map, else uses bin center"};
276+
struct : ConfigurableGroup {
277+
Configurable<bool> applyEfficiency{"applyEfficiency", false, "Use efficiency for filling histograms"};
278+
Configurable<bool> useEffInterpolation{"useEffInterpolation", false, "If true, interpolates efficiency map, else uses bin center"};
279+
Configurable<bool> applyPhiEfficiency{"applyPhiEfficiency", true, "Apply efficiency for Phi candidates"};
280+
} efficiencyConfigs;
275281

276282
// Configurable for event mixing
277283
Configurable<int> cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"};
@@ -285,6 +291,7 @@ struct PhiStrangenessCorrelation {
285291
Configurable<float> minPhiPt{"minPhiPt", 0.4f, "Minimum pT for Phi candidates"};
286292
Configurable<float> v0SettingMinPt{"v0SettingMinPt", 0.1f, "V0 min pt"};
287293
Configurable<float> cMinPionPtcut{"cMinPionPtcut", 0.2f, "Track minimum pt cut"};
294+
Configurable<bool> bypassPtCut{"bypassPtCut", false, "Bypass the minimum pt cut at MCGen level"};
288295
} minPtMcGenConfigs;
289296

290297
// Filter on phi selected collisions
@@ -362,12 +369,15 @@ struct PhiStrangenessCorrelation {
362369
AxisSpec massPhiAxis = {200, 0.9f, 1.2f, "#it{M}_{inv} [GeV/#it{c}^{2}]"};
363370
AxisSpec pTPhiAxis = {120, 0.0f, 12.0f, "#it{p}_{T} (GeV/#it{c})"};
364371
AxisSpec binnedpTPhiAxis{(std::vector<double>)binspTPhi, "#it{p}_{T} (GeV/#it{c})"};
372+
AxisSpec binnedpTPhiAxisExt{(std::vector<double>)binspTPhiExt, "#it{p}_{T} (GeV/#it{c})"};
365373
AxisSpec massK0SAxis = {200, 0.45f, 0.55f, "#it{M}_{inv} [GeV/#it{c}^{2}]"};
366374
AxisSpec pTK0SAxis = {100, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"};
367375
AxisSpec binnedpTK0SAxis{(std::vector<double>)binspTK0S, "#it{p}_{T} (GeV/#it{c})"};
376+
AxisSpec binnedpTK0SAxisExt{(std::vector<double>)binspTK0SExt, "#it{p}_{T} (GeV/#it{c})"};
368377
AxisSpec nSigmaPiAxis = {100, -10.0f, 10.0f, "N#sigma #pi"};
369378
AxisSpec pTPiAxis = {50, 0.0f, 5.0f, "#it{p}_{T} (GeV/#it{c})"};
370379
AxisSpec binnedpTPiAxis{(std::vector<double>)binspTPi, "#it{p}_{T} (GeV/#it{c})"};
380+
AxisSpec binnedpTPiAxisExt{(std::vector<double>)binspTPiExt, "#it{p}_{T} (GeV/#it{c})"};
371381

372382
histos.add("phi/h3PhiData", "Invariant mass of Phi in Data", kTH3F, {binnedmultAxis, binnedpTPhiAxis, massPhiAxis});
373383

@@ -406,16 +416,16 @@ struct PhiStrangenessCorrelation {
406416
histos.add("pi/h3PiMCGen", "Pion in MC Gen", kTH3F, {binnedmultAxis, binnedpTPiAxis, yAxis});
407417
histos.add("pi/h4PiMCGenAssocReco", "Pion in MC Gen Assoc Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, binnedpTPiAxis, yAxis});
408418

409-
histos.add("phi/h3PhiMCClosureGen", "Phi in MC Gen for MC Closure Test", kTH3F, {binnedmultAxis, binnedpTPhiAxis, yAxis});
419+
histos.add("phi/h3PhiMCClosureGen", "Phi in MC Gen for MC Closure Test", kTH3F, {binnedmultAxis, binnedpTPhiAxisExt, yAxis});
410420

411-
histos.add("phiK0S/h5PhiK0SClosureMCGen", "Deltay vs deltaphi for Phi and K0Short in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTK0SAxis, deltayAxis, deltaphiAxis});
412-
histos.add("phiPi/h5PhiPiClosureMCGen", "Deltay vs deltaphi for Phi and Pion in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTPiAxis, deltayAxis, deltaphiAxis});
421+
histos.add("phiK0S/h5PhiK0SClosureMCGen", "Deltay vs deltaphi for Phi and K0Short in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTK0SAxisExt, deltayAxis, deltaphiAxis});
422+
histos.add("phiPi/h5PhiPiClosureMCGen", "Deltay vs deltaphi for Phi and Pion in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTPiAxisExt, deltayAxis, deltaphiAxis});
413423

414-
histos.add("phiK0S/h5PhiK0SClosureMCGenME", "Deltay vs deltaphi for Phi and K0Short in MCGen ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTK0SAxis, deltayAxis, deltaphiAxis});
415-
histos.add("phiPi/h5PhiPiClosureMCGenME", "Deltay vs deltaphi for Phi and Pion in MCGen ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTPiAxis, deltayAxis, deltaphiAxis});
424+
histos.add("phiK0S/h5PhiK0SClosureMCGenME", "Deltay vs deltaphi for Phi and K0Short in MCGen ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTK0SAxisExt, deltayAxis, deltaphiAxis});
425+
histos.add("phiPi/h5PhiPiClosureMCGenME", "Deltay vs deltaphi for Phi and Pion in MCGen ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTPiAxisExt, deltayAxis, deltaphiAxis});
416426

417427
// Load efficiency maps from CCDB
418-
if (applyEfficiency) {
428+
if (efficiencyConfigs.applyEfficiency) {
419429
ccdb->setURL(ccdbUrl);
420430
ccdb->setCaching(true);
421431
ccdb->setLocalObjectValidityChecking();
@@ -451,8 +461,9 @@ struct PhiStrangenessCorrelation {
451461

452462
void loadEfficiencyMaps()
453463
{
454-
// Always load the Trigger (Phi) map
455-
fetchSingleEfficiencyMapFromCCDB(effMapPhi, "Phi");
464+
// Load the Trigger (Phi) map if requested by analysis method
465+
if (efficiencyConfigs.applyPhiEfficiency)
466+
fetchSingleEfficiencyMapFromCCDB(effMapPhi, "Phi");
456467

457468
// Map the user configurations for the associated particles
458469
bool doAssocCorrelations[kAssocPartSize] = {activeCorrelationConfigs.doK0SCorrelation, activeCorrelationConfigs.doXiCorrelation, activeCorrelationConfigs.doPionCorrelation};
@@ -476,10 +487,10 @@ struct PhiStrangenessCorrelation {
476487
template <typename... BoundEffMaps>
477488
float computeWeight(const BoundEffMaps&... boundEffMaps)
478489
{
479-
if (!applyEfficiency)
490+
if (!efficiencyConfigs.applyEfficiency)
480491
return 1.0f;
481492

482-
float totalEfficiency = ((useEffInterpolation ? boundEffMaps.interpolateEfficiency() : boundEffMaps.getBinEfficiency()) * ...);
493+
float totalEfficiency = ((efficiencyConfigs.useEffInterpolation ? boundEffMaps.interpolateEfficiency() : boundEffMaps.getBinEfficiency()) * ...);
483494

484495
return totalEfficiency <= 0.0f ? 1.0f : 1.0f / totalEfficiency;
485496
}
@@ -512,7 +523,7 @@ struct PhiStrangenessCorrelation {
512523
const bool applyK0sMassCut = (analysisMode == kDeltaYvsDeltaPhi) && k0sConfigs.selectK0sInSigRegion;
513524
const auto& [minMassK0s, maxMassK0s] = k0sConfigs.rangeMK0sSignal.value;
514525
auto isK0sValid = [&](const auto& k0s) {
515-
return (!applyEfficiency || k0s.pt() < binspTK0S->back()) && (!applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s));
526+
return (!efficiencyConfigs.applyEfficiency || k0s.pt() < binspTK0S->back()) && (!applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s));
516527
};
517528

518529
const bool applyPionNSigmaCut = (analysisMode == kDeltaYvsDeltaPhi) && pionConfigs.selectPionInSigRegion;
@@ -521,11 +532,11 @@ struct PhiStrangenessCorrelation {
521532
// const float& tofPIDThreshold = pionConfigs.tofPIDThreshold;
522533

523534
auto isPionValid = [&](const auto& pion) {
524-
return (!applyEfficiency || pion.pt() < binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax));
535+
return (!efficiencyConfigs.applyEfficiency || pion.pt() < binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax));
525536
};
526537

527538
for (const auto& phiCand : phiCandidates) {
528-
if (applyEfficiency && phiCand.pt() >= binspTPhi->back())
539+
if (efficiencyConfigs.applyEfficiency && phiCand.pt() >= binspTPhi->back())
529540
continue;
530541

531542
float weightPhi = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()));
@@ -652,7 +663,7 @@ struct PhiStrangenessCorrelation {
652663
const auto& [minMassK0s, maxMassK0s] = k0sConfigs.rangeMK0sSignal.value;
653664

654665
auto isK0sValid = [&](const auto& k0s) {
655-
return (!applyEfficiency || k0s.pt() < binspTK0S->back()) && (!applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s));
666+
return (!efficiencyConfigs.applyEfficiency || k0s.pt() < binspTK0S->back()) && (!applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s));
656667
};
657668

658669
auto tuplePhiK0S = std::make_tuple(phiCandidates, k0sReduced);
@@ -663,7 +674,7 @@ struct PhiStrangenessCorrelation {
663674
float multiplicity = c1.centFT0M();
664675

665676
for (const auto& [phiCand, k0s] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(phiCands, k0sRed))) {
666-
if (applyEfficiency && phiCand.pt() >= binspTPhi->back())
677+
if (efficiencyConfigs.applyEfficiency && phiCand.pt() >= binspTPhi->back())
667678
continue;
668679
if (!isK0sValid(k0s))
669680
continue;
@@ -747,7 +758,7 @@ struct PhiStrangenessCorrelation {
747758
// const float& tofPIDThreshold = pionConfigs.tofPIDThreshold;
748759

749760
auto isPionValid = [&](const auto& pion) {
750-
return (!applyEfficiency || pion.pt() < binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax));
761+
return (!efficiencyConfigs.applyEfficiency || pion.pt() < binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax));
751762
};
752763

753764
auto tuplePhiPion = std::make_tuple(phiCandidates, pionTracks);
@@ -758,7 +769,7 @@ struct PhiStrangenessCorrelation {
758769
float multiplicity = c1.centFT0M();
759770

760771
for (const auto& [phiCand, piTrack] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(phiCands, piTracks))) {
761-
if (applyEfficiency && phiCand.pt() >= binspTPhi->back())
772+
if (efficiencyConfigs.applyEfficiency && phiCand.pt() >= binspTPhi->back())
762773
continue;
763774
if (!isPionValid(piTrack))
764775
continue;
@@ -1098,15 +1109,15 @@ struct PhiStrangenessCorrelation {
10981109

10991110
switch (std::abs(mcParticle.pdgCode())) {
11001111
case o2::constants::physics::Pdg::kPhi:
1101-
if (eventSelectionType == 0 && mcParticle.pt() >= minPtMcGenConfigs.minPhiPt)
1112+
if (eventSelectionType == 0 && (minPtMcGenConfigs.bypassPtCut || mcParticle.pt() >= minPtMcGenConfigs.minPhiPt))
11021113
phiParticles.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi());
11031114
break;
11041115
case PDG_t::kK0Short:
1105-
if (mcParticle.isPhysicalPrimary() && mcParticle.pt() >= minPtMcGenConfigs.v0SettingMinPt)
1116+
if (mcParticle.isPhysicalPrimary() && (minPtMcGenConfigs.bypassPtCut || mcParticle.pt() >= minPtMcGenConfigs.v0SettingMinPt))
11061117
k0sParticles.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi());
11071118
break;
11081119
case PDG_t::kPiPlus:
1109-
if (mcParticle.isPhysicalPrimary() && mcParticle.pt() >= minPtMcGenConfigs.cMinPionPtcut)
1120+
if (mcParticle.isPhysicalPrimary() && (minPtMcGenConfigs.bypassPtCut || mcParticle.pt() >= minPtMcGenConfigs.cMinPionPtcut))
11101121
pionParticles.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi());
11111122
break;
11121123
default:

0 commit comments

Comments
 (0)