test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions
L1TCaloParamsOnlineProd.cc File Reference
#include <iostream>
#include <fstream>
#include <stdexcept>
#include <sstream>
#include "CondTools/L1TriggerExt/interface/L1ConfigOnlineProdBaseExt.h"
#include "CondFormats/L1TObjects/interface/CaloParams.h"
#include "CondFormats/DataRecord/interface/L1TCaloStage2ParamsRcd.h"
#include "CondFormats/DataRecord/interface/L1TCaloParamsO2ORcd.h"
#include "L1Trigger/L1TCommon/interface/TrigSystem.h"
#include "L1Trigger/L1TCommon/interface/XmlConfigReader.h"
#include "L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h"
#include "xercesc/util/PlatformUtils.hpp"

Go to the source code of this file.

Classes

class  L1TCaloParamsOnlineProd
 

Functions

bool readCaloLayer1OnlineSettings (l1t::CaloParamsHelper &paramsHelper, std::map< std::string, l1t::Setting > &conf, std::map< std::string, l1t::Mask > &)
 
bool readCaloLayer2OnlineSettings (l1t::CaloParamsHelper &paramsHelper, std::map< std::string, l1t::Setting > &conf, std::map< std::string, l1t::Mask > &)
 
static const
edm::ParameterSetDescriptionFillerPluginFactory::PMaker
< edm::DescriptionFillerForESProducers
< L1TCaloParamsOnlineProd > > 
s_filler__LINE__ ("L1TCaloParamsOnlineProd")
 
static const
edm::eventsetup::ModulePluginFactory::PMaker
< edm::eventsetup::ModuleMaker
< L1TCaloParamsOnlineProd > > 
s_maker__LINE__ ("L1TCaloParamsOnlineProd")
 

Function Documentation

bool readCaloLayer1OnlineSettings ( l1t::CaloParamsHelper paramsHelper,
std::map< std::string, l1t::Setting > &  conf,
std::map< std::string, l1t::Mask > &   
)

Definition at line 27 of file L1TCaloParamsOnlineProd.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, l1t::CaloParamsHelper::setLayer1ECalScaleETBins(), l1t::CaloParamsHelper::setLayer1ECalScaleFactors(), l1t::CaloParamsHelper::setLayer1HCalScaleETBins(), l1t::CaloParamsHelper::setLayer1HCalScaleFactors(), l1t::CaloParamsHelper::setLayer1HFScaleETBins(), and l1t::CaloParamsHelper::setLayer1HFScaleFactors().

Referenced by L1TCaloParamsOnlineProd::newObject().

27  {
28  const char * expectedParams[] = {
29  "layer1ECalScaleFactors",
30  "layer1HCalScaleFactors",
31  "layer1HFScaleFactors",
32  "layer1ECalScaleETBins",
33  "layer1HCalScaleETBins",
34  "layer1HFScaleETBins"
35  };
36  for (const auto param : expectedParams) {
37  if ( conf.find(param) == conf.end() ) {
38  std::cerr << "Unable to locate expected CaloLayer1 parameter: " << param << " in L1 settings payload!";
39  return false;
40  }
41  }
42  // Layer 1 LUT specification
43  paramsHelper.setLayer1ECalScaleFactors((conf["layer1ECalScaleFactors"].getVector<double>()));
44  paramsHelper.setLayer1HCalScaleFactors((conf["layer1HCalScaleFactors"].getVector<double>()));
45  paramsHelper.setLayer1HFScaleFactors ((conf["layer1HFScaleFactors"] .getVector<double>()));
46  paramsHelper.setLayer1ECalScaleETBins(conf["layer1ECalScaleETBins"].getVector<int>());
47  paramsHelper.setLayer1HCalScaleETBins(conf["layer1HCalScaleETBins"].getVector<int>());
48  paramsHelper.setLayer1HFScaleETBins (conf["layer1HFScaleETBins"] .getVector<int>());
49 
50  return true;
51 }
void setLayer1HCalScaleETBins(const std::vector< int > params)
void setLayer1HFScaleETBins(const std::vector< int > params)
void setLayer1ECalScaleETBins(const std::vector< int > params)
void setLayer1HCalScaleFactors(const std::vector< double > params)
void setLayer1HFScaleFactors(const std::vector< double > params)
void setLayer1ECalScaleFactors(const std::vector< double > params)
bool readCaloLayer2OnlineSettings ( l1t::CaloParamsHelper paramsHelper,
std::map< std::string, l1t::Setting > &  conf,
std::map< std::string, l1t::Mask > &   
)

Definition at line 54 of file L1TCaloParamsOnlineProd.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, i, l1t::CaloParamsHelper::setEgCalibrationLUT(), l1t::CaloParamsHelper::setEgEtaCut(), l1t::CaloParamsHelper::setEgIsolationLUT(), l1t::CaloParamsHelper::setEgMaxPtHOverE(), l1t::CaloParamsHelper::setEgNeighbourThreshold(), l1t::CaloParamsHelper::setEgSeedThreshold(), l1t::CaloParamsHelper::setEtSumEcalSumPUSLUT(), l1t::CaloParamsHelper::setEtSumEtaMax(), l1t::CaloParamsHelper::setEtSumEtThreshold(), l1t::CaloParamsHelper::setEtSumEttPUSLUT(), l1t::CaloParamsHelper::setEtSumXPUSLUT(), l1t::CaloParamsHelper::setIsoTauEtaMax(), l1t::CaloParamsHelper::setJetCalibrationLUT(), l1t::CaloParamsHelper::setJetSeedThreshold(), l1t::CaloParamsHelper::setTauCalibrationLUT(), l1t::CaloParamsHelper::setTauIsolationLUT(), l1t::CaloParamsHelper::setTauIsolationLUT2(), l1t::CaloParamsHelper::setTauNeighbourThreshold(), and l1t::CaloParamsHelper::setTauSeedThreshold().

Referenced by L1TCaloParamsOnlineProd::newObject().

54  {
55  const char * expectedParams[] = {
56  "leptonSeedThreshold",
57  "leptonTowerThreshold",
58  "pileUpTowerThreshold",
59  "jetSeedThreshold",
60  "jetMaxEta",
61  "HTMHT_maxJetEta",
62  "HT_jetThreshold",
63  "MHT_jetThreshold",
64  "jetEnergyCalibLUT",
65  "ETMET_maxTowerEta",
66  "ET_energyCalibLUT",
67  "ecalET_energyCalibLUT",
68  "METX_energyCalibLUT",
69  "METY_energyCalibLUT",
70  "egammaRelaxationThreshold",
71  "egammaMaxEta",
72  "egammaEnergyCalibLUT",
73  "egammaIsoLUT",
74  "tauMaxEta",
75  "tauEnergyCalibLUT",
76  "tauIsoLUT1",
77  "tauIsoLUT2"
78  };
79  for (const auto param : expectedParams) {
80  if ( conf.find(param) == conf.end() ) {
81  std::cerr << "Unable to locate expected CaloLayer2 parameter: " << param << " in L1 settings payload!";
82  return false;
83  }
84  }
85  // Layer 2 params specification
86  paramsHelper.setEgSeedThreshold((conf["leptonSeedThreshold"].getValue<int>())/2);
87  paramsHelper.setTauSeedThreshold((conf["leptonSeedThreshold"].getValue<int>())/2);
88  paramsHelper.setEgNeighbourThreshold((conf["leptonTowerThreshold"].getValue<int>())/2);
89  paramsHelper.setTauNeighbourThreshold((conf["leptonTowerThreshold"].getValue<int>())/2);
90  paramsHelper.setJetSeedThreshold((conf["jetSeedThreshold"].getValue<int>())/2);
91 
92  // Currently not used // paramsHelper.setEgPileupTowerThresh((conf["pileUpTowerThreshold"].getValue<int>()));
93  // Currently not used // paramsHelper.setTauPileupTowerThresh((conf["pileUpTowerThreshold"].getValue<int>()));
94  // Currently not used // paramsHelper.setJetMaxEta((conf["jetMaxEta"].getValue<int>()));
95 
96  std::vector<int> etSumEtaMax;
97  std::vector<int> etSumEtThresh;
98 
99  etSumEtaMax.push_back(conf["ETMET_maxTowerEta"].getValue<int>());
100  etSumEtaMax.push_back(conf["HTMHT_maxJetEta"].getValue<int>());
101  etSumEtaMax.push_back(conf["ETMET_maxTowerEta"].getValue<int>());
102  etSumEtaMax.push_back(conf["HTMHT_maxJetEta"].getValue<int>());
103 
104  etSumEtThresh.push_back(0); // ETT tower threshold
105  etSumEtThresh.push_back(conf["HT_jetThreshold"].getValue<int>());
106  etSumEtThresh.push_back(0); // ETM tower threshold
107  etSumEtThresh.push_back(conf["MHT_jetThreshold"].getValue<int>());
108 
109  for (uint i=0; i<4; ++i) {
110  paramsHelper.setEtSumEtaMax(i, etSumEtaMax.at(i));
111  paramsHelper.setEtSumEtThreshold(i, etSumEtThresh.at(i));
112  }
113 
114  std::stringstream oss;
115 
116  std::vector<uint32_t> jetEnergyCalibLUT = conf["jetEnergyCalibLUT"].getVector<uint32_t>();
117  oss <<"#<header> V1 "<< ( 32 - __builtin_clz( uint32_t(jetEnergyCalibLUT.size()-1) ) ) <<" 63 </header> "<<std::endl; // hardcode max bits for data
118  for(unsigned int i=0; i<jetEnergyCalibLUT.size(); i++) oss << i << " " << jetEnergyCalibLUT[i] << std::endl;
119 
120  std::istringstream iss1( oss.str() );
121  paramsHelper.setJetCalibrationLUT( l1t::LUT( (std::istream&)iss1 ) );
122  oss.str("");
123 
124  std::vector<int> etSumEttPUSLUT = conf["ET_energyCalibLUT"].getVector<int>();
125  oss <<"#<header> V1 "<< ( 32 - __builtin_clz( uint32_t(etSumEttPUSLUT.size()-1) ) ) <<" 63 </header> "<<std::endl; // hardcode max bits for data
126  for(unsigned int i=0; i<etSumEttPUSLUT.size(); i++) oss << i << " " << etSumEttPUSLUT[i] << std::endl;
127 
128  std::istringstream iss2( oss.str() );
129  paramsHelper.setEtSumEttPUSLUT( l1t::LUT( (std::istream&)iss2 ) );
130  oss.str("");
131 
132  std::vector<int> etSumEcalSumPUTLUT = conf["ecalET_energyCalibLUT"].getVector<int>();
133  oss <<"#<header> V1 "<< ( 32 - __builtin_clz( uint32_t(etSumEcalSumPUTLUT.size()-1) ) ) <<" 63 </header> "<<std::endl; // hardcode max bits for data
134  for(unsigned int i=0; i<etSumEcalSumPUTLUT.size(); i++) oss << i << " " << etSumEcalSumPUTLUT[i] << std::endl;
135 
136  std::istringstream iss3( oss.str() );
137  paramsHelper.setEtSumEcalSumPUSLUT( l1t::LUT( (std::istream&)iss3 ) );
138  oss.str("");
139 
140  std::vector<int> etSumXPUSLUT = conf["METX_energyCalibLUT"].getVector<int>();
141  oss <<"#<header> V1 "<< ( 32 - __builtin_clz( uint32_t(etSumXPUSLUT.size()-1) ) ) <<" 63 </header> "<<std::endl; // hardcode max bits for data
142  for(unsigned int i=0; i<etSumXPUSLUT.size(); i++) oss << i << " " << etSumXPUSLUT[i] << std::endl;
143 
144  std::istringstream iss4( oss.str() );
145  paramsHelper.setEtSumXPUSLUT( l1t::LUT( (std::istream&)iss4 ) );
146  oss.str("");
147 
148  paramsHelper.setEgMaxPtHOverE((conf["egammaRelaxationThreshold"].getValue<int>()));
149  paramsHelper.setEgEtaCut((conf["egammaMaxEta"].getValue<int>()));
150 
151 
152  std::vector<int> egCalibrationLUT = conf["egammaEnergyCalibLUT"].getVector<int>();
153  oss <<"#<header> V1 "<< ( 32 - __builtin_clz( uint32_t(egCalibrationLUT.size()-1) ) ) <<" 63 </header> "<<std::endl; // hardcode max bits for data
154  for(unsigned int i=0; i<egCalibrationLUT.size(); i++) oss << i << " " << egCalibrationLUT[i] << std::endl;
155 
156  std::istringstream iss5( oss.str() );
157  paramsHelper.setEgCalibrationLUT( l1t::LUT( (std::istream&)iss5 ) );
158  oss.str("");
159 
160  std::vector<int> egIsolationLUT = conf["egammaIsoLUT"].getVector<int>();
161  oss <<"#<header> V1 "<< ( 32 - __builtin_clz( uint32_t(egIsolationLUT.size()-1) ) ) <<" 63 </header> "<<std::endl; // hardcode max bits for data
162  for(unsigned int i=0; i<egIsolationLUT.size(); i++) oss << i << " " << egIsolationLUT[i] << std::endl;
163 
164  std::istringstream iss6( oss.str() );
165  paramsHelper.setEgIsolationLUT( l1t::LUT( (std::istream&)iss6 ) );
166  oss.str("");
167 
168  //std::cout<<"egammaIsoLUT: "<<std::endl;
169  //for(unsigned int i=0; i<paramsHelper.egIsolationLUT()->maxSize(); i++) std::cout << std::setprecision(14) << paramsHelper.egIsolationLUT()->data(i) <<", ";
170  //std::cout << std::endl;
171 
172  paramsHelper.setIsoTauEtaMax((conf["tauMaxEta"].getValue<int>()));
173 
174  std::vector<int> tauCalibrationLUT = conf["tauEnergyCalibLUT"].getVector<int>();
175  oss <<"#<header> V1 "<< ( 32 - __builtin_clz( uint32_t(tauCalibrationLUT.size()-1) ) ) <<" 63 </header> "<<std::endl; // hardcode max bits for data
176  for(unsigned int i=0; i<tauCalibrationLUT.size(); i++) oss << i << " " << tauCalibrationLUT[i] << std::endl;
177 
178  std::istringstream iss7( oss.str() );
179  paramsHelper.setTauCalibrationLUT(l1t::LUT( (std::istream&)iss7 ));
180  oss.str("");
181 
182  std::vector<int> tauIsolationLUT = conf["tauIsoLUT1"].getVector<int>();
183  oss <<"#<header> V1 "<< ( 32 - __builtin_clz( uint32_t(tauIsolationLUT.size()-1) ) ) <<" 63 </header> "<<std::endl; // hardcode max bits for data
184  for(unsigned int i=0; i<tauIsolationLUT.size(); i++) oss << i << " " << tauIsolationLUT[i] << std::endl;
185 
186  std::istringstream iss8( oss.str() );
187  paramsHelper.setTauIsolationLUT( l1t::LUT((std::istream&)iss8 ) );
188  oss.str("");
189 
190  std::vector<int> tauIsolationLUT2 = conf["tauIsoLUT2"].getVector<int>();
191  oss <<"#<header> V1 "<< ( 32 - __builtin_clz( uint32_t(tauIsolationLUT2.size()-1) ) ) <<" 63 </header> "<<std::endl; // hardcode max bits for data
192  for(unsigned int i=0; i<tauIsolationLUT2.size(); i++) oss << i << " " << tauIsolationLUT2[i] << std::endl;
193 
194  std::istringstream iss9( oss.str() );
195  paramsHelper.setTauIsolationLUT2( l1t::LUT( (std::istream&)iss9 ) );
196  oss.str("");
197 
198  return true;
199 }
void setEtSumEtaMax(unsigned isum, int eta)
int i
Definition: DBlmapReader.cc:9
void setIsoTauEtaMax(int value)
void setEgNeighbourThreshold(double thresh)
void setTauCalibrationLUT(const l1t::LUT &lut)
void setTauIsolationLUT(const l1t::LUT &lut)
void setJetCalibrationLUT(const l1t::LUT &lut)
void setTauNeighbourThreshold(double thresh)
void setEtSumXPUSLUT(const l1t::LUT &lut)
void setEgCalibrationLUT(const l1t::LUT &lut)
void setEtSumEttPUSLUT(const l1t::LUT &lut)
void setEtSumEtThreshold(unsigned isum, double thresh)
void setTauSeedThreshold(double thresh)
void setEgEtaCut(int mask)
Definition: LUT.h:29
void setJetSeedThreshold(double thresh)
void setEgMaxPtHOverE(double thresh)
void setEgIsolationLUT(const l1t::LUT &lut)
void setTauIsolationLUT2(const l1t::LUT &lut)
void setEgSeedThreshold(double thresh)
void setEtSumEcalSumPUSLUT(const l1t::LUT &lut)
static const edm::ParameterSetDescriptionFillerPluginFactory::PMaker<edm::DescriptionFillerForESProducers< L1TCaloParamsOnlineProd > > s_filler__LINE__ ( "L1TCaloParamsOnlineProd"  )
static
static const edm::eventsetup::ModulePluginFactory ::PMaker< edm::eventsetup::ModuleMaker< L1TCaloParamsOnlineProd > > s_maker__LINE__ ( "L1TCaloParamsOnlineProd"  )
static