test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MVATrainerSave.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <memory>
3 #include <vector>
4 #include <string>
5 
14 
18 
20 
23 
24 namespace PhysicsTools {
25 
27  saved(false)
28 {
29 }
30 
32  const edm::EventSetup& es)
33 {
34  if (calib.get() || saved)
35  return;
36 
37  const Calibration::MVAComputer *toPutCalib = getToPut(es);
38  if (MVATrainerLooper::isUntrained(toPutCalib))
39  return;
40 
41  edm::LogInfo("MVATrainerSave") << "Got the trained calibration data";
42 
43  std::auto_ptr<Calibration::MVAComputer> calib(
45  *calib = *toPutCalib;
46 
47  this->calib = calib;
48 }
49 
51 {
52  if (!calib.get() || saved)
53  return;
54 
55  edm::LogInfo("MVATrainerSave") << "Saving calibration data in CondDB.";
56 
58  if (!dbService.isAvailable())
59  throw cms::Exception("MVATrainerSave")
60  << "DBService unavailable" << std::endl;
61 
63  calib.release(), dbService->beginOfTime(),
64  dbService->endOfTime(), getRecordName().c_str());
65 
66  saved = true;
67 }
68 
69 } // namespace PhysicsTools
std::auto_ptr< Calibration::MVAComputer > calib
virtual void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
bool isAvailable() const
Definition: Service.h:46
virtual const Calibration::MVAComputer * getToPut(const edm::EventSetup &es) const =0
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
virtual std::string getRecordName() const =0
MVATrainerSave(const edm::ParameterSet &params)
volatile std::atomic< bool > shutdown_flag false
static bool isUntrained(const T *ptr)