CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Attributes
L1TMuonEndCapParamsOnlineProd Class Reference
Inheritance diagram for L1TMuonEndCapParamsOnlineProd:
L1ConfigOnlineProdBaseExt< L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams > edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

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
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
template<typename Record >
void updateFromMayConsumes (unsigned int iIndex, const Record &iRecord)
 
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

edm::ESGetToken< L1TMuonEndCapParams, L1TMuonEndCapParamsRcdbaseSettings_token
 
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< L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams >
bool getObjectKey (const L1TMuonEndCapParamsO2ORcd &record, std::string &objectKey)
 
edm::ESConsumesCollectorT< L1TMuonEndCapParamsO2ORcdwrappedSetWhatProduced (const edm::ParameterSet &)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &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={})
 
- 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< 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)

◆ ~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 34 of file L1TMuonEndCapParamsOnlineProd.cc.

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

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(), GlobalPosition_Frontier_DevDB_cff::record, l1t::TriggerSystem::setConfigured(), AlCaHLTBitMon_QueryRunRegistry::string, and transactionSafe.

Member Data Documentation

◆ baseSettings_token

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

Definition at line 18 of file L1TMuonEndCapParamsOnlineProd.cc.

Referenced by L1TMuonEndCapParamsOnlineProd(), and newObject().

◆ transactionSafe

bool L1TMuonEndCapParamsOnlineProd::transactionSafe
private

Definition at line 17 of file L1TMuonEndCapParamsOnlineProd.cc.

Referenced by L1TMuonEndCapParamsOnlineProd(), and newObject().

L1ConfigOnlineProdBaseExt< L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams >::m_omdsReader
l1t::OMDSReader m_omdsReader
Definition: L1ConfigOnlineProdBaseExt.h:47
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
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
l1t::XmlConfigParser::readRootElement
void readRootElement(TriggerSystem &aTriggerSystem, const std::string &sysId="")
Definition: XmlConfigParser.cc:189
edm::LogInfo
Definition: MessageLogger.h:254
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
l1t::TriggerSystem
Definition: TriggerSystem.h:14
L1ConfigOnlineProdBaseExt< L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
l1t::XmlConfigParser
Definition: XmlConfigParser.h:23
edm::LogError
Definition: MessageLogger.h:183
mps_setup.append
append
Definition: mps_setup.py:85
L1TMuonEndCapParamsRcd
Definition: L1TMuonEndCapParamsRcd.h:11
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
l1t::TriggerSystem::getParameters
const std::map< std::string, Parameter > & getParameters(const char *processor) const
Definition: TriggerSystem.cc:168
L1TMuonEndCapParamsOnlineProd::baseSettings_token
edm::ESGetToken< L1TMuonEndCapParams, L1TMuonEndCapParamsRcd > baseSettings_token
Definition: L1TMuonEndCapParamsOnlineProd.cc:18
edm::eventsetup::EventSetupRecordImplementation::get
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
Definition: EventSetupRecordImplementation.h:74
L1TMuonEndCapParamsOnlineProd::transactionSafe
bool transactionSafe
Definition: L1TMuonEndCapParamsOnlineProd.cc:17
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
L1ConfigOnlineProdBaseExt< L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams >::wrappedSetWhatProduced
edm::ESConsumesCollectorT< L1TMuonEndCapParamsO2ORcd > wrappedSetWhatProduced(const edm::ParameterSet &)
Definition: L1ConfigOnlineProdBaseExt.h:93
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37