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::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

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
 
 ESProducer (ESProducer &&)=delete
 
ESResolverIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (ESProducer &&)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESResolverIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProductResolverFactoryProducer
 ESProductResolverFactoryProducer ()
 
 ESProductResolverFactoryProducer (const ESProductResolverFactoryProducer &)=delete
 
const ESProductResolverFactoryProduceroperator= (const ESProductResolverFactoryProducer &)=delete
 
 ~ESProductResolverFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
void createKeyedResolvers (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
const ComponentDescriptiondescription () const
 
 ESProductResolverProvider ()
 
 ESProductResolverProvider (const ESProductResolverProvider &)=delete
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedResolverskeyedResolvers (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const ESProductResolverProvideroperator= (const ESProductResolverProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~ESProductResolverProvider () noexcept(false)
 

Private Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProductResolverFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::ESProductResolverProvider
using KeyedResolversVector = std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >>
 
- 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
ESConsumesInfoconsumesInfoPushBackNew ()
 
unsigned int consumesInfoSize () const
 
template<typename CallbackT , typename TList , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>> iCallback, const TList *, const TRecord *iRecord, const es::Label &iLabel)
 
template<typename CallbackT , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>>, const eventsetup::produce::Null *, const TRecord *, const es::Label &)
 
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 TDecorator >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProductResolverFactoryProducer
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::ESProductResolverFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedResolversVector registerResolvers (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::ESProductResolverProvider
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 14 of file L1TMuonGlobalParamsOnlineProd.cc.

Constructor & Destructor Documentation

◆ L1TMuonGlobalParamsOnlineProd()

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

Definition at line 27 of file L1TMuonGlobalParamsOnlineProd.cc.

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

◆ ~L1TMuonGlobalParamsOnlineProd()

L1TMuonGlobalParamsOnlineProd::~L1TMuonGlobalParamsOnlineProd ( void  )
inlineoverride

Definition at line 24 of file L1TMuonGlobalParamsOnlineProd.cc.

24 {}

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 32 of file L1TMuonGlobalParamsOnlineProd.cc.

References mps_setup::append, baseSettings_token, cast_to_L1TMuonGlobalParams(), MillePedeFileConverter_cfg::e, l1t::OnlineDBqueryHelper::fetch(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), submitPVResolutionJobs::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.

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

Member Data Documentation

◆ baseSettings_token

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

Definition at line 17 of file L1TMuonGlobalParamsOnlineProd.cc.

Referenced by newObject().

◆ transactionSafe

const bool L1TMuonGlobalParamsOnlineProd::transactionSafe
private

Definition at line 16 of file L1TMuonGlobalParamsOnlineProd.cc.

Referenced by newObject().