CMS 3D CMS Logo

PhysicsTools::MVATrainerSave Class Reference

#include <PhysicsTools/MVATrainer/interface/MVATrainerSave.h>

Inheritance diagram for PhysicsTools::MVATrainerSave:

edm::EDAnalyzer PhysicsTools::MVATrainerSaveImpl< Record_t >

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup)
virtual void endJob ()
 MVATrainerSave (const edm::ParameterSet &params)

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


Detailed Description

Definition at line 16 of file MVATrainerSave.h.


Constructor & Destructor Documentation

PhysicsTools::MVATrainerSave::MVATrainerSave ( const edm::ParameterSet params  )  [explicit]

Definition at line 26 of file MVATrainerSave.cc.

00026                                                             :
00027         saved(false)
00028 {
00029 }


Member Function Documentation

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 }

void PhysicsTools::MVATrainerSave::endJob ( void   )  [virtual]

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]

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().


Member Data Documentation

std::auto_ptr<Calibration::MVAComputer> PhysicsTools::MVATrainerSave::calib [private]

Definition at line 32 of file MVATrainerSave.h.

Referenced by analyze(), and endJob().

bool PhysicsTools::MVATrainerSave::saved [private]

Definition at line 33 of file MVATrainerSave.h.

Referenced by analyze(), and endJob().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:50:14 2009 for CMSSW by  doxygen 1.5.4