PandaRoot
PndMvaClassifier.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 /* **********************************************
14  * MVA classifiers interface. *
15  * Author: M.Babai@rug.nl *
16  * LICENSE: *
17  * Version: *
18  * License: *
19  * **********************************************
20  */
21 //#pragma once
22 #ifndef PND_MVA_CLASSIFIER_H
23 #define PND_MVA_CLASSIFIER_H
24 
25 // C++ includes
26 #include <iostream>
27 #include <vector>
28 #include <map>
29 #include <utility>
30 #include <algorithm>
31 #include <cmath>
32 #include <cassert>
33 
34 // PND PID includes.
35 #include "PndMvaDataSet.h"
36 #include "PndMvaUtil.h"
37 
42  public:
44 
49  explicit PndMvaClassifier(std::string const &InPut, std::vector<std::string> const &ClassNames, std::vector<std::string> const &VarNames);
51  virtual ~PndMvaClassifier();
52 
58  virtual void GetMvaValues(std::vector<float> EvtData, std::map<std::string, float> &result) = 0;
63  virtual std::string *Classify(std::vector<float> EvtData) = 0;
64 
65  // virtual std::string *Classify( std::vector<float> EvtData,
66  // std::map<std::string, float>& result ) = 0;
67 
68  virtual void Initialize();
69 
71  inline std::vector<PndMvaClass> const &GetClasses() const;
72 
74  inline std::vector<PndMvaVariable> const &GetVariables() const;
75 
76  protected:
78  virtual void NormalizeEvent(std::vector<float> &EvtVector) const;
79 
80  inline void SetAppType(AppType t);
81 
84 
85  private:
86  // To avoid mistakes.
87  PndMvaClassifier(PndMvaClassifier const &other);
88  PndMvaClassifier &operator=(PndMvaClassifier const &other);
89 };
90 
92 {
94 };
95 // End of class interface
96 //___________________ Inline implement ___________
98 inline std::vector<PndMvaClass> const &PndMvaClassifier::GetClasses() const
99 {
100  return m_dataSets.GetClasses();
101 };
102 
104 inline std::vector<PndMvaVariable> const &PndMvaClassifier::GetVariables() const
105 {
106  return m_dataSets.GetVars();
107 };
108 #endif
PndMvaClassifier(std::string const &InPut, std::vector< std::string > const &ClassNames, std::vector< std::string > const &VarNames)
Constructor.
void SetAppType(AppType t)
virtual void GetMvaValues(std::vector< float > EvtData, std::map< std::string, float > &result)=0
std::vector< PndMvaVariable > const & GetVars() const
Get the list of available variables.
void SetAppType(AppType t)
PndMvaDataSet m_dataSets
Data set. Holds event Weights.
virtual std::string * Classify(std::vector< float > EvtData)=0
std::vector< PndMvaClass > const & GetClasses() const
Get the list of available classes (labels).
virtual void Initialize()
std::vector< PndMvaVariable > const & GetVariables() const
Get the list of available variables.
virtual ~PndMvaClassifier()
Destructor.
virtual void NormalizeEvent(std::vector< float > &EvtVector) const
Normalize the given event vector.
std::vector< PndMvaClass > const & GetClasses() const
Get the list of available classes (labels).
AppType
Definition: PndMvaDataSet.h:50