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, VarProcessor::LoopCtx &ctx, 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 158 of file MVAComputer.h.

Constructor & Destructor Documentation

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

Definition at line 159 of file MVAComputer.h.

159 : n_(0) {}

Member Function Documentation

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

Definition at line 170 of file MVAComputer.h.

Referenced by eval().

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

Definition at line 312 of file MVAComputer.cc.

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

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

Definition at line 171 of file MVAComputer.h.

Referenced by eval().

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

Definition at line 321 of file MVAComputer.cc.

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

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

Definition at line 169 of file MVAComputer.h.

Referenced by eval().

169 { return &values_.front(); }

Member Data Documentation

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

Definition at line 175 of file MVAComputer.h.

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

Definition at line 174 of file MVAComputer.h.

Referenced by eval().

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

Definition at line 176 of file MVAComputer.h.

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

Definition at line 173 of file MVAComputer.h.