@@ -1148,7 +1148,7 @@ struct HfCandidateCreatorXic0Omegac0Qa {
11481148 TracksWCovIU const & lfTracks,
11491149 aod::BCsWithTimestamps const & bcsWithTimestamps)
11501150 {
1151- runCreatorWithDCAFitter<CentralityEstimator::FT0M , hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi>(collisions, candidates, cascades, v0s, tracks, lfTracks, bcsWithTimestamps, hInvMassCharmBaryonToOmegaPi, hInvMassCharmBaryonToOmegaPi );
1151+ runCreatorWithDCAFitter<CentralityEstimator::FT0M , hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi>(collisions, candidates, cascades, v0s, tracks, lfTracks, bcsWithTimestamps, hInvMassCharmBaryonToOmegaPi, hCandidateCounterToOmegaPi );
11521152 }
11531153 PROCESS_SWITCH (HfCandidateCreatorXic0Omegac0Qa, processToOmegaPiWithDCAFitterCentFT0M, " Charm candidate reconstruction with Omega Pi via DcaFitter method, centrality selection on FT0M" , false );
11541154
@@ -1187,7 +1187,7 @@ struct HfCandidateCreatorXic0Omegac0Qa {
11871187 TracksWCovIU const & lfTracks,
11881188 aod::BCsWithTimestamps const & bcsWithTimestamps)
11891189 {
1190- runCreatorWithDCAFitter<CentralityEstimator::FT0M , hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK>(collisions, candidates, cascades, v0s, tracks, lfTracks, bcsWithTimestamps, hInvMassCharmBaryonToOmegaKa, hCandidateCounterToOmegaPi );
1190+ runCreatorWithDCAFitter<CentralityEstimator::FT0M , hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK>(collisions, candidates, cascades, v0s, tracks, lfTracks, bcsWithTimestamps, hInvMassCharmBaryonToOmegaKa, hCandidateCounterToOmegaKa );
11911191 }
11921192 PROCESS_SWITCH (HfCandidateCreatorXic0Omegac0Qa, processToOmegaKaWithDCAFitterCentFT0M, " Charm candidate reconstruction with Omega Ka via DcaFitter method, centrality selection on FT0M" , false );
11931193
@@ -1370,45 +1370,26 @@ struct HfCandidateCreatorXic0Omegac0Qa {
13701370};
13711371
13721372struct HfCandidateCreatorXic0Omegac0QaMc {
1373-
1374- // Cursor to fill tables
1375- struct : ProducesGroup {
1376-
1377- Produces<aod::HfXicToXiPiMCRec> rowMcMatchRecXicToXiPi;
1378- Produces<aod::HfXicToXiPiMCGen> rowMcMatchGenXicToXiPi;
1379- Produces<aod::HfOmegacToXiPiMCRec> rowMcMatchRecOmegacToXiPi;
1380- Produces<aod::HfOmegacToXiPiMCGen> rowMcMatchGenOmegacToXiPi;
1381- Produces<aod::HfToOmegaPiMCRec> rowMcMatchRecToOmegaPi;
1382- Produces<aod::HfToOmegaPiMCGen> rowMcMatchGenToOmegaPi;
1383- Produces<aod::HfToOmegaKMCRec> rowMcMatchRecToOmegaKa;
1384- Produces<aod::HfToOmegaKMCGen> rowMcMatchGenToOmegaKa;
1385-
1386- } cursors;
1373+ Produces<aod::HfCandCascBachMCRecQa> rowMcMatchRecCascBach;
1374+ Produces<aod::HfCandCascBachMCGenQa> rowMcMatchGenCascBach;
13871375
13881376 // Configurables
13891377 struct : ConfigurableGroup {
1390-
13911378 Configurable<bool > rejectBackground{" rejectBackground" , false , " Reject particles from background events" }; // -> Used for only Xic0
13921379 Configurable<bool > acceptTrackInteractionWithMaterial{" acceptTrackInteractionWithMaterial" , false , " Accept candidates with final daughters interacting with materials" };
1393- Configurable<bool > fillMcHistograms{" fillMcHistograms" , true , " Fill validation plots" };
1394- Configurable<bool > fillResidualTable{" fillResidualTable" , true , " Fill table contaning residuals and pulls of PV and SV" };
13951380 // Configurable<bool> matchDecayedPions{"matchedDecayedPions", true, "Match also candidates with daughter pion tracks that decay with kinked toploogy"};
1396-
13971381 } configs;
13981382
1399- enum McMatchFlag : uint8_t {
1400- None = 0 ,
1401- CharmBaryonUnmatched,
1402- CascUnmatched,
1403- V0Unmatched,
1404- NumberMcMatchFlag
1405- };
1406-
14071383 std::array<int , 4 > pdgOfCharmBaryon{+kXiC0 , +kOmegaC0 , +kOmegaC0 , +kOmegaC0 };
14081384 std::array<int , 4 > pdgOfCascade{+kXiMinus , +kXiMinus , +kOmegaMinus , +kOmegaMinus };
14091385 std::array<int , 4 > pdgOfCharmBachelor{+kPiPlus , +kPiPlus , +kPiPlus , +kKPlus };
14101386 std::array<int , 4 > pdgOfBachelor{+kPiMinus , +kPiMinus , +kKMinus , +kKMinus };
14111387
1388+ std::array<int8_t , 4 > newDecayChannel{hf_cand_casc_bach_qa::DecayChannelMain::Xic0ToXiPi,
1389+ hf_cand_casc_bach_qa::DecayChannelMain::Omegac0ToXiPi,
1390+ hf_cand_casc_bach_qa::DecayChannelMain::Omegac0ToOmegaPi,
1391+ hf_cand_casc_bach_qa::DecayChannelMain::Omegac0ToOmegaKa};
1392+
14121393 // Table aliases
14131394 using TracksWMcIU = soa::Join<aod::TracksIU, McTrackLabels>;
14141395 using McCollisionsNoCents = soa::Join<aod::Collisions, aod::EvSels, aod::PVMults, aod::McCollisionLabels>;
@@ -1434,56 +1415,6 @@ struct HfCandidateCreatorXic0Omegac0QaMc {
14341415 break ;
14351416 }
14361417 }
1437-
1438- // Add histograms for QA
1439- if (configs.fillMcHistograms ) {
1440- registry.add (" hGenCharmBaryonPtRapidityTight" , " Generated charm baryon #it{p}_{T};#it{p}_{T} (GeV/#it{c});entries" , {HistType::kTH1D , {{20 , 0.0 , 20.0 }}});
1441- registry.add (" hGenCharmBaryonPtRapidityLoose" , " Generated charm baryon #it{p}_{T};#it{p}_{T} (GeV/#it{c});entries" , {HistType::kTH1D , {{20 , 0.0 , 20.0 }}});
1442- }
1443- }
1444-
1445- // Helper function to fill in table for MC Rec
1446- // /@brief decay Channel is the chosen reconstruction channel
1447- // /@brief flag
1448- // /@brief debug
1449- // /@brief origin
1450- // /@brief collisionMatched
1451- // /@brief pt
1452- // /@brief pdgcode
1453- template <int decayChannel>
1454- void fillRecoMcTableByDecayChannel (int8_t flag, int8_t debug, int8_t origin, bool collisionMatched, float pt, int pdgCode)
1455- {
1456- if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) {
1457- cursors.rowMcMatchRecXicToXiPi (flag, debug, origin, collisionMatched, pt, pdgCode);
1458- } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi) {
1459- cursors.rowMcMatchRecOmegacToXiPi (flag, debug, origin, collisionMatched, pt, pdgCode);
1460- } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi) {
1461- cursors.rowMcMatchRecToOmegaPi (flag, debug, origin, collisionMatched, pt, pdgCode);
1462- } else {
1463- cursors.rowMcMatchRecToOmegaKa (flag, debug, origin, collisionMatched, pt, pdgCode);
1464- }
1465- }
1466-
1467- // Helper function to fill in table for MC Gen
1468- // /@brief decay Channel is the chosen reconstruction channel
1469- // /@brief flag
1470- // /@brief debug
1471- // /@brief origin
1472- // /@brief collisionMatched
1473- // /@brief pt
1474- // /@brief pdgcode
1475- template <int decayChannel>
1476- void fillGenMcTableByDecayChannel (int8_t flag, int8_t debugGenCharmBaryon, int8_t debugGenCascade, int8_t debugGenLambda, float ptCharmBaryon, float yCharmBaryon, int8_t origin, int idxMother)
1477- {
1478- if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) {
1479- cursors.rowMcMatchGenXicToXiPi (flag, debugGenCharmBaryon, debugGenCascade, debugGenLambda, ptCharmBaryon, yCharmBaryon, origin, idxMother);
1480- } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi) {
1481- cursors.rowMcMatchGenOmegacToXiPi (flag, debugGenCharmBaryon, debugGenCascade, debugGenLambda, ptCharmBaryon, yCharmBaryon, origin, idxMother);
1482- } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi) {
1483- cursors.rowMcMatchGenToOmegaPi (flag, debugGenCharmBaryon, debugGenCascade, debugGenLambda, ptCharmBaryon, yCharmBaryon, origin, idxMother);
1484- } else {
1485- cursors.rowMcMatchGenToOmegaKa (flag, debugGenCharmBaryon, debugGenCascade, debugGenLambda, ptCharmBaryon, yCharmBaryon, origin, idxMother);
1486- }
14871418 }
14881419
14891420 template <o2::hf_centrality::CentralityEstimator centEstimator, int decayChannel, typename TRecoCand, typename Colls, typename McCollisions>
@@ -1494,31 +1425,20 @@ struct HfCandidateCreatorXic0Omegac0QaMc {
14941425 McCollisions const & mcCollisions,
14951426 BCsInfo const &)
14961427 {
1497- int indexRec{-1 };
1498- int indexRecCharmBaryon{-1 };
1499- int8_t sign{-9 };
1500- int8_t signCasc{-9 };
1501- int8_t signV0{-9 };
1502- int8_t flag{0 };
1503- int8_t origin{0 };
1504- int8_t debug{0 };
1505- int8_t debugGenCharmBaryon{0 };
1506- int8_t debugGenCasc{0 };
1507- int8_t debugGenV0{0 };
1508- bool collisionMatched = false ;
1509- float ptCharmBaryonGen = -999 .;
1510- float yCharmBaryonGen = -999 .;
1511-
1512- // //////////////////////////////////
15131428 // Match reconstructed candidates //
1514- // //////////////////////////////////
1515-
15161429 for (const auto & candidate : candidates) {
1430+ int indexRecCharmBaryon = -1 ;
1431+ int indexRecCascade = -1 ;
1432+ int indexRecV0 = -1 ;
1433+ int8_t sign = 0 ;
1434+ int8_t signCasc = 0 ;
1435+ int8_t signV0 = 0 ;
1436+ int8_t flagChannelMain = 0 ;
1437+ int8_t flagChannelResonant = 0 ; // TODO: Implement resonant channel matching
1438+ int8_t origin = 0 ;
1439+ int8_t nKinkedTracks = 0 ; // TODO: Implement kinked track matching
1440+ int8_t nInteractionsWithMaterial = 0 ; // TODO: Implement interaction with material matching
15171441
1518- flag = 0 ;
1519- origin = RecoDecay::OriginType::None;
1520- debug = McMatchFlag::None;
1521- collisionMatched = false ;
15221442 std::vector<int > idxBhadMothers{};
15231443
15241444 auto arrayDaughters = std::array{candidate.template bachelorFromCharmBaryon_as <TracksWMcIU>(),
@@ -1544,57 +1464,42 @@ struct HfCandidateCreatorXic0Omegac0QaMc {
15441464 }
15451465 }
15461466 if (fromBkg) {
1547- // fill the tables
1548- fillRecoMcTableByDecayChannel<decayChannel>(flag, debug, origin, collisionMatched, -1 .f , 0 );
1467+ rowMcMatchRecCascBach (flagChannelMain, origin, flagChannelResonant, -1 .f , 0 , 0 , 0 );
15491468 continue ;
15501469 }
15511470 }
15521471
15531472 // CharmBaryon -> Charm bachelor + Cascade
1554- indexRec = RecoDecay::getMatchedMCRec<false , true >(mcParticles, arrayDaughters, pdgOfCharmBaryon[decayChannel], std::array{pdgOfCharmBachelor[decayChannel], pdgOfBachelor[decayChannel], +kProton , +kPiMinus }, true , &sign, 3 );
1555- indexRecCharmBaryon = indexRec;
1556- if (indexRec == -1 ) { // Xic0 not reconstructed
1557- debug = McMatchFlag::CharmBaryonUnmatched;
1558- }
1559- if (indexRec > -1 ) {
1473+ indexRecCharmBaryon = RecoDecay::getMatchedMCRec<false , true >(mcParticles, arrayDaughters, pdgOfCharmBaryon[decayChannel], std::array{pdgOfCharmBachelor[decayChannel], pdgOfBachelor[decayChannel], +kProton , +kPiMinus }, true , &sign, 3 );
1474+
1475+ if (indexRecCharmBaryon > -1 ) {
15601476 // Cascade -> Bachelor + V0
1561- indexRec = RecoDecay::getMatchedMCRec<false , true >(mcParticles, arrayDaughtersCasc, pdgOfCascade[decayChannel], std::array{pdgOfBachelor[decayChannel], +kProton , +kPiMinus }, true , &signCasc, 2 );
1562- if (indexRec == -1 ) { // Xi- not reconstructed
1563- debug = McMatchFlag::CascUnmatched;
1564- }
1565- if (indexRec > -1 ) {
1477+ indexRecCascade = RecoDecay::getMatchedMCRec<false , true >(mcParticles, arrayDaughtersCasc, pdgOfCascade[decayChannel], std::array{pdgOfBachelor[decayChannel], +kProton , +kPiMinus }, true , &signCasc, 2 );
1478+
1479+ if (indexRecCascade > -1 ) {
15661480 // V0 -> Pos + Neg
1567- indexRec = RecoDecay::getMatchedMCRec<false , true >(mcParticles, arrayDaughtersV0, +kLambda0 , std::array{+kProton , +kPiMinus }, true , &signV0, 1 );
1568- if (indexRec == -1 ) { // V0 not reconstructed
1569- debug = McMatchFlag::V0Unmatched;
1570- }
1571- if (indexRec > -1 ) {
1572- flag = sign * (1 << decayChannel);
1573- collisionMatched = candidate.template collision_as <Colls>().mcCollisionId () == mcParticles.iteratorAt (indexRecCharmBaryon).mcCollisionId ();
1481+ indexRecV0 = RecoDecay::getMatchedMCRec<false , true >(mcParticles, arrayDaughtersV0, +kLambda0 , std::array{+kProton , +kPiMinus }, true , &signV0, 1 );
1482+
1483+ if (indexRecV0 > -1 ) {
1484+ flagChannelMain = sign * newDecayChannel[decayChannel];
15741485 }
15751486 }
15761487 }
15771488
15781489 // Check if charm baryon is from b-hadron decay(prompt vs non-prompt)
1579- if (flag != 0 ) {
1490+ if (flagChannelMain != 0 ) {
15801491 auto particle = mcParticles.rawIteratorAt (indexRecCharmBaryon);
15811492 origin = RecoDecay::getCharmHadronOrigin (mcParticles, particle, false , &idxBhadMothers);
15821493 }
15831494 if (origin == RecoDecay::OriginType::NonPrompt) {
15841495 auto bHadMother = mcParticles.rawIteratorAt (idxBhadMothers[0 ]);
1585- fillRecoMcTableByDecayChannel<decayChannel>(flag, debug, origin, collisionMatched , bHadMother.pt (), bHadMother.pdgCode ());
1496+ rowMcMatchRecCascBach (flagChannelMain, origin, flagChannelResonant , bHadMother.pt (), bHadMother.pdgCode (), nKinkedTracks, nInteractionsWithMaterial );
15861497 } else {
1587- fillRecoMcTableByDecayChannel<decayChannel>(flag, debug, origin, collisionMatched, -1 .f , 0 );
1588- }
1589- if (debug == McMatchFlag::CascUnmatched || debug == McMatchFlag::V0Unmatched) {
1590- LOGF (info, " WARNING: Charm baryon decays in the expected final state but the condition on the intermediate states are not fullfilled" );
1498+ rowMcMatchRecCascBach (flagChannelMain, origin, flagChannelResonant, -1 .f , 0 , nKinkedTracks, nInteractionsWithMaterial);
15911499 }
15921500 } // candidate loop
15931501
1594- // /////////////////////////////
1595- // Match generated particles //
1596- // /////////////////////////////
1597-
1502+ // Match generated particles
15981503 for (const auto & mcCollision : mcCollisions) {
15991504
16001505 const auto & mcParticlesPerMcColl = mcParticles.sliceBy (mcParticlesPerMcCollision, mcCollision.globalIndex ());
@@ -1621,80 +1526,62 @@ struct HfCandidateCreatorXic0Omegac0QaMc {
16211526
16221527 if (rejectionMask != 0 ) { // At least one event selection not satisfied --> Reject all particles from this event
16231528 for (unsigned int i = 0 ; i < mcParticlesPerMcColl.size (); ++i) {
1624- fillGenMcTableByDecayChannel<decayChannel> (0 , 0 , 0 , 0 , - 999 ., - 999 ., RecoDecay::OriginType::None , -1 );
1529+ rowMcMatchGenCascBach (0 , 0 , 0 , -1 );
16251530 }
16261531 continue ;
16271532 }
16281533
16291534 // Match generated particles
16301535 for (auto const & particle : mcParticlesPerMcColl) {
1631- ptCharmBaryonGen = -999 .;
1632- yCharmBaryonGen = -999 .;
1633- flag = 0 ;
1634- sign = -9 ;
1635- debugGenCharmBaryon = 0 ;
1636- debugGenCasc = 0 ;
1637- debugGenV0 = 0 ;
1638- origin = RecoDecay::OriginType::None;
1536+ int8_t flagChannelMain = 0 ;
1537+ int8_t flagChannelResonant = 0 ; // TODO: Implement resonant channel matching
1538+ int8_t origin = RecoDecay::OriginType::None;
1539+ int8_t sign = 0 ;
1540+
16391541 std::vector<int > idxBhadMothers{};
1640- const float kYCutTight = 0.5 ;
1641- const float kYCutLoose = 0.8 ;
16421542
16431543 // Reject particles from background events
16441544 if (particle.fromBackgroundEvent () && configs.rejectBackground ) {
1645- fillGenMcTableByDecayChannel<decayChannel>(flag, debugGenCharmBaryon, debugGenCasc, debugGenV0, ptCharmBaryonGen, yCharmBaryonGen, origin , -1 );
1545+ rowMcMatchGenCascBach (flagChannelMain, origin, flagChannelResonant , -1 );
16461546 continue ;
16471547 }
16481548
16491549 // Charm Baryon -> Cascade + Charm bachelor
16501550 if (RecoDecay::isMatchedMCGen<false , true >(mcParticles, particle, pdgOfCharmBaryon[decayChannel], std::array{pdgOfCascade[decayChannel], pdgOfCharmBachelor[decayChannel]}, true , &sign)) {
1651- debugGenCharmBaryon = 1 ;
1652- ptCharmBaryonGen = particle.pt ();
1653- yCharmBaryonGen = particle.y ();
1654-
16551551 for (auto const & daughterCharm : particle.template daughters_as <aod::McParticles>()) {
16561552 if (std::abs (daughterCharm.pdgCode ()) != pdgOfCascade[decayChannel]) {
16571553 continue ;
16581554 }
1659- // Xi -> Lambda + pi
1555+
1556+ // Cascade -> Lambda + pi
16601557 if (RecoDecay::isMatchedMCGen<false , true >(mcParticles, daughterCharm, pdgOfCascade[decayChannel], std::array{+kLambda0 , pdgOfBachelor[decayChannel]}, true )) {
1661- debugGenCasc = 1 ; // -> Matched Xi-
16621558 for (auto const & daughterCascade : daughterCharm.template daughters_as <aod::McParticles>()) {
16631559 if (std::abs (daughterCascade.pdgCode ()) != +kLambda0 ) {
16641560 continue ;
16651561 }
16661562
16671563 // Lambda -> p + pi
16681564 if (RecoDecay::isMatchedMCGen<false , true >(mcParticles, daughterCascade, +kLambda0 , std::array{+kProton , +kPiMinus }, true )) {
1669- debugGenV0 = 1 ; // -> Matched Lambda0
1670- flag = sign * ( 1 << decayChannel) ;
1565+ flagChannelMain = sign * newDecayChannel[decayChannel];
1566+ ;
16711567 }
16721568 } // V0 daughter loop
16731569 } // cascade daughter loop
1674- }
1675- } // charm daughter loop
1676-
1677- if (flag != 0 ) {
1678- origin = RecoDecay::getCharmHadronOrigin (mcParticles, particle, false , &idxBhadMothers);
1679- if (std::abs (yCharmBaryonGen) < kYCutTight ) {
1680- registry.fill (HIST (" hGenCharmBaryonPtRapidityTight" ), ptCharmBaryonGen);
1681- }
1682- if (std::abs (yCharmBaryonGen) < kYCutLoose ) {
1683- registry.fill (HIST (" hGenCharmBaryonPtRapidityLoose" ), ptCharmBaryonGen);
1684- }
1570+ } // charm daughter loop
16851571 }
16861572
16871573 // Check if charm is prompt or non-prompt
1574+ if (flagChannelMain != 0 ) {
1575+ origin = RecoDecay::getCharmHadronOrigin (mcParticles, particle, false , &idxBhadMothers);
1576+ }
16881577 if (origin == RecoDecay::OriginType::NonPrompt) {
1689- fillGenMcTableByDecayChannel<decayChannel>(flag, debugGenCharmBaryon, debugGenCasc, debugGenV0, ptCharmBaryonGen, yCharmBaryonGen, origin , idxBhadMothers[0 ]);
1578+ rowMcMatchGenCascBach (flagChannelMain, origin, flagChannelResonant , idxBhadMothers[0 ]);
16901579 } else {
1691- fillGenMcTableByDecayChannel<decayChannel>(flag, debugGenCharmBaryon, debugGenCasc, debugGenV0, ptCharmBaryonGen, yCharmBaryonGen, origin , -1 );
1580+ rowMcMatchGenCascBach (flagChannelMain, origin, flagChannelResonant , -1 );
16921581 }
16931582
16941583 } // particle loop
1695-
16961584 } // end of collision loop
1697-
16981585 } // template run function
16991586
17001587 void processMcEmpty (aod::Collisions const &)
0 commit comments