Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
LArMvaInterface.h
Go to the documentation of this file.
1
8#ifndef LAR_MVA_INTERFACE_H
9#define LAR_MVA_INTERFACE_H 1
10
12
13#include <vector>
14
15namespace lar_content
16{
17
22{
23public:
28 {
29 public:
34
40 InitializedDouble(const double number);
41
48
54 InitializedDouble &operator=(const double number);
55
62
68 double Get() const;
69
75 bool IsInitialized() const;
76
77 private:
78 double m_number;
80 };
81
83 typedef std::vector<MvaFeature> MvaFeatureVector;
84 typedef std::map<std::string, MvaFeature> MvaFeatureMap;
85};
86
87//------------------------------------------------------------------------------------------------------------------------------------------
88
93{
94public:
102 virtual bool Classify(const MvaTypes::MvaFeatureVector &features) const = 0;
103
111 virtual double CalculateClassificationScore(const MvaTypes::MvaFeatureVector &features) const = 0;
112
120 virtual double CalculateProbability(const MvaTypes::MvaFeatureVector &features) const = 0;
121
125 virtual ~MvaInterface() = default;
126};
127
128//------------------------------------------------------------------------------------------------------------------------------------------
129//------------------------------------------------------------------------------------------------------------------------------------------
130
131inline MvaTypes::InitializedDouble::InitializedDouble() : m_number(0.), m_isInitialized(false)
132{
133}
134
135//------------------------------------------------------------------------------------------------------------------------------------------
136
137inline MvaTypes::InitializedDouble::InitializedDouble(const double number) : m_number(number), m_isInitialized(true)
138{
139}
140
141//------------------------------------------------------------------------------------------------------------------------------------------
142
144 m_number(rhs.m_number),
145 m_isInitialized(rhs.m_isInitialized)
146{
147}
148
149//------------------------------------------------------------------------------------------------------------------------------------------
150
152{
153 m_number = number;
154 m_isInitialized = true;
155
156 return *this;
157}
158
159//------------------------------------------------------------------------------------------------------------------------------------------
160
162{
163 if (this != &rhs)
164 {
165 m_number = rhs.m_number;
166 m_isInitialized = rhs.m_isInitialized;
167 }
168
169 return *this;
170}
171
172//------------------------------------------------------------------------------------------------------------------------------------------
173
175{
176 if (!m_isInitialized)
177 throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
178
179 return m_number;
180}
181
182//------------------------------------------------------------------------------------------------------------------------------------------
183
185{
186 return m_isInitialized;
187}
188
189} // namespace lar_content
190
191#endif // #ifndef LAR_MVA_INTERFACE_H
Header file for pandora input types and associated external typedefs exposed via the PandoraApi.
MvaInterface class.
virtual double CalculateClassificationScore(const MvaTypes::MvaFeatureVector &features) const =0
Calculate the classification score for a set of input features, based on the trained model.
virtual bool Classify(const MvaTypes::MvaFeatureVector &features) const =0
Classify the set of input features based on the trained model.
virtual double CalculateProbability(const MvaTypes::MvaFeatureVector &features) const =0
Calculate the classification probability for a set of input features, based on the trained model.
virtual ~MvaInterface()=default
Destructor.
InitializedDouble class used to define mva features.
bool m_isInitialized
Whether the number has been initialized.
bool IsInitialized() const
Check number has been initialized.
double m_number
Number held by class.
InitializedDouble & operator=(const double number)
Assignment operator.
double Get() const
Get number held in class.
StatusCodeException class.
InitializedDouble MvaFeature
std::vector< MvaFeature > MvaFeatureVector
std::map< std::string, MvaFeature > MvaFeatureMap