CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
L1TMuonEndCapParamsOnlineProd Class Reference
Inheritance diagram for L1TMuonEndCapParamsOnlineProd:
L1ConfigOnlineProdBaseExt< L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams > edm::ESProducer edm::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

Public Member Functions

 L1TMuonEndCapParamsOnlineProd (const edm::ParameterSet &)
 
std::unique_ptr< const L1TMuonEndCapParamsnewObject (const std::string &objectKey, const L1TMuonEndCapParamsO2ORcd &record) override
 
 ~L1TMuonEndCapParamsOnlineProd (void) override
 
- Public Member Functions inherited from L1ConfigOnlineProdBaseExt< L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams >
 L1ConfigOnlineProdBaseExt (const edm::ParameterSet &)
 
std::unique_ptr< const L1TMuonEndCapParamsproduce (const L1TMuonEndCapParamsO2ORcd &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< L1TMuonEndCapParams, L1TMuonEndCapParamsRcdbaseSettings_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< L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams >
bool getObjectKey (const L1TMuonEndCapParamsO2ORcd &record, std::string &objectKey)
 
edm::ESConsumesCollectorT< L1TMuonEndCapParamsO2ORcdwrappedSetWhatProduced (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< L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams >
bool m_copyFromCondDB
 
cond::persistency::Session m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Definition at line 15 of file L1TMuonEndCapParamsOnlineProd.cc.

Constructor & Destructor Documentation

◆ L1TMuonEndCapParamsOnlineProd()

L1TMuonEndCapParamsOnlineProd::L1TMuonEndCapParamsOnlineProd ( const edm::ParameterSet iConfig)

Definition at line 28 of file L1TMuonEndCapParamsOnlineProd.cc.

30  transactionSafe(iConfig.getParameter<bool>("transactionSafe")),
31  baseSettings_token(wrappedSetWhatProduced(iConfig).consumes()) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESConsumesCollectorT< L1TMuonEndCapParamsO2ORcd > wrappedSetWhatProduced(const edm::ParameterSet &)
const edm::ESGetToken< L1TMuonEndCapParams, L1TMuonEndCapParamsRcd > baseSettings_token

◆ ~L1TMuonEndCapParamsOnlineProd()

L1TMuonEndCapParamsOnlineProd::~L1TMuonEndCapParamsOnlineProd ( void  )
inlineoverride

Definition at line 25 of file L1TMuonEndCapParamsOnlineProd.cc.

25 {}

Member Function Documentation

◆ newObject()

std::unique_ptr< const L1TMuonEndCapParams > L1TMuonEndCapParamsOnlineProd::newObject ( const std::string &  objectKey,
const L1TMuonEndCapParamsO2ORcd record 
)
overridevirtual

Implements L1ConfigOnlineProdBaseExt< L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams >.

Definition at line 33 of file L1TMuonEndCapParamsOnlineProd.cc.

References mps_setup::append, baseSettings_token, MillePedeFileConverter_cfg::e, l1t::OnlineDBqueryHelper::fetch(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), l1t::TriggerSystem::getParameters(), relativeConstraints::keys, L1ConfigOnlineProdBaseExt< L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams >::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 L1TMuonEndCapParamsRcd& baseRcd = record.template getRecord<L1TMuonEndCapParamsRcd>();
36  auto const& baseSettings = baseRcd.get(baseSettings_token);
37 
38  if (objectKey.empty()) {
39  edm::LogError("L1-O2O: L1TMuonEndCapParamsOnlineProd") << "Key is empty";
40  if (transactionSafe)
41  throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Empty objectKey");
42  else {
43  edm::LogError("L1-O2O: L1TMuonEndCapParamsOnlineProd") << "returning unmodified prototype of L1TMuonEndCapParams";
44  return std::make_unique<const L1TMuonEndCapParams>(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: L1TMuonEndCapParamsOnlineProd")
52  << "Producing L1TMuonEndCapParams with TSC key = " << tscKey << " and RS key = " << rsKey;
53 
54  std::string algo_key, hw_key;
55  std::string algo_payload, hw_payload;
56  try {
57  std::map<std::string, std::string> keys =
58  l1t::OnlineDBqueryHelper::fetch({"HW", "ALGO"}, "EMTF_KEYS", tscKey, m_omdsReader);
59 
60  hw_key = keys["HW"];
61  algo_key = keys["ALGO"];
62 
63  hw_payload = l1t::OnlineDBqueryHelper::fetch({"CONF"}, "EMTF_CLOBS", hw_key, m_omdsReader)["CONF"];
64 
65  algo_payload = l1t::OnlineDBqueryHelper::fetch({"CONF"}, "EMTF_CLOBS", algo_key, m_omdsReader)["CONF"];
66 
67  } catch (std::runtime_error& e) {
68  edm::LogError("L1-O2O: L1TMuonEndCapParamsOnlineProd") << e.what();
69  if (transactionSafe)
70  throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Broken key");
71  else {
72  edm::LogError("L1-O2O: L1TMuonEndCapParamsOnlineProd") << "returning unmodified prototype of L1TMuonEndCapParams";
73  return std::make_unique<const L1TMuonEndCapParams>(baseSettings);
74  }
75  }
76 
77  // for debugging purposes dump the configs to local files
78  {
79  std::ofstream output(std::string("/tmp/").append(hw_key.substr(0, hw_key.find('/'))).append(".xml"));
80  output << hw_payload;
81  output.close();
82  }
83  {
84  std::ofstream output(std::string("/tmp/").append(algo_key.substr(0, algo_key.find('/'))).append(".xml"));
85  output << algo_payload;
86  output.close();
87  }
88 
89  l1t::XmlConfigParser xmlRdr;
90  l1t::TriggerSystem trgSys;
91 
92  try {
93  xmlRdr.readDOMFromString(hw_payload);
94  xmlRdr.readRootElement(trgSys);
95 
96  xmlRdr.readDOMFromString(algo_payload);
97  xmlRdr.readRootElement(trgSys);
98 
99  trgSys.setConfigured();
100  } catch (std::runtime_error& e) {
101  edm::LogError("L1-O2O: L1TMuonEndCapParamsOnlineProd") << e.what();
102  if (transactionSafe)
103  throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Cannot parse XMLs");
104  else {
105  edm::LogError("L1-O2O: L1TMuonEndCapParamsOnlineProd") << "returning unmodified prototype of L1TMuonEndCapParams";
106  return std::make_unique<const L1TMuonEndCapParams>(baseSettings);
107  }
108  }
109 
110  // Changed from "EMTF-1" to "EMTFp1", but is this backwards compatible? Does it need to be? - AWB 10.04.2018
111  std::map<std::string, l1t::Parameter> conf = trgSys.getParameters("EMTFp1"); // any processor will do
112  // if (conf still empty) conf = trgSys.getParameters("EMTF+1"); // Should add some conditional for backwards-compatibility
113 
114  std::string core_fwv = conf["core_firmware_version"].getValueAsStr();
115  tm brokenTime;
116  strptime(core_fwv.c_str(), "%Y-%m-%d %T", &brokenTime);
117  time_t fw_sinceEpoch = timegm(&brokenTime);
118 
119  // std::string pclut_v = conf["pc_lut_version"].getValueAsStr();
120  // strptime(pclut_v.c_str(), "%Y-%m-%d", &brokenTime);
121  // time_t pclut_sinceEpoch = timegm(&brokenTime);
122 
123  auto retval = std::make_unique<L1TMuonEndCapParams>();
124 
125  retval->firmwareVersion_ = fw_sinceEpoch;
126  retval->PtAssignVersion_ = conf["pt_lut_version"].getValue<unsigned int>();
127  retval->PhiMatchWindowSt1_ = 1; //pclut_sinceEpoch;
128 
129  edm::LogInfo("L1-O2O: L1TMuonEndCapParamsOnlineProd")
130  << "SummaryForFunctionManager: EMTF | OK | All looks good";
131  return retval;
132 }
void setConfigured(bool state=true) noexcept
Definition: TriggerSystem.h:74
Log< level::Error, false > LogError
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
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="")
Definition: output.py:1
const edm::ESGetToken< L1TMuonEndCapParams, L1TMuonEndCapParamsRcd > baseSettings_token

Member Data Documentation

◆ baseSettings_token

const edm::ESGetToken<L1TMuonEndCapParams, L1TMuonEndCapParamsRcd> L1TMuonEndCapParamsOnlineProd::baseSettings_token
private

Definition at line 18 of file L1TMuonEndCapParamsOnlineProd.cc.

Referenced by newObject().

◆ transactionSafe

const bool L1TMuonEndCapParamsOnlineProd::transactionSafe
private

Definition at line 17 of file L1TMuonEndCapParamsOnlineProd.cc.

Referenced by newObject().