16 #include "xercesc/util/PlatformUtils.hpp" 30 const char * expectedParams[] = {
31 "layer1ECalScaleFactors",
32 "layer1HCalScaleFactors",
33 "layer1HFScaleFactors",
34 "layer1ECalScaleETBins",
35 "layer1HCalScaleETBins",
38 for (
const auto param : expectedParams) {
39 if ( conf.find(param) == conf.end() ) {
40 std::cerr <<
"Unable to locate expected CaloLayer1 parameter: " << param <<
" in L1 settings payload!";
57 const char * expectedParams[] = {
58 "leptonSeedThreshold",
59 "leptonTowerThreshold",
60 "pileUpTowerThreshold",
69 "ecalET_energyCalibLUT",
70 "METX_energyCalibLUT",
71 "METY_energyCalibLUT",
72 "egammaRelaxationThreshold",
74 "egammaEnergyCalibLUT",
80 "towerCountThreshold",
86 "egammaHOverECut_iEtaLT15",
87 "egammaHOverECut_iEtaGTEq15" 89 for (
const auto param : expectedParams) {
90 if ( conf.find(param) == conf.end() ) {
91 std::cerr <<
"Unable to locate expected CaloLayer2 parameter: " << param <<
" in L1 settings payload!";
101 paramsHelper.
setJetBypassPUS(conf[
"jetBypassPileUpSub"].getValue<bool>());
111 std::vector<int> etSumEtaMax;
112 std::vector<int> etSumEtThresh;
114 etSumEtaMax.push_back(conf[
"ETMET_maxTowerEta"].getValue<int>());
115 etSumEtaMax.push_back(conf[
"HTMHT_maxJetEta"].getValue<int>());
116 etSumEtaMax.push_back(conf[
"ETMET_maxTowerEta"].getValue<int>());
117 etSumEtaMax.push_back(conf[
"HTMHT_maxJetEta"].getValue<int>());
118 etSumEtaMax.push_back(conf[
"towerCountMaxEta"].getValue<int>());
120 etSumEtThresh.push_back(conf[
"ET_towerThreshold"].getValue<int>()/2);
121 etSumEtThresh.push_back(conf[
"HT_jetThreshold"].getValue<int>()/2);
122 etSumEtThresh.push_back(conf[
"MET_towerThreshold"].getValue<int>()/2);
123 etSumEtThresh.push_back(conf[
"MHT_jetThreshold"].getValue<int>()/2);
124 etSumEtThresh.push_back(conf[
"ET_towerThreshold"].getValue<int>()/2);
126 for (uint
i=0;
i<5; ++
i) {
135 paramsHelper.
setEgMaxPtHOverE((conf[
"egammaRelaxationThreshold"].getValue<int>())/2.);
136 paramsHelper.
setEgEtaCut((conf[
"egammaMaxEta"].getValue<int>()));
156 baseRcd.
get( baseSettings ) ;
159 if( objectKey.empty() ){
160 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd" ) <<
"Key is empty, returning empty l1t::CaloParams";
161 throw std::runtime_error(
"Empty objectKey");
164 std::string tscKey = objectKey.substr(0, objectKey.find(
":") );
165 std::string rsKey = objectKey.substr( objectKey.find(
":")+1, std::string::npos );
167 edm::LogInfo(
"L1-O2O: L1TCaloParamsOnlineProd" ) <<
"Producing L1TCaloParamsOnlineProd with TSC key = " << tscKey <<
" and RS key = " << rsKey ;
171 std::string calol2_top_key, calol2_algo_key, calol2_hw_key;
173 std::map<std::string,std::string> calol2_algo_payloads;
175 std::map<std::string,std::string> topKeys =
181 calol1_top_key = topKeys[
"CALOL1_KEY"];
195 calol2_top_key = topKeys[
"CALOL2_KEY"];
197 std::map<std::string,std::string> calol2_keys =
204 calol2_hw_key = calol2_keys[
"HW"];
211 calol2_algo_key = calol2_keys[
"ALGO"];
213 std::map<std::string,std::string> calol2_algo_keys =
220 for(
auto &
key : calol2_algo_keys)
221 calol2_algo_payloads[
key.second ] =
228 }
catch ( std::runtime_error &
e ) {
229 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd" ) << e.what();
230 throw std::runtime_error(
"Broken key");
234 for(
auto &conf : calol2_algo_payloads){
240 std::ofstream
output(
std::string(
"/tmp/").
append(calol2_hw_key.substr(0,calol2_hw_key.find(
"/"))).append(
".xml"));
241 output << calol2_hw_payload;
245 std::ofstream
output(
std::string(
"/tmp/").
append(calol1_algo_key.substr(0,calol1_algo_key.find(
"/"))).append(
".xml"));
246 output << calol1_algo_payload;
256 calol1.
addProcessor(
"processors",
"processors",
"-1",
"-1");
260 std::map<std::string, l1t::Parameter> calol1_conf = calol1.
getParameters(
"processors");
261 std::map<std::string, l1t::Mask> calol1_rs ;
269 for(
auto &conf : calol2_algo_payloads){
278 std::map<std::string, l1t::Parameter> calol2_conf = calol2.
getParameters(
"MP1");
279 std::map<std::string, l1t::Mask> calol2_rs ;
284 throw std::runtime_error(
"Parsing error for CaloLayer1");
286 throw std::runtime_error(
"Parsing error for CaloLayer2");
288 std::shared_ptr< l1t::CaloParams > retval = std::make_shared< l1t::CaloParams >( m_params_helper ) ;
void setEtSumEtaMax(unsigned isum, int eta)
void setConfigured(bool state=true) noexcept
void setLayer1HCalScaleETBins(const std::vector< int > params)
void setIsoTauEtaMax(int value)
void setEgNeighbourThreshold(double thresh)
~L1TCaloParamsOnlineProd(void)
void setTauCalibrationLUT(const l1t::LUT &lut)
void setTauIsolationLUT(const l1t::LUT &lut)
void setJetCalibrationLUT(const l1t::LUT &lut)
void setTauNeighbourThreshold(double thresh)
void setEgHOverEcutEndcap(int cut)
virtual std::shared_ptr< l1t::CaloParams > newObject(const std::string &objectKey, const L1TCaloParamsO2ORcd &record) override
void setEtSumXPUSLUT(const l1t::LUT &lut)
void setEgCalibrationLUT(const l1t::LUT &lut)
L1TCaloParamsOnlineProd(const edm::ParameterSet &)
void setEtSumEttPUSLUT(const l1t::LUT &lut)
l1t::OMDSReader m_omdsReader
void setEgHOverEcutBarrel(int cut)
bool readCaloLayer2OnlineSettings(l1t::CaloParamsHelper ¶msHelper, std::map< std::string, l1t::Parameter > &conf, std::map< std::string, l1t::Mask > &)
void readDOMFromString(const std::string &str, xercesc::DOMDocument *&doc)
void setEgBypassEGVetos(unsigned flag)
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 get(HolderT &iHolder) const
void setLayer1HFScaleETBins(const std::vector< int > params)
void setEtSumEtThreshold(unsigned isum, double thresh)
void setLayer1ECalScaleETBins(const std::vector< int > params)
void setTauSeedThreshold(double thresh)
l1t::LUT convertToLUT(const std::vector< uint64_t > &v, int padding=-1) noexcept
void setEgEtaCut(int mask)
void setLayer1HCalScaleFactors(const std::vector< double > params)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
void setLayer1HFScaleFactors(const std::vector< double > params)
const std::map< std::string, Parameter > & getParameters(const char *processor) const
void setJetSeedThreshold(double thresh)
void setEgMaxPtHOverE(double thresh)
void readRootElement(TriggerSystem &aTriggerSystem, const std::string &sysId="")
void setEgIsolationLUT(const l1t::LUT &lut)
void addProcessor(const char *processor, const char *role, const char *crate, const char *slot)
void setTauIsolationLUT2(const l1t::LUT &lut)
void setJetBypassPUS(unsigned flag)
void setEgSeedThreshold(double thresh)
void setLayer1ECalScaleFactors(const std::vector< double > params)
bool readCaloLayer1OnlineSettings(l1t::CaloParamsHelper ¶msHelper, std::map< std::string, l1t::Parameter > &conf, std::map< std::string, l1t::Mask > &)
void setEtSumEcalSumPUSLUT(const l1t::LUT &lut)