CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
L1TMuonGlobalParamsOnlineProd Class Reference
Inheritance diagram for L1TMuonGlobalParamsOnlineProd:
L1ConfigOnlineProdBaseExt< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams > edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 L1TMuonGlobalParamsOnlineProd (const edm::ParameterSet &)
 
virtual boost::shared_ptr
< L1TMuonGlobalParams
newObject (const std::string &objectKey, const L1TMuonGlobalParamsO2ORcd &record) override
 
 ~L1TMuonGlobalParamsOnlineProd (void)
 
- Public Member Functions inherited from L1ConfigOnlineProdBaseExt< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams >
 L1ConfigOnlineProdBaseExt (const edm::ParameterSet &)
 
boost::shared_ptr
< L1TMuonGlobalParams
produce (const L1TMuonGlobalParamsO2ORcd &iRecord)
 
 ~L1ConfigOnlineProdBaseExt ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer ()
 
- 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 ()
 

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
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 
- 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, boost::shared_ptr< L1TMuonGlobalParams > 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::auto_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::auto_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< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams >
bool m_copyFromCondDB
 
cond::persistency::Session m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Definition at line 13 of file L1TMuonGlobalParamsOnlineProd.cc.

Constructor & Destructor Documentation

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

Definition at line 19 of file L1TMuonGlobalParamsOnlineProd.cc.

19 {}

Member Function Documentation

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

return boost::shared_ptr< L1TMuonGlobalParams > ( new L1TMuonGlobalParams( *(baseSettings.product()) ) );

return boost::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ;

return boost::shared_ptr< L1TMuonGlobalParams > ( new L1TMuonGlobalParams( *(baseSettings.product()) ) );

return boost::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ;

return boost::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ;

return boost::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ;

return boost::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ;

return boost::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ;

return boost::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ;

Implements L1ConfigOnlineProdBaseExt< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams >.

Definition at line 24 of file L1TMuonGlobalParamsOnlineProd.cc.

References bitset_utilities::append(), l1t::OMDSReader::basicQuery(), cast_to_L1TMuonGlobalParams(), L1TMuonGlobalParamsHelper::loadFromOnline(), L1ConfigOnlineProdBaseExt< L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams >::m_omdsReader, convertSQLitetoXML_cfg::output, tauJetCorrections_cff::payloads, l1t::TrigSystem::setConfigured(), l1t::OMDSReader::singleAttribute(), and AlCaHLTBitMon_QueryRunRegistry::string.

24  {
25  using namespace edm::es;
26 
27  const L1TMuonGlobalParamsRcd& baseRcd = record.template getRecord< L1TMuonGlobalParamsRcd >() ;
29  baseRcd.get( baseSettings ) ;
30 
31  if( objectKey.empty() ){
32  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "Key is empty";
33  throw std::runtime_error("Empty objectKey");
35  }
36 
37  std::string tscKey = objectKey.substr(0, objectKey.find(":") );
38  std::string rsKey = objectKey.substr( objectKey.find(":")+1, std::string::npos );
39 
40  std::string stage2Schema = "CMS_TRG_L1_CONF" ;
41  edm::LogInfo( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "Producing L1TMuonGlobalParams with TSC key =" << tscKey << " and RS key = " << rsKey ;
42 
43  // ALGO and HW
44  std::vector< std::string > queryStrings ;
45  queryStrings.push_back( "ALGO" ) ;
46  queryStrings.push_back( "HW" ) ;
47 
48  std::string algo_key, hw_key;
49 
50  // select ALGO,HW from CMS_TRG_L1_CONF.UGMT_KEYS where ID = tscKey ;
51  l1t::OMDSReader::QueryResults queryResult =
52  m_omdsReader.basicQuery( queryStrings,
53  stage2Schema,
54  "UGMT_KEYS",
55  "UGMT_KEYS.ID",
57  ) ;
58 
59  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
60  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "Cannot get UGMT_KEYS.{ALGO,HW} for ID = " << tscKey ;
61  throw std::runtime_error("Broken key");
63  }
64 
65  if( !queryResult.fillVariable( "ALGO", algo_key) ) algo_key = "";
66  if( !queryResult.fillVariable( "HW", hw_key ) ) hw_key = "";
67 
68  // RS
69  queryStrings.clear();
70  queryStrings.push_back( "MP7" );
71  queryStrings.push_back( "MP7_MONI" );
72  queryStrings.push_back( "AMC13_MONI");
73 
74  std::string rs_mp7_key, rs_mp7moni_key, rs_amc13moni_key;
75 
76  // select MP7, MP&_MONI, AMC13_MONI from CMS_TRG_L1_CONF.UGMT_RS_KEYS where ID = rsKey ;
77  queryResult =
78  m_omdsReader.basicQuery( queryStrings,
79  stage2Schema,
80  "UGMT_RS_KEYS",
81  "UGMT_RS_KEYS.ID",
83  ) ;
84 
85  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
86  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "Cannot get UGMT_RS_KEYS.{MP7,MP7_MONI,AMC13_MONI} for ID = " << rsKey ;
87  throw std::runtime_error("Broken key");
89  }
90 
91  if( !queryResult.fillVariable( "MP7", rs_mp7_key ) ) rs_mp7_key = "";
92  if( !queryResult.fillVariable( "MP7_MONI", rs_mp7moni_key ) ) rs_mp7moni_key = "";
93  if( !queryResult.fillVariable( "AMC13_MONI", rs_amc13moni_key) ) rs_amc13moni_key = "";
94 
95 
96  std::string algo_mp7_key, algo_luts_key;
97 
98  queryStrings.clear();
99  queryStrings.push_back( "MP7" );
100  queryStrings.push_back( "LUTS" );
101 
102  // query ALGO configuration
103  queryResult =
104  m_omdsReader.basicQuery( queryStrings,
105  stage2Schema,
106  "UGMT_ALGO_KEYS",
107  "UGMT_ALGO_KEYS.ID",
108  m_omdsReader.singleAttribute(algo_key)
109  ) ;
110 
111  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
112  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "Cannot get UGMT_ALGO.{MP7,LUTS} for ID = " << algo_key;
113  throw std::runtime_error("Broken key");
115  }
116 
117  if( !queryResult.fillVariable( "MP7", algo_mp7_key ) ) algo_mp7_key = "";
118  if( !queryResult.fillVariable( "LUTS", algo_luts_key ) ) algo_luts_key = "";
119  // remember ALGO configuration
120 
121  // At this point we have four keys: one ALGO key, one HW key, and two RS keys; now query the payloads for these keys
122  // Now querry the actual payloads
123  enum {kALGO=0, kRS, kHW, NUM_TYPES};
124  std::map<std::string,std::string> payloads[NUM_TYPES]; // associates key -> XML payload for a given type of payloads
125  std::string xmlPayload;
126 
127  queryStrings.clear();
128  queryStrings.push_back( "CONF" );
129 
130  // query ALGO configurations
131  queryResult =
132  m_omdsReader.basicQuery( queryStrings,
133  stage2Schema,
134  "UGMT_ALGO",
135  "UGMT_ALGO.ID",
136  m_omdsReader.singleAttribute(algo_mp7_key)
137  ) ;
138 
139  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
140  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "Cannot get UGMT_ALGO.CONF for ID = " << algo_mp7_key;
141  throw std::runtime_error("Broken key");
143  }
144 
145  if( !queryResult.fillVariable( "CONF", xmlPayload ) ) xmlPayload = "";
146  // remember MP7 ALGO configuration
147  payloads[kALGO][algo_mp7_key] = xmlPayload;
148 
149  queryResult =
150  m_omdsReader.basicQuery( queryStrings,
151  stage2Schema,
152  "UGMT_ALGO",
153  "UGMT_ALGO.ID",
154  m_omdsReader.singleAttribute(algo_luts_key)
155  ) ;
156 
157  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
158  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "Cannot get UGMT_ALGO.CONF for ID = " << algo_luts_key;
159  throw std::runtime_error("Broken key");
161  }
162 
163  if( !queryResult.fillVariable( "CONF", xmlPayload ) ) xmlPayload = "";
164  // remember ALGO configuration
165  payloads[kALGO][algo_luts_key] = xmlPayload;
166 
167 
168  // query HW configuration
169  queryResult =
170  m_omdsReader.basicQuery( queryStrings,
171  stage2Schema,
172  "UGMT_HW",
173  "UGMT_HW.ID",
175  ) ;
176 
177  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
178  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "Cannot get UGMT_HW.CONF for ID = " << hw_key;
179  throw std::runtime_error("Broken key");
181  }
182 
183  if( !queryResult.fillVariable( "CONF", xmlPayload ) ) xmlPayload = "";
184  // remember HW configuration
185  payloads[kHW][hw_key] = xmlPayload;
186 
187  // query MP7 and AMC13 RS configuration
188  queryResult =
189  m_omdsReader.basicQuery( queryStrings,
190  stage2Schema,
191  "UGMT_RS",
192  "UGMT_RS.ID",
193  m_omdsReader.singleAttribute(rs_mp7_key)
194  ) ;
195 
196  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
197  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "Cannot get UGMT_RS.CONF for ID = " << rs_mp7_key;
198  throw std::runtime_error("Broken key");
199 //? return boost::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( *(baseSettings.product()) ) ) ;
200  }
201 
202  if( !queryResult.fillVariable( "CONF", xmlPayload ) ) xmlPayload = "";
203  // remember MP7 RS configuration
204  payloads[kRS][rs_mp7_key] = xmlPayload;
205 
206  queryResult =
207  m_omdsReader.basicQuery( queryStrings,
208  stage2Schema,
209  "UGMT_RS",
210  "UGMT_RS.ID",
211  m_omdsReader.singleAttribute(rs_mp7moni_key)
212  ) ;
213 
214  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
215  edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "Cannot get UGMT_RS.CONF for ID = " << rs_mp7moni_key;
216  throw std::runtime_error("Broken key");
218  }
219 
220  if( !queryResult.fillVariable( "CONF", xmlPayload ) ) xmlPayload = "";
221  // remember MP7 RS configuration
222  payloads[kRS][rs_mp7moni_key] = xmlPayload;
223 
224  // query AMC13 RS configuration
225  queryResult =
226  m_omdsReader.basicQuery( queryStrings,
227  stage2Schema,
228  "UGMT_RS",
229  "UGMT_RS.ID",
230  m_omdsReader.singleAttribute(rs_amc13moni_key)
231  ) ;
232 
233  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
234  edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "Cannot get UGMT_RS.CONF for ID = " << rs_amc13moni_key;
235  throw std::runtime_error("Broken key");
237  }
238 
239  if( !queryResult.fillVariable( "CONF", xmlPayload ) ) xmlPayload = "";
240  // remember AMC13 RS configuration
241  payloads[kRS][rs_amc13moni_key] = xmlPayload;
242 
243 
244  // for debugging dump the configs to local files
245  for(auto &conf : payloads[kHW]){
246  std::ofstream output(std::string("/tmp/").append(conf.first.substr(0,conf.first.find("/"))).append(".xml"));
247  output<<conf.second;
248  output.close();
249  }
250  for(auto &conf : payloads[kALGO]){
251  std::ofstream output(std::string("/tmp/").append(conf.first.substr(0,conf.first.find("/"))).append(".xml"));
252  output<<conf.second;
253  output.close();
254  }
255  for(auto &conf : payloads[kRS]){
256  std::ofstream output(std::string("/tmp/").append(conf.first.substr(0,conf.first.find("/"))).append(".xml"));
257  output<<conf.second;
258  output.close();
259  }
260 
261  // finally, push all payloads to the XML parser and construct the TrigSystem objects with each of those
262  l1t::XmlConfigReader xmlRdr;
263  l1t::TrigSystem trgSys;
264  // HW settings should always go first
265  for(auto &conf : payloads[ kHW ]){
266  xmlRdr.readDOMFromString( conf.second );
267  xmlRdr.readRootElement ( trgSys );
268  }
269  // now let's parse ALGO and then RS settings
270  for(auto &conf : payloads[ kALGO ]){
271  xmlRdr.readDOMFromString( conf.second );
272  xmlRdr.readRootElement ( trgSys );
273  }
274  for(auto &conf : payloads[ kRS ]){
275  xmlRdr.readDOMFromString( conf.second );
276  xmlRdr.readRootElement ( trgSys );
277  }
278  trgSys.setConfigured();
279 
280  L1TMuonGlobalParamsHelper m_params_helper( *(baseSettings.product()) );
281  m_params_helper.loadFromOnline(trgSys);
282 
283  return boost::shared_ptr< L1TMuonGlobalParams >( new L1TMuonGlobalParams( cast_to_L1TMuonGlobalParams(m_params_helper) ) ) ;
284 }
const L1TMuonGlobalParams & cast_to_L1TMuonGlobalParams(const L1TMuonGlobalParams_PUBLIC &x)
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:296
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="")
Definition: OMDSReader.cc:86
void setConfigured(const bool state=true)
Definition: TrigSystem.h:39