#include <MVATrainerSave.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) |
virtual void | endJob () |
MVATrainerSave (const edm::ParameterSet ¶ms) | |
Protected Member Functions | |
virtual std::string | getRecordName () const =0 |
virtual const Calibration::MVAComputer * | getToPut (const edm::EventSetup &es) const =0 |
Private Attributes | |
std::auto_ptr < Calibration::MVAComputer > | calib |
bool | saved |
Definition at line 16 of file MVATrainerSave.h.
PhysicsTools::MVATrainerSave::MVATrainerSave | ( | const edm::ParameterSet & | params | ) | [explicit] |
Definition at line 26 of file MVATrainerSave.cc.
: saved(false) { }
void PhysicsTools::MVATrainerSave::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 31 of file MVATrainerSave.cc.
References calib, getToPut(), PhysicsTools::MVATrainerLooper::isUntrained(), and saved.
{ if (calib.get() || saved) return; const Calibration::MVAComputer *toPutCalib = getToPut(es); if (MVATrainerLooper::isUntrained(toPutCalib)) return; edm::LogInfo("MVATrainerSave") << "Got the trained calibration data"; std::auto_ptr<Calibration::MVAComputer> calib( new Calibration::MVAComputer); *calib = *toPutCalib; this->calib = calib; }
void PhysicsTools::MVATrainerSave::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 50 of file MVATrainerSave.cc.
References calib, getRecordName(), edm::Service< T >::isAvailable(), and saved.
{ if (!calib.get() || saved) return; edm::LogInfo("MVATrainerSave") << "Saving calibration data in CondDB."; edm::Service<cond::service::PoolDBOutputService> dbService; if (!dbService.isAvailable()) throw cms::Exception("MVATrainerSave") << "DBService unavailable" << std::endl; dbService->createNewIOV<Calibration::MVAComputer>( calib.release(), dbService->beginOfTime(), dbService->endOfTime(), getRecordName().c_str()); saved = true; }
virtual std::string PhysicsTools::MVATrainerSave::getRecordName | ( | ) | const [protected, pure virtual] |
Implemented in PhysicsTools::MVATrainerSaveImpl< Record_t >.
Referenced by endJob().
virtual const Calibration::MVAComputer* PhysicsTools::MVATrainerSave::getToPut | ( | const edm::EventSetup & | es | ) | const [protected, pure virtual] |
Implemented in PhysicsTools::MVATrainerSaveImpl< Record_t >.
Referenced by analyze().
std::auto_ptr<Calibration::MVAComputer> PhysicsTools::MVATrainerSave::calib [private] |
Definition at line 32 of file MVATrainerSave.h.
bool PhysicsTools::MVATrainerSave::saved [private] |
Definition at line 33 of file MVATrainerSave.h.