17 #include "xercesc/util/PlatformUtils.hpp" 38 std::map<std::string, l1t::Mask>& ) {
39 const char * expectedParams[] = {
40 "layer1ECalScaleFactors",
41 "layer1HCalScaleFactors",
42 "layer1HFScaleFactors",
43 "layer1ECalScaleETBins",
44 "layer1HCalScaleETBins",
52 for (
const auto param : expectedParams) {
53 if ( conf.find(param) == conf.end() ) {
54 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd") <<
"Unable to locate expected CaloLayer1 parameter: " << param <<
" in L1 settings payload!";
66 if( conf.find(
"layer1ECalScalePhiBins") != conf.end() )
68 if( conf.find(
"layer1HCalScalePhiBins") != conf.end() )
70 if( conf.find(
"layer1HFScalePhiBins") != conf.end() )
72 if( conf.find(
"layer1SecondStageLUT") != conf.end() )
80 std::map<std::string, l1t::Mask>& ) {
81 const char * expectedParams[] = {
82 "leptonSeedThreshold",
83 "leptonTowerThreshold",
84 "pileUpTowerThreshold",
85 "egammaRelaxationThreshold",
90 "egammaBypassExtendedHOverE",
91 "egammaHOverECut_iEtaLT15",
92 "egammaHOverECut_iEtaGTEq15",
93 "egammaEnergyCalibLUT",
104 "jetBypassPileUpSub",
107 "towerCountThreshold",
110 "ecalET_towerThresholdLUT",
111 "ET_towerThresholdLUT",
112 "MET_towerThresholdLUT",
113 "ET_centralityLowerThresholds",
114 "ET_centralityUpperThresholds",
116 "ecalET_energyCalibLUT",
117 "MET_energyCalibLUT",
118 "METHF_energyCalibLUT",
123 for (
const auto param : expectedParams) {
124 if ( conf.find(param) == conf.end() ) {
125 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd") <<
"Unable to locate expected CaloLayer2 parameter: " << param <<
" in L1 settings payload!";
136 paramsHelper.
setEgMaxPtHOverE((conf[
"egammaRelaxationThreshold"].getValue<int>())/2.);
137 paramsHelper.
setEgEtaCut((conf[
"egammaMaxEta"].getValue<int>()));
139 paramsHelper.
setEgBypassShape( conf[
"egammaBypassShape"].getValue<bool>() );
155 paramsHelper.
setJetBypassPUS(conf[
"jetBypassPileUpSub"].getValue<bool>());
159 std::vector<int> etSumEtaMax;
160 std::vector<int> etSumEtThresh;
162 etSumEtaMax.push_back(conf[
"ETMET_maxTowerEta"].getValue<int>());
163 etSumEtaMax.push_back(conf[
"HTMHT_maxJetEta"].getValue<int>());
164 etSumEtaMax.push_back(conf[
"ETMET_maxTowerEta"].getValue<int>());
165 etSumEtaMax.push_back(conf[
"HTMHT_maxJetEta"].getValue<int>());
166 etSumEtaMax.push_back(conf[
"towerCountMaxEta"].getValue<int>());
168 etSumEtThresh.push_back(0);
169 etSumEtThresh.push_back(conf[
"HT_jetThreshold"].getValue<int>()/2);
170 etSumEtThresh.push_back(0);
171 etSumEtThresh.push_back(conf[
"MHT_jetThreshold"].getValue<int>()/2);
172 etSumEtThresh.push_back(conf[
"towerCountThreshold"].getValue<int>()/2);
183 std::vector<double> etSumCentLowerValues;
184 std::vector<double> etSumCentUpperValues;
186 etSumCentLowerValues = conf[
"ET_centralityLowerThresholds"].getVector<
double>();
187 etSumCentUpperValues = conf[
"ET_centralityUpperThresholds"].getVector<
double>();
214 const L1TCaloParamsRcd& baseRcd = record.template getRecord< L1TCaloParamsRcd >() ;
216 baseRcd.
get( baseSettings ) ;
219 if( objectKey.empty() ){
220 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd" ) <<
"Key is empty";
222 throw std::runtime_error(
"SummaryForFunctionManager: Calo | Faulty | Empty objectKey");
224 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd" ) <<
"returning unmodified prototype of l1t::CaloParams";
225 return std::make_unique< const l1t::CaloParams >( *(baseSettings.product()) ) ;
229 std::string tscKey = objectKey.substr(0, objectKey.find(
":") );
230 std::string rsKey = objectKey.substr( objectKey.find(
":")+1, std::string::npos );
232 edm::LogInfo(
"L1-O2O: L1TCaloParamsOnlineProd" ) <<
"Producing L1TCaloParamsOnlineProd with TSC key = " << tscKey <<
" and RS key = " << rsKey;
236 std::string calol2_top_key, calol2_algo_key, calol2_hw_key;
238 std::map<std::string,std::string> calol2_algo_payloads;
241 std::map<std::string,std::string> topKeys =
250 calol1_top_key = topKeys[
"CALOL1_KEY"];
267 calol2_top_key = topKeys[
"CALOL2_KEY"];
269 std::map<std::string,std::string> calol2_keys =
276 calol2_hw_key = calol2_keys[
"HW"];
283 calol2_algo_key = calol2_keys[
"ALGO"];
285 std::map<std::string,std::string> calol2_algo_keys =
292 for(
auto &
key : calol2_algo_keys)
293 calol2_algo_payloads[
key.second ] =
301 }
catch ( std::runtime_error &
e ) {
302 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd" ) << e.what();
304 throw std::runtime_error(
std::string(
"SummaryForFunctionManager: Calo | Faulty | ") + e.what());
306 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd" ) <<
"returning unmodified prototype of l1t::CaloParams";
307 return std::make_unique< const l1t::CaloParams >( *(baseSettings.product()) ) ;
313 for(
auto &conf : calol2_algo_payloads){
318 std::ofstream
output(
std::string(
"/tmp/").
append(calol2_hw_key.substr(0,calol2_hw_key.find(
"/"))).append(
".xml"));
319 output << calol2_hw_payload;
324 std::ofstream
output(
std::string(
"/tmp/").
append(calol1_algo_key.substr(0,calol1_algo_key.find(
"/"))).append(
".xml"));
325 output << calol1_algo_payload;
338 calol1.
addProcessor(
"processors",
"processors",
"-1",
"-1");
342 std::map<std::string, l1t::Parameter> calol1_conf = calol1.
getParameters(
"processors");
343 std::map<std::string, l1t::Mask> calol1_rs ;
346 throw std::runtime_error(
"Parsing error for CaloLayer1");
348 }
catch ( std::runtime_error &e ){
349 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd" ) << e.what();
351 throw std::runtime_error(
std::string(
"SummaryForFunctionManager: Calo | Faulty | ") + e.what());
353 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd" ) <<
"returning unmodified prototype of l1t::CaloParams";
354 return std::make_unique< const l1t::CaloParams >( *(baseSettings.product()) ) ;
367 for(
auto &conf : calol2_algo_payloads){
375 std::map<std::string, l1t::Parameter> calol2_conf = calol2.
getParameters(
"MP1");
376 std::map<std::string, l1t::Parameter> calol2_conf_demux = calol2.
getParameters(
"DEMUX");
377 calol2_conf.insert( calol2_conf_demux.begin(), calol2_conf_demux.end() ) ;
378 std::map<std::string, l1t::Mask> calol2_rs ;
381 throw std::runtime_error(
"Parsing error for CaloLayer2");
383 }
catch ( std::runtime_error &e ){
384 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd" ) << e.what();
386 throw std::runtime_error(
std::string(
"SummaryForFunctionManager: Calo | Faulty | ") + e.what());
388 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd" ) <<
"returning unmodified prototype of l1t::CaloParams";
389 return std::make_unique< const l1t::CaloParams >( *(baseSettings.product()) ) ;
394 auto retval = std::make_unique< const l1t::CaloParams >( m_params_helper ) ;
396 edm::LogInfo(
"L1-O2O: L1TCaloParamsOnlineProd" ) <<
"SummaryForFunctionManager: Calo | OK | All looks good";
T getParameter(std::string const &) const
void setConfigured(bool state=true) noexcept
void setTauIsolationLUT(const l1t::LUT &lut)
unsigned int exclusiveLayer
void setLayer1HFScalePhiBins(const std::vector< unsigned > params)
void setEgCalibrationLUT(const l1t::LUT &lut)
void setEtSumEttCalibrationLUT(const l1t::LUT &lut)
~L1TCaloParamsOnlineProd(void) override
void setJetCalibrationLUT(const l1t::LUT &lut)
void setEgNeighbourThreshold(double thresh)
void setLayer1HCalScaleFactors(const std::vector< double > params)
void setLayer1ECalScaleFactors(const std::vector< double > params)
void setLayer1SecondStageLUT(const std::vector< unsigned > &lut)
void setEtSumEcalSumCalibrationLUT(const l1t::LUT &lut)
L1TCaloParamsOnlineProd(const edm::ParameterSet &)
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
void setEtSumEttPUSLUT(const l1t::LUT &lut)
void setTauCalibrationLUT(const l1t::LUT &lut)
l1t::OMDSReader m_omdsReader
void setLayer1HCalScalePhiBins(const std::vector< unsigned > params)
void setJetSeedThreshold(double thresh)
void setLayer1HCalScaleETBins(const std::vector< int > params)
void setEtSumCentLower(unsigned centClass, double loBound)
void setEtSumEtaMax(unsigned isum, int eta)
void readDOMFromString(const std::string &str, xercesc::DOMDocument *&doc)
void setEgIsolationLUT(const l1t::LUT &lut)
void setLayer1HFScaleETBins(const std::vector< int > params)
void setTauSeedThreshold(double thresh)
static std::map< std::string, std::string > fetch(const std::vector< std::string > &queryColumns, const std::string &table, const std::string &key, l1t::OMDSReader &m_omdsReader)
void setTauNeighbourThreshold(double thresh)
void setLayer1ECalScaleETBins(const std::vector< int > params)
bool readCaloLayer2OnlineSettings(l1t::CaloParamsHelperO2O ¶msHelper, std::map< std::string, l1t::Parameter > &conf, std::map< std::string, l1t::Mask > &)
void setPileUpTowerThreshold(int thresh)
void setMetHFPhiCalibrationLUT(const l1t::LUT &lut)
void setEgIsolationLUT2(const l1t::LUT &lut)
l1t::LUT convertToLUT(const std::vector< uint64_t > &v, int padding=-1) noexcept
void setLayer1ECalScalePhiBins(const std::vector< unsigned > params)
void setTauTrimmingShapeVetoLUT(const l1t::LUT &lut)
void setMetHFCalibrationLUT(const l1t::LUT &lut)
void setMetPhiCalibrationLUT(const l1t::LUT &lut)
void setEgHOverEcutEndcap(int cut)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
std::unique_ptr< const l1t::CaloParams > newObject(const std::string &objectKey, const L1TCaloParamsO2ORcd &record) override
void setEgEtaCut(int mask)
const std::map< std::string, Parameter > & getParameters(const char *processor) const
void setIsoTauEtaMax(int value)
void setEgBypassEGVetos(unsigned flag)
void setEtSumEcalSumPUSLUT(const l1t::LUT &lut)
void setEgBypassShape(unsigned flag)
void setEtSumCentUpper(unsigned centClass, double upBound)
void setEgSeedThreshold(double thresh)
void setEtSumEtThreshold(unsigned isum, double thresh)
void readRootElement(TriggerSystem &aTriggerSystem, const std::string &sysId="")
bool readCaloLayer1OnlineSettings(l1t::CaloParamsHelperO2O ¶msHelper, std::map< std::string, l1t::Parameter > &conf, std::map< std::string, l1t::Mask > &)
void setEgBypassExtHOverE(unsigned flag)
void setEgHOverEcutBarrel(int cut)
void addProcessor(const char *processor, const char *role, const char *crate, const char *slot)
void setJetPUSUsePhiRing(unsigned flag)
void setEgMaxPtHOverE(double thresh)
void setEtSumMetPUSLUT(const l1t::LUT &lut)
void setJetBypassPUS(unsigned flag)
void setLayer1HFScaleFactors(const std::vector< double > params)
void setEgBypassECALFG(unsigned flag)
void setMetCalibrationLUT(const l1t::LUT &lut)