FairRoot/PandaRoot
PndMultiClassMlpClassify.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_MLP_CLASSIFY_H
19 #define PND_MULTICLASS_MLP_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 {
30  //______________ Public ____________________
31  public:
38  explicit PndMultiClassMlpClassify(std::string const& inputFile,
39  std::vector<std::string> const& classNames,
40  std::vector<std::string> const& varNames);
44  virtual ~PndMultiClassMlpClassify();
45 
50  void GetMvaValues( std::vector<float> EvtData,
51  std::map<std::string, float>& result );
56  std::string *Classify( std::vector<float> EvtData );
57 
61  void Initialize();
62 
63  //______________________________________________
64  //====== Getters and setters.
65  // Set the TMVA reader options
66  inline void SetReaderOptions(std::string const& opt);
67 
68  // Set the file name which contains the weights
69  inline void SetWeightsFileName(std::string const& name);
70 
71  // Get the TMVA reader options
72  inline std::string const& GetReaderOptions() const;
73 
74  // Get weights file name.
75  inline std::string const& GetWeightsFileName() const;
76 
77  //______________ Protected__________________
78  //protected:
79  //______________ Private ____________________
80  private:
81  // To avoid mistakes.
84 
85  //======================
86  TMVA::Reader* m_reader;
87 
88  std::string m_weightsFile;
89  std::string m_readerOptions;
90  std::vector<float> m_EventContainer;
91 };// End of classifier interface definition.
92 
93 //=============== inline functions implementation. ========
94 //__________________________________________
95 inline void PndMultiClassMlpClassify::SetReaderOptions(std::string const& opt)
96 {
97  this->m_readerOptions = opt;
98 };
99 
100 inline std::string const& PndMultiClassMlpClassify::GetReaderOptions() const
101 {
102  return m_readerOptions;
103 };
104 
105 inline void PndMultiClassMlpClassify::SetWeightsFileName(std::string const& name)
106 {
107  this->m_weightsFile = name;
108 };
109 
110 inline std::string const& PndMultiClassMlpClassify::GetWeightsFileName() const
111 {
112  return m_weightsFile;
113 };
114 #endif
std::vector< float > m_EventContainer
void GetMvaValues(std::vector< float > EvtData, std::map< std::string, float > &result)
std::string * Classify(std::vector< float > EvtData)
std::string m_weightsFile
TMVA reader.
void SetWeightsFileName(std::string const &name)
TString name
PndMultiClassMlpClassify(std::string const &inputFile, std::vector< std::string > const &classNames, std::vector< std::string > const &varNames)
std::string const & GetReaderOptions() const
PndMultiClassMlpClassify & operator=(PndMultiClassMlpClassify const &oth)
virtual ~PndMultiClassMlpClassify()
std::string const & GetWeightsFileName() const
void SetReaderOptions(std::string const &opt)