Skip to content

Commit a89aa97

Browse files
authored
[PWGCF] Add feeddown veto in MC process (#18770)
1 parent ed24c93 commit a89aa97

1 file changed

Lines changed: 58 additions & 45 deletions

File tree

‎PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx‎

Lines changed: 58 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
#include <iterator>
7575
#include <map>
7676
#include <memory>
77+
#include <optional>
7778
#include <sstream>
7879
#include <string>
7980
#include <string_view>
@@ -126,6 +127,7 @@ struct FlowGenericFramework {
126127
O2_DEFINE_CONFIGURABLE(cfgFillWeights, bool, false, "Fill NUA weights");
127128
O2_DEFINE_CONFIGURABLE(cfgFillQA, bool, false, "Fill QA histograms");
128129
O2_DEFINE_CONFIGURABLE(cfgFillV0QA, bool, true, "Fill QA histograms for V0 reconstruction");
130+
O2_DEFINE_CONFIGURABLE(cfgRejectXiFeeddown, bool, false, "Veto reconstructed MC Lambdas from charged or neutral Xi decays");
129131
O2_DEFINE_CONFIGURABLE(cfgFillRunByRunQA, bool, false, "Fill histograms on a run-by-run basis");
130132
O2_DEFINE_CONFIGURABLE(cfgAnalyseChargedHadrons, bool, true, "Store radial-flow and fraction outputs for charged tracks, pions, kaons, and protons");
131133
O2_DEFINE_CONFIGURABLE(cfgAnalyseK0Lambda, bool, true, "Store radial-flow and fraction outputs for K0 and Lambda candidates");
@@ -540,6 +542,9 @@ struct FlowGenericFramework {
540542

541543
void init(InitContext const&)
542544
{
545+
if (doprocessMC || doprocessMCReco || doprocessMCGen) {
546+
fRndm->SetSeed(42);
547+
}
543548
LOGF(info, "FlowGenericFramework::init()");
544549
if (!cfgFill.cfgAnalyseChargedHadrons && !cfgFill.cfgAnalyseK0Lambda) {
545550
LOGF(fatal, "Enable at least one radial-flow analysis channel");
@@ -2495,6 +2500,15 @@ struct FlowGenericFramework {
24952500
if (fillLambda) {
24962501
auto lambdaSelection = selectLambda(collision, v0, tracks);
24972502
if (lambdaSelection.selected) {
2503+
const double lambdaMass = lambdaSelection.isL ? v0.mLambda() : v0.mAntiLambda();
2504+
if constexpr (requires { postrack.has_mcParticle(); }) {
2505+
if (cfgFill.cfgRejectXiFeeddown) {
2506+
const auto xi = findLambdaXiParent(postrack, negtrack, false);
2507+
if (xi && (xi->pdgCode() > 0) == lambdaSelection.isL) {
2508+
return;
2509+
}
2510+
}
2511+
}
24982512
for (auto setup = 0; setup < FractionSetupCount; ++setup) {
24992513
auto fractionSetup = static_cast<FractionSetup>(setup);
25002514
if (!selectionLambdaDaughterEta(postrack, negtrack, lambdaSelection, fractionSetup)) {
@@ -2505,14 +2519,13 @@ struct FlowGenericFramework {
25052519
if (cfgFill.cfgFillV0QA && fractionSetup == FractionV02) {
25062520
fillV0QA(lambdaSelection, v0, postrack, negtrack, centrality, weff);
25072521
}
2508-
const double lambdaMass = lambdaSelection.isL ? v0.mLambda() : v0.mAntiLambda();
25092522
if (lambdaMass > cfgPIDCuts.cfgLambdaSideBand1Min && lambdaMass < cfgPIDCuts.cfgLambdaSideBand1Max) {
25102523
histosResoNpt[fractionSetup][LambdaSideband1]->Fill(v0.pt(), (cfgEventSelection.cfgUseNchCorrection) ? weff : 1.0);
25112524
}
2512-
if (v0.mLambda() > cfgPIDCuts.cfgLambdaSignalMin && v0.mLambda() < cfgPIDCuts.cfgLambdaSignalMax) {
2525+
if (lambdaMass > cfgPIDCuts.cfgLambdaSignalMin && lambdaMass < cfgPIDCuts.cfgLambdaSignalMax) {
25132526
histosResoNpt[fractionSetup][LambdaSignal]->Fill(v0.pt(), (cfgEventSelection.cfgUseNchCorrection) ? weff : 1.0);
25142527
}
2515-
if (v0.mLambda() > cfgPIDCuts.cfgLambdaSideBand2Min && v0.mLambda() < cfgPIDCuts.cfgLambdaSideBand2Max) {
2528+
if (lambdaMass > cfgPIDCuts.cfgLambdaSideBand2Min && lambdaMass < cfgPIDCuts.cfgLambdaSideBand2Max) {
25162529
histosResoNpt[fractionSetup][LambdaSideband2]->Fill(v0.pt(), (cfgEventSelection.cfgUseNchCorrection) ? weff : 1.0);
25172530
}
25182531
}
@@ -3047,7 +3060,7 @@ struct FlowGenericFramework {
30473060
}
30483061

30493062
o2::framework::expressions::Filter collisionFilter = nabs(aod::collision::posZ) < cfgVtxZ;
3050-
o2::framework::expressions::Filter trackFilter = (aod::track::eta > cfgKinematics.cfgEta->first) && (aod::track::eta < cfgKinematics.cfgEta->second) && (aod::track::pt > cfgKinematics.cfgPtMin) && (aod::track::pt < cfgKinematics.cfgPtmax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t)true)) && (aod::track::itsChi2NCl < cfgTrackCuts.cfgChi2PrITSCls) && (aod::track::tpcChi2NCl < cfgTrackCuts.cfgChi2PrTPCCls) && nabs(aod::track::dcaZ) < cfgTrackCuts.cfgDCAz;
3063+
o2::framework::expressions::Filter trackFilter = (aod::track::eta > cfgKinematics.cfgEta->first) && (aod::track::eta < cfgKinematics.cfgEta->second) && (aod::track::pt > cfgKinematics.cfgPtMin) && (aod::track::pt < cfgKinematics.cfgPtmax) && (requireGlobalTrackInFilter() || (aod::track::isGlobalTrackSDD == static_cast<uint8_t>(true))) && (aod::track::itsChi2NCl < cfgTrackCuts.cfgChi2PrITSCls) && (aod::track::tpcChi2NCl < cfgTrackCuts.cfgChi2PrTPCCls) && nabs(aod::track::dcaZ) < cfgTrackCuts.cfgDCAz;
30513064

30523065
using GFWCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFT0Cs, aod::CentFT0CVariant1s, aod::CentFT0Ms, aod::CentFV0As, aod::CentNTPVs, aod::CentNGlobals, aod::CentMFTs>>;
30533066
using GFWMCCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFT0Cs, aod::CentFT0CVariant1s, aod::CentFT0Ms, aod::CentFV0As, aod::CentNTPVs, aod::CentNGlobals, aod::CentMFTs, aod::McCollisionLabels>;
@@ -3463,63 +3476,63 @@ struct FlowGenericFramework {
34633476
}
34643477
}
34653478

3466-
template <typename TV0, typename TCollision, typename TTracks>
3467-
void fillLambdaFeeddownReco(const TV0& v0, const TCollision& collision, const TTracks& tracks, float centrality)
3479+
template <typename TTrack>
3480+
std::optional<aod::McParticles::iterator> findLambdaXiParent(const TTrack& postrack, const TTrack& negtrack, bool useResponseSelection)
34683481
{
3469-
if (resoSwitchVals[UseParticle][Lambda] == 0) {
3470-
return;
3471-
}
3472-
3473-
using V0TrackTable = std::decay_t<TTracks>;
3474-
auto postrack = v0.template posTrack_as<V0TrackTable>();
3475-
auto negtrack = v0.template negTrack_as<V0TrackTable>();
3476-
34773482
if (!postrack.has_mcParticle() || !negtrack.has_mcParticle()) {
3478-
return;
3483+
return std::nullopt;
34793484
}
3480-
3481-
auto posMcParticle = postrack.template mcParticle_as<aod::McParticles>();
3482-
auto negMcParticle = negtrack.template mcParticle_as<aod::McParticles>();
3485+
const auto posMcParticle = postrack.template mcParticle_as<aod::McParticles>();
3486+
const auto negMcParticle = negtrack.template mcParticle_as<aod::McParticles>();
34833487
if (!posMcParticle.has_mothers() || !negMcParticle.has_mothers()) {
3484-
return;
3488+
return std::nullopt;
34853489
}
3486-
34873490
for (const auto& posMother : posMcParticle.template mothers_as<aod::McParticles>()) {
3491+
if (std::abs(posMother.pdgCode()) != PDG_t::kLambda0 || !posMother.has_mothers()) {
3492+
continue;
3493+
}
34883494
for (const auto& negMother : negMcParticle.template mothers_as<aod::McParticles>()) {
3489-
if (posMother.globalIndex() != negMother.globalIndex() || std::abs(posMother.pdgCode()) != PDG_t::kLambda0) {
3490-
continue;
3491-
}
3492-
3493-
if (!posMother.has_mothers()) {
3495+
if (posMother.globalIndex() != negMother.globalIndex()) {
34943496
continue;
34953497
}
3496-
for (const auto& xiMother : posMother.template mothers_as<aod::McParticles>()) {
3497-
if (!isGeneratedFeeddownXi(xiMother)) {
3498+
for (const auto& xi : posMother.template mothers_as<aod::McParticles>()) {
3499+
const int absPdg = std::abs(xi.pdgCode());
3500+
if (absPdg != PDG_t::kXiMinus && absPdg != o2::constants::physics::Pdg::kXi0) {
34983501
continue;
34993502
}
3500-
3501-
const bool isLambda = posMother.pdgCode() == PDG_t::kLambda0 && xiMother.pdgCode() == PDG_t::kXiMinus;
3502-
const bool isAntiLambda = posMother.pdgCode() == -PDG_t::kLambda0 && xiMother.pdgCode() == -PDG_t::kXiMinus;
3503-
if (!isLambda && !isAntiLambda) {
3503+
if ((xi.pdgCode() > 0) != (posMother.pdgCode() > 0) || (useResponseSelection && !isGeneratedFeeddownXi(xi))) {
35043504
continue;
35053505
}
3506-
3507-
auto selection = selectLambda(collision, v0, tracks, false);
3508-
if (!selection.selected || (isLambda && !selection.isL) || (isAntiLambda && !selection.isAL)) {
3509-
return;
3510-
}
3511-
if (!isWithinEfficiencyEtaAcceptance(posMcParticle) || !isWithinEfficiencyEtaAcceptance(negMcParticle)) {
3512-
return;
3513-
}
3514-
if (!isWithinEfficiencyEtaAcceptance(postrack) || !isWithinEfficiencyEtaAcceptance(negtrack)) {
3515-
return;
3516-
}
3517-
3518-
registry.fill(HIST("Efficiency/lambdaFeeddownRecoXi"), v0.pt(), xiMother.pt(), centrality, getLambdaFeeddownSpeciesFromXi(xiMother));
3519-
return;
3506+
return xi;
35203507
}
35213508
}
35223509
}
3510+
return std::nullopt;
3511+
}
3512+
3513+
template <typename TV0, typename TCollision, typename TTracks>
3514+
void fillLambdaFeeddownReco(const TV0& v0, const TCollision& collision, const TTracks& tracks, float centrality)
3515+
{
3516+
if (resoSwitchVals[UseParticle][Lambda] == 0) {
3517+
return;
3518+
}
3519+
using V0TrackTable = std::decay_t<TTracks>;
3520+
const auto postrack = v0.template posTrack_as<V0TrackTable>();
3521+
const auto negtrack = v0.template negTrack_as<V0TrackTable>();
3522+
const auto xi = findLambdaXiParent(postrack, negtrack, true);
3523+
if (!xi) {
3524+
return;
3525+
}
3526+
const auto selection = selectLambda(collision, v0, tracks, false);
3527+
if (!selection.selected || (xi->pdgCode() > 0 ? !selection.isL : !selection.isAL)) {
3528+
return;
3529+
}
3530+
if (!isWithinEfficiencyEtaAcceptance(postrack.template mcParticle_as<aod::McParticles>()) ||
3531+
!isWithinEfficiencyEtaAcceptance(negtrack.template mcParticle_as<aod::McParticles>()) ||
3532+
!isWithinEfficiencyEtaAcceptance(postrack) || !isWithinEfficiencyEtaAcceptance(negtrack)) {
3533+
return;
3534+
}
3535+
registry.fill(HIST("Efficiency/lambdaFeeddownRecoXi"), v0.pt(), xi->pt(), centrality, getLambdaFeeddownSpeciesFromXi(*xi));
35233536
}
35243537

35253538
template <typename TTrack>

0 commit comments

Comments
 (0)