PandaRoot
PndMultiClassBdtClassify.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  * MultiClass MLP Classifier functions *
15  * Author: M.Babai@rug.nl *
16  * Version: *
17  * LICENSE: *
18  * ***************************************
19  */
20 /*
21  * Note: This is just an interface to the original TMVA
22  * implementation. To find out the available options, please read TMVA
23  * manuals. In case of errors or wrong outputs produced by TMVA
24  * classifiers, try to read their mailing list and send your questions
25  * to the same list.
26  ******* VERY IMORTANT ****
27  * You NEED TMVA version > 4.1.X before this works.
28  */
29 //#pragma once
30 #ifndef PND_MULTICLASS_BDT_CLASSIFY_H
31 #define PND_MULTICLASS_BDT_CLASSIFY_H
32 
33 // Local includes
34 #include "PndMvaClassifier.h"
35 
36 // Root && TMVA
37 #include "TMVA/Reader.h"
38 
39 // Interface definition for Multiclass MLP Classifier
41  //______________ Public ____________________
42  public:
49  explicit PndMultiClassBdtClassify(std::string const &inputFile, std::vector<std::string> const &classNames, std::vector<std::string> const &varNames);
53  virtual ~PndMultiClassBdtClassify();
54 
59  void GetMvaValues(std::vector<float> EvtData, std::map<std::string, float> &result);
64  std::string *Classify(std::vector<float> EvtData);
65 
69  void Initialize();
70 
71  //______________________________________________
72  //====== Getters and setters.
73  inline void SetReaderOptions(std::string const &opt);
74  inline void SetWeightsFileName(std::string const &name);
75 
76  inline std::string const &GetReaderOptions() const;
77  inline std::string const &GetWeightsFileName() const;
78 
79  //______________ Protected__________________
80  // protected:
81  //______________ Private ____________________
82  private:
83  // To avoid mistakes.
86 
87  // Set the TMVA reader options.
88  void SetOptions();
89 
90  //======================
91  TMVA::Reader *m_reader;
92 
93  std::string m_weightsFile;
94  std::string m_readerOptions;
95  std::vector<float> m_EventContainer;
96 }; // End of classifier interface definition.
97 
98 //=============== inline functions implementation. ========
99 //__________________________________________
100 inline void PndMultiClassBdtClassify::SetReaderOptions(std::string const &opt)
101 {
102  this->m_readerOptions = opt;
103 };
104 
105 inline std::string const &PndMultiClassBdtClassify::GetReaderOptions() const
106 {
107  return m_readerOptions;
108 };
109 
110 inline void PndMultiClassBdtClassify::SetWeightsFileName(std::string const &name)
111 {
112  this->m_weightsFile = name;
113 };
114 
115 inline std::string const &PndMultiClassBdtClassify::GetWeightsFileName() const
116 {
117  return m_weightsFile;
118 };
119 #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)