Skip to content

Commit ffc7bfa

Browse files
committed
Implemented matching for candidates with tracks with kinked decay topology for D2H analyses
1 parent 0fc2e1a commit ffc7bfa

File tree

4 files changed

+70
-24
lines changed

4 files changed

+70
-24
lines changed

PWGHF/DataModel/CandidateReconstructionTables.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ DECLARE_SOA_COLUMN(KfTopolChi2OverNdf, kfTopolChi2OverNdf, float); //! chi2overn
585585
DECLARE_SOA_COLUMN(PtBhadMotherPart, ptBhadMotherPart, float); //! pt of the first B-hadron mother particle (only in case of non-prompt)
586586
DECLARE_SOA_COLUMN(PdgBhadMotherPart, pdgBhadMotherPart, int); //! pdg of the first B-hadron mother particle (only in case of non-prompt)
587587
DECLARE_SOA_COLUMN(IdxBhadMotherPart, idxBhadMotherPart, int); //! index of the first B-hadron mother particle (only in case of non-prompt)
588+
// Kink topology mc flag
589+
DECLARE_SOA_COLUMN(NTracksDecayed, nTracksDecayed, int8_t); //! number of tracks matched with kinked decay topology
588590

589591
// method of secondary-vertex reconstruction
590592
enum VertexerType { DCAFitter = 0,
@@ -731,7 +733,8 @@ DECLARE_SOA_TABLE(HfCand2ProngMcRec, "AOD", "HFCAND2PMCREC", //!
731733
hf_cand_2prong::FlagMcMatchRec,
732734
hf_cand_2prong::OriginMcRec,
733735
hf_cand::PtBhadMotherPart,
734-
hf_cand::PdgBhadMotherPart);
736+
hf_cand::PdgBhadMotherPart,
737+
hf_cand::NTracksDecayed);
735738

736739
// table with results of generator level MC matching
737740
DECLARE_SOA_TABLE(HfCand2ProngMcGen, "AOD", "HFCAND2PMCGEN", //!
@@ -1008,7 +1011,8 @@ DECLARE_SOA_TABLE(HfCand3ProngMcRec, "AOD", "HFCAND3PMCREC", //!
10081011
hf_cand_3prong::IsCandidateSwapped,
10091012
hf_cand_3prong::FlagMcDecayChanRec,
10101013
hf_cand::PtBhadMotherPart,
1011-
hf_cand::PdgBhadMotherPart);
1014+
hf_cand::PdgBhadMotherPart,
1015+
hf_cand::NTracksDecayed);
10121016

10131017
// table with results of generator level MC matching
10141018
DECLARE_SOA_TABLE(HfCand3ProngMcGen, "AOD", "HFCAND3PMCGEN", //!
@@ -2264,7 +2268,8 @@ DECLARE_SOA_TABLE(HfCandDstarMcRec, "AOD", "HFCANDDSTRMCREC",
22642268
hf_cand_dstar::FlagMcMatchRec,
22652269
hf_cand_dstar::OriginMcRec,
22662270
hf_cand::PtBhadMotherPart,
2267-
hf_cand::PdgBhadMotherPart);
2271+
hf_cand::PdgBhadMotherPart,
2272+
hf_cand::NTracksDecayed);
22682273

22692274
// table with results of generator level MC matching
22702275
DECLARE_SOA_TABLE(HfCandDstarMcGen, "AOD", "HFCANDDSTRMCGEN",

PWGHF/TableProducer/candidateCreator2Prong.cxx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ struct HfCandidateCreator2ProngExpressions {
677677

678678
// Configuration
679679
o2::framework::Configurable<bool> rejectBackground{"rejectBackground", true, "Reject particles from background events"};
680+
o2::framework::Configurable<bool> matchKinkedDecayTopology{"matchKinkedDecayTopology", true, "Match also candidates with tracks that decay with kinked topology"};
680681

681682
HfEventSelectionMc hfEvSelMc; // mc event selection and monitoring
682683

@@ -723,6 +724,7 @@ struct HfCandidateCreator2ProngExpressions {
723724
int8_t sign = 0;
724725
int8_t flag = 0;
725726
int8_t origin = 0;
727+
int8_t nKinkedTracks = 0;
726728

727729
// Match reconstructed candidates.
728730
// Spawned table can be used directly
@@ -744,14 +746,18 @@ struct HfCandidateCreator2ProngExpressions {
744746
}
745747
}
746748
if (fromBkg) {
747-
rowMcMatchRec(flag, origin, -1.f, 0);
749+
rowMcMatchRec(flag, origin, -1.f, 0, 0);
748750
continue;
749751
}
750752
}
751753
std::vector<int> idxBhadMothers{};
752754

753755
// D0(bar) → π± K∓
754-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign);
756+
if (matchKinkedDecayTopology){
757+
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true>(mcParticles, arrayDaughters, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign, 1, &nKinkedTracks);
758+
} else {
759+
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign);
760+
}
755761
if (indexRec > -1) {
756762
flag = sign * (1 << DecayType::D0ToPiK);
757763
}
@@ -779,9 +785,9 @@ struct HfCandidateCreator2ProngExpressions {
779785
}
780786
if (origin == RecoDecay::OriginType::NonPrompt) {
781787
auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]);
782-
rowMcMatchRec(flag, origin, bHadMother.pt(), bHadMother.pdgCode());
788+
rowMcMatchRec(flag, origin, bHadMother.pt(), bHadMother.pdgCode(), nKinkedTracks);
783789
} else {
784-
rowMcMatchRec(flag, origin, -1.f, 0);
790+
rowMcMatchRec(flag, origin, -1.f, 0, nKinkedTracks);
785791
}
786792
}
787793

PWGHF/TableProducer/candidateCreator3Prong.cxx

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,8 @@ struct HfCandidateCreator3ProngExpressions {
456456

457457
// Configuration
458458
o2::framework::Configurable<bool> rejectBackground{"rejectBackground", true, "Reject particles from background events"};
459+
o2::framework::Configurable<bool> matchKinkedDecayTopology{"matchKinkedDecayTopology", true, "Match also candidates with tracks that decay with kinked topology"};
460+
459461

460462
bool createDplus{false};
461463
bool createDs{false};
@@ -526,6 +528,7 @@ struct HfCandidateCreator3ProngExpressions {
526528
int8_t origin = 0;
527529
int8_t swapping = 0;
528530
int8_t channel = 0;
531+
int8_t nKinkedTracks = 0;
529532
std::vector<int> arrDaughIndex;
530533
std::array<int, 2> arrPDGDaugh;
531534
std::array<int, 2> arrPDGResonant1 = {kProton, 313}; // Λc± → p± K*
@@ -558,14 +561,18 @@ struct HfCandidateCreator3ProngExpressions {
558561
}
559562
}
560563
if (fromBkg) {
561-
rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0);
564+
rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0, 0);
562565
continue;
563566
}
564567
}
565568

566569
// D± → π± K∓ π±
567570
if (createDplus) {
568-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
571+
if (matchKinkedDecayTopology){
572+
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true>(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2, &nKinkedTracks);
573+
} else{
574+
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
575+
}
569576
if (indexRec > -1) {
570577
flag = sign * (1 << DecayType::DplusToPiKPi);
571578
}
@@ -574,10 +581,18 @@ struct HfCandidateCreator3ProngExpressions {
574581
// Ds± → K± K∓ π± and D± → K± K∓ π±
575582
if (flag == 0 && createDs) {
576583
bool isDplus = false;
577-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDS, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
584+
if (matchKinkedDecayTopology){
585+
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true>(mcParticles, arrayDaughters, Pdg::kDS, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2, &nKinkedTracks);
586+
} else {
587+
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDS, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
588+
}
578589
if (indexRec == -1) {
579590
isDplus = true;
580-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
591+
if (matchKinkedDecayTopology){
592+
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true>(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2, &nKinkedTracks);
593+
} else {
594+
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
595+
}
581596
}
582597
if (indexRec > -1) {
583598
// DecayType::DsToKKPi is used to flag both Ds± → K± K∓ π± and D± → K± K∓ π±
@@ -603,7 +618,11 @@ struct HfCandidateCreator3ProngExpressions {
603618

604619
// Λc± → p± K∓ π±
605620
if (flag == 0 && createLc) {
606-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
621+
if (matchKinkedDecayTopology){
622+
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true>(mcParticles, arrayDaughters, Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2, &nKinkedTracks);
623+
} else{
624+
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
625+
}
607626
if (indexRec > -1) {
608627
flag = sign * (1 << DecayType::LcToPKPi);
609628

@@ -630,7 +649,11 @@ struct HfCandidateCreator3ProngExpressions {
630649

631650
// Ξc± → p± K∓ π±
632651
if (flag == 0 && createXic) {
633-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kXiCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
652+
if (matchKinkedDecayTopology){
653+
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true>(mcParticles, arrayDaughters, Pdg::kXiCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2, &nKinkedTracks);
654+
} else {
655+
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kXiCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
656+
}
634657
if (indexRec > -1) {
635658
flag = sign * (1 << DecayType::XicToPKPi);
636659
}
@@ -643,9 +666,9 @@ struct HfCandidateCreator3ProngExpressions {
643666
}
644667
if (origin == RecoDecay::OriginType::NonPrompt) {
645668
auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]);
646-
rowMcMatchRec(flag, origin, swapping, channel, bHadMother.pt(), bHadMother.pdgCode());
669+
rowMcMatchRec(flag, origin, swapping, channel, bHadMother.pt(), bHadMother.pdgCode(), nKinkedTracks);
647670
} else {
648-
rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0);
671+
rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0, nKinkedTracks);
649672
}
650673
}
651674

PWGHF/TableProducer/candidateCreatorDstar.cxx

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ struct HfCandidateCreatorDstarExpressions {
506506

507507
// Configuration
508508
o2::framework::Configurable<bool> rejectBackground{"rejectBackground", true, "Reject particles from background events"};
509+
o2::framework::Configurable<bool> matchKinkedDecayTopology{"matchKinkedDecayTopology", true, "Match also candidates with tracks that decay with kinked topology"};
510+
509511

510512
using McCollisionsNoCents = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels>;
511513
using McCollisionsFT0Cs = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentFT0Cs>;
@@ -552,6 +554,8 @@ struct HfCandidateCreatorDstarExpressions {
552554
int8_t signDstar = 0, signD0 = 0;
553555
int8_t flagDstar = 0, flagD0 = 0;
554556
int8_t originDstar = 0, originD0 = 0;
557+
int8_t nKinkedTracksDstar = 0, nKinkedTracksD0 = 0;
558+
555559

556560
// Match reconstructed candidates.
557561
for (const auto& rowCandidateDstar : *rowsCandidateDstar) {
@@ -581,16 +585,24 @@ struct HfCandidateCreatorDstarExpressions {
581585
}
582586
}
583587
if (fromBkg) {
584-
rowsMcMatchRecDstar(flagDstar, originDstar, -1.f, 0);
588+
rowsMcMatchRecDstar(flagDstar, originDstar, -1.f, 0, 0);
585589
continue;
586590
}
587591
}
588592

589-
// D*± → D0(bar) π±
590-
indexRecDstar = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersDstar, Pdg::kDStar, std::array{+kPiPlus, +kPiPlus, -kKPlus}, true, &signDstar, 2);
591-
// D0(bar) → π± K∓
592-
indexRecD0 = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersofD0, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD0);
593-
593+
594+
if (matchKinkedDecayTopology){
595+
// D*± → D0(bar) π±
596+
indexRecDstar = RecoDecay::getMatchedMCRec<false, false, false, true>(mcParticles, arrayDaughtersDstar, Pdg::kDStar, std::array{+kPiPlus, +kPiPlus, -kKPlus}, true, &signDstar, 2, &nKinkedTracksDstar);
597+
// D0(bar) → π± K∓
598+
indexRecD0 = RecoDecay::getMatchedMCRec<false, false, false, true>(mcParticles, arrayDaughtersofD0, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD0, 1, &nKinkedTracksD0);
599+
} else {
600+
// D*± → D0(bar) π±
601+
indexRecDstar = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersDstar, Pdg::kDStar, std::array{+kPiPlus, +kPiPlus, -kKPlus}, true, &signDstar, 2);
602+
// D0(bar) → π± K∓
603+
indexRecD0 = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersofD0, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD0);
604+
}
605+
594606
if (indexRecDstar > -1) {
595607
flagDstar = signDstar * (BIT(aod::hf_cand_dstar::DecayType::DstarToD0Pi));
596608
}
@@ -609,11 +621,11 @@ struct HfCandidateCreatorDstarExpressions {
609621
}
610622
if (originDstar == RecoDecay::OriginType::NonPrompt) {
611623
auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]);
612-
rowsMcMatchRecDstar(flagDstar, originDstar, bHadMother.pt(), bHadMother.pdgCode());
624+
rowsMcMatchRecDstar(flagDstar, originDstar, bHadMother.pt(), bHadMother.pdgCode(), nKinkedTracksDstar);
613625
} else {
614-
rowsMcMatchRecDstar(flagDstar, originDstar, -1.f, 0);
626+
rowsMcMatchRecDstar(flagDstar, originDstar, -1.f, 0, nKinkedTracksDstar);
615627
}
616-
rowsMcMatchRecD0(flagD0, originD0, -1.f, 0);
628+
rowsMcMatchRecD0(flagD0, originD0, -1.f, 0, nKinkedTracksD0);
617629
}
618630

619631
for (const auto& mcCollision : mcCollisions) {

0 commit comments

Comments
 (0)