PandaRoot
PndProjectedKNN.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  * Author: M. Babai (M.Babai@rug.nl) *
15  * *
16  * pid classifier *
17  * *
18  * Modified: *
19  * *
20  * ************************************/
21 #pragma once
22 #ifndef PND_PROJECTED_KNN_H
23 #define PND_PROJECTED_KNN_H
24 
25 // Local Headers
26 #include "PndKnnClassify.h"
27 
29  public:
31  explicit PndProjectedKNN(std::string const &inputFile, std::vector<std::string> const &classNames, std::vector<std::string> const &varNames,
32  std::vector<std::vector<std::string>> const &varCombinations);
34  virtual ~PndProjectedKNN();
35 
37  void GetMvaValues(std::vector<float> eventData, std::map<std::string, float> &result);
38 
40  std::string *Classify(std::vector<float> EvtData);
41 
43  inline void SetEvtParam(float const scFact, double const weight);
44 
46  inline void SetKnn(unsigned int const val);
47 
49  void InitKNN();
50 
51  private:
53  PndProjectedKNN(PndProjectedKNN const &other);
54  PndProjectedKNN &operator=(PndProjectedKNN const &other);
55 
56  // Free allocated memory.
57  void destroy();
58 
59  std::vector<std::vector<std::string>> m_varCombinations;
60 
61  // First = classifier, Second = parameter indices
62  std::vector<std::pair<PndKnnClassify *, std::vector<int> *>> m_classifiers;
63 
64  float m_ScaleFact;
65  double m_weight;
66  unsigned int m_knn;
67 };
68 // End, class interface
69 
70 inline void PndProjectedKNN::SetEvtParam(float const scFact, double const weight)
71 {
72  m_ScaleFact = scFact;
73  m_weight = weight;
74 };
75 
76 inline void PndProjectedKNN::SetKnn(unsigned int const val)
77 {
78  m_knn = val;
79 };
80 #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.