CMS 3D CMS Logo

JetResolutionDBWriter.cc
Go to the documentation of this file.
1 // Author: Sébastien Brochet
2 
3 #include <memory>
4 #include <string>
5 #include <fstream>
6 #include <iostream>
16 
18 {
19  public:
21  virtual void beginJob() override;
22  virtual void analyze(const edm::Event&, const edm::EventSetup&) override {}
23  virtual void endJob() override {}
25 
26  private:
29 };
30 
31 // Constructor
33 {
34  m_record = pSet.getUntrackedParameter<std::string>("record");
35  m_path = pSet.getUntrackedParameter<edm::FileInPath>("file").fullPath();
36 }
37 
38 // Begin Job
40 {
41 
42  std::cout << "Loading data from '" << m_path << "'" << std::endl;
43 
45 
46  std::cout << "Opening PoolDBOutputService" << std::endl;
47 
48  // now write it into the DB
50  if (s.isAvailable())
51  {
52 
53  std::cout << "Setting up payload record " << m_record << std::endl;
54  cond::Time_t sinceTime = s->isNewTagRequest(m_record) ? s->beginOfTime() : s->currentTime();
55  s->writeOne<JME::JetResolutionObject>(jerObject, sinceTime, m_record);
56 
57  std::cout << "Object saved into the database with the record: " << m_record << std::endl;
58  }
59 }
60 
T getUntrackedParameter(std::string const &, T const &) const
JetResolutionDBWriter(const edm::ParameterSet &)
virtual void beginJob() override
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void endJob() override
unsigned long long Time_t
Definition: Time.h:16
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:46
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)