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::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

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 ()
 
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< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams >
bool getObjectKey (const L1TMuonGlobalParamsO2ORcd &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< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams >
bool m_copyFromCondDB
 
cond::persistency::Session m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Definition at line 15 of file L1TMuonGlobalParamsOnlineProd.cc.

Constructor & Destructor Documentation

L1TMuonGlobalParamsOnlineProd::L1TMuonGlobalParamsOnlineProd ( const edm::ParameterSet iConfig)
L1TMuonGlobalParamsOnlineProd::~L1TMuonGlobalParamsOnlineProd ( void  )
inlineoverride

Definition at line 22 of file L1TMuonGlobalParamsOnlineProd.cc.

22 {}

Member Function Documentation

std::unique_ptr< const L1TMuonGlobalParams > L1TMuonGlobalParamsOnlineProd::newObject ( const std::string &  objectKey,
const L1TMuonGlobalParamsO2ORcd record 
)
overridevirtual

Implements L1ConfigOnlineProdBaseExt< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams >.

Definition at line 29 of file L1TMuonGlobalParamsOnlineProd.cc.

References mps_setup::append, cast_to_L1TMuonGlobalParams(), DEFINE_FWK_EVENTSETUP_MODULE, MillePedeFileConverter_cfg::e, l1t::OnlineDBqueryHelper::fetch(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), crabWrapper::key, relativeConstraints::keys, L1TMuonGlobalParamsHelper::loadFromOnline(), L1ConfigOnlineProdBaseExt< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams >::m_omdsReader, convertSQLitetoXML_cfg::output, l1t::XmlConfigParser::readDOMFromString(), l1t::XmlConfigParser::readRootElement(), l1t::TriggerSystem::setConfigured(), AlCaHLTBitMon_QueryRunRegistry::string, and transactionSafe.

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

Member Data Documentation

bool L1TMuonGlobalParamsOnlineProd::transactionSafe
private

Definition at line 17 of file L1TMuonGlobalParamsOnlineProd.cc.

Referenced by L1TMuonGlobalParamsOnlineProd(), and newObject().