CMS 3D CMS Logo

List of all members | Public Member Functions
L1TCaloParamsOnlineProd Class Reference
Inheritance diagram for L1TCaloParamsOnlineProd:
L1ConfigOnlineProdBaseExt< L1TCaloParamsO2ORcd, l1t::CaloParams > edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 L1TCaloParamsOnlineProd (const edm::ParameterSet &)
 
virtual std::shared_ptr< l1t::CaloParamsnewObject (const std::string &objectKey, const L1TCaloParamsO2ORcd &record) override
 
 ~L1TCaloParamsOnlineProd (void)
 
- Public Member Functions inherited from L1ConfigOnlineProdBaseExt< L1TCaloParamsO2ORcd, l1t::CaloParams >
 L1ConfigOnlineProdBaseExt (const edm::ParameterSet &)
 
std::shared_ptr< l1t::CaloParamsproduce (const L1TCaloParamsO2ORcd &iRecord)
 
 ~L1ConfigOnlineProdBaseExt ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()(false)
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer () noexcept(false)
 
- 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)
 

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< L1TCaloParamsO2ORcd, l1t::CaloParams >
bool getObjectKey (const L1TCaloParamsO2ORcd &record, std::shared_ptr< l1t::CaloParams > data, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
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())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 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< L1TCaloParamsO2ORcd, l1t::CaloParams >
bool m_copyFromCondDB
 
cond::persistency::Session m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Definition at line 19 of file L1TCaloParamsOnlineProd.cc.

Constructor & Destructor Documentation

L1TCaloParamsOnlineProd::L1TCaloParamsOnlineProd ( const edm::ParameterSet iConfig)
L1TCaloParamsOnlineProd::~L1TCaloParamsOnlineProd ( void  )
inline

Definition at line 25 of file L1TCaloParamsOnlineProd.cc.

25 {}

Member Function Documentation

std::shared_ptr< l1t::CaloParams > L1TCaloParamsOnlineProd::newObject ( const std::string &  objectKey,
const L1TCaloParamsO2ORcd record 
)
overridevirtual

Implements L1ConfigOnlineProdBaseExt< L1TCaloParamsO2ORcd, l1t::CaloParams >.

Definition at line 151 of file L1TCaloParamsOnlineProd.cc.

References l1t::TriggerSystem::addProcessor(), mps_alisetup::append, DEFINE_FWK_EVENTSETUP_MODULE, MillePedeFileConverter_cfg::e, l1t::OnlineDBqueryHelper::fetch(), edm::eventsetup::EventSetupRecord::get(), l1t::TriggerSystem::getParameters(), crabWrapper::key, L1ConfigOnlineProdBaseExt< L1TCaloParamsO2ORcd, l1t::CaloParams >::m_omdsReader, convertSQLitetoXML_cfg::output, readCaloLayer1OnlineSettings(), readCaloLayer2OnlineSettings(), l1t::XmlConfigParser::readDOMFromString(), l1t::XmlConfigParser::readRootElement(), l1t::TriggerSystem::setConfigured(), and AlCaHLTBitMon_QueryRunRegistry::string.

151  {
152  using namespace edm::es;
153 
154  const L1TCaloStage2ParamsRcd& baseRcd = record.template getRecord< L1TCaloStage2ParamsRcd >() ;
155  edm::ESHandle< l1t::CaloParams > baseSettings ;
156  baseRcd.get( baseSettings ) ;
157 
158 
159  if( objectKey.empty() ){
160  edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "Key is empty, returning empty l1t::CaloParams";
161  throw std::runtime_error("Empty objectKey");
162  }
163 
164  std::string tscKey = objectKey.substr(0, objectKey.find(":") );
165  std::string rsKey = objectKey.substr( objectKey.find(":")+1, std::string::npos );
166 
167  edm::LogInfo( "L1-O2O: L1TCaloParamsOnlineProd" ) << "Producing L1TCaloParamsOnlineProd with TSC key = " << tscKey << " and RS key = " << rsKey ;
168 
169  std::string calol1_top_key, calol1_algo_key, calol1_hw_key;
170  std::string calol1_hw_payload, calol1_algo_payload;
171  std::string calol2_top_key, calol2_algo_key, calol2_hw_key;
172  std::string calol2_hw_payload;
173  std::map<std::string,std::string> calol2_algo_payloads; // key -> XML payload
174  try {
175  std::map<std::string,std::string> topKeys =
176  l1t::OnlineDBqueryHelper::fetch( {"CALOL1_KEY","CALOL2_KEY"},
177  "L1_TRG_CONF_KEYS",
178  tscKey,
180  );
181  calol1_top_key = topKeys["CALOL1_KEY"];
182 
183  std::map<std::string,std::string> calol1_keys =
184  l1t::OnlineDBqueryHelper::fetch( {"ALGO","HW"},
185  "CALOL1_KEYS",
186  calol1_top_key,
188  );
189 
190  calol1_hw_key = calol1_keys["HW"];
191  calol1_hw_payload = l1t::OnlineDBqueryHelper::fetch( {"CONF"},
192  "CALOL1_CLOBS",
193  calol1_hw_key,
195  ) ["CONF"];
196 
197  calol1_algo_key = calol1_keys["ALGO"];
198 
199  calol1_algo_payload = l1t::OnlineDBqueryHelper::fetch( {"CONF"},
200  "CALOL1_CLOBS",
201  calol1_algo_key,
203  ) ["CONF"];
204 
205  calol2_top_key = topKeys["CALOL2_KEY"];
206 
207  std::map<std::string,std::string> calol2_keys =
208  l1t::OnlineDBqueryHelper::fetch( {"ALGO","HW"},
209  "CALOL2_KEYS",
210  calol2_top_key,
212  );
213 
214  calol2_hw_key = calol2_keys["HW"];
215  calol2_hw_payload = l1t::OnlineDBqueryHelper::fetch( {"CONF"},
216  "CALOL2_CLOBS",
217  calol2_hw_key,
219  ) ["CONF"];
220 
221  calol2_algo_key = calol2_keys["ALGO"];
222 
223  std::map<std::string,std::string> calol2_algo_keys =
224  l1t::OnlineDBqueryHelper::fetch( {"DEMUX","MPS_COMMON","MPS_JET","MP_EGAMMA","MP_SUM","MP_TAU"},
225  "CALOL2_ALGO_KEYS",
226  calol2_algo_key,
228  );
229 
230  for(auto &key : calol2_algo_keys)
231  calol2_algo_payloads[ key.second ] =
233  "CALOL2_CLOBS",
234  key.second,
236  ) ["CONF"];
237 
238  } catch ( std::runtime_error &e ) {
239  edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << e.what();
240  throw std::runtime_error("Broken key");
241  }
242 
243  // for debugging purposes dump the configs to local files
244  for(auto &conf : calol2_algo_payloads){
245  std::ofstream output(std::string("/tmp/").append(conf.first.substr(0,conf.first.find("/"))).append(".xml"));
246  output<<conf.second;
247  output.close();
248  }
249  {
250  std::ofstream output(std::string("/tmp/").append(calol2_hw_key.substr(0,calol2_hw_key.find("/"))).append(".xml"));
251  output << calol2_hw_payload;
252  output.close();
253  }
254  {
255  std::ofstream output(std::string("/tmp/").append(calol1_algo_key.substr(0,calol1_algo_key.find("/"))).append(".xml"));
256  output << calol1_algo_payload;
257  output.close();
258  }
259 
260 
261  l1t::XmlConfigParser xmlReader1;
262  l1t::TriggerSystem calol1;
263 
264 if( true ){
265  xmlReader1.readDOMFromString( calol1_hw_payload );
266  xmlReader1.readRootElement ( calol1, "calol1" );
267 } else {
268  // explicitly make the parser aware of the processors
269  calol1.addProcessor("CTP7_Phi0", "Layer1Processor","-2","-0");
270  calol1.addProcessor("CTP7_Phi1", "Layer1Processor","-2","-1");
271  calol1.addProcessor("CTP7_Phi2", "Layer1Processor","-2","-2");
272  calol1.addProcessor("CTP7_Phi3", "Layer1Processor","-2","-3");
273  calol1.addProcessor("CTP7_Phi4", "Layer1Processor","-2","-4");
274  calol1.addProcessor("CTP7_Phi5", "Layer1Processor","-2","-5");
275  calol1.addProcessor("CTP7_Phi6", "Layer1Processor","-2","-6");
276  calol1.addProcessor("CTP7_Phi7", "Layer1Processor","-2","-7");
277  calol1.addProcessor("CTP7_Phi8", "Layer1Processor","-2","-8");
278  calol1.addProcessor("CTP7_Phi9", "Layer1Processor","-2","-9");
279  calol1.addProcessor("CTP7_Phi10","Layer1Processor","-2","-10");
280  calol1.addProcessor("CTP7_Phi11","Layer1Processor","-2","-11");
281  calol1.addProcessor("CTP7_Phi12","Layer1Processor","-2","-12");
282  calol1.addProcessor("CTP7_Phi13","Layer1Processor","-2","-13");
283  calol1.addProcessor("CTP7_Phi14","Layer1Processor","-2","-14");
284  calol1.addProcessor("CTP7_Phi15","Layer1Processor","-2","-15");
285  calol1.addProcessor("CTP7_Phi16","Layer1Processor","-2","-16");
286 }
287  calol1.addProcessor("defaultProc", "processors","-2","0");
288 
290  calol1.addProcessor("processor0", "processors","-1","-1");
291  calol1.addProcessor("processor1", "processors","-1","-2");
292  calol1.addProcessor("processor2", "processors","-1","-3");
293  calol1.addProcessor("processor3", "processors","-1","-4");
294  calol1.addProcessor("processor4", "processors","-1","-5");
295  calol1.addProcessor("processor5", "processors","-1","-6");
296  calol1.addProcessor("processor6", "processors","-1","-7");
297  calol1.addProcessor("processor7", "processors","-1","-8");
298  calol1.addProcessor("processor8", "processors","-1","-9");
299  calol1.addProcessor("processor9", "processors","-1","-10");
300  calol1.addProcessor("processor10", "processors","-1","-11");
301  calol1.addProcessor("processor11", "processors","-1","-12");
302  calol1.addProcessor("processor12", "processors","-1","-13");
303  calol1.addProcessor("processor13", "processors","-1","-14");
304  calol1.addProcessor("processor14", "processors","-1","-15");
305  calol1.addProcessor("processor15", "processors","-1","-16");
306  calol1.addProcessor("processor16", "processors","-1","-17");
307  calol1.addProcessor("processor17", "processors","-1","-18");
309 
310  xmlReader1.readDOMFromString( calol1_algo_payload );
311  xmlReader1.readRootElement( calol1, "calol1" );
312 
313  calol1.setConfigured();
314 
315  std::map<std::string, l1t::Parameter> calol1_conf = calol1.getParameters("defaultProc");
316  std::map<std::string, l1t::Mask> calol1_rs ;//= calol1.getMasks ("processors");
317 
318  l1t::TriggerSystem calol2;
319 
320  l1t::XmlConfigParser xmlReader2;
321  xmlReader2.readDOMFromString( calol2_hw_payload );
322  xmlReader2.readRootElement( calol2, "calol2" );
323 
324  for(auto &conf : calol2_algo_payloads){
325  xmlReader2.readDOMFromString( conf.second );
326  xmlReader2.readRootElement( calol2, "calol2" );
327  }
328 
329 // calol2.setSystemId("calol2");
330  calol2.setConfigured();
331 
332  // Perhaps layer 2 has to look at settings for demux and mp separately? // => No demux settings required
333  std::map<std::string, l1t::Parameter> calol2_conf = calol2.getParameters("MP1");
334  std::map<std::string, l1t::Mask> calol2_rs ;//= calol2.getMasks ("processors");
335 
336  l1t::CaloParamsHelper m_params_helper( *(baseSettings.product()) );
337 
338  if( !readCaloLayer1OnlineSettings(m_params_helper, calol1_conf, calol1_rs) )
339  throw std::runtime_error("Parsing error for CaloLayer1");
340  if( !readCaloLayer2OnlineSettings(m_params_helper, calol2_conf, calol2_rs) )
341  throw std::runtime_error("Parsing error for CaloLayer2");
342 
343  std::shared_ptr< l1t::CaloParams > retval = std::make_shared< l1t::CaloParams >( m_params_helper ) ;
344  return retval;
345 }
void setConfigured(bool state=true) noexcept
Definition: TriggerSystem.h:73
bool readCaloLayer2OnlineSettings(l1t::CaloParamsHelper &paramsHelper, std::map< std::string, l1t::Parameter > &conf, std::map< std::string, l1t::Mask > &)
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
const std::map< std::string, Parameter > & getParameters(const char *processor) const
void readRootElement(TriggerSystem &aTriggerSystem, const std::string &sysId="")
void addProcessor(const char *processor, const char *role, const char *crate, const char *slot)
bool readCaloLayer1OnlineSettings(l1t::CaloParamsHelper &paramsHelper, std::map< std::string, l1t::Parameter > &conf, std::map< std::string, l1t::Mask > &)