@@ -79,6 +79,7 @@ DECLARE_SOA_COLUMN(IsRealPKPi, isRealPKPi, int8_t);
7979DECLARE_SOA_COLUMN (IsRealLcPKPi, isRealLcPKPi, int8_t );
8080DECLARE_SOA_COLUMN (IsReflected, isReflected, int8_t );
8181DECLARE_SOA_COLUMN (Charge, charge, int8_t );
82+ DECLARE_SOA_COLUMN (Origin, origin, int8_t );
8283
8384} // namespace charm_polarisation
8485
@@ -99,7 +100,8 @@ DECLARE_SOA_TABLE(HfLcPolBkg, "AOD", "HFLCPOLBKG",
99100 charm_polarisation::IsRealPKPi,
100101 charm_polarisation::IsRealLcPKPi,
101102 charm_polarisation::IsReflected,
102- charm_polarisation::Charge);
103+ charm_polarisation::Charge,
104+ charm_polarisation::Origin);
103105
104106} // namespace o2::aod
105107
@@ -1281,23 +1283,32 @@ struct TaskPolarisationCharmHadrons {
12811283 int pdgProng0 = 0 ;
12821284 int pdgProng1 = 0 ;
12831285 int pdgProng2 = 0 ;
1286+ int8_t originProng0 = -1 ;
1287+ int8_t originProng1 = -1 ;
1288+ int8_t originProng2 = -1 ;
1289+ std::vector<int > idxBhadMothersProng0{};
1290+ std::vector<int > idxBhadMothersProng1{};
1291+ std::vector<int > idxBhadMothersProng2{};
12841292 if (trackProng0.has_mcParticle ()) {
12851293 // / BEWARE: even when grouping by mcCollision, mcParticle_as<> gets the mcParticle even if it belongs to a different mcCollision
12861294 // / because _as<> works with unbound tables. (*)
12871295 auto particleProng0 = trackProng0.template mcParticle_as <Part>();
12881296 pdgProng0 = particleProng0.pdgCode ();
1297+ originProng0 = RecoDecay::getCharmHadronOrigin (particles, particleProng0, false , &idxBhadMothersProng0);
12891298 }
12901299 if (trackProng1.has_mcParticle ()) {
12911300 // / BEWARE: even when grouping by mcCollision, mcParticle_as<> gets the mcParticle even if it belongs to a different mcCollision
12921301 // / because _as<> works with unbound tables. (*)
12931302 auto particleProng1 = trackProng1.template mcParticle_as <Part>();
12941303 pdgProng1 = particleProng1.pdgCode ();
1304+ originProng1 = RecoDecay::getCharmHadronOrigin (particles, particleProng1, false , &idxBhadMothersProng1);
12951305 }
12961306 if (trackProng2.has_mcParticle ()) {
12971307 // / BEWARE: even when grouping by mcCollision, mcParticle_as<> gets the mcParticle even if it belongs to a different mcCollision
12981308 // / because _as<> works with unbound tables. (*)
12991309 auto particleProng2 = trackProng2.template mcParticle_as <Part>();
13001310 pdgProng2 = particleProng2.pdgCode ();
1311+ originProng2 = RecoDecay::getCharmHadronOrigin (particles, particleProng2, false , &idxBhadMothersProng2);
13011312 }
13021313 isGenPKPi = std::abs (pdgProng0) == kProton && std::abs (pdgProng1) == kKPlus && std::abs (pdgProng2) == kPiPlus ;
13031314 isGenPiKP = std::abs (pdgProng0) == kPiPlus && std::abs (pdgProng1) == kKPlus && std::abs (pdgProng2) == kProton ;
@@ -1312,6 +1323,26 @@ struct TaskPolarisationCharmHadrons {
13121323 isReflected = 1 ;
13131324 }
13141325
1326+ // / check the origin (prompt, non-prompt of the triplet)
1327+ // / need to check each prong, since they might come from combinatorial background
1328+ // / convention:
1329+ // / - all 3 prongs from the same B hadron: non-prompt
1330+ // / - all 3 prongs claimed to be prompt: prompt --> check on same charm mother done offline with prong PDG daughters (more difficult for beauty, due to more intermediate resonances) and checking that the distribution peaks somehow (otherwise: combinatorial background)
1331+ // / - otherwise: none
1332+ int8_t originTriplet = RecoDecay::OriginType::None;
1333+ if (originProng0 == RecoDecay::OriginType::Prompt && originProng1 == RecoDecay::OriginType::Prompt && originProng2 == RecoDecay::OriginType::Prompt) {
1334+ // / we claim this triplet as prong w/o checking if all triplets have the same mother
1335+ originTriplet = RecoDecay::OriginType::Prompt;
1336+ } else if (originProng0 == RecoDecay::OriginType::NonPrompt && originProng1 == RecoDecay::OriginType::NonPrompt && originProng2 == RecoDecay::OriginType::NonPrompt) {
1337+ // / check if the three particles share the same B-hadron id. If yes: claim the triplet as "non-prompt"
1338+ int idBMotherProng0 = idxBhadMothersProng0.at (0 );
1339+ int idBMotherProng1 = idxBhadMothersProng1.at (0 );
1340+ int idBMotherProng2 = idxBhadMothersProng2.at (0 );
1341+ if (idBMotherProng0 == idBMotherProng1 && idBMotherProng1 == idBMotherProng2) {
1342+ originTriplet = RecoDecay::OriginType::NonPrompt;
1343+ }
1344+ }
1345+
13151346 // / check if the pKpi triplet is a Lc->pKpi
13161347 int8_t isRealLcPKPi = 0 ;
13171348 if (isRealPKPi && TESTBIT (std::abs (candidate.flagMcMatchRec ()), aod::hf_cand_3prong::DecayType::LcToPKPi)) {
@@ -1396,7 +1427,7 @@ struct TaskPolarisationCharmHadrons {
13961427 massKPi, massKProton, massPiProton,
13971428 outputMl.at (0 ), outputMl.at (2 ),
13981429 isRealPKPi, isRealLcPKPi, isReflected,
1399- charge);
1430+ charge, originTriplet );
14001431 } // end studyLcPKPiBkgMc
14011432 } // end table for Lc->pKpi background studies
14021433
0 commit comments