Skip to content

Commit 30a710d

Browse files
Templatization of matched MC process function so that it can be called for D0/Lc jets
1 parent 3e68e60 commit 30a710d

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎PWGJE/Tasks/hfFragmentationFunction.cxx‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "PWGJE/Core/JetDerivedDataUtilities.h"
2121
#include "PWGJE/Core/JetUtilities.h"
22+
#include "PWGJE/Core/JetHFUtilities.h"
2223
#include "PWGJE/DataModel/Jet.h"
2324
#include "PWGJE/DataModel/JetReducedData.h"
2425

@@ -442,6 +443,28 @@ struct HfFragmentationFunction {
442443
selectedAs = -1;
443444
}
444445

446+
// reflection information for storage: HF = +1, HFbar = -1, neither = 0
447+
int matchedFrom = 0;
448+
int decayChannel = 0;
449+
if (jethfutilities::isD0Table<TCandidatesMCD>()) {
450+
decayChannel = o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK;
451+
} else if (jethfutilities::isLcTable<TCandidatesMCD>()) {
452+
decayChannel = o2::hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi;
453+
}
454+
int selectedAs = 0;
455+
456+
if (mcdcand.flagMcMatchRec() == decayChannel) { // matched to HF on truth level
457+
matchedFrom = 1;
458+
} else if (mcdcand.flagMcMatchRec() == -decayChannel) { // matched to HFbar on truth level
459+
matchedFrom = -1;
460+
}
461+
// bitwise AND operation: Checks whether BIT(i) is set, regardless of other bits
462+
if (mcdcand.candidateSelFlag() & BIT(0)) { // CandidateSelFlag == BIT(0) -> selected as HF
463+
selectedAs = 1;
464+
} else if (mcdcand.candidateSelFlag() & BIT(1)) { // CandidateSelFlag == BIT(1) -> selected as HFbar
465+
selectedAs = -1;
466+
}
467+
445468
// store matched particle and detector level data in one single table (calculate angular distance in eta-phi plane on the fly)
446469
matchJetTable(jetutilities::deltaR(mcpjet, mcpcand), mcpjet.pt(), mcpjet.eta(), mcpjet.phi(), mcpjet.template tracks_as<aod::JetParticles>().size() + mcpjet.template candidates_as<TCandidatesMCP>().size(), // particle level jet
447470
mcpcand.pt(), mcpcand.eta(), mcpcand.phi(), mcpcand.y(), (mcpcand.originMcGen() == RecoDecay::OriginType::Prompt), // particle level HF

0 commit comments

Comments
 (0)