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().
PhysicsTools::MVAComputer::MVAComputer | ( | Calibration::MVAComputer * | calib, |
bool | owned = false |
||
) |
construct a discriminator computer from a calibation object
Definition at line 39 of file MVAComputer.cc.
References owned, and setup().
PhysicsTools::MVAComputer::~MVAComputer | ( | ) |
Definition at line 118 of file MVAComputer.cc.
PhysicsTools::MVAComputer::MVAComputer | ( | const char * | filename | ) |
construct a discriminator computer from a calibration file
Definition at line 45 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 49 of file MVAComputer.cc.
References owned, and setup().
double PhysicsTools::MVAComputer::deriv | ( | Iterator_t | first, |
Iterator_t | last | ||
) | const |
|
inline |
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 evaluateTtFullHadSignalSel(), evaluateTtSemiLepSignalSel(), and TtSemiLepJetCombMVAComputer::produce().
|
inline |
evaluate variables in iterable container values
Definition at line 58 of file MVAComputer.h.
References contentValuesCheck::values.
|
private |
evaluate discriminator from flattened variable array
Definition at line 130 of file MVAComputer.cc.
References gather_cfg::cout, mps_fire::i, inputVariables, dqmiolumiharvest::j, PhysicsTools::VarProcessor::kNext, PhysicsTools::VarProcessor::kReset, PhysicsTools::VarProcessor::kSkip, PhysicsTools::VarProcessor::kStop, heppy_loop::loop, GetRecoTauVFromDQM_MC_cff::next, EcalTangentSkim_cfg::o, hltrates_dqm_sourceclient-live_cfg::offset, output, mps_update::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 120 of file MVAComputer.cc.
References inputVariables, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, and Skims_PA_cff::name.
|
static |
read calibration object from plain file
Definition at line 195 of file MVAComputer.cc.
References geometryDiff::file, and corrVsCorr::filename.
Referenced by PhysicsTools::MVAComputerESSourceBase::produce().
|
static |
read calibration object from plain C++ input stream
Definition at line 200 of file MVAComputer.cc.
References visDQMUpload::buf, edmScanValgrind::buffer, L1EGammaClusterEmuProducer_cfi::calib, Exception, RecoTauValidation_cfi::header, 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 51 of file MVAComputer.cc.
References L1EGammaClusterEmuProducer_cfi::calib, submitPVResolutionJobs::config, PhysicsTools::VarProcessor::configure(), filterCSVwithJSON::copy, PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >::Factory::create(), Exception, PhysicsTools::Variable::FLAG_ALL, PhysicsTools::Variable::FLAG_MULTIPLE, HLT_2022v12_cff::flags, mps_fire::i, PhysicsTools::TrainMVAComputerCalibration::initFlags(), inputVariables, dqmiolumiharvest::j, PhysicsTools::VarProcessor::Config::mask, Skims_PA_cff::name, nVars, PhysicsTools::VarProcessor::Config::origin, output, AlCaHLTBitMon_QueryRunRegistry::string, trigObjTnPSource_cfi::var, L1TEGammaDiff_cfi::variables, and varProcessors.
Referenced by MVAComputer().
|
static |
write calibration object to file
Definition at line 235 of file MVAComputer.cc.
References geometryDiff::file, and corrVsCorr::filename.
|
static |
write calibration object to pain C++ output stream
Definition at line 240 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::EvalContext::eval(), evalInternal(), 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().