Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-15 23:33:54

0001 #include "FWCore/ServiceRegistry/interface/Service.h"
0002 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0003 #include "FWCore/Framework/interface/Event.h"
0004 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
0005 #include "CondFormats/Calibration/interface/BlobComplex.h"
0006 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0007 
0008 #include <iostream>
0009 #include <string>
0010 
0011 namespace edm {
0012   class ParameterSet;
0013   class Event;
0014   class EventSetup;
0015 }  // namespace edm
0016 
0017 // class decleration
0018 class writeBlobComplex : public edm::one::EDAnalyzer<> {
0019 public:
0020   explicit writeBlobComplex(const edm::ParameterSet& iConfig);
0021   ~writeBlobComplex();
0022   virtual void analyze(const edm::Event&, const edm::EventSetup&);
0023   virtual void endJob() {}
0024 
0025 private:
0026   std::string m_RecordName;
0027 };
0028 
0029 writeBlobComplex::writeBlobComplex(const edm::ParameterSet& iConfig) : m_RecordName("BlobComplexRcd") {}
0030 
0031 writeBlobComplex::~writeBlobComplex() { std::cout << "writeBlobComplex::writeBlobComplex" << std::endl; }
0032 
0033 void writeBlobComplex::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) {
0034   std::cout << "writeBlobComplex::analyze " << std::endl;
0035   edm::Service<cond::service::PoolDBOutputService> mydbservice;
0036   if (!mydbservice.isAvailable()) {
0037     std::cout << "db service unavailable" << std::endl;
0038     return;
0039   }
0040   try {
0041     BlobComplex me;
0042     unsigned int serial = 123;
0043     me.fill(serial);
0044     std::cout << "writeBlobComplex::about to write " << std::endl;
0045     mydbservice->writeOneIOV(me, mydbservice->currentTime(), m_RecordName);
0046   } catch (const std::exception& er) {
0047     std::cout << "caught std::exception " << er.what() << std::endl;
0048     throw er;
0049   }
0050 }
0051 #include "FWCore/Framework/interface/MakerMacros.h"
0052 DEFINE_FWK_MODULE(writeBlobComplex);