72 #ifndef IClassifierReader__def
73 #define IClassifierReader__def
84 virtual double GetMvaValue(
const std::vector<double>& inputValues )
const = 0;
101 ReadPDEFoam( std::vector<std::string>& theInputVars )
103 fClassName(
"ReadPDEFoam" ),
105 fIsNormalised(
false )
108 const char* inputVars[] = {
"track_deta",
"track_dlayer",
"track_layer",
"track_pT",
"approach_dist",
"vtx_radius",
"vtxTrack_dist",
"photon_m",
"photon_pT",
"cluster_prob" };
111 if (theInputVars.size() <= 0) {
112 std::cout <<
"Problem in class \"" << fClassName <<
"\": empty input vector" << std::endl;
113 fStatusIsClean =
false;
116 if (theInputVars.size() != fNvars) {
117 std::cout <<
"Problem in class \"" << fClassName <<
"\": mismatch in number of input values: "
118 << theInputVars.size() <<
" != " << fNvars << std::endl;
119 fStatusIsClean =
false;
123 for (
size_t ivar = 0; ivar < theInputVars.size(); ivar++) {
124 if (theInputVars[ivar] != inputVars[ivar]) {
125 std::cout <<
"Problem in class \"" << fClassName <<
"\": mismatch in input variable names" << std::endl
126 <<
" for variable [" << ivar <<
"]: " << theInputVars[ivar].c_str() <<
" != " << inputVars[ivar] << std::endl;
127 fStatusIsClean =
false;
171 virtual ~ReadPDEFoam() {
178 double GetMvaValue(
const std::vector<double>& inputValues )
const;
186 const char* fClassName;
189 size_t GetNvar()
const {
return fNvars; }
190 char GetType(
int ivar )
const {
return fType[ivar]; }
193 const bool fIsNormalised;
194 bool IsNormalised()
const {
return fIsNormalised; }
197 double NormVariable(
double x,
double xmin,
double xmax )
const {
199 return 2*(x -
xmin)/(xmax - xmin) - 1.0;
207 double GetMvaValue__(
const std::vector<double>& inputValues )
const;
210 inline double ReadPDEFoam::GetMvaValue(
const std::vector<double>& inputValues )
const
217 std::cout <<
"Problem in class \"" << fClassName <<
"\": cannot return classifier response"
218 <<
" because status is dirty" << std::endl;
222 if (IsNormalised()) {
224 std::vector<double> iV;
225 iV.reserve(inputValues.size());
227 for (std::vector<double>::const_iterator varIt = inputValues.begin();
228 varIt != inputValues.end(); varIt++, ivar++) {
229 iV.push_back(NormVariable( *varIt, fVmin[ivar], fVmax[ivar] ));
231 retval = GetMvaValue__( iV );
234 retval = GetMvaValue__( inputValues );