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::shared_ptr< 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::shared_ptr< L1TMuonGlobalParamsproduce (const L1TMuonGlobalParamsO2ORcd &iRecord)
 
 ~L1ConfigOnlineProdBaseExt () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ~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::shared_ptr< L1TMuonGlobalParams > data, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- 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::shared_ptr< 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::EventSetupRecord::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  using namespace edm::es;
31 
32  const L1TMuonGlobalParamsRcd& baseRcd = record.template getRecord< L1TMuonGlobalParamsRcd >() ;
34  baseRcd.get( baseSettings ) ;
35 
36  if( objectKey.empty() ){
37  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "Key is empty";
38  if( transactionSafe )
39  throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Empty objectKey");
40  else {
41  edm::LogError( "L1-O2O: L1TMuonGlobalParams" ) << "returning unmodified prototype of L1TMuonGlobalParams";
42  return std::make_shared< L1TMuonGlobalParams>( *(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: L1TMuonGlobalParamsOnlineProd" ) << "Producing L1TMuonGlobalParams with TSC key =" << tscKey << " and RS key = " << rsKey ;
50 
51  std::string algo_key, hw_key;
52  std::string hw_payload;
53  std::map<std::string,std::string> rs_payloads, algo_payloads;
54  try {
55  std::map<std::string,std::string> keys =
56  l1t::OnlineDBqueryHelper::fetch( {"ALGO","HW"},
57  "UGMT_KEYS",
58  tscKey,
60  );
61  algo_key = keys["ALGO"];
62  hw_key = keys["HW"];
63 
64  hw_payload = l1t::OnlineDBqueryHelper::fetch( {"CONF"},
65  "UGMT_CLOBS",
66  hw_key,
68  ) ["CONF"];
69 
70  std::map<std::string,std::string> rsKeys =
71  l1t::OnlineDBqueryHelper::fetch( {"MP7","MP7_MONI","AMC13_MONI"},
72  "UGMT_RS_KEYS",
73  rsKey,
75  );
76 
77  std::map<std::string,std::string> algoKeys =
78  l1t::OnlineDBqueryHelper::fetch( {"MP7","LUTS"},
79  "UGMT_ALGO_KEYS",
80  algo_key,
82  );
83 
84  for(auto &key : rsKeys)
85  rs_payloads[ key.second ] =
87  "UGMT_CLOBS",
88  key.second,
90  ) ["CONF"];
91 
92  for(auto &key : algoKeys)
93  algo_payloads[ key.second ] =
95  "UGMT_CLOBS",
96  key.second,
98  ) ["CONF"];
99  } catch ( std::runtime_error &e ) {
100  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << e.what();
101  if( transactionSafe )
102  throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Broken key");
103  else {
104  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonGlobalParams";
105  return std::make_shared< L1TMuonGlobalParams >( *(baseSettings.product()) ) ;
106  }
107  }
108 
109  // for debugging dump the configs to local files
110  {
111  std::ofstream output(std::string("/tmp/").append(hw_key.substr(0,hw_key.find("/"))).append(".xml"));
112  output << hw_payload;
113  output.close();
114  }
115  for(auto &conf : rs_payloads){
116  std::ofstream output(std::string("/tmp/").append(conf.first.substr(0,conf.first.find("/"))).append(".xml"));
117  output<<conf.second;
118  output.close();
119  }
120  for(auto &conf : algo_payloads){
121  std::ofstream output(std::string("/tmp/").append(conf.first.substr(0,conf.first.find("/"))).append(".xml"));
122  output<<conf.second;
123  output.close();
124  }
125 
126  // finally, push all payloads to the XML parser and construct the TrigSystem objects with each of those
127  l1t::XmlConfigParser xmlRdr;
128  l1t::TriggerSystem trgSys;
129 
130  try {
131  // HW settings should always go first
132  xmlRdr.readDOMFromString( hw_payload );
133  xmlRdr.readRootElement ( trgSys );
134 
135  // now let's parse ALGO and then RS settings
136  for(auto &conf : algo_payloads){
137  xmlRdr.readDOMFromString( conf.second );
138  xmlRdr.readRootElement ( trgSys );
139  }
140  for(auto &conf : rs_payloads){
141  xmlRdr.readDOMFromString( conf.second );
142  xmlRdr.readRootElement ( trgSys );
143  }
144  trgSys.setConfigured();
145  } catch ( std::runtime_error &e ) {
146  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << e.what();
147  if( transactionSafe )
148  throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Cannot parse XMLs");
149  else {
150  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonGlobalParams";
151  return std::make_shared< L1TMuonGlobalParams >( *(baseSettings.product()) ) ;
152  }
153  }
154 
155  L1TMuonGlobalParamsHelper m_params_helper( *(baseSettings.product()) );
156  try {
157  m_params_helper.loadFromOnline(trgSys);
158  } catch ( std::runtime_error &e ) {
159  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << e.what();
160  if( transactionSafe )
161  throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Cannot run helper");
162  else {
163  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonGlobalParams";
164  return std::make_shared< L1TMuonGlobalParams >( *(baseSettings.product()) ) ;
165  }
166  }
167 
168  std::shared_ptr< L1TMuonGlobalParams > retval = std::make_shared< L1TMuonGlobalParams >( cast_to_L1TMuonGlobalParams(m_params_helper) );
169 
170  edm::LogInfo( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "SummaryForFunctionManager: uGMT | OK | All looks good";
171  return retval ;
172 }
const L1TMuonGlobalParams & cast_to_L1TMuonGlobalParams(const L1TMuonGlobalParams_PUBLIC &x)
void setConfigured(bool state=true) noexcept
Definition: TriggerSystem.h:73
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 get(HolderT &iHolder) const
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().