Skip to content

Commit

Permalink
Mother mcParticle label added (AliceO2Group#4059)
Browse files Browse the repository at this point in the history
* Mother mcParticle label added

* Please consider the following formatting changes (#197)

---------

Co-authored-by: ALICE Builder <[email protected]>
  • Loading branch information
ddobrigk and alibuild authored Dec 4, 2023
1 parent f8029f4 commit ed579a5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
6 changes: 4 additions & 2 deletions PWGLF/DataModel/LFStrangenessTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -895,10 +895,11 @@ DECLARE_SOA_TABLE(CascTags, "AOD", "CASCTAGS",
namespace mcv0label
{
DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle for V0
DECLARE_SOA_INDEX_COLUMN_FULL(McMotherParticle, mcMotherParticle, int, McParticles, "_Mother"); //!
} // namespace mcv0label

DECLARE_SOA_TABLE(McV0Labels, "AOD", "MCV0LABEL", //! Table joinable with V0Data containing the MC labels
mcv0label::McParticleId);
mcv0label::McParticleId, mcv0label::McMotherParticleId);
using McV0Label = McV0Labels::iterator;

// Definition of labels for V0s // Full table, joinable with V0 (CAUTION: NOT WITH V0DATA)
Expand All @@ -915,11 +916,12 @@ using McFullV0Label = McFullV0Labels::iterator;
namespace mccasclabel
{
DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle for Cascade
DECLARE_SOA_INDEX_COLUMN_FULL(McMotherParticle, mcMotherParticle, int, McParticles, "_Mother"); //!
DECLARE_SOA_COLUMN(IsBachBaryonCandidate, isBachBaryonCandidate, bool); //! will this be built or not?
} // namespace mccasclabel

DECLARE_SOA_TABLE(McCascLabels, "AOD", "MCCASCLABEL", //! Table joinable with CascData containing the MC labels
mccasclabel::McParticleId);
mccasclabel::McParticleId, mccasclabel::McMotherParticleId);
DECLARE_SOA_TABLE(McCascBBTags, "AOD", "MCCASCBBTAG", //! Table joinable with CascData containing yes / no for BB correlation
mccasclabel::IsBachBaryonCandidate);
using McCascLabel = McCascLabels::iterator;
Expand Down
7 changes: 4 additions & 3 deletions PWGLF/TableProducer/cascademcbuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ struct cascademcbuilder {
// Loop over those that actually have the corresponding V0 associated to them
auto v0 = casc.v0_as<o2::aod::V0sLinked>();
if (!(v0.has_v0Data())) {
casclabels(-1);
casclabels(-1, -1);
continue; // skip those cascades for which V0 doesn't exist (but: should never happen)
}
auto v0data = v0.v0Data(); // de-reference index to correct v0data in case it exists
int lLabel = -1;
int lLabel = -1, lMotherLabel = -1;

// Acquire all three daughter tracks, please
auto lBachTrack = casc.bachelor_as<aod::McTrackLabels>();
Expand Down Expand Up @@ -132,6 +132,7 @@ struct cascademcbuilder {
if (lV0Mother.has_mothers()) {
for (auto& lV0GrandMother : lV0Mother.mothers_as<aod::McParticles>()) {
pdgCodeMother = lV0GrandMother.pdgCode();
lMotherLabel = lV0GrandMother.globalIndex();
}
}
}
Expand All @@ -144,7 +145,7 @@ struct cascademcbuilder {
} // end association check
// Construct label table (note: this will be joinable with CascDatas)
casclabels(
lLabel);
lLabel, lMotherLabel);
if (populateCascMCCores) {
cascmccores(
pdgCode, pdgCodeMother, pdgCodeV0, isPhysicalPrimary,
Expand Down
5 changes: 3 additions & 2 deletions PWGLF/TableProducer/lambdakzeromcbuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct lambdakzeromcbuilder {
void process(aod::V0Datas const& v0table, aod::McTrackLabels const&, aod::McParticles const& particlesMC)
{
for (auto& v0 : v0table) {
int lLabel = -1;
int lLabel = -1, lMotherLabel = -1;
int pdgCode = -1, pdgCodeMother = -1, pdgCodePositive = -1, pdgCodeNegative = -1;
bool isPhysicalPrimary = false;
float xmc = -999.0f, ymc = -999.0f, zmc = -999.0f;
Expand Down Expand Up @@ -91,6 +91,7 @@ struct lambdakzeromcbuilder {
if (lNegMother.has_mothers()) {
for (auto& lNegGrandMother : lNegMother.mothers_as<aod::McParticles>()) {
pdgCodeMother = lNegGrandMother.pdgCode();
lMotherLabel = lNegGrandMother.globalIndex();
}
}
}
Expand All @@ -100,7 +101,7 @@ struct lambdakzeromcbuilder {
} // end association check
// Construct label table (note: this will be joinable with V0Datas!)
v0labels(
lLabel);
lLabel, lMotherLabel);
if (populateV0MCCores) {
v0mccores(
pdgCode, pdgCodeMother, pdgCodePositive, pdgCodeNegative,
Expand Down
12 changes: 6 additions & 6 deletions PWGLF/TableProducer/strangederivedbuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,11 @@ struct strangederivedbuilder {
//__________________________________________________
// mark mcParticles for referencing
for (auto const& v0 : V0s)
if (v0.has_mcParticle())
motherReference[v0.mcParticleId()] = 0;
if (v0.has_mcMotherParticle())
motherReference[v0.mcMotherParticleId()] = 0;
for (auto const& ca : Cascades)
if (ca.has_mcParticle())
motherReference[ca.mcParticleId()] = 0;
if (ca.has_mcMotherParticle())
motherReference[ca.mcMotherParticleId()] = 0;
//__________________________________________________
// Figure out the numbering of the new mcMother table
// assume filling per order
Expand All @@ -349,9 +349,9 @@ struct strangederivedbuilder {
//__________________________________________________
// populate track references
for (auto const& v0 : V0s)
v0mothers(motherReference[v0.mcParticleId()]); // joinable with V0Datas
v0mothers(motherReference[v0.mcMotherParticleId()]); // joinable with V0Datas
for (auto const& ca : Cascades)
cascmothers(motherReference[ca.mcParticleId()]); // joinable with CascDatas
cascmothers(motherReference[ca.mcMotherParticleId()]); // joinable with CascDatas
//__________________________________________________
// populate motherMCParticles
for (auto const& tr : mcParticles) {
Expand Down

0 comments on commit ed579a5

Please sign in to comment.