@@ -161,6 +161,8 @@ DECLARE_SOA_COLUMN(OniaEta, oniaEta, float);
161161DECLARE_SOA_COLUMN (OniaPhi, oniaPhi, float );
162162DECLARE_SOA_COLUMN (OniaVz, oniaVz, float );
163163DECLARE_SOA_COLUMN (OniaVtxZ, oniaVtxZ, float );
164+ DECLARE_SOA_COLUMN (MotherID, motherID, int64_t );
165+ DECLARE_SOA_COLUMN (GrandmotherID, grandmotherID, int64_t );
164166DECLARE_SOA_COLUMN (MotherPDG, motherPDG, int64_t );
165167DECLARE_SOA_COLUMN (GrandmotherPDG, grandmotherPDG, int64_t );
166168} // namespace dqanalysisflags
@@ -198,7 +200,7 @@ DECLARE_SOA_TABLE(OniaMCTruth, "AOD", "MCTRUTHONIA", dqanalysisflags::OniaPt, dq
198200DECLARE_SOA_TABLE (MuonTable, " AOD" , " DQMUONTABLE" ,
199201 dqanalysisflags::RunNumber, dqanalysisflags::EventIdx, dqanalysisflags::EventTimestamp, dqanalysisflags::GlobalIndexassoc,
200202 dqanalysisflags::Ptassoc, dqanalysisflags::Etaassoc, dqanalysisflags::Phiassoc,
201- dqanalysisflags::MotherPDG, dqanalysisflags::GrandmotherPDG
203+ dqanalysisflags::MotherID, dqanalysisflags::GrandmotherID, dqanalysisflags:: MotherPDG, dqanalysisflags::GrandmotherPDG
202204 );
203205} // namespace o2::aod
204206
@@ -1033,30 +1035,36 @@ struct AnalysisMuonSelection {
10331035 } // end loop over MC signals
10341036
10351037 // Find grandmothers
1038+ int motherID = -9999 ;
1039+ int grandmotherID = -9999 ;
10361040 int motherPdg = -9999 ;
10371041 int grandmotherPdg = -9999 ;
1042+ int nmothers = 0 ;
10381043
10391044 if (track.has_reducedMCTrack ()) {
10401045 auto mctrack = track.reducedMCTrack ();
10411046 if (mctrack.has_mothers ()) {
10421047
1048+ motherID = mctrack.template mothers_first_as <ReducedMCTracks>().globalIndex ();
10431049 motherPdg = mctrack.template mothers_first_as <ReducedMCTracks>().pdgCode ();
10441050 auto currentMCParticle = mctrack;
1045- int ith = 0 ;
1051+ // int ith = 0;
10461052
10471053 while (currentMCParticle.has_mothers ()) {
10481054 auto mother = currentMCParticle.template mothers_first_as <ReducedMCTracks>();
10491055 currentMCParticle = mother;
1056+ grandmotherID = currentMCParticle.globalIndex ();
10501057 grandmotherPdg = currentMCParticle.pdgCode ();
1051- ith++;
1058+ // ith++;
1059+ nmothers++;
10521060 }
10531061 }
10541062 }
10551063
10561064 // Fill muon table
10571065 muonTable (event.runNumber (), event.globalIndex (), event.timestamp (),
10581066 track.globalIndex (), track.pt (), track.eta (), track.phi (),
1059- motherPdg, grandmotherPdg);
1067+ motherID, grandmotherID, motherPdg, grandmotherPdg);
10601068
10611069 // count the number of associations per track
10621070 if (fConfigPublishAmbiguity && filterMap > 0 ) {
0 commit comments