Skip to content

Commit a4b28a6

Browse files
fmazzascFrancesco Mazzaschi
andauthored
[Tutorial] ML inference task: avoid crash when running the skeleton (#13723)
Co-authored-by: Francesco Mazzaschi <fmazzasc@alipap1.cern.ch>
1 parent 405f868 commit a4b28a6

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

Tutorials/ML/applyMlSelection.cxx

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
///
1616
/// \author Fabio Catalano <fabio.catalano@cern.ch>, CERN
1717

18+
#include "PWGHF/Core/HfHelper.h"
19+
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
20+
21+
#include "Tools/ML/MlResponse.h"
22+
1823
#include "Framework/AnalysisTask.h"
1924
#include "Framework/HistogramRegistry.h"
2025
#include "Framework/runDataProcessing.h"
2126

22-
#include "Tools/ML/MlResponse.h"
23-
#include "PWGHF/Core/HfHelper.h"
24-
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
25-
2627
using namespace o2;
2728
using namespace o2::analysis;
2829
using namespace o2::framework;
@@ -113,26 +114,12 @@ struct applyMlSelection {
113114
// Retrieve model output and selection outcome
114115

115116
// Fill BDT score histograms before selection
116-
registry.fill(HIST("hPromptScoreBeforeSel"), outputMl[0]);
117117

118118
// Fill histograms for selected candidates
119-
bool isSelectedMlPiKK = true;
120-
if (isSelectedMlPiKK) {
121-
registry.fill(HIST("hMassAfterSelVsPt"), hfHelper.invMassDsToPiKK(candidate), candidate.pt());
122-
registry.fill(HIST("hPromptScoreAfterSelVsPt"), outputMl[0], candidate.pt());
123-
}
124119

125120
outputMl.clear(); // not necessary in this case but for good measure
126121

127122
// Perform ML selections for other mass hypothesis (Ds -> PhiPi -> KKPi)
128-
std::vector<float> inputFeaturesKKPi{candidate.cpa(),
129-
candidate.cpaXY(),
130-
candidate.decayLength(),
131-
candidate.decayLengthXY(),
132-
static_cast<float>(hfHelper.deltaMassPhiDsToKKPi(candidate)),
133-
candidate.impactParameterXY(),
134-
static_cast<float>(hfHelper.cos3PiKDsToKKPi(candidate)),
135-
candidate.maxNormalisedDeltaIP()};
136123

137124
// Retrieve model output and selection outcome
138125

0 commit comments

Comments
 (0)