Skip to content

Commit c411013

Browse files
committed
code-check
1 parent c024fc4 commit c411013

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

PWGHF/D2H/TableProducer/mlBasedTrackSelector.cxx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,17 @@
5656
#include <ReconstructionDataFormats/Track.h>
5757
#include <ReconstructionDataFormats/Vertex.h>
5858

59+
#include <TH1.h>
60+
5961
#include <Rtypes.h>
6062

6163
#include <algorithm>
6264
#include <array>
6365
#include <chrono>
6466
#include <cmath>
67+
#include <cstddef>
6568
#include <cstdint>
66-
#include <numeric>
69+
#include <iterator>
6770
#include <string>
6871
#include <vector>
6972

@@ -115,9 +118,10 @@ constexpr int NProngs = 3; // prongs of the candidates built here
115118
constexpr int NMassHypos = 2; // mass hypotheses per channel, i.e. the two orderings of the same-sign pair
116119

117120
/// Whether each prong is a kaon, per channel and mass hypothesis.
118-
constexpr bool IsKaonProng[NChannels3Prong][NMassHypos][NProngs] = {
119-
{{false, true, false}, {false, true, false}},
120-
{{true, true, false}, {false, true, true}}};
121+
constexpr std::array<std::array<std::array<bool, NProngs>, NMassHypos>, NChannels3Prong> IsKaonProng{{
122+
{{{{false, true, false}}, {{false, true, false}}}},
123+
{{{{true, true, false}}, {{false, true, true}}}},
124+
}};
121125

122126
constexpr double PtMaxModel = 1.e10;
123127

@@ -180,8 +184,8 @@ struct HfTrackSelectorTagSelCollisions {
180184

181185
void init(InitContext const&)
182186
{
183-
const std::array<int, 7> doProcess = {doprocessTrigAndCentFT0ASel, doprocessTrigAndCentFT0CSel, doprocessTrigAndCentFT0MSel, doprocessTrigAndCentFV0ASel, doprocessTrigSel, doprocessNoTrigSel, doprocessUpcSel};
184-
if (std::accumulate(doProcess.begin(), doProcess.end(), 0) != 1) {
187+
const std::array<bool, 7> doProcess = {doprocessTrigAndCentFT0ASel, doprocessTrigAndCentFT0CSel, doprocessTrigAndCentFT0MSel, doprocessTrigAndCentFV0ASel, doprocessTrigSel, doprocessNoTrigSel, doprocessUpcSel};
188+
if (std::count(doProcess.begin(), doProcess.end(), true) != 1) {
185189
LOGP(fatal, "One and only one process function for collision selection can be enabled at a time!");
186190
}
187191

@@ -420,8 +424,8 @@ struct HfTrackSelectorTagSelTracks {
420424
LOGF(fatal, "ml-based-track-selector is for test only, please do not use for analysis. If you are aware of what you are doing, set testAcknowledgement to true in the configuration.");
421425
}
422426

423-
const std::array<int, 2> doProcess = {doprocessTracks, doprocessTracksWithCentFT0C};
424-
if (std::accumulate(doProcess.begin(), doProcess.end(), 0) != 1) {
427+
const std::array<bool, 2> doProcess = {doprocessTracks, doprocessTracksWithCentFT0C};
428+
if (std::count(doProcess.begin(), doProcess.end(), true) != 1) {
425429
LOGP(fatal, "One and only one process function of HfTrackSelectorTagSelTracks can be enabled at a time!");
426430
}
427431

@@ -985,7 +989,7 @@ struct HfMlBasedTrackSelector {
985989
const double minMass = cut3Prong[iChannel].get(binPt, 0u);
986990
const double maxMass = cut3Prong[iChannel].get(binPt, 1u);
987991
if (minMass >= 0. && maxMass > 0.) {
988-
double massHypos[2] = {0., 0.};
992+
std::array<double, 2> massHypos = {0., 0.};
989993
const std::array arrMom{pVecTrack0, pVecTrack1, pVecTrack2};
990994
const double min2 = minMass * minMass;
991995
const double max2 = maxMass * maxMass;
@@ -1100,7 +1104,7 @@ struct HfMlBasedTrackSelector {
11001104
const int64_t globalIndex0, const int64_t globalIndex1, const int64_t globalIndex2)
11011105
{
11021106
uint32_t isSelected3ProngCand = BIT(NChannels3Prong) - 1;
1103-
std::array<int, NChannels3Prong> whichHypo3Prong;
1107+
std::array<int, NChannels3Prong> whichHypo3Prong{};
11041108
whichHypo3Prong.fill(BIT(NMassHypos) - 1); // all mass hypotheses alive
11051109

11061110
applyMlRoleSelection(isIdentifiedPid0, isIdentifiedPid1, isIdentifiedPid2, whichHypo3Prong, isSelected3ProngCand);

0 commit comments

Comments
 (0)