Main interface class to the generic discriminator computer framework. More...
#include <MVAComputer.h>
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::MVAComputer * | readCalibration (const char *filename) |
read calibration object from plain file More... | |
static Calibration::MVAComputer * | readCalibration (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< InputVar > | inputVariables |
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< Processor > | varProcessors |
vector of variable processors More... | |
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.
PhysicsTools::MVAComputer::MVAComputer | ( | const Calibration::MVAComputer * | calib | ) |
construct a discriminator computer from a const calibation object
Definition at line 37 of file MVAComputer.cc.
References setup().
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.
References setup().
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.
References owned, and setup().
PhysicsTools::MVAComputer::MVAComputer | ( | std::istream & | is | ) |
construct a discriminator computer from C++ input stream
Definition at line 57 of file MVAComputer.cc.
References owned, and setup().
double PhysicsTools::MVAComputer::deriv | ( | Iterator_t | first, |
Iterator_t | last | ||
) | const |
|
inline |
Definition at line 66 of file MVAComputer.h.
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 TtSemiLepJetCombMVATrainer::analyze(), evaluateTtFullHadSignalSel(), evaluateTtSemiLepSignalSel(), PhysicsTools::TreeReader::fill(), and TtSemiLepJetCombMVAComputer::produce().
|
inline |
|
private |
evaluate discriminator from flattened variable array
Definition at line 158 of file MVAComputer.cc.
References gather_cfg::cout, ora::ClassUtils::demangledName(), i, inputVariables, j, PhysicsTools::VarProcessor::kNext, PhysicsTools::VarProcessor::kReset, PhysicsTools::VarProcessor::kSkip, PhysicsTools::VarProcessor::kStop, cmsHarvester::loop, GetRecoTauVFromDQM_MC_cff::next, connectstrParser::o, hltrates_dqm_sourceclient-live_cfg::offset, output, ntuplemaker::status, AlCaHLTBitMon_QueryRunRegistry::string, edm::typeDemangle(), findQualityFiles::v, and varProcessors.
|
private |
map variable identifier name to the numerical position in the array
Definition at line 146 of file MVAComputer.cc.
References inputVariables, and mergeVDriftHistosByStation::name.
|
static |
read calibration object from plain file
Definition at line 232 of file MVAComputer.cc.
References mergeVDriftHistosByStation::file.
Referenced by PhysicsTools::MVAComputerESSourceBase::produce().
|
static |
read calibration object from plain C++ input stream
Definition at line 238 of file MVAComputer.cc.
References calib, Exception, ext::basic_izstreambase< Item_t, Traits_t, Allocator_t >::rdbuf(), contentValuesCheck::ss, STANDALONE_HEADER, and AlCaHLTBitMon_QueryRunRegistry::string.
|
private |
construct processors from calibration and setup variables
Definition at line 63 of file MVAComputer.cc.
References PhysicsTools::VarProcessor::ConfigCtx::begin(), calib, HDQMDatabaseProducer::config, PhysicsTools::VarProcessor::configure(), filterCSVwithJSON::copy, PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >::Factory::create(), PhysicsTools::VarProcessor::ConfigCtx::end(), Exception, PhysicsTools::Variable::FLAG_ALL, PhysicsTools::Variable::FLAG_MULTIPLE, flags, PhysicsTools::Calibration::MVAComputer::getProcessors(), i, PhysicsTools::MVAComputer::InputVar::index, PhysicsTools::TrainMVAComputerCalibration::initFlags(), PhysicsTools::Calibration::MVAComputer::inputSet, inputVariables, j, PhysicsTools::VarProcessor::Config::mask, PhysicsTools::MVAComputer::InputVar::multiplicity, mergeVDriftHistosByStation::name, nVars, PhysicsTools::VarProcessor::Config::origin, output, PhysicsTools::Calibration::MVAComputer::output, PhysicsTools::VarProcessor::ConfigCtx::size(), AlCaHLTBitMon_QueryRunRegistry::string, MetTreeProducer::var(), PhysicsTools::MVAComputer::InputVar::var, makeLayoutFileForGui::variables, and varProcessors.
Referenced by MVAComputer().
|
static |
write calibration object to file
Definition at line 276 of file MVAComputer.cc.
References mergeVDriftHistosByStation::file.
Referenced by PhysicsTools::MVATrainerFileSave::endJob().
|
static |
write calibration object to pain C++ output stream
Definition at line 283 of file MVAComputer.cc.
References Exception, and STANDALONE_HEADER.
|
private |
vector of input variables
Definition at line 190 of file MVAComputer.h.
Referenced by evalInternal(), getVariableId(), and setup().
|
private |
total number of variables to expect while computing discriminator
Definition at line 196 of file MVAComputer.h.
Referenced by setup().
|
private |
index of the variable in the "conf" array to return as result
Definition at line 199 of file MVAComputer.h.
Referenced by evalInternal(), PhysicsTools::MVAComputer::EvalContext::output(), PhysicsTools::MVAComputer::DerivContext::output(), and setup().
|
private |
in case calibration object is owned by the MVAComputer
Definition at line 202 of file MVAComputer.h.
Referenced by MVAComputer().
|
private |
vector of variable processors
Definition at line 193 of file MVAComputer.h.
Referenced by evalInternal(), and setup().