PandaRoot
PndMultiClassBdtClassify.h
Go to the documentation of this file.
1 /* ***************************************
2  * MultiClass MLP Classifier functions *
3  * Author: M.Babai@rug.nl *
4  * Version: *
5  * LICENSE: *
6  * ***************************************
7  */
8 /*
9  * Note: This is just an interface to the original TMVA
10  * implementation. To find out the available options, please read TMVA
11  * manuals. In case of errors or wrong outputs produced by TMVA
12  * classifiers, try to read their mailing list and send your questions
13  * to the same list.
14  ******* VERY IMORTANT ****
15  * You NEED TMVA version > 4.1.X before this works.
16  */
17 //#pragma once
18 #ifndef PND_MULTICLASS_BDT_CLASSIFY_H
19 #define PND_MULTICLASS_BDT_CLASSIFY_H
20 
21 // Local includes
22 #include "PndMvaClassifier.h"
23 
24 // Root && TMVA
25 #include "TMVA/Reader.h"
26 
27 // Interface definition for Multiclass MLP Classifier
29  //______________ Public ____________________
30  public:
37  explicit PndMultiClassBdtClassify(std::string const &inputFile, std::vector<std::string> const &classNames, std::vector<std::string> const &varNames);
41  virtual ~PndMultiClassBdtClassify();
42 
47  void GetMvaValues(std::vector<float> EvtData, std::map<std::string, float> &result);
52  std::string *Classify(std::vector<float> EvtData);
53 
57  void Initialize();
58 
59  //______________________________________________
60  //====== Getters and setters.
61  inline void SetReaderOptions(std::string const &opt);
62  inline void SetWeightsFileName(std::string const &name);
63 
64  inline std::string const &GetReaderOptions() const;
65  inline std::string const &GetWeightsFileName() const;
66 
67  //______________ Protected__________________
68  // protected:
69  //______________ Private ____________________
70  private:
71  // To avoid mistakes.
74 
75  // Set the TMVA reader options.
76  void SetOptions();
77 
78  //======================
79  TMVA::Reader *m_reader;
80 
81  std::string m_weightsFile;
82  std::string m_readerOptions;
83  std::vector<float> m_EventContainer;
84 }; // End of classifier interface definition.
85 
86 //=============== inline functions implementation. ========
87 //__________________________________________
88 inline void PndMultiClassBdtClassify::SetReaderOptions(std::string const &opt)
89 {
90  this->m_readerOptions = opt;
91 };
92 
93 inline std::string const &PndMultiClassBdtClassify::GetReaderOptions() const
94 {
95  return m_readerOptions;
96 };
97 
98 inline void PndMultiClassBdtClassify::SetWeightsFileName(std::string const &name)
99 {
100  this->m_weightsFile = name;
101 };
102 
103 inline std::string const &PndMultiClassBdtClassify::GetWeightsFileName() const
104 {
105  return m_weightsFile;
106 };
107 #endif
void SetWeightsFileName(std::string const &name)
virtual ~PndMultiClassBdtClassify()
std::string const & GetWeightsFileName() const
PndMultiClassBdtClassify(std::string const &inputFile, std::vector< std::string > const &classNames, std::vector< std::string > const &varNames)
std::string * Classify(std::vector< float > EvtData)
std::string const & GetReaderOptions() const
void GetMvaValues(std::vector< float > EvtData, std::map< std::string, float > &result)
void SetReaderOptions(std::string const &opt)