Skip to content

Commit cd6dcd2

Browse files
Luca610alibuildfgrosa
authored
[PWGHF] Implemented matching of candidates with kinked tracks for D2H analyses (#8670)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch> Co-authored-by: Fabrizio <fabrizio.grosa@cern.ch>
1 parent 57f4a88 commit cd6dcd2

File tree

4 files changed

+69
-24
lines changed

4 files changed

+69
-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", false, "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: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ 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", false, "Match also candidates with tracks that decay with kinked topology"};
459460

460461
bool createDplus{false};
461462
bool createDs{false};
@@ -526,6 +527,7 @@ struct HfCandidateCreator3ProngExpressions {
526527
int8_t origin = 0;
527528
int8_t swapping = 0;
528529
int8_t channel = 0;
530+
int8_t nKinkedTracks = 0;
529531
std::vector<int> arrDaughIndex;
530532
std::array<int, 2> arrPDGDaugh;
531533
std::array<int, 2> arrPDGResonant1 = {kProton, 313}; // Λc± → p± K*
@@ -558,14 +560,18 @@ struct HfCandidateCreator3ProngExpressions {
558560
}
559561
}
560562
if (fromBkg) {
561-
rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0);
563+
rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0, 0);
562564
continue;
563565
}
564566
}
565567

566568
// D± → π± K∓ π±
567569
if (createDplus) {
568-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
570+
if (matchKinkedDecayTopology) {
571+
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true>(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2, &nKinkedTracks);
572+
} else {
573+
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
574+
}
569575
if (indexRec > -1) {
570576
flag = sign * (1 << DecayType::DplusToPiKPi);
571577
}
@@ -574,10 +580,18 @@ struct HfCandidateCreator3ProngExpressions {
574580
// Ds± → K± K∓ π± and D± → K± K∓ π±
575581
if (flag == 0 && createDs) {
576582
bool isDplus = false;
577-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDS, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
583+
if (matchKinkedDecayTopology) {
584+
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true>(mcParticles, arrayDaughters, Pdg::kDS, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2, &nKinkedTracks);
585+
} else {
586+
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDS, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
587+
}
578588
if (indexRec == -1) {
579589
isDplus = true;
580-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
590+
if (matchKinkedDecayTopology) {
591+
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true>(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2, &nKinkedTracks);
592+
} else {
593+
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
594+
}
581595
}
582596
if (indexRec > -1) {
583597
// DecayType::DsToKKPi is used to flag both Ds± → K± K∓ π± and D± → K± K∓ π±
@@ -603,7 +617,11 @@ struct HfCandidateCreator3ProngExpressions {
603617

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

@@ -630,7 +648,11 @@ struct HfCandidateCreator3ProngExpressions {
630648

631649
// Ξc± → p± K∓ π±
632650
if (flag == 0 && createXic) {
633-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kXiCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
651+
if (matchKinkedDecayTopology) {
652+
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true>(mcParticles, arrayDaughters, Pdg::kXiCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2, &nKinkedTracks);
653+
} else {
654+
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kXiCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
655+
}
634656
if (indexRec > -1) {
635657
flag = sign * (1 << DecayType::XicToPKPi);
636658
}
@@ -643,9 +665,9 @@ struct HfCandidateCreator3ProngExpressions {
643665
}
644666
if (origin == RecoDecay::OriginType::NonPrompt) {
645667
auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]);
646-
rowMcMatchRec(flag, origin, swapping, channel, bHadMother.pt(), bHadMother.pdgCode());
668+
rowMcMatchRec(flag, origin, swapping, channel, bHadMother.pt(), bHadMother.pdgCode(), nKinkedTracks);
647669
} else {
648-
rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0);
670+
rowMcMatchRec(flag, origin, swapping, channel, -1.f, 0, nKinkedTracks);
649671
}
650672
}
651673

PWGHF/TableProducer/candidateCreatorDstar.cxx

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
/// \author Vít Kučera <vit.kucera@cern.ch>, CERN
1616
/// \author Deependra Sharma <deependra.sharma@cern.ch>, IITB
1717
/// \author Fabrizio Grosa <fabrizio.grosa@cern.ch>, CERN
18-
18+
// std
19+
#include <memory>
20+
#include <string>
21+
#include <vector>
1922
// ROOT
2023
#include <TPDGCode.h>
2124
// O2
@@ -506,6 +509,7 @@ struct HfCandidateCreatorDstarExpressions {
506509

507510
// Configuration
508511
o2::framework::Configurable<bool> rejectBackground{"rejectBackground", true, "Reject particles from background events"};
512+
o2::framework::Configurable<bool> matchKinkedDecayTopology{"matchKinkedDecayTopology", false, "Match also candidates with tracks that decay with kinked topology"};
509513

510514
using McCollisionsNoCents = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels>;
511515
using McCollisionsFT0Cs = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentFT0Cs>;
@@ -552,6 +556,7 @@ struct HfCandidateCreatorDstarExpressions {
552556
int8_t signDstar = 0, signD0 = 0;
553557
int8_t flagDstar = 0, flagD0 = 0;
554558
int8_t originDstar = 0, originD0 = 0;
559+
int8_t nKinkedTracksDstar = 0, nKinkedTracksD0 = 0;
555560

556561
// Match reconstructed candidates.
557562
for (const auto& rowCandidateDstar : *rowsCandidateDstar) {
@@ -581,15 +586,22 @@ struct HfCandidateCreatorDstarExpressions {
581586
}
582587
}
583588
if (fromBkg) {
584-
rowsMcMatchRecDstar(flagDstar, originDstar, -1.f, 0);
589+
rowsMcMatchRecDstar(flagDstar, originDstar, -1.f, 0, 0);
585590
continue;
586591
}
587592
}
588593

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);
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+
}
593605

594606
if (indexRecDstar > -1) {
595607
flagDstar = signDstar * (BIT(aod::hf_cand_dstar::DecayType::DstarToD0Pi));
@@ -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)