Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,11 @@ struct HfCandidateCreatorCharmResoReduced {
if (TESTBIT(candV0Tr.v0Type(), V0Type::Lambda)) {
invMassV0Tr = candV0Tr.invMassLambda();
signReso = candD.sign();
isWrongSign = candD.sign() < 0 ? 1 : 0;
} else if (TESTBIT(candV0Tr.v0Type(), V0Type::AntiLambda)) {
invMassV0Tr = candV0Tr.invMassAntiLambda();
signReso = candD.sign();
isWrongSign = 1;
isWrongSign = candD.sign() > 0 ? 1 : 0;
}
if (useDeltaMass) {
invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda}) - invMassD;
Expand Down
25 changes: 18 additions & 7 deletions PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,17 @@ struct HfDataCreatorCharmResoReduced {
return flagV0; // Placeholder, should return the actual flag based on matching logic
}

template <typename PParticles>
float computeInvMassGen(PParticles const& particlesMc, int indexRec)
{
auto particleReso = particlesMc.iteratorAt(indexRec);
auto dau1 = particlesMc.iteratorAt(particleReso.daughtersIds().front());
auto dau2 = particlesMc.iteratorAt(particleReso.daughtersIds().back());
std::array<std::array<float, 3>, 2> pArr = {{{dau1.px(), dau1.py(), dau1.pz()}, {dau2.px(), dau2.py(), dau2.pz()}}};
Comment on lines +627 to +629
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can consider to loop on daughters, to generalise in case of more than 2 daughters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RecoDecay::m takes fixed length arrays as input, that's way I ended up implementing it only for 2 prongs

std::array<float, 2> mArr = {static_cast<float>(pdg->Mass(dau1.pdgCode())), static_cast<float>(pdg->Mass(dau2.pdgCode()))};
return static_cast<float>(RecoDecay::m(pArr, mArr));
}

/// Function for filling MC reco information of DV0 candidates in the tables
/// \tparam dType is the D meson type (Dstar, Dplus or D0)
/// \param particlesMc is the table with MC particles
Expand Down Expand Up @@ -690,7 +701,7 @@ struct HfDataCreatorCharmResoReduced {
if (indexRec > -1) {
auto particleReso = particlesMc.iteratorAt(indexRec);
ptGen = particleReso.pt();
invMassGen = RecoDecay::m(particleReso.p(), particleReso.e());
invMassGen = computeInvMassGen(particlesMc, indexRec);
}
rowHfDstarV0McRecReduced(indexHfCandCharm, indexCandV0Bach,
flagReso, flagCharmBach,
Expand Down Expand Up @@ -743,7 +754,7 @@ struct HfDataCreatorCharmResoReduced {
if (indexRec > -1) {
auto particleReso = particlesMc.iteratorAt(indexRec);
ptGen = particleReso.pt();
invMassGen = RecoDecay::m(particleReso.p(), particleReso.e());
invMassGen = computeInvMassGen(particlesMc, indexRec);
}
rowHf3PrV0McRecReduced(indexHfCandCharm, indexCandV0Bach,
flagReso, flagCharmBach,
Expand Down Expand Up @@ -784,7 +795,7 @@ struct HfDataCreatorCharmResoReduced {
if (indexRec > -1) {
auto particleReso = particlesMc.iteratorAt(indexRec);
ptGen = particleReso.pt();
invMassGen = RecoDecay::m(particleReso.p(), particleReso.e());
invMassGen = computeInvMassGen(particlesMc, indexRec);
}
rowHf2PrV0McRecReduced(indexHfCandCharm, indexCandV0Bach,
flagReso, flagCharmBach,
Expand Down Expand Up @@ -874,7 +885,7 @@ struct HfDataCreatorCharmResoReduced {
if (indexRec > -1) {
auto particleReso = particlesMc.iteratorAt(indexRec);
ptGen = particleReso.pt();
invMassGen = RecoDecay::m(particleReso.p(), particleReso.e());
invMassGen = computeInvMassGen(particlesMc, indexRec);
}
rowHfDstarTrkMcRecReduced(indexHfCandCharm, indexCandTrBach,
flagReso, flagCharmBach,
Expand Down Expand Up @@ -914,7 +925,7 @@ struct HfDataCreatorCharmResoReduced {
if (indexRec > -1) {
auto particleReso = particlesMc.iteratorAt(indexRec);
ptGen = particleReso.pt();
invMassGen = RecoDecay::m(particleReso.p(), particleReso.e());
invMassGen = computeInvMassGen(particlesMc, indexRec);
}
rowHf3PrTrkMcRecReduced(indexHfCandCharm, indexCandTrBach,
flagReso, flagCharmBach,
Expand Down Expand Up @@ -961,7 +972,7 @@ struct HfDataCreatorCharmResoReduced {
if (indexRec > -1) {
auto particleReso = particlesMc.iteratorAt(indexRec);
ptGen = particleReso.pt();
invMassGen = RecoDecay::m(particleReso.p(), particleReso.e());
invMassGen = computeInvMassGen(particlesMc, indexRec);
}
rowHf2PrTrkMcRecReduced(indexHfCandCharm, indexCandTrBach,
flagReso, flagCharmBach,
Expand Down Expand Up @@ -1679,7 +1690,7 @@ struct HfDataCreatorCharmResoReduced {
origin = RecoDecay::getCharmHadronOrigin(mcParticlesPerMcColl, particle, false, &idxBhadMothers);
registry.fill(HIST("hMCGenOrigin"), origin);
auto ptParticle = particle.pt();
auto invMassGen = RecoDecay::m(particle.p(), particle.e());
auto invMassGen = computeInvMassGen(mcParticles, particle.globalIndex());
auto yParticle = RecoDecay::y(particle.pVector(), invMassGen);
auto etaParticle = particle.eta();

Expand Down
Loading