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::unique_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().
Referenced by deriv().
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.
References corrVsCorr::filename, MVAComputer(), readCalibration(), and writeCalibration().
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(), PhysicsTools::MVAComputer::DerivContext::DerivContext(), 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, mps_fire::i, inputVariables, PhysicsTools::VarProcessor::kNext, PhysicsTools::VarProcessor::kReset, PhysicsTools::VarProcessor::kSkip, PhysicsTools::VarProcessor::kStop, heppy_loop::loop, GetRecoTauVFromDQM_MC_cff::next, connectstrParser::o, PFRecoTauDiscriminationByIsolation_cfi::offset, output, mps_update::status, AlCaHLTBitMon_QueryRunRegistry::string, edm::typeDemangle(), findQualityFiles::v, and varProcessors.
Referenced by PhysicsTools::MVAComputer::DerivContext::output().
|
private |
map variable identifier name to the numerical position in the array
Definition at line 146 of file MVAComputer.cc.
References inputVariables, and dataset::name.
|
static |
read calibration object from plain file
Definition at line 232 of file MVAComputer.cc.
References FrontierConditions_GlobalTag_cff::file.
Referenced by deriv(), and PhysicsTools::MVAComputerESSourceBase::produce().
|
static |
read calibration object from plain C++ input stream
Definition at line 238 of file MVAComputer.cc.
References edmScanValgrind::buffer, calib, Exception, RecoTauValidation_cfi::header, ext::basic_izstreambase< Item_t, Traits_t, Allocator_t >::rdbuf(), 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, looper::config, PhysicsTools::VarProcessor::configure(), popcon2dropbox::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(), mps_fire::i, PhysicsTools::MVAComputer::InputVar::index, PhysicsTools::TrainMVAComputerCalibration::initFlags(), PhysicsTools::Calibration::MVAComputer::inputSet, inputVariables, PhysicsTools::VarProcessor::Config::mask, PhysicsTools::MVAComputer::InputVar::multiplicity, dataset::name, nVars, PhysicsTools::VarProcessor::Config::origin, output, PhysicsTools::Calibration::MVAComputer::output, PhysicsTools::VarProcessor::ConfigCtx::size(), AlCaHLTBitMon_QueryRunRegistry::string, JetChargeProducer_cfi::var, PhysicsTools::MVAComputer::InputVar::var, objects.autophobj::variables, and varProcessors.
Referenced by MVAComputer().
|
static |
write calibration object to file
Definition at line 276 of file MVAComputer.cc.
References FrontierConditions_GlobalTag_cff::file.
Referenced by deriv(), and PhysicsTools::MVATrainerFileSave::endJob().
|
static |
write calibration object to pain C++ output stream
Definition at line 283 of file MVAComputer.cc.
References edmScanValgrind::buffer, 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 PhysicsTools::MVAComputer::DerivContext::DerivContext(), 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().