Skip to content

Commit 1aece1a

Browse files
Templatization of matched MC process function so that it can be called for D0/Lc jets
1 parent f6d7879 commit 1aece1a

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
@@ -21,6 +21,7 @@
2121
#include "PWGJE/Core/JetDerivedDataUtilities.h"
2222
#include "PWGJE/Core/JetHFUtilities.h"
2323
#include "PWGJE/Core/JetUtilities.h"
24+
#include "PWGJE/Core/JetHFUtilities.h"
2425
#include "PWGJE/DataModel/Jet.h"
2526
#include "PWGJE/DataModel/JetReducedData.h"
2627

@@ -464,6 +465,28 @@ struct HfFragmentationFunction {
464465
selectedAs = -1;
465466
}
466467

468+
// reflection information for storage: HF = +1, HFbar = -1, neither = 0
469+
int matchedFrom = 0;
470+
int decayChannel = 0;
471+
if (jethfutilities::isD0Table<TCandidatesMCD>()) {
472+
decayChannel = o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK;
473+
} else if (jethfutilities::isLcTable<TCandidatesMCD>()) {
474+
decayChannel = o2::hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi;
475+
}
476+
int selectedAs = 0;
477+
478+
if (mcdcand.flagMcMatchRec() == decayChannel) { // matched to HF on truth level
479+
matchedFrom = 1;
480+
} else if (mcdcand.flagMcMatchRec() == -decayChannel) { // matched to HFbar on truth level
481+
matchedFrom = -1;
482+
}
483+
// bitwise AND operation: Checks whether BIT(i) is set, regardless of other bits
484+
if (mcdcand.candidateSelFlag() & BIT(0)) { // CandidateSelFlag == BIT(0) -> selected as HF
485+
selectedAs = 1;
486+
} else if (mcdcand.candidateSelFlag() & BIT(1)) { // CandidateSelFlag == BIT(1) -> selected as HFbar
487+
selectedAs = -1;
488+
}
489+
467490
// store matched particle and detector level data in one single table (calculate angular distance in eta-phi plane on the fly)
468491
matchJetTable(jetutilities::deltaR(mcpjet, mcpcand), mcpjet.pt(), mcpjet.eta(), mcpjet.phi(), mcpjet.template tracks_as<aod::JetParticles>().size(), // particle level jet
469492
mcpcand.pt(), mcpcand.eta(), mcpcand.phi(), mcpcand.y(), (mcpcand.originMcGen() == RecoDecay::OriginType::Prompt), // particle level HF

0 commit comments

Comments
 (0)