#include <MVATrainerFileSave.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) |
virtual void | endJob () |
MVATrainerFileSave (const edm::ParameterSet ¶ms) | |
Protected Member Functions | |
virtual const Calibration::MVAComputerContainer * | getToPut (const edm::EventSetup &es) const =0 |
Protected Attributes | |
bool | trained |
Private Types | |
typedef std::map< std::string, std::string > | LabelFileMap |
Private Attributes | |
std::auto_ptr < Calibration::MVAComputerContainer > | calib |
bool | saved |
LabelFileMap | toPut |
Definition at line 17 of file MVATrainerFileSave.h.
typedef std::map<std::string, std::string> PhysicsTools::MVATrainerFileSave::LabelFileMap [private] |
Definition at line 33 of file MVATrainerFileSave.h.
PhysicsTools::MVATrainerFileSave::MVATrainerFileSave | ( | const edm::ParameterSet & | params | ) | [explicit] |
Definition at line 23 of file MVATrainerFileSave.cc.
References edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), h::names, and toPut.
: trained(params.getUntrackedParameter<bool>("trained", true)), saved(false) { std::vector<std::string> names = params.getParameterNames(); for(std::vector<std::string>::const_iterator iter = names.begin(); iter != names.end(); iter++) { if (iter->c_str()[0] == '@' || *iter == "trained") continue; toPut[*iter] = params.getParameter<std::string>(*iter); } }
void PhysicsTools::MVATrainerFileSave::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 38 of file MVATrainerFileSave.cc.
References calib, getToPut(), PhysicsTools::MVATrainerLooper::isUntrained(), and saved.
{ if (calib.get() || saved) return; const Calibration::MVAComputerContainer *toPutCalib = getToPut(es); if (MVATrainerLooper::isUntrained(toPutCalib)) return; edm::LogInfo("MVATrainerFileSave") << "Got the trained calibration data"; std::auto_ptr<Calibration::MVAComputerContainer> calib( new Calibration::MVAComputerContainer); *calib = *toPutCalib; this->calib = calib; }
void PhysicsTools::MVATrainerFileSave::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 58 of file MVATrainerFileSave.cc.
References calib, saved, toPut, and PhysicsTools::MVAComputer::writeCalibration().
{ if (!calib.get() || saved) return; edm::LogInfo("MVATrainerFileSave") << "Saving calibration data into plain MVA files."; for(LabelFileMap::const_iterator iter = toPut.begin(); iter != toPut.end(); iter++) { const Calibration::MVAComputer *calibration = &calib->find(iter->first); MVAComputer::writeCalibration(iter->second.c_str(), calibration); } saved = true; }
virtual const Calibration::MVAComputerContainer* PhysicsTools::MVATrainerFileSave::getToPut | ( | const edm::EventSetup & | es | ) | const [protected, pure virtual] |
Implemented in PhysicsTools::MVATrainerFileSaveImpl< Record_t >.
Referenced by analyze().
std::auto_ptr<Calibration::MVAComputerContainer> PhysicsTools::MVATrainerFileSave::calib [private] |
Definition at line 36 of file MVATrainerFileSave.h.
bool PhysicsTools::MVATrainerFileSave::saved [private] |
Definition at line 37 of file MVATrainerFileSave.h.
Definition at line 35 of file MVATrainerFileSave.h.
Referenced by endJob(), and MVATrainerFileSave().
bool PhysicsTools::MVATrainerFileSave::trained [protected] |
Definition at line 30 of file MVATrainerFileSave.h.
Referenced by PhysicsTools::MVATrainerFileSaveImpl< Record_t >::getToPut().