@@ -231,6 +231,7 @@ struct decay3bodyBuilder {
231231 bool isTrueH3L;
232232 bool isTrueAntiH3L;
233233 bool isReco;
234+ int motherPdgCode;
234235 int daughterPrPdgCode;
235236 int daughterPiPdgCode;
236237 int daughterDePdgCode;
@@ -849,16 +850,16 @@ struct decay3bodyBuilder {
849850 // get generated mother MC info
850851 if (motherID > 0 ) {
851852 auto mcTrackH3L = mcParticles.rawIteratorAt (motherID);
852- int chargeFactor = mcTrackH3L.pdgCode () > 0 ? 1 : - 1 ;
853+ this3BodyMCInfo. motherPdgCode = mcTrackH3L.pdgCode ();
853854 this3BodyMCInfo.label = motherID;
854855 this3BodyMCInfo.genMomentum = {mcTrackH3L.px (), mcTrackH3L.py (), mcTrackH3L.pz ()};
855856 this3BodyMCInfo.genDecVtx = {mcTrackProton.vx (), mcTrackProton.vy (), mcTrackProton.vz ()};
856857 this3BodyMCInfo.genCt = RecoDecay::sqrtSumOfSquares (mcTrackProton.vx () - mcTrackH3L.vx (), mcTrackProton.vy () - mcTrackH3L.vy (), mcTrackProton.vz () - mcTrackH3L.vz ()) * o2::constants::physics::MassHyperTriton / mcTrackH3L.p ();
857858 this3BodyMCInfo.genPhi = mcTrackH3L.phi ();
858859 this3BodyMCInfo.genEta = mcTrackH3L.eta ();
859860 this3BodyMCInfo.genRapidity = mcTrackH3L.y ();
860- this3BodyMCInfo.isTrueH3L = chargeFactor > 0 ;
861- this3BodyMCInfo.isTrueAntiH3L = chargeFactor < 0 ;
861+ this3BodyMCInfo.isTrueH3L = this3BodyMCInfo. motherPdgCode > 0 ? true : false ;
862+ this3BodyMCInfo.isTrueAntiH3L = this3BodyMCInfo. motherPdgCode < 0 ? true : false ;
862863 }
863864
864865 // fill analysis tables (only McVtx3BodyDatas is filled here)
@@ -878,12 +879,12 @@ struct decay3bodyBuilder {
878879 for (const auto & mcparticle : mcParticles) {
879880 // MC info
880881 resetMCInfo (this3BodyMCInfo);
881- this3BodyMCInfo.isReco = false ;
882882
883883 // skip MC particle if reconstructed and already filled previously
884884 if (mcParticleIsReco[mcparticle.globalIndex ()] == true ) {
885885 continue ;
886886 }
887+ this3BodyMCInfo.isReco = false ;
887888
888889 // set flag if corresponding MC collision has matched reconstructed collision which passed event selection
889890 this3BodyMCInfo.survivedEventSel = isGoodCollision[mcparticle.mcCollisionId ()];
@@ -912,7 +913,7 @@ struct decay3bodyBuilder {
912913 }
913914
914915 // check if hypertriton decayed via 3-body decay and is particle or anti-particle
915- if ((haveProton && haveAntiPion && haveDeuteron) || (haveAntiProton && havePion && haveAntiDeuteron)) {
916+ if ((haveProton && haveAntiPion && haveDeuteron && !(haveAntiProton || havePion || haveAntiDeuteron)) || (haveAntiProton && havePion && haveAntiDeuteron && !(haveProton || haveAntiPion || haveDeuteron) )) {
916917 if (mcparticle.pdgCode () > 0 ) {
917918 this3BodyMCInfo.isTrueH3L = true ;
918919 } else if (mcparticle.pdgCode () < 0 ) {
@@ -973,6 +974,7 @@ struct decay3bodyBuilder {
973974 this3BodyMCInfo.genPtProton , this3BodyMCInfo.genPtPion , this3BodyMCInfo.genPtDeuteron ,
974975 this3BodyMCInfo.isTrueH3L , this3BodyMCInfo.isTrueAntiH3L ,
975976 this3BodyMCInfo.isReco ,
977+ mcparticle.pdgCode (),
976978 this3BodyMCInfo.daughterPrPdgCode , this3BodyMCInfo.daughterPiPdgCode , this3BodyMCInfo.daughterDePdgCode ,
977979 this3BodyMCInfo.isDeuteronPrimary ,
978980 this3BodyMCInfo.survivedEventSel );
@@ -1160,6 +1162,7 @@ struct decay3bodyBuilder {
11601162 this3BodyMCInfo.genPtProton , this3BodyMCInfo.genPtPion , this3BodyMCInfo.genPtDeuteron ,
11611163 this3BodyMCInfo.isTrueH3L , this3BodyMCInfo.isTrueAntiH3L ,
11621164 this3BodyMCInfo.isReco ,
1165+ this3BodyMCInfo.motherPdgCode ,
11631166 this3BodyMCInfo.daughterPrPdgCode , this3BodyMCInfo.daughterPiPdgCode , this3BodyMCInfo.daughterDePdgCode ,
11641167 this3BodyMCInfo.isDeuteronPrimary ,
11651168 this3BodyMCInfo.survivedEventSel );
@@ -1240,7 +1243,7 @@ struct decay3bodyBuilder {
12401243
12411244 // ______________________________________________________________
12421245 // function to reset MCInfo
1243- void resetMCInfo (mc3Bodyinfo mcInfo)
1246+ void resetMCInfo (mc3Bodyinfo& mcInfo)
12441247 {
12451248 mcInfo.label = -1 ;
12461249 mcInfo.genMomentum [0 ] = -1 ., mcInfo.genMomentum [1 ] = -1 ., mcInfo.genMomentum [2 ] = -1 .;
@@ -1251,6 +1254,7 @@ struct decay3bodyBuilder {
12511254 mcInfo.genPtProton = -1 ., mcInfo.genPtPion = -1 ., mcInfo.genPtDeuteron = -1 .;
12521255 mcInfo.isTrueH3L = false , mcInfo.isTrueAntiH3L = false ;
12531256 mcInfo.isReco = false ;
1257+ mcInfo.motherPdgCode = -1 ;
12541258 mcInfo.daughterPrPdgCode = -1 , mcInfo.daughterPiPdgCode = -1 , mcInfo.daughterDePdgCode = -1 ;
12551259 mcInfo.isDeuteronPrimary = false ;
12561260 mcInfo.survivedEventSel = false ;
0 commit comments