CMS 3D CMS Logo

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

Main interface class to the generic discriminator computer framework. More...

#include <MVAComputer.h>

Inheritance diagram for PhysicsTools::MVAComputer:
GenericMVAComputer

Classes

struct  DerivContext
 
struct  EvalContext
 
class  InputVar
 input variable configuration object More...
 
class  Processor
 variable processor container More...
 

Public Member Functions

template<typename Iterator_t >
double deriv (Iterator_t first, Iterator_t last) const
 
template<typename Container_t >
double deriv (Container_t &values) const
 
template<typename Iterator_t >
double eval (Iterator_t first, Iterator_t last) const
 evaluate variables given by a range of iterators given by first and last More...
 
template<typename Container_t >
double eval (const Container_t &values) const
 evaluate variables in iterable container values More...
 
 MVAComputer (const Calibration::MVAComputer *calib)
 construct a discriminator computer from a const calibation object More...
 
 MVAComputer (Calibration::MVAComputer *calib, bool owned=false)
 construct a discriminator computer from a calibation object More...
 
 MVAComputer (const char *filename)
 construct a discriminator computer from a calibration file More...
 
 MVAComputer (std::istream &is)
 construct a discriminator computer from C++ input stream More...
 
 ~MVAComputer ()
 

Static Public Member Functions

static Calibration::MVAComputerreadCalibration (const char *filename)
 read calibration object from plain file More...
 
static Calibration::MVAComputerreadCalibration (std::istream &is)
 read calibration object from plain C++ input stream More...
 
static void writeCalibration (const char *filename, const Calibration::MVAComputer *calib)
 write calibration object to file More...
 
static void writeCalibration (std::ostream &os, const Calibration::MVAComputer *calib)
 write calibration object to pain C++ output stream More...
 

Private Member Functions

template<class T >
void evalInternal (T &ctx) const
 evaluate discriminator from flattened variable array More...
 
int getVariableId (AtomicId name) const
 map variable identifier name to the numerical position in the array More...
 
void setup (const Calibration::MVAComputer *calib)
 construct processors from calibration and setup variables More...
 

Private Attributes

std::vector< InputVarinputVariables
 vector of input variables More...
 
unsigned int nVars
 total number of variables to expect while computing discriminator More...
 
unsigned int output
 index of the variable in the "conf" array to return as result More...
 
std::auto_ptr
< Calibration::MVAComputer
owned
 in case calibration object is owned by the MVAComputer More...
 
std::vector< ProcessorvarProcessors
 vector of variable processors More...
 

Detailed Description

Main interface class to the generic discriminator computer framework.

The MVAComputer class represents an instance of the modular discriminator computer. It is constructed from a "calibration" object which contains all the required histograms, matrices and other trainina data required for computing the discriminator. The calibration data also defines the names and properties of variables that can passed to that instance of the discriminator computer. The evaluation methods then calculates the discriminator from a applicable set of input variables, i.e. vector of key-value pairs.

Definition at line 39 of file MVAComputer.h.

Constructor & Destructor Documentation

PhysicsTools::MVAComputer::MVAComputer ( const Calibration::MVAComputer calib)

construct a discriminator computer from a const calibation object

Definition at line 37 of file MVAComputer.cc.

PhysicsTools::MVAComputer::MVAComputer ( Calibration::MVAComputer calib,
bool  owned = false 
)

construct a discriminator computer from a calibation object

Definition at line 43 of file MVAComputer.cc.

PhysicsTools::MVAComputer::~MVAComputer ( )

Definition at line 142 of file MVAComputer.cc.

PhysicsTools::MVAComputer::MVAComputer ( const char *  filename)

construct a discriminator computer from a calibration file

Definition at line 51 of file MVAComputer.cc.

PhysicsTools::MVAComputer::MVAComputer ( std::istream &  is)

construct a discriminator computer from C++ input stream

Definition at line 57 of file MVAComputer.cc.

Member Function Documentation

template<typename Iterator_t >
double PhysicsTools::MVAComputer::deriv ( Iterator_t  first,
Iterator_t  last 
) const
template<typename Container_t >
double PhysicsTools::MVAComputer::deriv ( Container_t &  values) const
inline

Definition at line 66 of file MVAComputer.h.

template<typename Iterator_t >
double PhysicsTools::MVAComputer::eval ( Iterator_t  first,
Iterator_t  last 
) const

evaluate variables given by a range of iterators given by first and last

Referenced by evaluateTtSemiLepSignalSel(), and TtSemiLepJetCombMVAComputer::produce().

template<typename Container_t >
double PhysicsTools::MVAComputer::eval ( const Container_t &  values) const
inline

evaluate variables in iterable container values

Definition at line 58 of file MVAComputer.h.

template<class T >
template void PhysicsTools::MVAComputer::evalInternal ( T ctx) const
private

evaluate discriminator from flattened variable array

Definition at line 158 of file MVAComputer.cc.

int PhysicsTools::MVAComputer::getVariableId ( AtomicId  name) const
private

map variable identifier name to the numerical position in the array

Definition at line 146 of file MVAComputer.cc.

Calibration::MVAComputer * PhysicsTools::MVAComputer::readCalibration ( const char *  filename)
static

read calibration object from plain file

Definition at line 232 of file MVAComputer.cc.

Referenced by PhysicsTools::MVAComputerESSourceBase::produce().

Calibration::MVAComputer * PhysicsTools::MVAComputer::readCalibration ( std::istream &  is)
static

read calibration object from plain C++ input stream

Definition at line 238 of file MVAComputer.cc.

void PhysicsTools::MVAComputer::setup ( const Calibration::MVAComputer calib)
private

construct processors from calibration and setup variables

Definition at line 63 of file MVAComputer.cc.

void PhysicsTools::MVAComputer::writeCalibration ( const char *  filename,
const Calibration::MVAComputer calib 
)
static

write calibration object to file

Definition at line 276 of file MVAComputer.cc.

Referenced by PhysicsTools::MVATrainerFileSave::endJob().

void PhysicsTools::MVAComputer::writeCalibration ( std::ostream &  os,
const Calibration::MVAComputer calib 
)
static

write calibration object to pain C++ output stream

Definition at line 283 of file MVAComputer.cc.

Member Data Documentation

std::vector<InputVar> PhysicsTools::MVAComputer::inputVariables
private

vector of input variables

Definition at line 190 of file MVAComputer.h.

unsigned int PhysicsTools::MVAComputer::nVars
private

total number of variables to expect while computing discriminator

Definition at line 196 of file MVAComputer.h.

unsigned int PhysicsTools::MVAComputer::output
private

index of the variable in the "conf" array to return as result

Definition at line 199 of file MVAComputer.h.

std::auto_ptr<Calibration::MVAComputer> PhysicsTools::MVAComputer::owned
private

in case calibration object is owned by the MVAComputer

Definition at line 202 of file MVAComputer.h.

std::vector<Processor> PhysicsTools::MVAComputer::varProcessors
private

vector of variable processors

Definition at line 193 of file MVAComputer.h.