Skip to content

Commit 488109c

Browse files
minjungkim12claude
andcommitted
Refactor UPC gap determination thresholds using ConfigurableGroup
- Add HfUpcGapThresholds ConfigurableGroup in utilsUpcHf.h - Includes fv0aThreshold, ft0aThreshold, ft0cThreshold, zdcThreshold - Enables reusability across multiple HF tasks - Uses "upc" as JSON group name prefix - Add determineGapType() overload accepting HfUpcGapThresholds - Simplifies function calls by passing threshold group directly - Improves code readability and maintainability - Replace individual Configurables in taskD0.cxx and taskDplus.cxx - Remove 4 separate threshold Configurables per task - Replace with single HfUpcGapThresholds member - Simplify determineGapType() calls from 3 parameters to 1 - Update thnConfigAxisGapType description to reference TrueGap enum - Change from hardcoded values to enum reference - Improves documentation clarity 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2f23121 commit 488109c

File tree

3 files changed

+40
-21
lines changed

3 files changed

+40
-21
lines changed

PWGHF/D2H/Tasks/taskD0.cxx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,8 @@ struct HfTaskD0 {
9696
Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
9797
Configurable<std::string> irSource{"irSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
9898

99-
// UPC gap determination thresholds
100-
Configurable<float> upcFV0AThreshold{"upcFV0AThreshold", 100.0f, "FV0-A amplitude threshold for UPC gap determination (a.u.)"};
101-
Configurable<float> upcFT0AThreshold{"upcFT0AThreshold", 100.0f, "FT0-A amplitude threshold for UPC gap determination (a.u.)"};
102-
Configurable<float> upcFT0CThreshold{"upcFT0CThreshold", 50.0f, "FT0-C amplitude threshold for UPC gap determination (a.u.)"};
103-
Configurable<float> upcZDCThreshold{"upcZDCThreshold", 1.0f, "ZDC energy threshold for UPC gap determination (a.u.)"};
104-
105-
HfEventSelection hfEvSel; // event selection and monitoring
99+
HfEventSelection hfEvSel; // event selection and monitoring
100+
HfUpcGapThresholds upcThresholds; // UPC gap determination thresholds
106101
ctpRateFetcher mRateFetcher;
107102

108103
SliceCache cache;
@@ -158,7 +153,7 @@ struct HfTaskD0 {
158153
ConfigurableAxis thnConfigAxisMinItsNCls{"thnConfigAxisMinItsNCls", {5, 3, 8}, "axis for minimum ITS NCls of candidate prongs"};
159154
ConfigurableAxis thnConfigAxisMinTpcNCrossedRows{"thnConfigAxisMinTpcNCrossedRows", {10, 70, 180}, "axis for minimum TPC NCls crossed rows of candidate prongs"};
160155
ConfigurableAxis thnConfigAxisIR{"thnConfigAxisIR", {5000, 0, 500}, "Interaction rate (kHz)"};
161-
ConfigurableAxis thnConfigAxisGapType{"thnConfigAxisGapType", {7, -1.5, 5.5}, "axis for UPC gap type (-1=NoGap, 0=SingleGapA, 1=SingleGapC, 2=DoubleGap, 3=NoUpc, 4=TrkOutOfRange, 5=BadDoubleGap)"};
156+
ConfigurableAxis thnConfigAxisGapType{"thnConfigAxisGapType", {7, -1.5, 5.5}, "axis for UPC gap type (see TrueGap enum in o2::aod::sgselector)"};
162157
ConfigurableAxis thnConfigAxisFT0{"thnConfigAxisFT0", {1001, -1.5, 999.5}, "axis for FT0 amplitude (a.u.)"};
163158
ConfigurableAxis thnConfigAxisFV0A{"thnConfigAxisFV0A", {2001, -1.5, 1999.5}, "axis for FV0-A amplitude (a.u.)"};
164159
ConfigurableAxis thnConfigAxisFDD{"thnConfigAxisFDD", {200, 0., 4000.}, "axis for FDD amplitude (a.u.)"};
@@ -589,8 +584,7 @@ struct HfTaskD0 {
589584
auto bc = collision.template bc_as<BCsType>();
590585

591586
// Determine gap type using SGSelector with BC range checking
592-
const auto gapResult = hf_upc::determineGapType(collision, bcs,
593-
upcFV0AThreshold, upcFT0AThreshold, upcFT0CThreshold);
587+
const auto gapResult = hf_upc::determineGapType(collision, bcs, upcThresholds);
594588
const int gap = gapResult.value;
595589

596590
// Use the BC with FIT activity if available from SGSelector

PWGHF/D2H/Tasks/taskDplus.cxx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,9 @@ struct HfTaskDplus {
8686
Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
8787
Configurable<std::string> irSource{"irSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
8888

89-
// UPC gap determination thresholds
90-
Configurable<float> upcFV0AThreshold{"upcFV0AThreshold", 100.0f, "FV0-A amplitude threshold for UPC gap determination (a.u.)"};
91-
Configurable<float> upcFT0AThreshold{"upcFT0AThreshold", 100.0f, "FT0-A amplitude threshold for UPC gap determination (a.u.)"};
92-
Configurable<float> upcFT0CThreshold{"upcFT0CThreshold", 50.0f, "FT0-C amplitude threshold for UPC gap determination (a.u.)"};
93-
Configurable<float> upcZDCThreshold{"upcZDCThreshold", 1.0f, "ZDC energy threshold for UPC gap determination (a.u.)"};
94-
95-
HfEventSelection hfEvSel; // event selection and monitoring
96-
ctpRateFetcher mRateFetcher; // interaction rate fetcher
89+
HfEventSelection hfEvSel; // event selection and monitoring
90+
HfUpcGapThresholds upcThresholds; // UPC gap determination thresholds
91+
ctpRateFetcher mRateFetcher; // interaction rate fetcher
9792

9893
Service<o2::ccdb::BasicCCDBManager> ccdb;
9994

@@ -134,7 +129,7 @@ struct HfTaskDplus {
134129
ConfigurableAxis thnConfigAxisMlScore0{"thnConfigAxisMlScore0", {100, 0., 1.}, "axis for ML output score 0"};
135130
ConfigurableAxis thnConfigAxisMlScore1{"thnConfigAxisMlScore1", {100, 0., 1.}, "axis for ML output score 1"};
136131
ConfigurableAxis thnConfigAxisMlScore2{"thnConfigAxisMlScore2", {100, 0., 1.}, "axis for ML output score 2"};
137-
ConfigurableAxis thnConfigAxisGapType{"thnConfigAxisGapType", {7, -1.5, 5.5}, "axis for UPC gap type (-1=NoGap, 0=SingleGapA, 1=SingleGapC, 2=DoubleGap, 3=NoUpc, 4=TrkOutOfRange, 5=BadDoubleGap)"};
132+
ConfigurableAxis thnConfigAxisGapType{"thnConfigAxisGapType", {7, -1.5, 5.5}, "axis for UPC gap type (see TrueGap enum in o2::aod::sgselector)"};
138133
ConfigurableAxis thnConfigAxisFT0{"thnConfigAxisFT0", {1001, -1.5, 999.5}, "axis for FT0 amplitude (a.u.)"};
139134
ConfigurableAxis thnConfigAxisFV0A{"thnConfigAxisFV0A", {2001, -1.5, 1999.5}, "axis for FV0-A amplitude (a.u.)"};
140135
ConfigurableAxis thnConfigAxisFDD{"thnConfigAxisFDD", {200, 0., 4000.}, "axis for FDD amplitude (a.u.)"};
@@ -726,8 +721,7 @@ struct HfTaskDplus {
726721
auto bc = collision.template bc_as<BCsType>();
727722

728723
// Determine gap type using SGSelector with BC range checking
729-
const auto gapResult = hf_upc::determineGapType(collision, bcs,
730-
upcFV0AThreshold, upcFT0AThreshold, upcFT0CThreshold);
724+
const auto gapResult = hf_upc::determineGapType(collision, bcs, upcThresholds);
731725
const int gap = gapResult.value;
732726

733727
// Use the BC with FIT activity if available from SGSelector

PWGHF/Utils/utilsUpcHf.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,25 @@
2121
#include "PWGUD/Core/SGSelector.h"
2222
#include "PWGUD/Core/UDHelpers.h"
2323

24+
#include <Framework/Configurable.h>
25+
26+
#include <string>
27+
2428
namespace o2::analysis::hf_upc
2529
{
2630

2731
/// \brief Use TrueGap enum from SGSelector for gap type classification
2832
using o2::aod::sgselector::TrueGap;
2933

34+
/// \brief Configurable group for UPC gap determination thresholds
35+
struct HfUpcGapThresholds : o2::framework::ConfigurableGroup {
36+
std::string prefix = "upc"; // JSON group name
37+
o2::framework::Configurable<float> fv0aThreshold{"fv0aThreshold", 100.0f, "FV0-A amplitude threshold for UPC gap determination (a.u.)"};
38+
o2::framework::Configurable<float> ft0aThreshold{"ft0aThreshold", 100.0f, "FT0-A amplitude threshold for UPC gap determination (a.u.)"};
39+
o2::framework::Configurable<float> ft0cThreshold{"ft0cThreshold", 50.0f, "FT0-C amplitude threshold for UPC gap determination (a.u.)"};
40+
o2::framework::Configurable<float> zdcThreshold{"zdcThreshold", 1.0f, "ZDC energy threshold for UPC gap determination (a.u.)"};
41+
};
42+
3043
/// \brief Default thresholds for gap determination
3144
namespace defaults
3245
{
@@ -81,6 +94,24 @@ inline auto determineGapType(TCollision const& collision,
8194
return sgResult;
8295
}
8396

97+
/// \brief Determine gap type using SGSelector with BC range checking and HfUpcGapThresholds
98+
/// \tparam TCollision Collision type
99+
/// \tparam TBCs BC table type
100+
/// \param collision Collision object
101+
/// \param bcs BC table
102+
/// \param thresholds HfUpcGapThresholds object containing all UPC thresholds
103+
/// \return SelectionResult with gap type value and BC pointer
104+
template <typename TCollision, typename TBCs>
105+
inline auto determineGapType(TCollision const& collision,
106+
TBCs const& bcs,
107+
HfUpcGapThresholds const& thresholds)
108+
{
109+
return determineGapType(collision, bcs,
110+
thresholds.fv0aThreshold.value,
111+
thresholds.ft0aThreshold.value,
112+
thresholds.ft0cThreshold.value);
113+
}
114+
84115
/// \brief Check if the gap type is a single-sided gap (SingleGapA or SingleGapC)
85116
/// \param gap TrueGap enum value
86117
/// \return true if single-sided gap, false otherwise

0 commit comments

Comments
 (0)