Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:26

0001 #include <iomanip>
0002 #include <fstream>
0003 #include <iostream>
0004 
0005 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
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 #include "CondFormats/DataRecord/interface/L1TCaloStage2ParamsRcd.h"
0013 #include "CondFormats/L1TObjects/interface/CaloParams.h"
0014 #include "L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h"
0015 
0016 #include "FWCore/ServiceRegistry/interface/Service.h"
0017 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
0018 
0019 class L1TCaloParamsUpdater : public edm::one::EDAnalyzer<> {
0020 public:
0021   void analyze(const edm::Event&, const edm::EventSetup&) override;
0022 
0023   explicit L1TCaloParamsUpdater(const edm::ParameterSet&) : token_{esConsumes()} {}
0024 
0025 private:
0026   edm::ESGetToken<l1t::CaloParams, L1TCaloStage2ParamsRcd> token_;
0027 };
0028 
0029 void L1TCaloParamsUpdater::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
0030   l1t::CaloParamsHelper m_params_helper(evSetup.getData(token_));
0031 
0032   //    std::ifstream is("tauL1CalibLUT_V2.txt");
0033   //    l1t::LUT lut;
0034   //    std::cout<<"LUT read success: "<<lut.read(is)<<std::endl;
0035 
0036   m_params_helper.setIsoTauEtaMax(28);
0037 
0038   std::shared_ptr<l1t::CaloParams> ptr1 = std::make_shared<l1t::CaloParams>(m_params_helper);
0039 
0040   edm::Service<cond::service::PoolDBOutputService> poolDb;
0041   if (poolDb.isAvailable()) {
0042     cond::Time_t firstSinceTime = poolDb->beginOfTime();
0043     poolDb->writeOneIOV(*ptr1, firstSinceTime, "L1TCaloStage2ParamsTweakedRcd");
0044   }
0045 }
0046 
0047 #include "FWCore/PluginManager/interface/ModuleDef.h"
0048 #include "FWCore/Framework/interface/MakerMacros.h"
0049 #include "FWCore/Framework/interface/ModuleFactory.h"
0050 
0051 DEFINE_FWK_MODULE(L1TCaloParamsUpdater);