Skip to content

Commit 8a5cfda

Browse files
minjungkim12claude
andcommitted
Remove HfHelper instance and use static methods directly
As pointed out in code review, HfHelper methods are static and don't require an instance. This change: 1. Removes HfHelper instance variable from both taskD0 and taskDplus 2. Changes all method calls from `hfHelper.method()` to `HfHelper::method()` This is more efficient as it avoids unnecessary object instantiation for methods that don't need instance state. Changes: - taskD0.cxx: Remove hfHelper instance, update 5 method calls - taskDplus.cxx: Remove hfHelper instance, update 2 method calls 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3af7f8f commit 8a5cfda

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

PWGHF/D2H/Tasks/taskD0.cxx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ struct HfTaskD0 {
105105

106106
HfEventSelection hfEvSel; // event selection and monitoring
107107

108-
HfHelper hfHelper;
109108
ctpRateFetcher mRateFetcher;
110109

111110
SliceCache cache;
@@ -604,12 +603,12 @@ struct HfTaskD0 {
604603
if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) {
605604
continue;
606605
}
607-
if (yCandRecoMax >= 0. && std::abs(hfHelper.yD0(candidate)) > yCandRecoMax) {
606+
if (yCandRecoMax >= 0. && std::abs(HfHelper::yD0(candidate)) > yCandRecoMax) {
608607
continue;
609608
}
610609

611-
float massD0 = hfHelper.invMassD0ToPiK(candidate);
612-
float massD0bar = hfHelper.invMassD0barToKPi(candidate);
610+
float massD0 = HfHelper::invMassD0ToPiK(candidate);
611+
float massD0bar = HfHelper::invMassD0barToKPi(candidate);
613612
auto ptCandidate = candidate.pt();
614613

615614
if (candidate.isSelD0() >= selectionFlagD0) {
@@ -628,7 +627,7 @@ struct HfTaskD0 {
628627
auto fillTHnData = [&](float mass, int d0Type) {
629628
std::vector<double> valuesToFill{static_cast<double>(mass), static_cast<double>(ptCandidate),
630629
candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2],
631-
static_cast<double>(hfHelper.yD0(candidate)), static_cast<double>(d0Type)};
630+
static_cast<double>(HfHelper::yD0(candidate)), static_cast<double>(d0Type)};
632631
if (storeCentrality) {
633632
valuesToFill.push_back(centrality);
634633
}
@@ -652,7 +651,7 @@ struct HfTaskD0 {
652651
} else {
653652
auto fillTHnData = [&](float mass, int d0Type) {
654653
std::vector<double> valuesToFill{static_cast<double>(mass), static_cast<double>(ptCandidate),
655-
static_cast<double>(hfHelper.yD0(candidate)), static_cast<double>(d0Type)};
654+
static_cast<double>(HfHelper::yD0(candidate)), static_cast<double>(d0Type)};
656655
if (storeCentrality) {
657656
valuesToFill.push_back(centrality);
658657
}

PWGHF/D2H/Tasks/taskDplus.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ struct HfTaskDplus {
9191

9292
HfEventSelection hfEvSel; // event selection and monitoring
9393

94-
HfHelper hfHelper;
9594
Service<o2::ccdb::BasicCCDBManager> ccdb;
9695

9796
using CandDplusData = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDplusToPiKPi>>;
@@ -735,7 +734,7 @@ struct HfTaskDplus {
735734
int const gapTypeInt = hf_upc::gapTypeToInt(gap);
736735

737736
for (const auto& candidate : groupedDplusCandidates) {
738-
if ((yCandRecoMax >= 0. && std::abs(hfHelper.yDplus(candidate)) > yCandRecoMax)) {
737+
if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) {
739738
continue;
740739
}
741740
fillHisto(candidate);
@@ -746,7 +745,7 @@ struct HfTaskDplus {
746745
outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)];
747746
}
748747

749-
std::vector<double> valuesToFill{hfHelper.invMassDplusToPiKPi(candidate), static_cast<double>(candidate.pt()), outputMl[0], outputMl[1], outputMl[2]};
748+
std::vector<double> valuesToFill{HfHelper::invMassDplusToPiKPi(candidate), static_cast<double>(candidate.pt()), outputMl[0], outputMl[1], outputMl[2]};
750749
if (storeCentrality) {
751750
valuesToFill.push_back(cent);
752751
}

0 commit comments

Comments
 (0)