Skip to content

Commit 38b58de

Browse files
committed
style: Fix workflow name to pidFeatureExtractor and use UpperCamelCase for constants
1 parent 80c5a41 commit 38b58de

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

Tools/PIDFeatureExtractor/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# granted to it by virtue of its status as an Intergovernmental Organization
1010
# or submit itself to any jurisdiction.
1111

12-
o2physics_add_dpl_workflow(pid-feature-extractor
12+
o2physics_add_dpl_workflow(pidFeatureExtractor
1313
SOURCES PIDFeatureExtractor.cxx
1414
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
15-
COMPONENT_NAME Analysis)
15+
COMPONENT_NAME Analysis)

Tools/PIDFeatureExtractor/PIDFeatureExtractor.cxx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@ struct PIDFeatureExtractor {
153153
// ============================================================================
154154
// CONSTANTS
155155
// ============================================================================
156-
static constexpr int kNumSpecies = 4;
157-
static constexpr float kPriorPi = 1.0f;
158-
static constexpr float kPriorKa = 0.2f;
159-
static constexpr float kPriorPr = 0.1f;
160-
static constexpr float kPriorEl = 0.05f;
161-
static constexpr float kSentinelValue = -999.0f;
156+
static constexpr int KNumSpecies = 4;
157+
static constexpr float KPriorPi = 1.0f;
158+
static constexpr float KPriorKa = 0.2f;
159+
static constexpr float KPriorPr = 0.1f;
160+
static constexpr float KPriorEl = 0.05f;
161+
static constexpr float KSentinelValue = -999.0f;
162162

163163
// ============================================================================
164164
// INITIALIZATION FUNCTION
@@ -254,18 +254,18 @@ struct PIDFeatureExtractor {
254254
// BAYESIAN PID CALCULATION FUNCTION
255255
// ============================================================================
256256
/// Compute Bayesian probabilities combining TPC and TOF information
257-
void computeBayesianPID(const float nsTPC[kNumSpecies], const float nsTOF[kNumSpecies], const float pri[kNumSpecies], float out[kNumSpecies]) {
257+
void computeBayesianPID(const float nsTPC[KNumSpecies], const float nsTOF[KNumSpecies], const float pri[KNumSpecies], float out[KNumSpecies]) {
258258
float sum = 0;
259259

260-
for (int i = 0; i < kNumSpecies; i++) {
260+
for (int i = 0; i < KNumSpecies; i++) {
261261
float l = std::exp(-0.5f * (nsTPC[i]*nsTPC[i] +
262262
(std::isfinite(nsTOF[i]) ? nsTOF[i]*nsTOF[i] : 0.0f)));
263263

264264
out[i] = l * pri[i];
265265
sum += out[i];
266266
}
267267

268-
for (int i = 0; i < kNumSpecies; i++) {
268+
for (int i = 0; i < KNumSpecies; i++) {
269269
out[i] = sum > 0 ? out[i] / sum : 0.0f;
270270
}
271271
}
@@ -322,9 +322,9 @@ struct PIDFeatureExtractor {
322322
tpcNclusters = t.tpcNClsFound();
323323
tpcChi2 = t.tpcChi2NCl();
324324
} else {
325-
tpcSignal = tpcNsigmaPi = tpcNsigmaKa = tpcNsigmaPr = tpcNsigmaEl = kSentinelValue;
325+
tpcSignal = tpcNsigmaPi = tpcNsigmaKa = tpcNsigmaPr = tpcNsigmaEl = KSentinelValue;
326326
tpcNclusters = 0;
327-
tpcChi2 = kSentinelValue;
327+
tpcChi2 = KSentinelValue;
328328
}
329329

330330
// TOF info
@@ -337,19 +337,19 @@ struct PIDFeatureExtractor {
337337
tofNsigmaPr = t.tofNSigmaPr();
338338
tofNsigmaEl = t.tofNSigmaEl();
339339
} else {
340-
tofBeta = tofMass = kSentinelValue;
341-
tofNsigmaPi = tofNsigmaKa = tofNsigmaPr = tofNsigmaEl = kSentinelValue;
340+
tofBeta = tofMass = KSentinelValue;
341+
tofNsigmaPi = tofNsigmaKa = tofNsigmaPr = tofNsigmaEl = KSentinelValue;
342342
}
343343

344344
// Impact parameters
345345
dcaXy = t.dcaXY();
346346
dcaZ = t.dcaZ();
347347

348348
// Bayesian PID calculation
349-
float arrTPC[kNumSpecies] = {tpcNsigmaPi, tpcNsigmaKa, tpcNsigmaPr, tpcNsigmaEl};
350-
float arrTOF[kNumSpecies] = {tofNsigmaPi, tofNsigmaKa, tofNsigmaPr, tofNsigmaEl};
351-
float priors[kNumSpecies] = {kPriorPi, kPriorKa, kPriorPr, kPriorEl};
352-
float probs[kNumSpecies];
349+
float arrTPC[KNumSpecies] = {tpcNsigmaPi, tpcNsigmaKa, tpcNsigmaPr, tpcNsigmaEl};
350+
float arrTOF[KNumSpecies] = {tofNsigmaPi, tofNsigmaKa, tofNsigmaPr, tofNsigmaEl};
351+
float priors[KNumSpecies] = {KPriorPi, KPriorKa, KPriorPr, KPriorEl};
352+
float probs[KNumSpecies];
353353

354354
computeBayesianPID(arrTPC, arrTOF, priors, probs);
355355
bayesProbPi = probs[0];

0 commit comments

Comments
 (0)