Skip to content

Commit 6cef4e6

Browse files
minjungkim12claude
andcommitted
Add Filter for D0 hfflag check similar to taskDplus
Following the pattern used in taskDplus, add a Filter to automatically filter D0 candidates by decay type flag at the framework level. Changes: 1. Add Filter filterD0Flag to check hfflag for D0ToPiK decay type 2. Wrap all D0 candidate types with soa::Filtered<> to apply the filter 3. Remove manual hfflag check in UPC process loop (now redundant) This ensures the hfflag filtering is applied consistently across all process functions and removes the need for manual checks in loops. The Filter is placed after using declarations and before Preslice declarations, following PWGHF struct member ordering guidelines. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8a5cfda commit 6cef4e6

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

PWGHF/D2H/Tasks/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ o2physics_add_dpl_workflow(task-charm-reso-to-d-trk-reduced
7171

7272
o2physics_add_dpl_workflow(task-d0
7373
SOURCES taskD0.cxx
74-
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::SGCutParHolder O2Physics::EventFilteringUtils
74+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB
7575
COMPONENT_NAME Analysis)
7676

7777
o2physics_add_dpl_workflow(task-directed-flow-charm-hadrons
@@ -81,7 +81,7 @@ o2physics_add_dpl_workflow(task-directed-flow-charm-hadrons
8181

8282
o2physics_add_dpl_workflow(task-dplus
8383
SOURCES taskDplus.cxx
84-
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::SGCutParHolder O2Physics::EventFilteringUtils
84+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
8585
COMPONENT_NAME Analysis)
8686

8787
o2physics_add_dpl_workflow(task-ds

PWGHF/D2H/Tasks/taskD0.cxx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,24 @@ struct HfTaskD0 {
110110
SliceCache cache;
111111
Service<o2::ccdb::BasicCCDBManager> ccdb;
112112

113-
using D0Candidates = soa::Join<aod::HfCand2Prong, aod::HfSelD0>;
114-
using D0CandidatesMc = soa::Join<D0Candidates, aod::HfCand2ProngMcRec>;
115-
using D0CandidatesKF = soa::Join<D0Candidates, aod::HfCand2ProngKF>;
116-
using D0CandidatesMcKF = soa::Join<D0CandidatesKF, aod::HfCand2ProngMcRec>;
113+
using D0Candidates = soa::Filtered<soa::Join<aod::HfCand2Prong, aod::HfSelD0>>;
114+
using D0CandidatesMc = soa::Filtered<soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfCand2ProngMcRec>>;
115+
using D0CandidatesKF = soa::Filtered<soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfCand2ProngKF>>;
116+
using D0CandidatesMcKF = soa::Filtered<soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfCand2ProngKF, aod::HfCand2ProngMcRec>>;
117117

118-
using D0CandidatesMl = soa::Join<D0Candidates, aod::HfMlD0>;
119-
using D0CandidatesMlMc = soa::Join<D0CandidatesMl, aod::HfCand2ProngMcRec>;
120-
using D0CandidatesMlKF = soa::Join<D0CandidatesMl, aod::HfCand2ProngKF>;
121-
using D0CandidatesMlMcKF = soa::Join<D0CandidatesMlKF, aod::HfCand2ProngMcRec>;
118+
using D0CandidatesMl = soa::Filtered<soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfMlD0>>;
119+
using D0CandidatesMlMc = soa::Filtered<soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfMlD0, aod::HfCand2ProngMcRec>>;
120+
using D0CandidatesMlKF = soa::Filtered<soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfMlD0, aod::HfCand2ProngKF>>;
121+
using D0CandidatesMlMcKF = soa::Filtered<soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfMlD0, aod::HfCand2ProngKF, aod::HfCand2ProngMcRec>>;
122122

123123
using Collisions = soa::Join<aod::Collisions, aod::EvSels>;
124124
using CollisionsCent = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Ms, aod::CentFT0Cs>;
125125
using CollisionsWithMcLabels = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels>;
126126
using CollisionsWithMcLabelsCent = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels, aod::CentFT0Ms, aod::CentFT0Cs>;
127127
using TracksSelQuality = soa::Join<aod::TracksExtra, aod::TracksWMc>;
128128

129+
Filter filterD0Flag = (o2::aod::hf_track_index::hfflag & static_cast<uint8_t>(BIT(aod::hf_cand_2prong::DecayType::D0ToPiK))) != static_cast<uint8_t>(0);
130+
129131
Preslice<aod::HfCand2Prong> candD0PerCollision = aod::hf_cand::collisionId;
130132
PresliceUnsorted<CollisionsWithMcLabels> colPerMcCollision = aod::mccollisionlabel::mcCollisionId;
131133
PresliceUnsorted<CollisionsWithMcLabelsCent> colPerMcCollisionCent = aod::mccollisionlabel::mcCollisionId;
@@ -600,9 +602,6 @@ struct HfTaskD0 {
600602
float occ{-1.f};
601603

602604
for (const auto& candidate : groupedD0Candidates) {
603-
if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) {
604-
continue;
605-
}
606605
if (yCandRecoMax >= 0. && std::abs(HfHelper::yD0(candidate)) > yCandRecoMax) {
607606
continue;
608607
}

0 commit comments

Comments
 (0)