57#ifndef IClassifierReader__def
58#define IClassifierReader__def
60class IClassifierReader {
65 IClassifierReader() : fStatusIsClean(
true ) {}
66 virtual ~IClassifierReader() {}
69 virtual double GetMvaValue(
const std::vector<double>& inputValues )
const = 0;
72 bool IsStatusClean()
const {
return fStatusIsClean; }
81class ReadFDA_GA :
public IClassifierReader {
86 ReadFDA_GA( std::vector<std::string>& theInputVars )
87 : IClassifierReader(),
88 fClassName(
"ReadFDA_GA" ),
92 const char* inputVars[] = {
"var1+var2",
"var1-var2",
"var3",
"var4" };
95 if (theInputVars.size() <= 0) {
96 std::cout <<
"Problem in class \"" << fClassName <<
"\": empty input vector" << std::endl;
97 fStatusIsClean =
false;
100 if (theInputVars.size() != fNvars) {
101 std::cout <<
"Problem in class \"" << fClassName <<
"\": mismatch in number of input values: "
102 << theInputVars.size() <<
" != " << fNvars << std::endl;
103 fStatusIsClean =
false;
107 for (
size_t ivar = 0; ivar < theInputVars.size(); ivar++) {
108 if (theInputVars[ivar] != inputVars[ivar]) {
109 std::cout <<
"Problem in class \"" << fClassName <<
"\": mismatch in input variable names" << std::endl
110 <<
" for variable [" << ivar <<
"]: " << theInputVars[ivar].c_str() <<
" != " << inputVars[ivar] << std::endl;
111 fStatusIsClean =
false;
137 virtual ~ReadFDA_GA() {
144 double GetMvaValue(
const std::vector<double>& inputValues )
const override;
152 const char* fClassName;
155 size_t GetNvar()
const {
return fNvars; }
161 double NormVariable(
double x,
double xmin,
double xmax )
const {
171 double GetMvaValue__(
const std::vector<double>& inputValues )
const;
174 double fParameter[5];
179 fParameter[0] = 0.516172096466999;
180 fParameter[1] = -0.223975889384747;
182 fParameter[3] = -0.0484458589926362;
183 fParameter[4] = 0.519118621014059;
186inline double ReadFDA_GA::GetMvaValue__(
const std::vector<double>& inputValues )
const
189 double retval = fParameter[0]+fParameter[1]*inputValues[0]+fParameter[2]*inputValues[1]+fParameter[3]*inputValues[2]+fParameter[4]*inputValues[3];
195inline void ReadFDA_GA::Clear()
199 inline double ReadFDA_GA::GetMvaValue(
const std::vector<double>& inputValues )
const
205 if (!IsStatusClean()) {
206 std::cout <<
"Problem in class \"" << fClassName <<
"\": cannot return classifier response"
207 <<
" because status is dirty" << std::endl;
211 retval = GetMvaValue__( inputValues );
Type GetType(const std::string &Name)
void Initialize(Bool_t useTMVAStyle=kTRUE)