17 #include "xercesc/util/PlatformUtils.hpp" 27 std::map<std::string, l1t::Parameter>& conf,
28 std::map<std::string, l1t::Mask>&);
30 std::map<std::string, l1t::Parameter>& conf,
31 std::map<std::string, l1t::Mask>&);
34 std::unique_ptr<const l1t::CaloParams> newObject(
const std::string& objectKey,
42 std::map<std::string, l1t::Parameter>& conf,
43 std::map<std::string, l1t::Mask>&) {
44 const char* expectedParams[] = {
45 "layer1ECalScaleFactors",
46 "layer1HCalScaleFactors",
47 "layer1HFScaleFactors",
48 "layer1ECalScaleETBins",
49 "layer1HCalScaleETBins",
59 for (
const auto param : expectedParams) {
60 if (conf.find(param) == conf.end()) {
62 <<
"Unable to locate expected CaloLayer1 parameter: " << param <<
" in L1 settings payload!";
74 if (conf.find(
"layer1ECalScalePhiBins") != conf.end())
76 conf[
"layer1ECalScalePhiBins"].getVector<
unsigned int>());
77 if (conf.find(
"layer1HCalScalePhiBins") != conf.end())
79 if (conf.find(
"layer1HFScalePhiBins") != conf.end())
81 if (conf.find(
"layer1SecondStageLUT") != conf.end())
83 if (conf.find(
"layer1HCalFBLUTUpper") != conf.end())
85 if (conf.find(
"layer1HCalFBLUTLower") != conf.end())
92 std::map<std::string, l1t::Parameter>& conf,
93 std::map<std::string, l1t::Mask>&) {
94 const char* expectedParams[] = {
95 "leptonSeedThreshold",
96 "leptonTowerThreshold",
97 "pileUpTowerThreshold",
98 "egammaRelaxationThreshold",
102 "egammaBypassEcalFG",
103 "egammaBypassExtendedHOverE",
104 "egammaHOverECut_iEtaLT15",
105 "egammaHOverECut_iEtaGTEq15",
106 "egammaEnergyCalibLUT",
117 "jetBypassPileUpSub",
120 "towerCountThreshold",
123 "ecalET_towerThresholdLUT",
124 "ET_towerThresholdLUT",
125 "MET_towerThresholdLUT",
126 "ET_centralityLowerThresholds",
127 "ET_centralityUpperThresholds",
129 "ecalET_energyCalibLUT",
130 "MET_energyCalibLUT",
131 "METHF_energyCalibLUT",
136 for (
const auto param : expectedParams) {
137 if (conf.find(param) == conf.end()) {
139 <<
"Unable to locate expected CaloLayer2 parameter: " << param <<
" in L1 settings payload!";
150 paramsHelper.
setEgMaxPtHOverE((conf[
"egammaRelaxationThreshold"].getValue<int>()) / 2.);
151 paramsHelper.
setEgEtaCut((conf[
"egammaMaxEta"].getValue<int>()));
168 paramsHelper.
setJetBypassPUS(conf[
"jetBypassPileUpSub"].getValue<bool>());
173 std::vector<int> etSumEtThresh;
175 etSumEtaMax.push_back(conf[
"ETMET_maxTowerEta"].getValue<int>());
176 etSumEtaMax.push_back(conf[
"HTMHT_maxJetEta"].getValue<int>());
177 etSumEtaMax.push_back(conf[
"ETMET_maxTowerEta"].getValue<int>());
178 etSumEtaMax.push_back(conf[
"HTMHT_maxJetEta"].getValue<int>());
179 etSumEtaMax.push_back(conf[
"towerCountMaxEta"].getValue<int>());
181 etSumEtThresh.push_back(0);
182 etSumEtThresh.push_back(conf[
"HT_jetThreshold"].getValue<int>() / 2.);
183 etSumEtThresh.push_back(0);
184 etSumEtThresh.push_back(conf[
"MHT_jetThreshold"].getValue<int>() / 2.);
185 etSumEtThresh.push_back(conf[
"towerCountThreshold"].getValue<int>() / 2.);
196 std::vector<double> etSumCentLowerValues;
197 std::vector<double> etSumCentUpperValues;
199 etSumCentLowerValues = conf[
"ET_centralityLowerThresholds"].getVector<
double>();
200 etSumCentUpperValues = conf[
"ET_centralityUpperThresholds"].getVector<
double>();
220 baseSettings_token(wrappedSetWhatProduced(iConfig).consumes()),
229 if (objectKey.empty()) {
230 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd") <<
"Key is empty";
232 throw std::runtime_error(
"SummaryForFunctionManager: Calo | Faulty | Empty objectKey");
234 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd") <<
"returning unmodified prototype of l1t::CaloParams";
235 return std::make_unique<const l1t::CaloParams>(baseSettings);
239 std::string tscKey = objectKey.substr(0, objectKey.find(
':'));
240 std::string rsKey = objectKey.substr(objectKey.find(
':') + 1, std::string::npos);
243 <<
"Producing L1TCaloParamsOnlineProd with TSC key = " << tscKey <<
" and RS key = " << rsKey;
247 std::string calol2_top_key, calol2_algo_key, calol2_hw_key;
249 std::map<std::string, std::string> calol2_algo_payloads;
251 std::map<std::string, std::string> topKeys =
255 calol1_top_key = topKeys[
"CALOL1_KEY"];
259 calol1_algo_payload =
264 calol2_top_key = topKeys[
"CALOL2_KEY"];
266 std::map<std::string, std::string> calol2_keys =
269 calol2_hw_key = calol2_keys[
"HW"];
273 calol2_algo_key = calol2_keys[
"ALGO"];
275 std::map<std::string, std::string> calol2_algo_keys =
281 for (
auto&
key : calol2_algo_keys)
282 calol2_algo_payloads[
key.second] =
286 }
catch (std::runtime_error&
e) {
289 throw std::runtime_error(
std::string(
"SummaryForFunctionManager: Calo | Faulty | ") +
e.what());
291 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd") <<
"returning unmodified prototype of l1t::CaloParams";
292 return std::make_unique<const l1t::CaloParams>(baseSettings);
298 for (
auto& conf : calol2_algo_payloads) {
303 std::ofstream
output(
std::string(
"/tmp/").
append(calol2_hw_key.substr(0, calol2_hw_key.find(
'/'))).append(
".xml"));
304 output << calol2_hw_payload;
309 std::string(
"/tmp/").
append(calol1_algo_key.substr(0, calol1_algo_key.find(
'/'))).append(
".xml"));
310 output << calol1_algo_payload;
322 calol1.
addProcessor(
"processors",
"processors",
"-1",
"-1");
326 std::map<std::string, l1t::Parameter> calol1_conf = calol1.
getParameters(
"processors");
327 std::map<std::string, l1t::Mask> calol1_rs;
330 throw std::runtime_error(
"Parsing error for CaloLayer1");
332 }
catch (std::runtime_error&
e) {
335 throw std::runtime_error(
std::string(
"SummaryForFunctionManager: Calo | Faulty | ") +
e.what());
337 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd") <<
"returning unmodified prototype of l1t::CaloParams";
338 return std::make_unique<const l1t::CaloParams>(baseSettings);
350 for (
auto& conf : calol2_algo_payloads) {
358 std::map<std::string, l1t::Parameter> calol2_conf = calol2.
getParameters(
"MP1");
359 std::map<std::string, l1t::Parameter> calol2_conf_demux = calol2.
getParameters(
"DEMUX");
360 calol2_conf.insert(calol2_conf_demux.begin(), calol2_conf_demux.end());
361 std::map<std::string, l1t::Mask> calol2_rs;
364 throw std::runtime_error(
"Parsing error for CaloLayer2");
366 }
catch (std::runtime_error&
e) {
369 throw std::runtime_error(
std::string(
"SummaryForFunctionManager: Calo | Faulty | ") +
e.what());
371 edm::LogError(
"L1-O2O: L1TCaloParamsOnlineProd") <<
"returning unmodified prototype of l1t::CaloParams";
372 return std::make_unique<const l1t::CaloParams>(baseSettings);
377 auto retval = std::make_unique<const l1t::CaloParams>(m_params_helper);
379 edm::LogInfo(
"L1-O2O: L1TCaloParamsOnlineProd") <<
"SummaryForFunctionManager: Calo | OK | All looks good";
void setConfigured(bool state=true) noexcept
void setTauIsolationLUT(const l1t::LUT &lut)
void setLayer1HCalFBLUTUpper(const std::vector< unsigned > params)
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)
Log< level::Error, false > LogError
const edm::ESGetToken< l1t::CaloParams, L1TCaloParamsRcd > baseSettings_token
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 setEtSumCentLower(unsigned centClass, double loBound)
void setEtSumEtaMax(unsigned isum, int eta)
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
void readDOMFromString(const std::string &str, xercesc::DOMDocument *&doc)
void setEgIsolationLUT(const l1t::LUT &lut)
void setLayer1HFScaleETBins(const std::vector< int > params)
const std::map< std::string, Parameter > & getParameters(const char *processor) const
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 > &)
key
prepare the HTCondor submission files and eventually submit them
void setPileUpTowerThreshold(int thresh)
void setMetHFPhiCalibrationLUT(const l1t::LUT &lut)
void setEgIsolationLUT2(const l1t::LUT &lut)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
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)
Log< level::Info, false > LogInfo
void setLayer1HCalFBLUTLower(const std::vector< unsigned > params)
void setEgHOverEcutEndcap(int cut)
std::unique_ptr< const l1t::CaloParams > newObject(const std::string &objectKey, const L1TCaloParamsO2ORcd &record) override
void setEgEtaCut(int mask)
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)
const unsigned int exclusiveLayer
void setLayer1HFScaleFactors(const std::vector< double > params)
const bool transactionSafe
void setEgBypassECALFG(unsigned flag)
void setMetCalibrationLUT(const l1t::LUT &lut)