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::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 ()
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Private Attributes

bool transactionSafe
 

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from L1ConfigOnlineProdBaseExt< L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams >
bool getObjectKey (const L1TMuonEndCapParamsO2ORcd &record, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
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={})
 
- 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 eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 
- 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 ( const edm::ParameterSet iConfig)
L1TMuonEndCapParamsOnlineProd::~L1TMuonEndCapParamsOnlineProd ( void  )
inlineoverride

Definition at line 22 of file L1TMuonEndCapParamsOnlineProd.cc.

22 {}

Member Function Documentation

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

Implements L1ConfigOnlineProdBaseExt< L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams >.

Definition at line 29 of file L1TMuonEndCapParamsOnlineProd.cc.

References mps_setup::append, DEFINE_FWK_EVENTSETUP_MODULE, 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(), l1t::TriggerSystem::setConfigured(), AlCaHLTBitMon_QueryRunRegistry::string, and transactionSafe.

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

Member Data Documentation

bool L1TMuonEndCapParamsOnlineProd::transactionSafe
private

Definition at line 17 of file L1TMuonEndCapParamsOnlineProd.cc.

Referenced by L1TMuonEndCapParamsOnlineProd(), and newObject().