Skip to content

Commit 18f95ec

Browse files
committed
adding missing file to the previous commit
1 parent 32e4f43 commit 18f95ec

2 files changed

Lines changed: 67 additions & 6 deletions

File tree

‎PWGHF/HFC/DataModel/CorrelationTables.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -498,19 +498,19 @@ DECLARE_SOA_TABLE(TrkRecInfoDplus, "AOD", "TRKRECINFODPLUS", //! Tracks Reconstr
498498
aod::hf_correlation_dplus_hadron::TrackTPCNClsCrossedRows);
499499

500500
// definition of columns and tables for the beauty-mother information of the charm-hadron trigger (MC only), usable by any D-hadron correlation analysis
501-
namespace hf_correlation_b_mother
501+
namespace hf_correlation_info_b_mother
502502
{
503503
DECLARE_SOA_COLUMN(PtB, ptB, float); //! Generated pT of the beauty mother of the charm hadron (-1 if not from beauty)
504504
DECLARE_SOA_COLUMN(DeltaPhiBtoD, deltaPhiBtoD, float); //! phi(charm hadron) - phi(B mother, generated) in [-pihalf, 3.*pihalf) (-999 if not from beauty)
505-
} // namespace hf_correlation_b_mother
505+
} // namespace hf_correlation_info_b_mother
506506

507507
DECLARE_SOA_TABLE(BMotherPairInfo, "AOD", "BMOTHERPAIRINFO", //! Charm-hadron-hadron pairs beauty-mother information, joinable with the pair table
508-
aod::hf_correlation_b_mother::PtB,
509-
aod::hf_correlation_b_mother::DeltaPhiBtoD);
508+
aod::hf_correlation_info_b_mother::PtB,
509+
aod::hf_correlation_info_b_mother::DeltaPhiBtoD);
510510

511511
DECLARE_SOA_TABLE(BMotherCandInfo, "AOD", "BMOTHERCANDINFO", //! Charm-hadron candidates beauty-mother information, joinable with the candidate table
512-
aod::hf_correlation_b_mother::PtB,
513-
aod::hf_correlation_b_mother::DeltaPhiBtoD);
512+
aod::hf_correlation_info_b_mother::PtB,
513+
aod::hf_correlation_info_b_mother::DeltaPhiBtoD);
514514

515515
// definition of columns and tables for Dstar-Hadron correlation pair
516516
namespace hf_correlation_dstar_hadron

‎PWGHF/HFC/Utils/utilsCorrelations.h‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "PWGHF/Core/DecayChannels.h"
2020

21+
#include "Common/Core/RecoDecay.h"
2122
#include "Common/DataModel/PIDResponseTOF.h"
2223
#include "Common/DataModel/PIDResponseTPC.h"
2324

@@ -29,6 +30,9 @@
2930

3031
#include <cmath>
3132
#include <cstddef>
33+
#include <cstdint>
34+
#include <utility>
35+
#include <vector>
3236

3337
namespace o2::analysis::hf_correlations
3438
{
@@ -227,5 +231,62 @@ int findLeadingParticleMcGen(TMcParticles const& mcParticles, T1 const etaTrackM
227231
}
228232
return leadingParticle.globalIndex();
229233
}
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+
}
230291
} // namespace o2::analysis::hf_correlations
231292
#endif // PWGHF_HFC_UTILS_UTILSCORRELATIONS_H_

0 commit comments

Comments
 (0)