12 #include "xercesc/util/PlatformUtils.hpp" 22 std::unique_ptr<const L1TMuonOverlapFwVersion> newObject(
const std::string& objectKey,
33 while ((start_pos =
str.find(from, start_pos)) != std::string::npos) {
34 str.replace(start_pos, from.length(),
to);
35 start_pos +=
to.length();
43 while ((start_pos =
str.find(from, start_pos)) != std::string::npos) {
44 size_t end_pos =
str.find(
to) +
to.length();
45 int length = end_pos - start_pos;
46 str.replace(start_pos, length,
"");
53 baseSettings_token(wrappedSetWhatProduced(iConfig).consumes()) {}
60 if (objectKey.empty()) {
62 <<
"Key is empty, returning empty L1TMuonOverlapFwVersion";
64 throw std::runtime_error(
"SummaryForFunctionManager: OMTF | Faulty | Empty objectKey");
67 <<
"returning unmodified prototype of L1TMuonOverlapFwVersion";
68 return std::make_unique<const L1TMuonOverlapFwVersion>(baseSettings);
72 edm::LogInfo(
"L1-O2O: L1TMuonOverlapFwVersionOnlineProd")
73 <<
"Producing L1TMuonOverlapFwVersion for key = " << objectKey;
81 }
catch (std::runtime_error&
e) {
82 edm::LogError(
"L1-O2O: L1TMuonOverlapFwVersionOnlineProd") <<
e.what();
84 throw std::runtime_error(
std::string(
"SummaryForFunctionManager: OMTF | Faulty | ") +
e.what());
87 <<
"returning unmodified prototype of L1TMuonOverlapFwVersion";
88 return std::make_unique<const L1TMuonOverlapFwVersion>(baseSettings);
104 hw_fake =
"<system id=\"OMTF\"> </system>";
106 parsedXMLs.
addProcessor(
"processors",
"processors",
"all_crates",
"all_slots");
118 }
catch (std::runtime_error&
e) {
119 edm::LogError(
"L1-O2O: L1TMuonOverlapFwVersionOnlineProd") <<
e.what();
121 throw std::runtime_error(
std::string(
"SummaryForFunctionManager: OMTF | Faulty at parsing XML | ") +
e.what());
124 <<
"returning unmodified prototype of L1TMuonOverlapFwVersion";
125 return std::make_unique<const L1TMuonOverlapFwVersion>(baseSettings);
129 std::map<std::string, l1t::Parameter> conf = parsedXMLs.
getParameters(
"processors");
130 algoV_string = conf[
"algorithmVer"].getValueAsStr();
131 layersV_string = conf[
"layersVer"].getValueAsStr();
132 patternsV_string = conf[
"patternsVer"].getValueAsStr();
133 synthDate = conf[
"synthDate"].getValueAsStr();
135 unsigned algoV, layersV, patternsV;
136 std::stringstream ssalgoV, sslayersV, sspatternsV;
137 ssalgoV << std::hex << algoV_string.c_str();
139 sslayersV << std::hex << layersV_string.c_str();
140 sslayersV >> layersV;
141 sspatternsV << std::hex << patternsV_string.c_str();
142 sspatternsV >> patternsV;
143 auto retval = std::make_unique<const L1TMuonOverlapFwVersion>(algoV, layersV, patternsV,
synthDate);
145 edm::LogInfo(
"L1-O2O: L1TMuonOverlapFwVersionOnlineProd")
146 <<
"SummaryForFunctionManager: OMTF | OK | All looks good";
void setConfigured(bool state=true) noexcept
Log< level::Error, false > LogError
l1t::OMDSReader m_omdsReader
const bool transactionSafe
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
void readDOMFromString(const std::string &str, xercesc::DOMDocument *&doc)
const std::map< std::string, Parameter > & getParameters(const char *processor) const
void replaceAll(std::string &str, const std::string &from, const std::string &to)
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)
std::unique_ptr< const L1TMuonOverlapFwVersion > newObject(const std::string &objectKey, const L1TMuonOverlapFwVersionO2ORcd &record) override
L1TMuonOverlapFwVersionOnlineProd
Log< level::Info, false > LogInfo
L1TMuonOverlapFwVersionOnlineProd(const edm::ParameterSet &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
void readRootElement(TriggerSystem &aTriggerSystem, const std::string &sysId="")
void removeAll(std::string &str, const std::string &from, const std::string &to)
void addProcessor(const char *processor, const char *role, const char *crate, const char *slot)
const edm::ESGetToken< L1TMuonOverlapFwVersion, L1TMuonOverlapFwVersionRcd > baseSettings_token