9#include <ecl/variables/ECLCNNPIDVariables.h>
10#include <ecl/dataobjects/ECLCNNPid.h>
12#include <analysis/VariableManager/Manager.h>
13#include <analysis/dataobjects/Particle.h>
15#include <mdst/dataobjects/Track.h>
17#include <framework/logging/Logger.h>
30 double CNNPIDECLMuon(
const Particle* part)
32 auto track = part->getTrack();
33 if (!track)
return std::numeric_limits<double>::quiet_NaN();
35 const auto eclCnnMuonRelationVector = track->getRelationsWith<ECLCNNPid>();
36 if (eclCnnMuonRelationVector.size() == 0)
return std::numeric_limits<double>::quiet_NaN();
38 if (eclCnnMuonRelationVector.size() == 1) {
39 return eclCnnMuonRelationVector.object(0)->getEclCnnMuon();
41 B2FATAL(
"Somehow found more than 1 ECL CNN muon probabilities matched to the extrapolated track. This should not be possible!");
42 return std::numeric_limits<double>::quiet_NaN();
46 VARIABLE_GROUP(
"CNN PID ECL variable (cDST)");
48 REGISTER_VARIABLE(
"cnn_pid_ecl_muon", CNNPIDECLMuon,
49 R
"DOC(CNN runs over extrapolated tracks and output probabilities of pion or muon like. The variable here is muon-like probability.
50Returns NaN if CNN was not run or if the ``cnn_pid_ecl_muon`` parameter was not set.)DOC");
Abstract base class for different kinds of events.