Skip to content

Commit 7f3a379

Browse files
authored
[PWGCF] FemtoUniverse: V0V0 pair fractions for MC truth (#10787)
1 parent 0b50091 commit 7f3a379

File tree

2 files changed

+53
-9
lines changed

2 files changed

+53
-9
lines changed

PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ struct FemtoUniverseProducerTask {
130130
Configurable<bool> confIsForceGRP{"confIsForceGRP", false, "Set true if the magnetic field configuration is not available in the usual CCDB directory (e.g. for Run 2 converted data or unanchorad Monte Carlo)"};
131131

132132
Configurable<bool> confDoSpher{"confDoSpher", false, "Calculate sphericity. If false sphericity will take value of 2."};
133+
Configurable<bool> confStoreMCmothers{"confStoreMCmothers", false, "MC truth: Fill with not only primary particles and store mothers' PDG in tempFitVar."};
133134
Configurable<bool> confFillCollExt{"confFillCollExt", false, "Option to fill collision extended table"};
134135

135136
/// Event cuts
@@ -675,20 +676,23 @@ struct FemtoUniverseProducerTask {
675676
}
676677

677678
template <typename ParticleType>
678-
void fillDebugParticleMC(ParticleType const& particle)
679+
int32_t getMotherPDG(ParticleType particle)
679680
{
680681
auto motherparticlesMC = particle.template mothers_as<aod::McParticles>();
681682
if (!motherparticlesMC.empty()) {
682683
auto motherparticleMC = motherparticlesMC.front();
683-
if (particle.isPhysicalPrimary())
684-
outputDebugPartsMC(0);
685-
else
686-
outputDebugPartsMC(motherparticleMC.pdgCode());
684+
return particle.isPhysicalPrimary() ? 0 : motherparticleMC.pdgCode();
687685
} else {
688-
outputDebugPartsMC(9999);
686+
return 9999;
689687
}
690688
}
691689

690+
template <typename ParticleType>
691+
void fillDebugParticleMC(ParticleType const& particle)
692+
{
693+
outputDebugPartsMC(getMotherPDG(particle));
694+
}
695+
692696
template <typename ParticleType>
693697
void fillMCParticle(ParticleType const& particle, o2::aod::femtouniverseparticle::ParticleType fdparttype)
694698
{
@@ -1691,7 +1695,7 @@ struct FemtoUniverseProducerTask {
16911695
if (pdgCode == 333) { // && (recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) { // ATTENTION: all Phi mesons are NOT primary particles
16921696
pass = true;
16931697
} else {
1694-
if (particle.isPhysicalPrimary() || (confActivateSecondaries && recoMcIds && recoMcIds->get().contains(particle.globalIndex())))
1698+
if (confStoreMCmothers || particle.isPhysicalPrimary() || (confActivateSecondaries && recoMcIds && recoMcIds->get().contains(particle.globalIndex())))
16951699
pass = true;
16961700
}
16971701
}
@@ -1711,6 +1715,8 @@ struct FemtoUniverseProducerTask {
17111715
// auto cutContainer = trackCuts.getCutContainer<aod::femtouniverseparticle::CutContainerType>(track);
17121716
// instead of the bitmask, the PDG of the particle is stored as uint32_t
17131717

1718+
int32_t variablePDG = confStoreMCmothers ? getMotherPDG(particle) : particle.pdgCode();
1719+
17141720
// now the table is filled
17151721
if constexpr (resolveDaughs) {
17161722
tmpIDtrack.push_back(particle.globalIndex());
@@ -1724,7 +1730,7 @@ struct FemtoUniverseProducerTask {
17241730
aod::femtouniverseparticle::ParticleType::kMCTruthTrack,
17251731
0,
17261732
pdgCode,
1727-
pdgCode,
1733+
variablePDG,
17281734
childIDs,
17291735
0,
17301736
0);
@@ -1770,6 +1776,9 @@ struct FemtoUniverseProducerTask {
17701776
}
17711777
}
17721778
}
1779+
1780+
int32_t variablePDG = confStoreMCmothers ? getMotherPDG(particle) : particle.pdgCode();
1781+
17731782
if (!confIsActivateCascade) {
17741783
outputParts(outputCollision.lastIndex(),
17751784
particle.pt(),
@@ -1778,7 +1787,7 @@ struct FemtoUniverseProducerTask {
17781787
aod::femtouniverseparticle::ParticleType::kMCTruthTrack,
17791788
0,
17801789
static_cast<uint32_t>(particle.pdgCode()),
1781-
particle.pdgCode(),
1790+
variablePDG,
17821791
childIDs,
17831792
0,
17841793
0);

PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ struct FemtoUniversePairTaskTrackV0Extended {
248248
registryMCtruth.add("minus/MCtruthPiPt", "MC truth pions;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}});
249249
registryMCtruth.add("minus/MCtruthPrPt", "MC truth protons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}});
250250

251+
registryMCtruth.add("motherParticle", "pair fractions;part1 mother PDG;part2 mother PDG", {HistType::kTH2F, {{8001, -4000, 4000}, {8001, -4000, 4000}}});
252+
251253
// MC reco
252254
registryMCreco.add("plus/MCrecoLambda", "MC reco Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}});
253255
registryMCreco.add("plus/MCrecoLambdaChildPr", "MC reco Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}});
@@ -1013,6 +1015,39 @@ struct FemtoUniversePairTaskTrackV0Extended {
10131015
}
10141016
PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Extended, processPairFractionsV0, "Process MC data to obtain pair fractions for V0V0 pairs", false);
10151017

1018+
void processPairFractionsMCTruthV0(FilteredFDCollisions const& cols, FemtoFullParticles const& /*parts*/)
1019+
{
1020+
ColumnBinningPolicy<aod::collision::PosZ, aod::femtouniversecollision::MultNtr> colBinningMult{{confVtxBins, confMultBins}, true};
1021+
ColumnBinningPolicy<aod::collision::PosZ, aod::femtouniversecollision::MultV0M> colBinningCent{{confVtxBins, confMultBins}, true};
1022+
1023+
auto mixedCollProcessFunc = [&](auto& collision1, auto& collision2) -> void {
1024+
auto groupPartsOne = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache);
1025+
auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache);
1026+
1027+
for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) {
1028+
int pdgCode1 = static_cast<int>(p1.pidCut());
1029+
if ((confV0Type1 == 0 && pdgCode1 != kLambda0) || (confV0Type1 == 1 && pdgCode1 != kLambda0Bar))
1030+
continue;
1031+
int pdgCode2 = static_cast<int>(p2.pidCut());
1032+
if ((confV0Type2 == 0 && pdgCode2 != kLambda0) || (confV0Type2 == 1 && pdgCode2 != kLambda0Bar))
1033+
continue;
1034+
1035+
registryMCtruth.fill(HIST("motherParticle"), p1.tempFitVar(), p2.tempFitVar());
1036+
}
1037+
};
1038+
1039+
if (confUseCent) {
1040+
for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, confNEventsMix, -1, cols, cols)) {
1041+
mixedCollProcessFunc(collision1, collision2);
1042+
}
1043+
} else {
1044+
for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningMult, confNEventsMix, -1, cols, cols)) {
1045+
mixedCollProcessFunc(collision1, collision2);
1046+
}
1047+
}
1048+
}
1049+
PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Extended, processPairFractionsMCTruthV0, "Process MC data to obtain pair fractions for V0V0 MC truth pairs", false);
1050+
10161051
void processMCReco(FemtoRecoParticles const& parts, aod::FdMCParticles const& mcparts)
10171052
{
10181053
for (const auto& part : parts) {

0 commit comments

Comments
 (0)