|
18 | 18 |
|
19 | 19 | #include "PWGHF/Core/DecayChannels.h" |
20 | 20 |
|
| 21 | +#include "Common/Core/RecoDecay.h" |
21 | 22 | #include "Common/DataModel/PIDResponseTOF.h" |
22 | 23 | #include "Common/DataModel/PIDResponseTPC.h" |
23 | 24 |
|
|
29 | 30 |
|
30 | 31 | #include <cmath> |
31 | 32 | #include <cstddef> |
| 33 | +#include <cstdint> |
| 34 | +#include <utility> |
| 35 | +#include <vector> |
32 | 36 |
|
33 | 37 | namespace o2::analysis::hf_correlations |
34 | 38 | { |
@@ -227,5 +231,62 @@ int findLeadingParticleMcGen(TMcParticles const& mcParticles, T1 const etaTrackM |
227 | 231 | } |
228 | 232 | return leadingParticle.globalIndex(); |
229 | 233 | } |
| 234 | + |
| 235 | +// ======= Beauty-mother information of non-prompt charm hadrons ============ |
| 236 | +constexpr float PtBMotherDefault{-1.f}; // pT(B mother) returned when the charm hadron is not from beauty |
| 237 | +constexpr float DeltaPhiBMotherDefault{-999.f}; // phi(charm hadron) - phi(B mother) returned when the charm hadron is not from beauty |
| 238 | + |
| 239 | +/// Gets the generated beauty mother of a reconstructed charm-hadron candidate matched to a non-prompt charm hadron |
| 240 | +/// \tparam TTracks is the track table with MC labels, used to access the candidate prongs |
| 241 | +/// \param candidate is the reconstructed candidate (with originMcRec column) |
| 242 | +/// \param mcParticles is the table of MC particles |
| 243 | +/// \param pdgCharmHadron is the PDG code of the charm hadron (e.g. Pdg::kDPlus), antiparticles are accepted |
| 244 | +/// \param depthMaxDaughters is the max. depth of the candidate prong in the charm-hadron decay chain (> 1 for resonant channels) |
| 245 | +/// \return pair (pT of the B mother, phi(candidate, reco) - phi(B mother, gen) in [-pi, pi)), default values if the candidate is not from beauty |
| 246 | +template <typename TTracks, typename TCandidate, typename TMcParticles> |
| 247 | +std::pair<float, float> getBMotherInfoMcRec(TCandidate const& candidate, TMcParticles const& mcParticles, int pdgCharmHadron, int8_t depthMaxDaughters = 2) |
| 248 | +{ |
| 249 | + std::pair<float, float> bMotherInfo{PtBMotherDefault, DeltaPhiBMotherDefault}; |
| 250 | + if (candidate.originMcRec() != RecoDecay::OriginType::NonPrompt) { |
| 251 | + return bMotherInfo; |
| 252 | + } |
| 253 | + // retrieve the generated charm hadron from the MC particle of one of its daughters |
| 254 | + auto prong0 = candidate.template prong0_as<TTracks>(); |
| 255 | + if (!prong0.has_mcParticle()) { |
| 256 | + return bMotherInfo; |
| 257 | + } |
| 258 | + auto prong0McPart = prong0.template mcParticle_as<TMcParticles>(); |
| 259 | + int const indexCharmHadronGen = RecoDecay::getMother(mcParticles, prong0McPart, pdgCharmHadron, true, nullptr, depthMaxDaughters); |
| 260 | + if (indexCharmHadronGen < 0) { |
| 261 | + return bMotherInfo; |
| 262 | + } |
| 263 | + // same procedure used in the candidate creators to fill PtBhadMotherPart |
| 264 | + auto charmHadronGen = mcParticles.rawIteratorAt(indexCharmHadronGen - mcParticles.offset()); |
| 265 | + std::vector<int> idxBhadMothers{}; |
| 266 | + if (RecoDecay::getCharmHadronOrigin(mcParticles, charmHadronGen, false, &idxBhadMothers) != RecoDecay::OriginType::NonPrompt || idxBhadMothers.empty()) { |
| 267 | + return bMotherInfo; |
| 268 | + } |
| 269 | + auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0] - mcParticles.offset()); |
| 270 | + bMotherInfo.first = bHadMother.pt(); |
| 271 | + bMotherInfo.second = RecoDecay::constrainAngle(candidate.phi() - bHadMother.phi(), -o2::constants::math::PI); |
| 272 | + return bMotherInfo; |
| 273 | +} |
| 274 | + |
| 275 | +/// Gets the beauty mother of a generated charm hadron |
| 276 | +/// \param particle is the generated charm hadron (with originMcGen and idxBhadMotherPart columns) |
| 277 | +/// \param mcParticles is the table of MC particles containing the B mother |
| 278 | +/// \return pair (pT of the B mother, phi(charm hadron) - phi(B mother) in [-pi, pi)), default values if the charm hadron is not from beauty |
| 279 | +template <typename TParticle, typename TMcParticles> |
| 280 | +std::pair<float, float> getBMotherInfoMcGen(TParticle const& particle, TMcParticles const& mcParticles) |
| 281 | +{ |
| 282 | + std::pair<float, float> bMotherInfo{PtBMotherDefault, DeltaPhiBMotherDefault}; |
| 283 | + if (particle.originMcGen() != RecoDecay::OriginType::NonPrompt || particle.idxBhadMotherPart() < 0) { |
| 284 | + return bMotherInfo; |
| 285 | + } |
| 286 | + auto bHadMother = mcParticles.rawIteratorAt(particle.idxBhadMotherPart() - mcParticles.offset()); |
| 287 | + bMotherInfo.first = bHadMother.pt(); |
| 288 | + bMotherInfo.second = RecoDecay::constrainAngle(particle.phi() - bHadMother.phi(), -o2::constants::math::PI); |
| 289 | + return bMotherInfo; |
| 290 | +} |
230 | 291 | } // namespace o2::analysis::hf_correlations |
231 | 292 | #endif // PWGHF_HFC_UTILS_UTILSCORRELATIONS_H_ |
0 commit comments