17 #include "xercesc/util/PlatformUtils.hpp" 37 std::map<std::string, l1t::Mask>& ) {
38 const char * expectedParams[] = {
39 "layer1ECalScaleFactors",
40 "layer1HCalScaleFactors",
41 "layer1HFScaleFactors",
42 "layer1ECalScaleETBins",
43 "layer1HCalScaleETBins",
51 for (
const auto param : expectedParams) {
52 if ( conf.find(param) == conf.end() ) {
53 std::cerr <<
"Unable to locate expected CaloLayer1 parameter: " << param <<
" in L1 settings payload!";
65 if( conf.find(
"layer1ECalScalePhiBins") != conf.end() )
67 if( conf.find(
"layer1HCalScalePhiBins") != conf.end() )
69 if( conf.find(
"layer1HFScalePhiBins") != conf.end() )
71 if( conf.find(
"layer1SecondStageLUT") != conf.end() )
79 std::map<std::string, l1t::Mask>& ) {
80 const char * expectedParams[] = {
81 "leptonSeedThreshold",
82 "leptonTowerThreshold",
83 "pileUpTowerThreshold",
92 "ecalET_energyCalibLUT",
93 "METX_energyCalibLUT",
94 "METY_energyCalibLUT",
95 "egammaRelaxationThreshold",
97 "egammaEnergyCalibLUT",
104 "towerCountThreshold",
106 "ET_towerThresholdLUT",
107 "MET_towerThresholdLUT",
108 "ecalET_towerThresholdLUT",
109 "jetBypassPileUpSub",
111 "egammaHOverECut_iEtaLT15",
112 "egammaHOverECut_iEtaGTEq15",
113 "egammaBypassExtendedHOverE" 115 for (
const auto param : expectedParams) {
116 if ( conf.find(param) == conf.end() ) {
117 std::cerr <<
"Unable to locate expected CaloLayer2 parameter: " << param <<
" in L1 settings payload!";
127 paramsHelper.
setJetBypassPUS(conf[
"jetBypassPileUpSub"].getValue<bool>());
137 std::vector<int> etSumEtaMax;
138 std::vector<int> etSumEtThresh;
140 etSumEtaMax.push_back(conf[
"ETMET_maxTowerEta"].getValue<int>());
141 etSumEtaMax.push_back(conf[
"HTMHT_maxJetEta"].getValue<int>());
142 etSumEtaMax.push_back(conf[
"ETMET_maxTowerEta"].getValue<int>());
143 etSumEtaMax.push_back(conf[
"HTMHT_maxJetEta"].getValue<int>());
144 etSumEtaMax.push_back(conf[
"towerCountMaxEta"].getValue<int>());
146 etSumEtThresh.push_back(0);
147 etSumEtThresh.push_back(conf[
"HT_jetThreshold"].getValue<int>()/2);
148 etSumEtThresh.push_back(0);
149 etSumEtThresh.push_back(conf[
"MHT_jetThreshold"].getValue<int>()/2);
150 etSumEtThresh.push_back(conf[
"ET_towerThreshold"].getValue<int>()/2);
167 paramsHelper.
setEgMaxPtHOverE((conf[
"egammaRelaxationThreshold"].getValue<int>())/2.);
168 paramsHelper.
setEgEtaCut((conf[
"egammaMaxEta"].getValue<int>()));
177 if( conf.find(
"tauIsoLUT2") != conf.end() )
182 if( conf.find(
"P_TauTrimming_13to8.mif") != conf.end() )
197 const L1TCaloParamsRcd& baseRcd = record.template getRecord< L1TCaloParamsRcd >() ;
199 baseRcd.
get( baseSettings ) ;
202 if( objectKey.empty() ){
203 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd" ) <<
"Key is empty, returning empty l1t::CaloParams";
204 throw std::runtime_error(
"Empty objectKey");
207 std::string tscKey = objectKey.substr(0, objectKey.find(
":") );
208 std::string rsKey = objectKey.substr( objectKey.find(
":")+1, std::string::npos );
210 edm::LogInfo(
"L1-O2O: L1TCaloParamsOnlineProd" ) <<
"Producing L1TCaloParamsOnlineProd with TSC key = " << tscKey <<
" and RS key = " << rsKey
215 std::string calol2_top_key, calol2_algo_key, calol2_hw_key;
217 std::map<std::string,std::string> calol2_algo_payloads;
220 std::map<std::string,std::string> topKeys =
229 calol1_top_key = topKeys[
"CALOL1_KEY"];
246 calol2_top_key = topKeys[
"CALOL2_KEY"];
248 std::map<std::string,std::string> calol2_keys =
255 calol2_hw_key = calol2_keys[
"HW"];
262 calol2_algo_key = calol2_keys[
"ALGO"];
264 std::map<std::string,std::string> calol2_algo_keys =
271 for(
auto &
key : calol2_algo_keys)
272 calol2_algo_payloads[
key.second ] =
280 }
catch ( std::runtime_error &
e ) {
281 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd" ) << e.what();
282 throw std::runtime_error(
"Broken key");
287 for(
auto &conf : calol2_algo_payloads){
292 std::ofstream
output(
std::string(
"/tmp/").
append(calol2_hw_key.substr(0,calol2_hw_key.find(
"/"))).append(
".xml"));
293 output << calol2_hw_payload;
298 std::ofstream
output(
std::string(
"/tmp/").
append(calol1_algo_key.substr(0,calol1_algo_key.find(
"/"))).append(
".xml"));
299 output << calol1_algo_payload;
311 calol1.
addProcessor(
"processors",
"processors",
"-1",
"-1");
315 std::map<std::string, l1t::Parameter> calol1_conf = calol1.
getParameters(
"processors");
316 std::map<std::string, l1t::Mask> calol1_rs ;
319 throw std::runtime_error(
"Parsing error for CaloLayer1");
330 for(
auto &conf : calol2_algo_payloads){
339 std::map<std::string, l1t::Parameter> calol2_conf = calol2.
getParameters(
"MP1");
340 std::map<std::string, l1t::Mask> calol2_rs ;
343 throw std::runtime_error(
"Parsing error for CaloLayer2");
347 std::shared_ptr< l1t::CaloParams > retval = std::make_shared< l1t::CaloParams >( m_params_helper ) ;
T getParameter(std::string const &) const
void setConfigured(bool state=true) noexcept
void setEtSumXCalibrationLUT(const l1t::LUT &lut)
void setTauIsolationLUT(const l1t::LUT &lut)
unsigned int exclusiveLayer
~L1TCaloParamsOnlineProd(void)
void setLayer1HFScalePhiBins(const std::vector< unsigned > params)
void setEgCalibrationLUT(const l1t::LUT &lut)
void setEtSumEttCalibrationLUT(const l1t::LUT &lut)
void setJetCalibrationLUT(const l1t::LUT &lut)
virtual std::shared_ptr< l1t::CaloParams > newObject(const std::string &objectKey, const L1TCaloParamsO2ORcd &record) override
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 &)
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 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)
void get(HolderT &iHolder) const
bool readCaloLayer2OnlineSettings(l1t::CaloParamsHelperO2O ¶msHelper, std::map< std::string, l1t::Parameter > &conf, std::map< std::string, l1t::Mask > &)
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 setEgHOverEcutEndcap(int cut)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
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 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 setEgMaxPtHOverE(double thresh)
void setEtSumMetPUSLUT(const l1t::LUT &lut)
void setTauIsolationLUT2(const l1t::LUT &lut)
void setJetBypassPUS(unsigned flag)
void setLayer1HFScaleFactors(const std::vector< double > params)