PandaRoot
PndProjectedKNN.h
Go to the documentation of this file.
1 /* ************************************
2  * Author: M. Babai (M.Babai@rug.nl) *
3  * *
4  * pid classifier *
5  * *
6  * Modified: *
7  * *
8  * ************************************/
9 #pragma once
10 #ifndef PND_PROJECTED_KNN_H
11 #define PND_PROJECTED_KNN_H
12 
13 // Local Headers
14 #include "PndKnnClassify.h"
15 
17  public:
19  explicit PndProjectedKNN(std::string const &inputFile, std::vector<std::string> const &classNames, std::vector<std::string> const &varNames,
20  std::vector<std::vector<std::string>> const &varCombinations);
22  virtual ~PndProjectedKNN();
23 
25  void GetMvaValues(std::vector<float> eventData, std::map<std::string, float> &result);
26 
28  std::string *Classify(std::vector<float> EvtData);
29 
31  inline void SetEvtParam(float const scFact, double const weight);
32 
34  inline void SetKnn(unsigned int const val);
35 
37  void InitKNN();
38 
39  private:
41  PndProjectedKNN(PndProjectedKNN const &other);
42  PndProjectedKNN &operator=(PndProjectedKNN const &other);
43 
44  // Free allocated memory.
45  void destroy();
46 
47  std::vector<std::vector<std::string>> m_varCombinations;
48 
49  // First = classifier, Second = parameter indices
50  std::vector<std::pair<PndKnnClassify *, std::vector<int> *>> m_classifiers;
51 
52  float m_ScaleFact;
53  double m_weight;
54  unsigned int m_knn;
55 };
56 // End, class interface
57 
58 inline void PndProjectedKNN::SetEvtParam(float const scFact, double const weight)
59 {
60  m_ScaleFact = scFact;
61  m_weight = weight;
62 };
63 
64 inline void PndProjectedKNN::SetKnn(unsigned int const val)
65 {
66  m_knn = val;
67 };
68 #endif
void InitKNN()
Init classifiers.
void SetKnn(unsigned int const val)
Set number of neighbors.
PndProjectedKNN(std::string const &inputFile, std::vector< std::string > const &classNames, std::vector< std::string > const &varNames, std::vector< std::vector< std::string >> const &varCombinations)
Constructor.
void SetEvtParam(float const scFact, double const weight)
Set params.
void GetMvaValues(std::vector< float > eventData, std::map< std::string, float > &result)
Get pdf&#39;s.
std::string * Classify(std::vector< float > EvtData)
Classify Current event.
virtual ~PndProjectedKNN()
Destructor.