Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions Tutorials/ML/applyMlSelection.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2025 CERN and copyright holders of ALICE O2.

Check failure on line 1 in Tutorials/ML/applyMlSelection.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -15,14 +15,15 @@
///
/// \author Fabio Catalano <fabio.catalano@cern.ch>, CERN

#include "PWGHF/Core/HfHelper.h"
#include "PWGHF/DataModel/CandidateReconstructionTables.h"

#include "Tools/ML/MlResponse.h"

#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/runDataProcessing.h"

#include "Tools/ML/MlResponse.h"
#include "PWGHF/Core/HfHelper.h"
#include "PWGHF/DataModel/CandidateReconstructionTables.h"

using namespace o2;
using namespace o2::analysis;
using namespace o2::framework;
Expand Down Expand Up @@ -81,7 +82,7 @@
for (const auto& candidate : candidates) {

nCandidates++;
if (nCandidates % 1000 == 0) {

Check failure on line 85 in Tutorials/ML/applyMlSelection.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
LOG(info) << "Candidates processed: " << nCandidates;
}

Expand Down Expand Up @@ -113,26 +114,12 @@
// Retrieve model output and selection outcome

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

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

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

// Perform ML selections for other mass hypothesis (Ds -> PhiPi -> KKPi)
std::vector<float> inputFeaturesKKPi{candidate.cpa(),
candidate.cpaXY(),
candidate.decayLength(),
candidate.decayLengthXY(),
static_cast<float>(hfHelper.deltaMassPhiDsToKKPi(candidate)),
candidate.impactParameterXY(),
static_cast<float>(hfHelper.cos3PiKDsToKKPi(candidate)),
candidate.maxNormalisedDeltaIP()};

// Retrieve model output and selection outcome

Expand Down
Loading