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/LHCInfoPerFill.h"
0013 #include "CondFormats/DataRecord/interface/LHCInfoPerFillRcd.h"
0014 
0015 #include <memory>
0016 #include <iostream>
0017 
0018 class LHCInfoPerFillWriter : public edm::one::EDAnalyzer<> {
0019 public:
0020   explicit LHCInfoPerFillWriter(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 LHCInfoPerFillWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0029   LHCInfoPerFill lhcInfoPerFill;
0030   lhcInfoPerFill.setFillNumber(3);
0031   lhcInfoPerFill.setBunchesInBeam1(10);
0032   lhcInfoPerFill.setBunchesInBeam2(8);
0033   lhcInfoPerFill.setCollidingBunches(5);
0034   lhcInfoPerFill.setTargetBunches(4);
0035   lhcInfoPerFill.setFillType(lhcInfoPerFill.PROTONS);
0036   lhcInfoPerFill.setParticleTypeForBeam1(lhcInfoPerFill.PROTON);
0037   lhcInfoPerFill.setParticleTypeForBeam2(lhcInfoPerFill.PROTON);
0038   lhcInfoPerFill.setIntensityForBeam1(1016.5);
0039   lhcInfoPerFill.setIntensityForBeam2(1096.66);
0040   lhcInfoPerFill.setEnergy(7000);
0041   lhcInfoPerFill.setDelivLumi(2E-07);
0042   lhcInfoPerFill.setRecLumi(2E-07);
0043   lhcInfoPerFill.setInstLumi(0);
0044   lhcInfoPerFill.setInstLumiError(0);
0045   lhcInfoPerFill.setCreationTime(6561530930997627120);
0046   lhcInfoPerFill.setBeginTime(6561530930997627120);
0047   lhcInfoPerFill.setEndTime(6561530930997627120);
0048   lhcInfoPerFill.setInjectionScheme("None");
0049   lhcInfoPerFill.setLumiPerBX({0.000114139, 0.000114139});
0050   lhcInfoPerFill.setLhcState("some lhcState");
0051   lhcInfoPerFill.setLhcComment("some lhcComment");
0052   lhcInfoPerFill.setCtppsStatus("some ctppsStatus");
0053 
0054   // store the info into a DB object
0055   edm::Service<cond::service::PoolDBOutputService> poolDbService;
0056   if (poolDbService.isAvailable())
0057     poolDbService->writeOneIOV(lhcInfoPerFill, poolDbService->currentTime(), "LHCInfoPerFillRcd");
0058   else
0059     throw cms::Exception("LHCInfoPerFillWriter") << "PoolDBService required.";
0060 }
0061 
0062 DEFINE_FWK_MODULE(LHCInfoPerFillWriter);