LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
LArMvaInterface.h
Go to the documentation of this file.
1 
8 #ifndef LAR_MVA_INTERFACE_H
9 #define LAR_MVA_INTERFACE_H 1
10 
11 #include "Pandora/PandoraInputTypes.h"
12 
13 #include <vector>
14 
15 namespace lar_content
16 {
17 
21 class MvaTypes
22 {
23 public:
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 };
85 
86 //------------------------------------------------------------------------------------------------------------------------------------------
87 
92 {
93 public:
101  virtual bool Classify(const MvaTypes::MvaFeatureVector &features) const = 0;
102 
110  virtual double CalculateClassificationScore(const MvaTypes::MvaFeatureVector &features) const = 0;
111 
119  virtual double CalculateProbability(const MvaTypes::MvaFeatureVector &features) const = 0;
120 
124  virtual ~MvaInterface() = default;
125 };
126 
127 //------------------------------------------------------------------------------------------------------------------------------------------
128 //------------------------------------------------------------------------------------------------------------------------------------------
129 
131  m_number(0.),
132  m_isInitialized(false)
133 {
134 }
135 
136 //------------------------------------------------------------------------------------------------------------------------------------------
137 
139  m_number(number),
140  m_isInitialized(true)
141 {
142 }
143 
144 //------------------------------------------------------------------------------------------------------------------------------------------
145 
147  m_number(rhs.m_number),
149 {
150 }
151 
152 //------------------------------------------------------------------------------------------------------------------------------------------
153 
155 {
156  m_number = number;
157  m_isInitialized = true;
158 
159  return *this;
160 }
161 
162 //------------------------------------------------------------------------------------------------------------------------------------------
163 
165 {
166  if (this != &rhs)
167  {
168  m_number = rhs.m_number;
170  }
171 
172  return *this;
173 }
174 
175 //------------------------------------------------------------------------------------------------------------------------------------------
176 
177 inline double MvaTypes::InitializedDouble::Get() const
178 {
179  if (!m_isInitialized)
180  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
181 
182  return m_number;
183 }
184 
185 //------------------------------------------------------------------------------------------------------------------------------------------
186 
188 {
189  return m_isInitialized;
190 }
191 
192 } // namespace lar_content
193 
194 #endif // #ifndef LAR_MVA_INTERFACE_H
double Get() const
Get number held in class.
bool IsInitialized() const
Check number has been initialized.
MvaInterface class.
InitializedDouble class used to define mva features.
bool m_isInitialized
Whether the number has been initialized.
double m_number
Number held by class.
MvaTypes class.
InitializedDouble MvaFeature
InitializedDouble & operator=(const double number)
Assignment operator.
std::vector< MvaFeature > MvaFeatureVector