File indexing completed on 2024-04-06 12:22:27
0001 #include <iomanip>
0002 #include <iostream>
0003
0004 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0005
0006 #include "FWCore/Framework/interface/Event.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008
0009 #include "FWCore/Framework/interface/EventSetup.h"
0010 #include "FWCore/Framework/interface/ESHandle.h"
0011
0012
0013 #include "CondFormats/DataRecord/interface/L1TMuonEndCapForestRcd.h"
0014 #include "CondFormats/L1TObjects/interface/L1TMuonEndCapForest.h"
0015
0016 #include "FWCore/ServiceRegistry/interface/Service.h"
0017 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
0018
0019 class L1TMuonEndCapForestWriter : public edm::one::EDAnalyzer<> {
0020 private:
0021 edm::ESGetToken<L1TMuonEndCapForest, L1TMuonEndCapForestRcd> token_;
0022 bool isO2Opayload;
0023
0024 public:
0025 void analyze(const edm::Event&, const edm::EventSetup&) override;
0026
0027 explicit L1TMuonEndCapForestWriter(const edm::ParameterSet& pset) {
0028 isO2Opayload = pset.getUntrackedParameter<bool>("isO2Opayload", false);
0029 token_ = esConsumes();
0030 }
0031 ~L1TMuonEndCapForestWriter(void) override {}
0032 };
0033
0034 void L1TMuonEndCapForestWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
0035 L1TMuonEndCapForest const& ptr1 = evSetup.getData(token_);
0036
0037 edm::Service<cond::service::PoolDBOutputService> poolDb;
0038 if (poolDb.isAvailable()) {
0039 cond::Time_t firstSinceTime = poolDb->beginOfTime();
0040 poolDb->writeOneIOV(ptr1, firstSinceTime, (isO2Opayload ? "L1TMuonEndCapForestO2ORcd" : "L1TMuonEndCapForestRcd"));
0041 }
0042 }
0043
0044 #include "FWCore/PluginManager/interface/ModuleDef.h"
0045 #include "FWCore/Framework/interface/MakerMacros.h"
0046 #include "FWCore/Framework/interface/ModuleFactory.h"
0047
0048 DEFINE_FWK_MODULE(L1TMuonEndCapForestWriter);