Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:18

0001 #include "FWCore/Framework/interface/Frameworkfwd.h"
0002 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0003 #include "FWCore/Framework/interface/Event.h"
0004 #include "FWCore/Framework/interface/EventSetup.h"
0005 #include "FWCore/Framework/interface/MakerMacros.h"
0006 
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/ServiceRegistry/interface/Service.h"
0009 
0010 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
0011 
0012 #include "CondFormats/RunInfo/interface/LHCInfoPerLS.h"
0013 #include "CondFormats/DataRecord/interface/LHCInfoPerLSRcd.h"
0014 
0015 #include <memory>
0016 #include <iostream>
0017 
0018 class LHCInfoPerLSWriter : public edm::one::EDAnalyzer<> {
0019 public:
0020   explicit LHCInfoPerLSWriter(const edm::ParameterSet&) {}
0021 
0022 private:
0023   void beginJob() override {}
0024   void analyze(const edm::Event&, const edm::EventSetup&) override;
0025   void endJob() override {}
0026 };
0027 
0028 void LHCInfoPerLSWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0029   LHCInfoPerLS lhcInfoPerLS;
0030   lhcInfoPerLS.setFillNumber(7066);
0031   lhcInfoPerLS.setLumiSection(1);
0032   lhcInfoPerLS.setCrossingAngleX(170);
0033   lhcInfoPerLS.setCrossingAngleY(170);
0034   lhcInfoPerLS.setBetaStarX(11);
0035   lhcInfoPerLS.setBetaStarY(11);
0036   lhcInfoPerLS.setRunNumber(301765);
0037 
0038   // store the info into a DB object
0039   edm::Service<cond::service::PoolDBOutputService> poolDbService;
0040   if (poolDbService.isAvailable())
0041     poolDbService->writeOneIOV(lhcInfoPerLS, poolDbService->currentTime(), "LHCInfoPerLSRcd");
0042   else
0043     throw cms::Exception("LHCInfoPerLSWriter") << "PoolDBService required.";
0044 }
0045 
0046 DEFINE_FWK_MODULE(LHCInfoPerLSWriter);