Skip to content

Commit e7af6b1

Browse files
authored
[PWGCF] FemtoUniverse: Add function to fill only MCTruthTracks (#13350)
1 parent 080c6d6 commit e7af6b1

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ struct FemtoUniverseProducerTask {
188188
Configurable<std::vector<float>> confTrkDCAzMax{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kDCAzMax, "ConfTrk"), std::vector<float>{0.2f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kDCAzMax, "Track selection: ")}; /// \todo Reintegrate PID to the general selection container
189189
Configurable<std::vector<float>> confTrkPIDnSigmaMax{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kPIDnSigmaMax, "ConfTrk"), std::vector<float>{3.5f, 3.f, 2.5f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kPIDnSigmaMax, "Track selection: ")};
190190
Configurable<std::vector<int>> confTrkPIDspecies{"confTrkPIDspecies", std::vector<int>{o2::track::PID::Pion, o2::track::PID::Kaon, o2::track::PID::Proton, o2::track::PID::Deuteron}, "Trk sel: Particles species for PID (Pion=2, Kaon=3, Proton=4, Deuteron=5)"};
191+
Configurable<bool> confIsOnlyMCTrack{"confIsOnlyMCTrack", false, "Enable filling of only MC Tracks"};
191192
// Numbers from ~/alice/O2/DataFormats/Reconstruction/include/ReconstructionDataFormats/PID.h //static constexpr ID Pion = 2; static constexpr ID Kaon = 3; static constexpr ID Proton = 4; static constexpr ID Deuteron = 5;
192193
} ConfTrkSelection;
193194

@@ -1349,6 +1350,27 @@ struct FemtoUniverseProducerTask {
13491350
}
13501351
}
13511352

1353+
template <typename MCParticlesType>
1354+
void fillTracksMCTruth(MCParticlesType const& mcParticles)
1355+
{
1356+
for (const auto& mc : mcParticles) { // Loop over all MC Truth particles
1357+
1358+
std::vector<int> childIDs = {0, 0};
1359+
outputParts(outputCollision.lastIndex(),
1360+
mc.pt(),
1361+
mc.eta(),
1362+
mc.phi(),
1363+
aod::femtouniverseparticle::ParticleType::kMCTruthTrack,
1364+
0,
1365+
0,
1366+
mc.pdgCode(),
1367+
childIDs,
1368+
0,
1369+
0);
1370+
fillMCTruthParticle(mc, aod::femtouniverseparticle::ParticleType::kMCTruthTrack);
1371+
}
1372+
}
1373+
13521374
template <bool isMC, typename CollisionType, typename CascadeType, typename TrackType>
13531375
void fillCascade(CollisionType const& col, CascadeType const& fullCascades, TrackType const&)
13541376
{
@@ -2534,7 +2556,11 @@ struct FemtoUniverseProducerTask {
25342556
if (colcheck) {
25352557
auto groupedMCParticles = mcParticles.sliceBy(perMCCollision, mccol.globalIndex());
25362558
outputCollExtra(1.0, 1.0);
2537-
fillParticles<decltype(groupedMCParticles), true, true>(groupedMCParticles, recoMcIds); // fills mc particles
2559+
if (!ConfTrkSelection.confIsOnlyMCTrack) {
2560+
fillParticles<decltype(groupedMCParticles), true, true>(groupedMCParticles, recoMcIds); // fills mc particles
2561+
} else {
2562+
fillTracksMCTruth(groupedMCParticles);
2563+
}
25382564
}
25392565
}
25402566
}

0 commit comments

Comments
 (0)