CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
L1TMuonGlobalParamsOnlineProd Class Reference
Inheritance diagram for L1TMuonGlobalParamsOnlineProd:
L1ConfigOnlineProdBaseExt< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams > edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 L1TMuonGlobalParamsOnlineProd (const edm::ParameterSet &)
 
std::unique_ptr< const L1TMuonGlobalParamsnewObject (const std::string &objectKey, const L1TMuonGlobalParamsO2ORcd &record) override
 
 ~L1TMuonGlobalParamsOnlineProd (void) override
 
- Public Member Functions inherited from L1ConfigOnlineProdBaseExt< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams >
 L1ConfigOnlineProdBaseExt (const edm::ParameterSet &)
 
std::unique_ptr< const L1TMuonGlobalParamsproduce (const L1TMuonGlobalParamsO2ORcd &iRecord)
 
 ~L1ConfigOnlineProdBaseExt () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Private Attributes

const edm::ESGetToken< L1TMuonGlobalParams, L1TMuonGlobalParamsRcdbaseSettings_token
 
const bool transactionSafe
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 
- Protected Member Functions inherited from L1ConfigOnlineProdBaseExt< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams >
bool getObjectKey (const L1TMuonGlobalParamsO2ORcd &record, std::string &objectKey)
 
edm::ESConsumesCollectorT< L1TMuonGlobalParamsO2ORcdwrappedSetWhatProduced (const edm::ParameterSet &)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- Protected Attributes inherited from L1ConfigOnlineProdBaseExt< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams >
bool m_copyFromCondDB
 
cond::persistency::Session m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Definition at line 15 of file L1TMuonGlobalParamsOnlineProd.cc.

Constructor & Destructor Documentation

◆ L1TMuonGlobalParamsOnlineProd()

L1TMuonGlobalParamsOnlineProd::L1TMuonGlobalParamsOnlineProd ( const edm::ParameterSet iConfig)

Definition at line 28 of file L1TMuonGlobalParamsOnlineProd.cc.

30  transactionSafe(iConfig.getParameter<bool>("transactionSafe")),
31  baseSettings_token(wrappedSetWhatProduced(iConfig).consumes()) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< L1TMuonGlobalParams, L1TMuonGlobalParamsRcd > baseSettings_token
edm::ESConsumesCollectorT< L1TMuonGlobalParamsO2ORcd > wrappedSetWhatProduced(const edm::ParameterSet &)

◆ ~L1TMuonGlobalParamsOnlineProd()

L1TMuonGlobalParamsOnlineProd::~L1TMuonGlobalParamsOnlineProd ( void  )
inlineoverride

Definition at line 25 of file L1TMuonGlobalParamsOnlineProd.cc.

25 {}

Member Function Documentation

◆ newObject()

std::unique_ptr< const L1TMuonGlobalParams > L1TMuonGlobalParamsOnlineProd::newObject ( const std::string &  objectKey,
const L1TMuonGlobalParamsO2ORcd record 
)
overridevirtual

Implements L1ConfigOnlineProdBaseExt< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams >.

Definition at line 33 of file L1TMuonGlobalParamsOnlineProd.cc.

References mps_setup::append, baseSettings_token, cast_to_L1TMuonGlobalParams(), MillePedeFileConverter_cfg::e, l1t::OnlineDBqueryHelper::fetch(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), crabWrapper::key, relativeConstraints::keys, L1TMuonGlobalParamsHelper::loadFromOnline(), L1ConfigOnlineProdBaseExt< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams >::m_omdsReader, convertSQLitetoXML_cfg::output, l1t::XmlConfigParser::readDOMFromString(), l1t::XmlConfigParser::readRootElement(), AlCaHarvesting_cff::record, l1t::TriggerSystem::setConfigured(), AlCaHLTBitMon_QueryRunRegistry::string, and transactionSafe.

34  {
35  const L1TMuonGlobalParamsRcd &baseRcd = record.template getRecord<L1TMuonGlobalParamsRcd>();
36  auto const &baseSettings = baseRcd.get(baseSettings_token);
37 
38  if (objectKey.empty()) {
39  edm::LogError("L1-O2O: L1TMuonGlobalParamsOnlineProd") << "Key is empty";
40  if (transactionSafe)
41  throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Empty objectKey");
42  else {
43  edm::LogError("L1-O2O: L1TMuonGlobalParams") << "returning unmodified prototype of L1TMuonGlobalParams";
44  return std::make_unique<const L1TMuonGlobalParams>(baseSettings);
45  }
46  }
47 
48  std::string tscKey = objectKey.substr(0, objectKey.find(':'));
49  std::string rsKey = objectKey.substr(objectKey.find(':') + 1, std::string::npos);
50 
51  edm::LogInfo("L1-O2O: L1TMuonGlobalParamsOnlineProd")
52  << "Producing L1TMuonGlobalParams with TSC key =" << tscKey << " and RS key = " << rsKey;
53 
54  std::string algo_key, hw_key;
55  std::string hw_payload;
56  std::map<std::string, std::string> rs_payloads, algo_payloads;
57  try {
58  std::map<std::string, std::string> keys =
59  l1t::OnlineDBqueryHelper::fetch({"ALGO", "HW"}, "UGMT_KEYS", tscKey, m_omdsReader);
60  algo_key = keys["ALGO"];
61  hw_key = keys["HW"];
62 
63  hw_payload = l1t::OnlineDBqueryHelper::fetch({"CONF"}, "UGMT_CLOBS", hw_key, m_omdsReader)["CONF"];
64 
65  std::map<std::string, std::string> rsKeys =
66  l1t::OnlineDBqueryHelper::fetch({"MP7", "MP7_MONI", "AMC13_MONI"}, "UGMT_RS_KEYS", rsKey, m_omdsReader);
67 
68  std::map<std::string, std::string> algoKeys =
69  l1t::OnlineDBqueryHelper::fetch({"MP7", "LUTS"}, "UGMT_ALGO_KEYS", algo_key, m_omdsReader);
70 
71  for (auto &key : rsKeys)
72  rs_payloads[key.second] =
73  l1t::OnlineDBqueryHelper::fetch({"CONF"}, "UGMT_CLOBS", key.second, m_omdsReader)["CONF"];
74 
75  for (auto &key : algoKeys)
76  algo_payloads[key.second] =
77  l1t::OnlineDBqueryHelper::fetch({"CONF"}, "UGMT_CLOBS", key.second, m_omdsReader)["CONF"];
78  } catch (std::runtime_error &e) {
79  edm::LogError("L1-O2O: L1TMuonGlobalParamsOnlineProd") << e.what();
80  if (transactionSafe)
81  throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Broken key");
82  else {
83  edm::LogError("L1-O2O: L1TMuonGlobalParamsOnlineProd") << "returning unmodified prototype of L1TMuonGlobalParams";
84  return std::make_unique<const L1TMuonGlobalParams>(baseSettings);
85  }
86  }
87 
88  // for debugging dump the configs to local files
89  {
90  std::ofstream output(std::string("/tmp/").append(hw_key.substr(0, hw_key.find('/'))).append(".xml"));
91  output << hw_payload;
92  output.close();
93  }
94  for (auto &conf : rs_payloads) {
95  std::ofstream output(std::string("/tmp/").append(conf.first.substr(0, conf.first.find("/"))).append(".xml"));
96  output << conf.second;
97  output.close();
98  }
99  for (auto &conf : algo_payloads) {
100  std::ofstream output(std::string("/tmp/").append(conf.first.substr(0, conf.first.find("/"))).append(".xml"));
101  output << conf.second;
102  output.close();
103  }
104 
105  // finally, push all payloads to the XML parser and construct the TrigSystem objects with each of those
106  l1t::XmlConfigParser xmlRdr;
107  l1t::TriggerSystem trgSys;
108 
109  try {
110  // HW settings should always go first
111  xmlRdr.readDOMFromString(hw_payload);
112  xmlRdr.readRootElement(trgSys);
113 
114  // now let's parse ALGO and then RS settings
115  for (auto &conf : algo_payloads) {
116  xmlRdr.readDOMFromString(conf.second);
117  xmlRdr.readRootElement(trgSys);
118  }
119  for (auto &conf : rs_payloads) {
120  xmlRdr.readDOMFromString(conf.second);
121  xmlRdr.readRootElement(trgSys);
122  }
123  trgSys.setConfigured();
124  } catch (std::runtime_error &e) {
125  edm::LogError("L1-O2O: L1TMuonGlobalParamsOnlineProd") << e.what();
126  if (transactionSafe)
127  throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Cannot parse XMLs");
128  else {
129  edm::LogError("L1-O2O: L1TMuonGlobalParamsOnlineProd") << "returning unmodified prototype of L1TMuonGlobalParams";
130  return std::make_unique<const L1TMuonGlobalParams>(baseSettings);
131  }
132  }
133 
134  L1TMuonGlobalParamsHelper m_params_helper(baseSettings);
135  try {
136  m_params_helper.loadFromOnline(trgSys);
137  } catch (std::runtime_error &e) {
138  edm::LogError("L1-O2O: L1TMuonGlobalParamsOnlineProd") << e.what();
139  if (transactionSafe)
140  throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Cannot run helper");
141  else {
142  edm::LogError("L1-O2O: L1TMuonGlobalParamsOnlineProd") << "returning unmodified prototype of L1TMuonGlobalParams";
143  return std::make_unique<const L1TMuonGlobalParams>(baseSettings);
144  }
145  }
146 
147  auto retval = std::make_unique<const L1TMuonGlobalParams>(cast_to_L1TMuonGlobalParams(m_params_helper));
148 
149  edm::LogInfo("L1-O2O: L1TMuonGlobalParamsOnlineProd")
150  << "SummaryForFunctionManager: uGMT | OK | All looks good";
151  return retval;
152 }
const L1TMuonGlobalParams & cast_to_L1TMuonGlobalParams(const L1TMuonGlobalParams_PUBLIC &x)
void setConfigured(bool state=true) noexcept
Definition: TriggerSystem.h:74
const edm::ESGetToken< L1TMuonGlobalParams, L1TMuonGlobalParamsRcd > baseSettings_token
Log< level::Error, false > LogError
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
void readDOMFromString(const std::string &str, xercesc::DOMDocument *&doc)
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)
Log< level::Info, false > LogInfo
void readRootElement(TriggerSystem &aTriggerSystem, const std::string &sysId="")

Member Data Documentation

◆ baseSettings_token

const edm::ESGetToken<L1TMuonGlobalParams, L1TMuonGlobalParamsRcd> L1TMuonGlobalParamsOnlineProd::baseSettings_token
private

Definition at line 18 of file L1TMuonGlobalParamsOnlineProd.cc.

Referenced by newObject().

◆ transactionSafe

const bool L1TMuonGlobalParamsOnlineProd::transactionSafe
private

Definition at line 17 of file L1TMuonGlobalParamsOnlineProd.cc.

Referenced by newObject().