Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 ///
0002 /// \class L1TCaloStage2ParamsESProducer
0003 ///
0004 /// Description: Produces configuration parameters for stage 2 trigger
0005 ///
0006 /// Implementation:
0007 ///    L1TCaloParamsESProducer is for stage 1
0008 ///
0009 /// \author: L1 Offline Software
0010 ///
0011 
0012 //
0013 //
0014 
0015 // system include files
0016 #include <memory>
0017 #include <iostream>
0018 #include <fstream>
0019 
0020 // user include files
0021 #include "FWCore/Framework/interface/ModuleFactory.h"
0022 #include "FWCore/Framework/interface/ESProducer.h"
0023 #include "FWCore/Framework/interface/ESProducts.h"
0024 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0025 
0026 #include "FWCore/ParameterSet/interface/FileInPath.h"
0027 
0028 #include "CondFormats/L1TObjects/interface/CaloParams.h"
0029 #include "L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h"
0030 #include "CondFormats/DataRecord/interface/L1TCaloParamsRcd.h"
0031 
0032 using namespace std;
0033 
0034 //
0035 // class declaration
0036 //
0037 
0038 using namespace l1t;
0039 
0040 class L1TCaloStage2ParamsESProducer : public edm::ESProducer {
0041 public:
0042   L1TCaloStage2ParamsESProducer(const edm::ParameterSet&);
0043   ~L1TCaloStage2ParamsESProducer() override;
0044 
0045   using ReturnType = std::unique_ptr<CaloParams>;
0046 
0047   ReturnType produce(const L1TCaloParamsRcd&);
0048 
0049 private:
0050   CaloParams m_params;
0051   std::string m_label;
0052 };
0053 
0054 //
0055 // constants, enums and typedefs
0056 //
0057 
0058 //
0059 // static data member definitions
0060 //
0061 
0062 //
0063 // constructors and destructor
0064 //
0065 L1TCaloStage2ParamsESProducer::L1TCaloStage2ParamsESProducer(const edm::ParameterSet& conf) {
0066   //the following line is needed to tell the framework what
0067   // data is being produced
0068   setWhatProduced(this);
0069   //setWhatProduced(this, conf.getParameter<std::string>("label"));
0070 
0071   CaloParamsHelper m_params_helper;
0072 
0073   // towers
0074   m_params_helper.setTowerLsbH(conf.getParameter<double>("towerLsbH"));
0075   m_params_helper.setTowerLsbE(conf.getParameter<double>("towerLsbE"));
0076   m_params_helper.setTowerLsbSum(conf.getParameter<double>("towerLsbSum"));
0077   m_params_helper.setTowerNBitsH(conf.getParameter<int>("towerNBitsH"));
0078   m_params_helper.setTowerNBitsE(conf.getParameter<int>("towerNBitsE"));
0079   m_params_helper.setTowerNBitsSum(conf.getParameter<int>("towerNBitsSum"));
0080   m_params_helper.setTowerNBitsRatio(conf.getParameter<int>("towerNBitsRatio"));
0081   m_params_helper.setTowerEncoding(conf.getParameter<bool>("towerEncoding"));
0082 
0083   // regions
0084   m_params_helper.setRegionLsb(conf.getParameter<double>("regionLsb"));
0085   m_params_helper.setRegionPUSType(conf.getParameter<std::string>("regionPUSType"));
0086   m_params_helper.setRegionPUSParams(conf.getParameter<std::vector<double>>("regionPUSParams"));
0087 
0088   m_params_helper.setPileUpTowerThreshold(conf.getParameter<int>("pileUpTowerThreshold"));
0089 
0090   // EG
0091   m_params_helper.setEgEtaCut(conf.getParameter<int>("egEtaCut"));
0092 
0093   m_params_helper.setEgLsb(conf.getParameter<double>("egLsb"));
0094   m_params_helper.setEgSeedThreshold(conf.getParameter<double>("egSeedThreshold"));
0095   m_params_helper.setEgNeighbourThreshold(conf.getParameter<double>("egNeighbourThreshold"));
0096   m_params_helper.setEgHcalThreshold(conf.getParameter<double>("egHcalThreshold"));
0097 
0098   edm::FileInPath egTrimmingLUTFile = conf.getParameter<edm::FileInPath>("egTrimmingLUTFile");
0099   std::ifstream egTrimmingLUTStream(egTrimmingLUTFile.fullPath());
0100   std::shared_ptr<LUT> egTrimmingLUT(new LUT(egTrimmingLUTStream));
0101   m_params_helper.setEgTrimmingLUT(*egTrimmingLUT);
0102 
0103   m_params_helper.setEgMaxHcalEt(conf.getParameter<double>("egMaxHcalEt"));
0104   m_params_helper.setEgMaxPtHOverE(conf.getParameter<double>("egMaxPtHOverE"));
0105   m_params_helper.setEgHOverEcutBarrel(conf.getParameter<int>("egHOverEcutBarrel"));
0106   m_params_helper.setEgHOverEcutEndcap(conf.getParameter<int>("egHOverEcutEndcap"));
0107 
0108   m_params_helper.setEgMinPtJetIsolation(conf.getParameter<int>("egMinPtJetIsolation"));
0109   m_params_helper.setEgMaxPtJetIsolation(conf.getParameter<int>("egMaxPtJetIsolation"));
0110   m_params_helper.setEgMinPtHOverEIsolation(conf.getParameter<int>("egMinPtHOverEIsolation"));
0111   m_params_helper.setEgMaxPtHOverEIsolation(conf.getParameter<int>("egMaxPtHOverEIsolation"));
0112   m_params_helper.setEgBypassEGVetos(conf.getParameter<unsigned>("egBypassEGVetos"));
0113   m_params_helper.setEgBypassExtHOverE(conf.getParameter<unsigned>("egBypassExtHOverE"));
0114   m_params_helper.setEgBypassShape(conf.getParameter<unsigned>("egBypassShape"));
0115   m_params_helper.setEgBypassECALFG(conf.getParameter<unsigned>("egBypassECALFG"));
0116   m_params_helper.setEgBypassHoE(conf.getParameter<unsigned>("egBypassHoE"));
0117 
0118   edm::FileInPath egMaxHOverELUTFile = conf.getParameter<edm::FileInPath>("egMaxHOverELUTFile");
0119   std::ifstream egMaxHOverELUTStream(egMaxHOverELUTFile.fullPath());
0120   std::shared_ptr<LUT> egMaxHOverELUT(new LUT(egMaxHOverELUTStream));
0121   m_params_helper.setEgMaxHOverELUT(*egMaxHOverELUT);
0122 
0123   edm::FileInPath egCompressShapesLUTFile = conf.getParameter<edm::FileInPath>("egCompressShapesLUTFile");
0124   std::ifstream egCompressShapesLUTStream(egCompressShapesLUTFile.fullPath());
0125   std::shared_ptr<LUT> egCompressShapesLUT(new LUT(egCompressShapesLUTStream));
0126   m_params_helper.setEgCompressShapesLUT(*egCompressShapesLUT);
0127 
0128   m_params_helper.setEgShapeIdType(conf.getParameter<std::string>("egShapeIdType"));
0129   m_params_helper.setEgShapeIdVersion(conf.getParameter<unsigned>("egShapeIdVersion"));
0130   edm::FileInPath egShapeIdLUTFile = conf.getParameter<edm::FileInPath>("egShapeIdLUTFile");
0131   std::ifstream egShapeIdLUTStream(egShapeIdLUTFile.fullPath());
0132   std::shared_ptr<LUT> egShapeIdLUT(new LUT(egShapeIdLUTStream));
0133   m_params_helper.setEgShapeIdLUT(*egShapeIdLUT);
0134 
0135   m_params_helper.setEgPUSType(conf.getParameter<std::string>("egPUSType"));
0136 
0137   m_params_helper.setEgIsolationType(conf.getParameter<std::string>("egIsolationType"));
0138   edm::FileInPath egIsoLUTFile = conf.getParameter<edm::FileInPath>("egIsoLUTFile");
0139   std::ifstream egIsoLUTStream(egIsoLUTFile.fullPath());
0140   std::shared_ptr<LUT> egIsoLUT(new LUT(egIsoLUTStream));
0141   m_params_helper.setEgIsolationLUT(*egIsoLUT);
0142   edm::FileInPath egIsoLUTFile2 = conf.getParameter<edm::FileInPath>("egIsoLUTFile2");
0143   std::ifstream egIsoLUTStream2(egIsoLUTFile2.fullPath());
0144   auto egIsoLUT2 = std::make_shared<LUT>(egIsoLUTStream2);
0145   m_params_helper.setEgIsolationLUT2(*egIsoLUT2);
0146 
0147   //edm::FileInPath egIsoLUTFileBarrel = conf.getParameter<edm::FileInPath>("egIsoLUTFileBarrel");
0148   //std::ifstream egIsoLUTBarrelStream(egIsoLUTFileBarrel.fullPath());
0149   //std::shared_ptr<LUT> egIsoLUTBarrel( new LUT(egIsoLUTBarrelStream) );
0150   //m_params_helper.setEgIsolationLUTBarrel(egIsoLUTBarrel);
0151 
0152   //edm::FileInPath egIsoLUTFileEndcaps = conf.getParameter<edm::FileInPath>("egIsoLUTFileEndcaps");
0153   //std::ifstream egIsoLUTEndcapsStream(egIsoLUTFileEndcaps.fullPath());
0154   //std::shared_ptr<LUT> egIsoLUTEndcaps( new LUT(egIsoLUTEndcapsStream) );
0155   //m_params_helper.setEgIsolationLUTEndcaps(egIsoLUTEndcaps);
0156 
0157   m_params_helper.setEgIsoAreaNrTowersEta(conf.getParameter<unsigned int>("egIsoAreaNrTowersEta"));
0158   m_params_helper.setEgIsoAreaNrTowersPhi(conf.getParameter<unsigned int>("egIsoAreaNrTowersPhi"));
0159   m_params_helper.setEgIsoVetoNrTowersPhi(conf.getParameter<unsigned int>("egIsoVetoNrTowersPhi"));
0160   //m_params_helper.setEgIsoPUEstTowerGranularity(conf.getParameter<unsigned int>("egIsoPUEstTowerGranularity"));
0161   //m_params_helper.setEgIsoMaxEtaAbsForTowerSum(conf.getParameter<unsigned int>("egIsoMaxEtaAbsForTowerSum"));
0162   //m_params_helper.setEgIsoMaxEtaAbsForIsoSum(conf.getParameter<unsigned int>("egIsoMaxEtaAbsForIsoSum"));
0163   m_params_helper.setEgPUSParams(conf.getParameter<std::vector<double>>("egPUSParams"));
0164 
0165   m_params_helper.setEgCalibrationType(conf.getParameter<std::string>("egCalibrationType"));
0166   m_params_helper.setEgCalibrationVersion(conf.getParameter<unsigned>("egCalibrationVersion"));
0167   edm::FileInPath egCalibrationLUTFile = conf.getParameter<edm::FileInPath>("egCalibrationLUTFile");
0168   std::ifstream egCalibrationLUTStream(egCalibrationLUTFile.fullPath());
0169   std::shared_ptr<LUT> egCalibrationLUT(new LUT(egCalibrationLUTStream));
0170   m_params_helper.setEgCalibrationLUT(*egCalibrationLUT);
0171 
0172   // tau
0173   m_params_helper.setTauRegionMask(conf.getParameter<int>("tauRegionMask"));
0174   m_params_helper.setTauLsb(conf.getParameter<double>("tauLsb"));
0175   m_params_helper.setTauSeedThreshold(conf.getParameter<double>("tauSeedThreshold"));
0176   m_params_helper.setTauNeighbourThreshold(conf.getParameter<double>("tauNeighbourThreshold"));
0177   m_params_helper.setTauMaxPtTauVeto(conf.getParameter<double>("tauMaxPtTauVeto"));
0178   m_params_helper.setTauMinPtJetIsolationB(conf.getParameter<double>("tauMinPtJetIsolationB"));
0179   m_params_helper.setTauPUSType(conf.getParameter<std::string>("tauPUSType"));
0180   m_params_helper.setTauMaxJetIsolationB(conf.getParameter<double>("tauMaxJetIsolationB"));
0181   m_params_helper.setTauMaxJetIsolationA(conf.getParameter<double>("tauMaxJetIsolationA"));
0182   m_params_helper.setTauIsoAreaNrTowersEta(conf.getParameter<unsigned int>("tauIsoAreaNrTowersEta"));
0183   m_params_helper.setTauIsoAreaNrTowersPhi(conf.getParameter<unsigned int>("tauIsoAreaNrTowersPhi"));
0184   m_params_helper.setTauIsoVetoNrTowersPhi(conf.getParameter<unsigned int>("tauIsoVetoNrTowersPhi"));
0185 
0186   edm::FileInPath tauIsoLUTFile = conf.getParameter<edm::FileInPath>("tauIsoLUTFile");
0187   std::ifstream tauIsoLUTStream(tauIsoLUTFile.fullPath());
0188   std::shared_ptr<LUT> tauIsoLUT(new LUT(tauIsoLUTStream));
0189   m_params_helper.setTauIsolationLUT(*tauIsoLUT);
0190 
0191   edm::FileInPath tauIsoLUTFile2 = conf.getParameter<edm::FileInPath>("tauIsoLUTFile2");
0192   std::ifstream tauIsoLUTStream2(tauIsoLUTFile2.fullPath());
0193   std::shared_ptr<LUT> tauIsoLUT2(new LUT(tauIsoLUTStream2));
0194   m_params_helper.setTauIsolationLUT2(*tauIsoLUT2);
0195 
0196   edm::FileInPath tauTrimmingShapeVetoLUTFile = conf.getParameter<edm::FileInPath>("tauTrimmingShapeVetoLUTFile");
0197   std::ifstream tauTrimmingShapeVetoLUTStream(tauTrimmingShapeVetoLUTFile.fullPath());
0198   std::shared_ptr<LUT> tauTrimmingShapeVetoLUT(new LUT(tauTrimmingShapeVetoLUTStream));
0199   m_params_helper.setTauTrimmingShapeVetoLUT(*tauTrimmingShapeVetoLUT);
0200 
0201   edm::FileInPath tauCalibrationLUTFile = conf.getParameter<edm::FileInPath>("tauCalibrationLUTFile");
0202   std::ifstream tauCalibrationLUTStream(tauCalibrationLUTFile.fullPath());
0203   std::shared_ptr<LUT> tauCalibrationLUT(new LUT(tauCalibrationLUTStream));
0204   m_params_helper.setTauCalibrationLUT(*tauCalibrationLUT);
0205 
0206   edm::FileInPath tauCompressLUTFile = conf.getParameter<edm::FileInPath>("tauCompressLUTFile");
0207   std::ifstream tauCompressLUTStream(tauCompressLUTFile.fullPath());
0208   std::shared_ptr<LUT> tauCompressLUT(new LUT(tauCompressLUTStream));
0209   m_params_helper.setTauCompressLUT(*tauCompressLUT);
0210 
0211   edm::FileInPath tauEtToHFRingEtLUTFile = conf.getParameter<edm::FileInPath>("tauEtToHFRingEtLUTFile");
0212   std::ifstream tauEtToHFRingEtLUTStream(tauEtToHFRingEtLUTFile.fullPath());
0213   std::shared_ptr<LUT> tauEtToHFRingEtLUT(new LUT(tauEtToHFRingEtLUTStream));
0214   m_params_helper.setTauEtToHFRingEtLUT(*tauEtToHFRingEtLUT);
0215 
0216   m_params_helper.setIsoTauEtaMin(conf.getParameter<int>("isoTauEtaMin"));
0217   m_params_helper.setIsoTauEtaMax(conf.getParameter<int>("isoTauEtaMax"));
0218 
0219   m_params_helper.setTauPUSParams(conf.getParameter<std::vector<double>>("tauPUSParams"));
0220 
0221   // jets
0222   m_params_helper.setJetLsb(conf.getParameter<double>("jetLsb"));
0223   m_params_helper.setJetSeedThreshold(conf.getParameter<double>("jetSeedThreshold"));
0224   m_params_helper.setJetNeighbourThreshold(conf.getParameter<double>("jetNeighbourThreshold"));
0225   m_params_helper.setJetRegionMask(conf.getParameter<int>("jetRegionMask"));
0226   m_params_helper.setJetPUSType(conf.getParameter<std::string>("jetPUSType"));
0227   m_params_helper.setJetBypassPUS(conf.getParameter<unsigned>("jetBypassPUS"));
0228   m_params_helper.setJetPUSUsePhiRing(conf.getParameter<unsigned>("jetPUSUsePhiRing"));
0229   m_params_helper.setJetCalibrationType(conf.getParameter<std::string>("jetCalibrationType"));
0230   m_params_helper.setJetCalibrationParams(conf.getParameter<std::vector<double>>("jetCalibrationParams"));
0231   edm::FileInPath jetCalibrationLUTFile = conf.getParameter<edm::FileInPath>("jetCalibrationLUTFile");
0232   std::ifstream jetCalibrationLUTStream(jetCalibrationLUTFile.fullPath());
0233   std::shared_ptr<LUT> jetCalibrationLUT(new LUT(jetCalibrationLUTStream));
0234   m_params_helper.setJetCalibrationLUT(*jetCalibrationLUT);
0235   edm::FileInPath jetCompressEtaLUTFile = conf.getParameter<edm::FileInPath>("jetCompressEtaLUTFile");
0236   std::ifstream jetCompressEtaLUTStream(jetCompressEtaLUTFile.fullPath());
0237   std::shared_ptr<LUT> jetCompressEtaLUT(new LUT(jetCompressEtaLUTStream));
0238   m_params_helper.setJetCompressEtaLUT(*jetCompressEtaLUT);
0239   edm::FileInPath jetCompressPtLUTFile = conf.getParameter<edm::FileInPath>("jetCompressPtLUTFile");
0240   std::ifstream jetCompressPtLUTStream(jetCompressPtLUTFile.fullPath());
0241   std::shared_ptr<LUT> jetCompressPtLUT(new LUT(jetCompressPtLUTStream));
0242   m_params_helper.setJetCompressPtLUT(*jetCompressPtLUT);
0243 
0244   // sums
0245   m_params_helper.setEtSumLsb(conf.getParameter<double>("etSumLsb"));
0246 
0247   std::vector<int> etSumEtaMin = conf.getParameter<std::vector<int>>("etSumEtaMin");
0248   std::vector<int> etSumEtaMax = conf.getParameter<std::vector<int>>("etSumEtaMax");
0249   std::vector<double> etSumEtThreshold = conf.getParameter<std::vector<double>>("etSumEtThreshold");
0250   m_params_helper.setEtSumBypassMetPUS(conf.getParameter<unsigned>("etSumBypassMetPUS"));
0251   m_params_helper.setEtSumBypassEttPUS(conf.getParameter<unsigned>("etSumBypassEttPUS"));
0252   m_params_helper.setEtSumBypassEcalSumPUS(conf.getParameter<unsigned>("etSumBypassEcalSumPUS"));
0253   m_params_helper.setEtSumMetPUSType(conf.getParameter<std::string>("etSumMetPUSType"));
0254   m_params_helper.setEtSumEttPUSType(conf.getParameter<std::string>("etSumEttPUSType"));
0255   m_params_helper.setEtSumEcalSumPUSType(conf.getParameter<std::string>("etSumEcalSumPUSType"));
0256   m_params_helper.setMetCalibrationType(conf.getParameter<std::string>("metCalibrationType"));
0257   m_params_helper.setMetHFCalibrationType(conf.getParameter<std::string>("metHFCalibrationType"));
0258   m_params_helper.setEtSumEttCalibrationType(conf.getParameter<std::string>("etSumEttCalibrationType"));
0259   m_params_helper.setEtSumEcalSumCalibrationType(conf.getParameter<std::string>("etSumEcalSumCalibrationType"));
0260 
0261   if ((etSumEtaMin.size() == etSumEtaMax.size()) && (etSumEtaMin.size() == etSumEtThreshold.size())) {
0262     for (unsigned i = 0; i < etSumEtaMin.size(); ++i) {
0263       m_params_helper.setEtSumEtaMin(i, etSumEtaMin.at(i));
0264       m_params_helper.setEtSumEtaMax(i, etSumEtaMax.at(i));
0265       m_params_helper.setEtSumEtThreshold(i, etSumEtThreshold.at(i));
0266     }
0267   } else {
0268     edm::LogError("l1t|calo") << "Inconsistent number of EtSum parameters" << std::endl;
0269   }
0270 
0271   edm::FileInPath etSumMetPUSLUTFile = conf.getParameter<edm::FileInPath>("etSumMetPUSLUTFile");
0272   std::ifstream etSumMetPUSLUTStream(etSumMetPUSLUTFile.fullPath());
0273   std::shared_ptr<LUT> etSumMetPUSLUT(new LUT(etSumMetPUSLUTStream));
0274   m_params_helper.setEtSumMetPUSLUT(*etSumMetPUSLUT);
0275 
0276   edm::FileInPath etSumEttPUSLUTFile = conf.getParameter<edm::FileInPath>("etSumEttPUSLUTFile");
0277   std::ifstream etSumEttPUSLUTStream(etSumEttPUSLUTFile.fullPath());
0278   std::shared_ptr<LUT> etSumEttPUSLUT(new LUT(etSumEttPUSLUTStream));
0279   m_params_helper.setEtSumEttPUSLUT(*etSumEttPUSLUT);
0280 
0281   edm::FileInPath etSumEcalSumPUSLUTFile = conf.getParameter<edm::FileInPath>("etSumEcalSumPUSLUTFile");
0282   std::ifstream etSumEcalSumPUSLUTStream(etSumEcalSumPUSLUTFile.fullPath());
0283   std::shared_ptr<LUT> etSumEcalSumPUSLUT(new LUT(etSumEcalSumPUSLUTStream));
0284   m_params_helper.setEtSumEcalSumPUSLUT(*etSumEcalSumPUSLUT);
0285 
0286   edm::FileInPath metCalibrationLUTFile = conf.getParameter<edm::FileInPath>("metCalibrationLUTFile");
0287   std::ifstream metCalibrationLUTStream(metCalibrationLUTFile.fullPath());
0288   std::shared_ptr<LUT> metCalibrationLUT(new LUT(metCalibrationLUTStream));
0289   m_params_helper.setMetCalibrationLUT(*metCalibrationLUT);
0290 
0291   edm::FileInPath metHFCalibrationLUTFile = conf.getParameter<edm::FileInPath>("metHFCalibrationLUTFile");
0292   std::ifstream metHFCalibrationLUTStream(metHFCalibrationLUTFile.fullPath());
0293   std::shared_ptr<LUT> metHFCalibrationLUT(new LUT(metHFCalibrationLUTStream));
0294   m_params_helper.setMetHFCalibrationLUT(*metHFCalibrationLUT);
0295 
0296   edm::FileInPath etSumEttCalibrationLUTFile = conf.getParameter<edm::FileInPath>("etSumEttCalibrationLUTFile");
0297   std::ifstream etSumEttCalibrationLUTStream(etSumEttCalibrationLUTFile.fullPath());
0298   std::shared_ptr<LUT> etSumEttCalibrationLUT(new LUT(etSumEttCalibrationLUTStream));
0299   m_params_helper.setEtSumEttCalibrationLUT(*etSumEttCalibrationLUT);
0300 
0301   edm::FileInPath etSumEcalSumCalibrationLUTFile = conf.getParameter<edm::FileInPath>("etSumEcalSumCalibrationLUTFile");
0302   std::ifstream etSumEcalSumCalibrationLUTStream(etSumEcalSumCalibrationLUTFile.fullPath());
0303   std::shared_ptr<LUT> etSumEcalSumCalibrationLUT(new LUT(etSumEcalSumCalibrationLUTStream));
0304   m_params_helper.setEtSumEcalSumCalibrationLUT(*etSumEcalSumCalibrationLUT);
0305 
0306   edm::FileInPath metPhiCalibrationLUTFile = conf.getParameter<edm::FileInPath>("metPhiCalibrationLUTFile");
0307   std::ifstream metPhiCalibrationLUTStream(metPhiCalibrationLUTFile.fullPath());
0308   std::shared_ptr<LUT> metPhiCalibrationLUT(new LUT(metPhiCalibrationLUTStream));
0309   m_params_helper.setMetPhiCalibrationLUT(*metPhiCalibrationLUT);
0310 
0311   edm::FileInPath metHFPhiCalibrationLUTFile = conf.getParameter<edm::FileInPath>("metHFPhiCalibrationLUTFile");
0312   std::ifstream metHFPhiCalibrationLUTStream(metHFPhiCalibrationLUTFile.fullPath());
0313   std::shared_ptr<LUT> metHFPhiCalibrationLUT(new LUT(metHFPhiCalibrationLUTStream));
0314   m_params_helper.setMetHFPhiCalibrationLUT(*metHFPhiCalibrationLUT);
0315 
0316   // HI centrality trigger
0317   std::vector<double> etSumCentLower = conf.getParameter<std::vector<double>>("etSumCentralityLower");
0318   std::vector<double> etSumCentUpper = conf.getParameter<std::vector<double>>("etSumCentralityUpper");
0319   if (etSumCentLower.size() == etSumCentUpper.size()) {
0320     for (unsigned i = 0; i < etSumCentLower.size(); ++i) {
0321       m_params_helper.setEtSumCentLower(i, etSumCentLower.at(i));
0322       m_params_helper.setEtSumCentUpper(i, etSumCentUpper.at(i));
0323     }
0324   } else {
0325     edm::LogError("l1t|calo") << "Inconsistent number of Centrality boundaries" << std::endl;
0326   }
0327 
0328   // HI centrality trigger
0329   edm::FileInPath centralityLUTFile = conf.getParameter<edm::FileInPath>("centralityLUTFile");
0330   std::ifstream centralityLUTStream(centralityLUTFile.fullPath());
0331   std::shared_ptr<LUT> centralityLUT(new LUT(centralityLUTStream));
0332   m_params_helper.setCentralityLUT(*centralityLUT);
0333   m_params_helper.setCentralityRegionMask(conf.getParameter<int>("centralityRegionMask"));
0334   std::vector<int> minbiasThresholds = conf.getParameter<std::vector<int>>("minimumBiasThresholds");
0335   if (minbiasThresholds.size() == 4) {
0336     m_params_helper.setMinimumBiasThresholds(minbiasThresholds);
0337   } else {
0338     edm::LogError("l1t|calo") << "Incorrect number of minimum bias thresholds set.";
0339   }
0340 
0341   // HI Q2 trigger
0342   edm::FileInPath q2LUTFile = conf.getParameter<edm::FileInPath>("q2LUTFile");
0343   std::ifstream q2LUTStream(q2LUTFile.fullPath());
0344   std::shared_ptr<LUT> q2LUT(new LUT(q2LUTStream));
0345   m_params_helper.setQ2LUT(*q2LUT);
0346 
0347   // Layer 1 LUT specification
0348   m_params_helper.setLayer1ECalScaleFactors(conf.getParameter<std::vector<double>>("layer1ECalScaleFactors"));
0349   m_params_helper.setLayer1HCalScaleFactors(conf.getParameter<std::vector<double>>("layer1HCalScaleFactors"));
0350   m_params_helper.setLayer1HFScaleFactors(conf.getParameter<std::vector<double>>("layer1HFScaleFactors"));
0351   m_params_helper.setLayer1HCalFBLUTUpper(conf.getParameter<std::vector<unsigned>>("layer1HCalFBLUTUpper"));
0352   m_params_helper.setLayer1HCalFBLUTLower(conf.getParameter<std::vector<unsigned>>("layer1HCalFBLUTLower"));
0353 
0354   m_params_helper.setLayer1ECalScaleETBins(conf.getParameter<std::vector<int>>("layer1ECalScaleETBins"));
0355   m_params_helper.setLayer1HCalScaleETBins(conf.getParameter<std::vector<int>>("layer1HCalScaleETBins"));
0356   m_params_helper.setLayer1HFScaleETBins(conf.getParameter<std::vector<int>>("layer1HFScaleETBins"));
0357 
0358   m_params_helper.setLayer1ECalScalePhiBins(conf.exists("layer1ECalScalePhiBins")
0359                                                 ? conf.getParameter<std::vector<unsigned>>("layer1ECalScalePhiBins")
0360                                                 : std::vector<unsigned>(36, 0));
0361   m_params_helper.setLayer1HCalScalePhiBins(conf.exists("layer1HCalScalePhiBins")
0362                                                 ? conf.getParameter<std::vector<unsigned>>("layer1HCalScalePhiBins")
0363                                                 : std::vector<unsigned>(36, 0));
0364   m_params_helper.setLayer1HFScalePhiBins(conf.exists("layer1HFScalePhiBins")
0365                                               ? conf.getParameter<std::vector<unsigned>>("layer1HFScalePhiBins")
0366                                               : std::vector<unsigned>(36, 0));
0367 
0368   if (conf.existsAs<std::vector<unsigned>>("layer1SecondStageLUT")) {
0369     m_params_helper.setLayer1SecondStageLUT(conf.getParameter<std::vector<unsigned>>("layer1SecondStageLUT"));
0370   }
0371 
0372   m_params = (CaloParams)m_params_helper;
0373 }
0374 
0375 L1TCaloStage2ParamsESProducer::~L1TCaloStage2ParamsESProducer() {
0376   // do anything here that needs to be done at desctruction time
0377   // (e.g. close files, deallocate resources etc.)
0378 }
0379 
0380 //
0381 // member functions
0382 //
0383 
0384 // ------------ method called to produce the data  ------------
0385 L1TCaloStage2ParamsESProducer::ReturnType L1TCaloStage2ParamsESProducer::produce(const L1TCaloParamsRcd& iRecord) {
0386   return std::make_unique<CaloParams>(m_params);
0387 }
0388 
0389 //define this as a plug-in
0390 DEFINE_FWK_EVENTSETUP_MODULE(L1TCaloStage2ParamsESProducer);