CMS 3D CMS Logo

L1TMuonEndCapObjectKeysOnlineProd.cc
Go to the documentation of this file.
1 #include <iostream>
6 #include "OnlineDBqueryHelper.h"
7 
9 private:
11 
12 public:
13  void fillObjectKeys(L1TriggerKeyExt* pL1TriggerKey) override;
14 
17 };
18 
21  transactionSafe = iConfig.getParameter<bool>("transactionSafe");
22 }
23 
25  std::string EMTFKey = pL1TriggerKey->subsystemKey(L1TriggerKeyExt::kEMTF);
26 
27  // simply assign the algo key to the record
28  pL1TriggerKey->add("L1TMuonEndCapParamsO2ORcd", "L1TMuonEndCapParams", EMTFKey);
29 
30  std::string tscKey = EMTFKey.substr(0, EMTFKey.find(":"));
31 
33  // the block below reproduces L1TMuonEndCapParamsOnlineProd identically
34 
35  std::string algo_key, hw_key;
36  std::string algo_payload, hw_payload;
37  try {
38  std::map<std::string, std::string> keys =
39  l1t::OnlineDBqueryHelper::fetch({"HW", "ALGO"}, "EMTF_KEYS", tscKey, m_omdsReader);
40 
41  hw_key = keys["HW"];
42  algo_key = keys["ALGO"];
43 
44  hw_payload = l1t::OnlineDBqueryHelper::fetch({"CONF"}, "EMTF_CLOBS", hw_key, m_omdsReader)["CONF"];
45 
46  algo_payload = l1t::OnlineDBqueryHelper::fetch({"CONF"}, "EMTF_CLOBS", algo_key, m_omdsReader)["CONF"];
47 
48  } catch (std::runtime_error& e) {
49  edm::LogError("L1-O2O: L1TMuonEndCapObjectKeysOnlineProd") << e.what();
50  if (transactionSafe)
51  throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Broken key");
52  else {
53  edm::LogError("L1-O2O: L1TMuonEndCapObjectKeysOnlineProd")
54  << "forcing L1TMuonEndCapForest key to be = '7' (known to exist)";
55  pL1TriggerKey->add("L1TMuonEndCapForestO2ORcd", "L1TMuonEndCapForest", "7");
56  return;
57  }
58  }
59 
60  l1t::XmlConfigParser xmlRdr;
61  l1t::TriggerSystem trgSys;
62 
63  try {
64  xmlRdr.readDOMFromString(hw_payload);
65  xmlRdr.readRootElement(trgSys);
66 
67  xmlRdr.readDOMFromString(algo_payload);
68  xmlRdr.readRootElement(trgSys);
69 
70  trgSys.setConfigured();
71  } catch (std::runtime_error& e) {
72  edm::LogError("L1-O2O: L1TMuonEndCapObjectKeysOnlineProd") << e.what();
73  if (transactionSafe)
74  throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Cannot parse XMLs");
75  else {
76  edm::LogError("L1-O2O: L1TMuonEndCapObjectKeysOnlineProd")
77  << "forcing L1TMuonEndCapForest key to be = '7' (known to exist)";
78  pL1TriggerKey->add("L1TMuonEndCapForestO2ORcd", "L1TMuonEndCapForest", "7");
79  return;
80  }
81  }
82 
83  // Changed from "EMTF-1" to "EMTFp1", but is this backwards compatible? Does it need to be? - AWB 10.04.2018
84  std::map<std::string, l1t::Parameter> conf = trgSys.getParameters("EMTFp1"); // any processor will do
85  // if (conf still empty) conf = trgSys.getParameters("EMTF+1"); // Should add some conditional for backwards-compatibility
86 
88 
89  // simply assign the algo key to the record
90  pL1TriggerKey->add("L1TMuonEndCapForestO2ORcd", "L1TMuonEndCapForest", conf["pt_lut_version"].getValueAsStr());
91 }
92 
93 //define this as a plug-in
L1TriggerKeyExt::add
void add(const std::string &record, const std::string &type, const std::string &key)
Definition: L1TriggerKeyExt.h:42
MessageLogger.h
l1t::OnlineDBqueryHelper::fetch
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)
Definition: OnlineDBqueryHelper.cc:3
L1TriggerKeyExt::subsystemKey
const std::string & subsystemKey(L1Subsystems subsystem) const
Definition: L1TriggerKeyExt.h:71
l1t::XmlConfigParser::readRootElement
void readRootElement(TriggerSystem &aTriggerSystem, const std::string &sysId="")
Definition: XmlConfigParser.cc:189
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
XmlConfigParser.h
l1t::TriggerSystem
Definition: TriggerSystem.h:14
L1ObjectKeysOnlineProdBaseExt::m_omdsReader
l1t::OMDSReader m_omdsReader
Definition: L1ObjectKeysOnlineProdBaseExt.h:35
L1TriggerKeyExt
Definition: L1TriggerKeyExt.h:23
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
l1t::XmlConfigParser
Definition: XmlConfigParser.h:23
OnlineDBqueryHelper.h
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
L1TMuonEndCapObjectKeysOnlineProd::transactionSafe
bool transactionSafe
Definition: L1TMuonEndCapObjectKeysOnlineProd.cc:10
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
L1TMuonEndCapObjectKeysOnlineProd::L1TMuonEndCapObjectKeysOnlineProd
L1TMuonEndCapObjectKeysOnlineProd(const edm::ParameterSet &)
Definition: L1TMuonEndCapObjectKeysOnlineProd.cc:19
l1t::TriggerSystem::getParameters
const std::map< std::string, Parameter > & getParameters(const char *processor) const
Definition: TriggerSystem.cc:168
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
L1TMuonEndCapObjectKeysOnlineProd::fillObjectKeys
void fillObjectKeys(L1TriggerKeyExt *pL1TriggerKey) override
Definition: L1TMuonEndCapObjectKeysOnlineProd.cc:24
L1ObjectKeysOnlineProdBaseExt.h
L1TriggerKeyExt::kEMTF
Definition: L1TriggerKeyExt.h:27
L1ObjectKeysOnlineProdBaseExt
Definition: L1ObjectKeysOnlineProdBaseExt.h:19
L1TMuonEndCapObjectKeysOnlineProd
Definition: L1TMuonEndCapObjectKeysOnlineProd.cc:8
TriggerSystem.h
l1t::XmlConfigParser::readDOMFromString
void readDOMFromString(const std::string &str, xercesc::DOMDocument *&doc)
l1t::TriggerSystem::setConfigured
void setConfigured(bool state=true) noexcept
Definition: TriggerSystem.h:74
L1TMuonEndCapObjectKeysOnlineProd::~L1TMuonEndCapObjectKeysOnlineProd
~L1TMuonEndCapObjectKeysOnlineProd(void) override
Definition: L1TMuonEndCapObjectKeysOnlineProd.cc:16
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37