CMS 3D CMS Logo

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

Public Member Functions

 L1TMuonOverlapFwVersionOnlineProd (const edm::ParameterSet &)
 
std::unique_ptr< const L1TMuonOverlapFwVersionnewObject (const std::string &objectKey, const L1TMuonOverlapFwVersionO2ORcd &record) override
 
 ~L1TMuonOverlapFwVersionOnlineProd (void) override=default
 
- Public Member Functions inherited from L1ConfigOnlineProdBaseExt< L1TMuonOverlapFwVersionO2ORcd, L1TMuonOverlapFwVersion >
 L1ConfigOnlineProdBaseExt (const edm::ParameterSet &)
 
std::unique_ptr< const L1TMuonOverlapFwVersionproduce (const L1TMuonOverlapFwVersionO2ORcd &iRecord)
 
 ~L1ConfigOnlineProdBaseExt () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
 ESProducer (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
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (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< L1TMuonOverlapFwVersion, L1TMuonOverlapFwVersionRcdbaseSettings_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< L1TMuonOverlapFwVersionO2ORcd, L1TMuonOverlapFwVersion >
bool getObjectKey (const L1TMuonOverlapFwVersionO2ORcd &record, std::string &objectKey)
 
edm::ESConsumesCollectorT< L1TMuonOverlapFwVersionO2ORcdwrappedSetWhatProduced (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::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< L1TMuonOverlapFwVersionO2ORcd, L1TMuonOverlapFwVersion >
bool m_copyFromCondDB
 
cond::persistency::Session m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Definition at line 15 of file L1TMuonOverlapFwVersionOnlineProd.cc.

Constructor & Destructor Documentation

◆ L1TMuonOverlapFwVersionOnlineProd()

L1TMuonOverlapFwVersionOnlineProd::L1TMuonOverlapFwVersionOnlineProd ( const edm::ParameterSet iConfig)

Definition at line 50 of file L1TMuonOverlapFwVersionOnlineProd.cc.

52  transactionSafe(iConfig.getParameter<bool>("transactionSafe")),
53  baseSettings_token(wrappedSetWhatProduced(iConfig).consumes()) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESConsumesCollectorT< L1TMuonOverlapFwVersionO2ORcd > wrappedSetWhatProduced(const edm::ParameterSet &)
const edm::ESGetToken< L1TMuonOverlapFwVersion, L1TMuonOverlapFwVersionRcd > baseSettings_token

◆ ~L1TMuonOverlapFwVersionOnlineProd()

L1TMuonOverlapFwVersionOnlineProd::~L1TMuonOverlapFwVersionOnlineProd ( void  )
overridedefault

Member Function Documentation

◆ newObject()

std::unique_ptr< const L1TMuonOverlapFwVersion > L1TMuonOverlapFwVersionOnlineProd::newObject ( const std::string &  objectKey,
const L1TMuonOverlapFwVersionO2ORcd record 
)
overridevirtual

Implements L1ConfigOnlineProdBaseExt< L1TMuonOverlapFwVersionO2ORcd, L1TMuonOverlapFwVersion >.

Definition at line 55 of file L1TMuonOverlapFwVersionOnlineProd.cc.

References l1t::TriggerSystem::addProcessor(), mps_setup::append, baseSettings_token, MillePedeFileConverter_cfg::e, l1t::OnlineDBqueryHelper::fetch(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), l1t::TriggerSystem::getParameters(), L1ConfigOnlineProdBaseExt< L1TMuonOverlapFwVersionO2ORcd, L1TMuonOverlapFwVersion >::m_omdsReader, convertSQLitetoXML_cfg::output, jetsAK4_Puppi_cff::payload, l1t::XmlConfigParser::readDOMFromString(), l1t::XmlConfigParser::readRootElement(), AlCaHarvesting_cff::record, removeAll(), replaceAll(), l1t::TriggerSystem::setConfigured(), AlCaHLTBitMon_QueryRunRegistry::string, fakeOmtfFwVersion_cff::synthDate, and transactionSafe.

56  {
57  const L1TMuonOverlapFwVersionRcd& baseRcd = record.template getRecord<L1TMuonOverlapFwVersionRcd>();
58  auto const& baseSettings = baseRcd.get(baseSettings_token);
59 
60  if (objectKey.empty()) {
61  edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd")
62  << "Key is empty, returning empty L1TMuonOverlapFwVersion";
63  if (transactionSafe)
64  throw std::runtime_error("SummaryForFunctionManager: OMTF | Faulty | Empty objectKey");
65  else {
66  edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd")
67  << "returning unmodified prototype of L1TMuonOverlapFwVersion";
68  return std::make_unique<const L1TMuonOverlapFwVersion>(baseSettings);
69  }
70  }
71 
72  edm::LogInfo("L1-O2O: L1TMuonOverlapFwVersionOnlineProd")
73  << "Producing L1TMuonOverlapFwVersion for key = " << objectKey;
74 
75  std::string payload, hw_fake;
76  std::string algoV_string, layersV_string, patternsV_string, synthDate;
77 
78  try {
79  payload = l1t::OnlineDBqueryHelper::fetch({"CONF"}, "OMTF_CLOBS", objectKey, m_omdsReader)["CONF"];
80 
81  } catch (std::runtime_error& e) {
82  edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << e.what();
83  if (transactionSafe)
84  throw std::runtime_error(std::string("SummaryForFunctionManager: OMTF | Faulty | ") + e.what());
85  else {
86  edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd")
87  << "returning unmodified prototype of L1TMuonOverlapFwVersion";
88  return std::make_unique<const L1TMuonOverlapFwVersion>(baseSettings);
89  }
90  }
91  // for debugging dump the configs to local files
92  {
93  std::ofstream output(std::string("/tmp/").append(objectKey.substr(0, objectKey.find('/'))).append(".xml"));
94  output << objectKey;
95  output.close();
96  }
97 
98  // finally push all payloads to the XML parser and construct the TrigSystem object
99  l1t::XmlConfigParser xmlRdr;
100  l1t::TriggerSystem parsedXMLs;
101 
102  try {
103  // no need to read all the HW settings, just define a dummy processor
104  hw_fake = "<system id=\"OMTF\"> </system>";
105  xmlRdr.readDOMFromString(hw_fake);
106  parsedXMLs.addProcessor("processors", "processors", "all_crates", "all_slots");
107  xmlRdr.readRootElement(parsedXMLs);
108 
109  // INFRA payload needs some editing to be suitable for the standard XML parser
110  replaceAll(payload, "infra", "algo");
111  removeAll(payload, "<context id=\"daq", "</context>");
112  removeAll(payload, "<context id=\"OMTF", "</context>");
113  xmlRdr.readDOMFromString(payload);
114  xmlRdr.readRootElement(parsedXMLs);
115 
116  parsedXMLs.setConfigured();
117 
118  } catch (std::runtime_error& e) {
119  edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << e.what();
120  if (transactionSafe)
121  throw std::runtime_error(std::string("SummaryForFunctionManager: OMTF | Faulty at parsing XML | ") + e.what());
122  else {
123  edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd")
124  << "returning unmodified prototype of L1TMuonOverlapFwVersion";
125  return std::make_unique<const L1TMuonOverlapFwVersion>(baseSettings);
126  }
127  }
128 
129  std::map<std::string, l1t::Parameter> conf = parsedXMLs.getParameters("processors");
130  algoV_string = conf["algorithmVer"].getValueAsStr();
131  layersV_string = conf["layersVer"].getValueAsStr();
132  patternsV_string = conf["patternsVer"].getValueAsStr();
133  synthDate = conf["synthDate"].getValueAsStr();
134 
135  unsigned algoV, layersV, patternsV;
136  std::stringstream ssalgoV, sslayersV, sspatternsV;
137  ssalgoV << std::hex << algoV_string.c_str();
138  ssalgoV >> algoV;
139  sslayersV << std::hex << layersV_string.c_str();
140  sslayersV >> layersV;
141  sspatternsV << std::hex << patternsV_string.c_str();
142  sspatternsV >> patternsV;
143  auto retval = std::make_unique<const L1TMuonOverlapFwVersion>(algoV, layersV, patternsV, synthDate);
144 
145  edm::LogInfo("L1-O2O: L1TMuonOverlapFwVersionOnlineProd")
146  << "SummaryForFunctionManager: OMTF | OK | All looks good";
147  return retval;
148 }
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
void replaceAll(std::string &str, const std::string &from, const std::string &to)
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="")
void removeAll(std::string &str, const std::string &from, const std::string &to)
void addProcessor(const char *processor, const char *role, const char *crate, const char *slot)
const edm::ESGetToken< L1TMuonOverlapFwVersion, L1TMuonOverlapFwVersionRcd > baseSettings_token

Member Data Documentation

◆ baseSettings_token

const edm::ESGetToken<L1TMuonOverlapFwVersion, L1TMuonOverlapFwVersionRcd> L1TMuonOverlapFwVersionOnlineProd::baseSettings_token
private

Definition at line 19 of file L1TMuonOverlapFwVersionOnlineProd.cc.

Referenced by newObject().

◆ transactionSafe

const bool L1TMuonOverlapFwVersionOnlineProd::transactionSafe
private

Definition at line 18 of file L1TMuonOverlapFwVersionOnlineProd.cc.

Referenced by newObject().