#include <PhysicsTools/MVATrainer/interface/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] |
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.
00033 { 00034 if (calib.get() || saved) 00035 return; 00036 00037 const Calibration::MVAComputer *toPutCalib = getToPut(es); 00038 if (MVATrainerLooper::isUntrained(toPutCalib)) 00039 return; 00040 00041 edm::LogInfo("MVATrainerSave") << "Got the trained calibration data"; 00042 00043 std::auto_ptr<Calibration::MVAComputer> calib( 00044 new Calibration::MVAComputer); 00045 *calib = *toPutCalib; 00046 00047 this->calib = calib; 00048 }
Reimplemented from edm::EDAnalyzer.
Definition at line 50 of file MVATrainerSave.cc.
References calib, lat::endl(), getRecordName(), edm::Service< T >::isAvailable(), and saved.
00051 { 00052 if (!calib.get() || saved) 00053 return; 00054 00055 edm::LogInfo("MVATrainerSave") << "Saving calibration data in CondDB."; 00056 00057 edm::Service<cond::service::PoolDBOutputService> dbService; 00058 if (!dbService.isAvailable()) 00059 throw cms::Exception("MVATrainerSave") 00060 << "DBService unavailable" << std::endl; 00061 00062 dbService->createNewIOV<Calibration::MVAComputer>( 00063 calib.release(), dbService->beginOfTime(), 00064 dbService->endOfTime(), getRecordName().c_str()); 00065 00066 saved = true; 00067 }
virtual std::string PhysicsTools::MVATrainerSave::getRecordName | ( | ) | const [protected, pure virtual] |
virtual const Calibration::MVAComputer* PhysicsTools::MVATrainerSave::getToPut | ( | const edm::EventSetup & | es | ) | const [protected, pure virtual] |
std::auto_ptr<Calibration::MVAComputer> PhysicsTools::MVATrainerSave::calib [private] |
bool PhysicsTools::MVATrainerSave::saved [private] |