CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
PhysicsTools::MVAComputer::DerivContext Struct Reference

#include <MVAComputer.h>

Public Member Functions

int * conf () const
 
 DerivContext ()
 
void eval (const VarProcessor *proc, int *outConf, double *output, int *loop, unsigned int offset, unsigned int out) const
 
unsigned int n () const
 
double output (unsigned int output, std::vector< double > &derivs) const
 
double * values () const
 

Public Attributes

std::vector< int > conf_
 
std::vector< double > deriv_
 
unsigned int n_
 
std::vector< double > values_
 

Detailed Description

Definition at line 157 of file MVAComputer.h.

Constructor & Destructor Documentation

PhysicsTools::MVAComputer::DerivContext::DerivContext ( )
inline

Definition at line 158 of file MVAComputer.h.

158 : n_(0) {}

Member Function Documentation

int* PhysicsTools::MVAComputer::DerivContext::conf ( ) const
inline

Definition at line 168 of file MVAComputer.h.

Referenced by eval().

168 { return &conf_.front(); }
void PhysicsTools::MVAComputer::DerivContext::eval ( const VarProcessor proc,
int *  outConf,
double *  output,
int *  loop,
unsigned int  offset,
unsigned int  out 
) const

Definition at line 312 of file MVAComputer.cc.

References conf(), PhysicsTools::VarProcessor::deriv(), deriv_, n(), and values().

315 {
316  proc->deriv(values(), conf(), output, outConf,
317  loop, offset, n(), out, deriv_);
318 }
double output(unsigned int output, std::vector< double > &derivs) const
Definition: MVAComputer.cc:320
TrainProcessor *const proc
Definition: MVATrainer.cc:101
unsigned int offset(bool)
tuple out
Definition: dbtoconf.py:99
unsigned int PhysicsTools::MVAComputer::DerivContext::n ( void  ) const
inline

Definition at line 169 of file MVAComputer.h.

Referenced by eval().

169 { return n_; }
double PhysicsTools::MVAComputer::DerivContext::output ( unsigned int  output,
std::vector< double > &  derivs 
) const

Definition at line 320 of file MVAComputer.cc.

References filterCSVwithJSON::copy, and PhysicsTools::MVAComputer::output.

322 {
323  derivs.clear();
324  derivs.reserve(n_);
325 
326  int pos = conf_[output];
327  if (pos >= (int)n_)
328  std::copy(&deriv_.front() + n_ * (pos - n_),
329  &deriv_.front() + n_ * (pos - n_ + 1),
330  std::back_inserter(derivs));
331  else {
332  derivs.resize(n_);
333  derivs[pos] = 1.;
334  }
335 
336  return values_[pos];
337 }
double output(unsigned int output, std::vector< double > &derivs) const
Definition: MVAComputer.cc:320
double* PhysicsTools::MVAComputer::DerivContext::values ( ) const
inline

Definition at line 167 of file MVAComputer.h.

Referenced by eval().

167 { return &values_.front(); }

Member Data Documentation

std::vector<int> PhysicsTools::MVAComputer::DerivContext::conf_
mutable

Definition at line 173 of file MVAComputer.h.

std::vector<double> PhysicsTools::MVAComputer::DerivContext::deriv_
mutable

Definition at line 172 of file MVAComputer.h.

Referenced by eval().

unsigned int PhysicsTools::MVAComputer::DerivContext::n_

Definition at line 174 of file MVAComputer.h.

std::vector<double> PhysicsTools::MVAComputer::DerivContext::values_
mutable

Definition at line 171 of file MVAComputer.h.