test
CMS 3D CMS Logo

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

Public Member Functions

 L1TMuonBarrelParamsOnlineProd (const edm::ParameterSet &)
 
virtual std::shared_ptr
< L1TMuonBarrelParams
newObject (const std::string &objectKey, const L1TMuonBarrelParamsO2ORcd &record) override
 
 ~L1TMuonBarrelParamsOnlineProd (void)
 
- Public Member Functions inherited from L1ConfigOnlineProdBaseExt< L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams >
 L1ConfigOnlineProdBaseExt (const edm::ParameterSet &)
 
std::shared_ptr
< L1TMuonBarrelParams
produce (const L1TMuonBarrelParamsO2ORcd &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
< 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< L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams >
bool getObjectKey (const L1TMuonBarrelParamsO2ORcd &record, std::shared_ptr< L1TMuonBarrelParams > 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< L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams >
bool m_copyFromCondDB
 
cond::persistency::Session m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Definition at line 14 of file L1TMuonBarrelParamsOnlineProd.cc.

Constructor & Destructor Documentation

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

Definition at line 20 of file L1TMuonBarrelParamsOnlineProd.cc.

20 {}

Member Function Documentation

std::shared_ptr< L1TMuonBarrelParams > L1TMuonBarrelParamsOnlineProd::newObject ( const std::string &  objectKey,
const L1TMuonBarrelParamsO2ORcd record 
)
overridevirtual

return std::make_shared< L1TMuonBarrelParams > ( *(baseSettings.product()) );

return std::make_shared< L1TMuonBarrelParams > ( *(baseSettings.product()) );

return std::make_shared< L1TMuonBarrelParams > ( *(baseSettings.product()) );

return std::make_shared< L1TMuonBarrelParams > ( *(baseSettings.product()) );

return std::make_shared< L1TMuonBarrelParams > ( *(baseSettings.product()) );

return std::make_shared< L1TMuonBarrelParams > ( *(baseSettings.product()) );

return std::make_shared< L1TMuonBarrelParams > ( *(baseSettings.product()) );

Implements L1ConfigOnlineProdBaseExt< L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams >.

Definition at line 25 of file L1TMuonBarrelParamsOnlineProd.cc.

References bitset_utilities::append(), l1t::OMDSReader::basicQuery(), L1TMuonBarrelParamsHelper::configFromDB(), L1ConfigOnlineProdBaseExt< L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams >::m_omdsReader, convertSQLitetoXML_cfg::output, tauJetCorrections_cff::payloads, l1t::TrigSystem::setConfigured(), l1t::OMDSReader::singleAttribute(), and AlCaHLTBitMon_QueryRunRegistry::string.

25  {
26  using namespace edm::es;
27 
28  const L1TMuonBarrelParamsRcd& baseRcd = record.template getRecord< L1TMuonBarrelParamsRcd >() ;
30  baseRcd.get( baseSettings ) ;
31 
32 
33  if (objectKey.empty()) {
34  edm::LogInfo( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "Key is empty, returning empty L1TMuonBarrelParams";
35  throw std::runtime_error("Empty objectKey");
37  }
38 
39  std::string tscKey = objectKey.substr(0, objectKey.find(":") );
40  std::string rsKey = objectKey.substr( objectKey.find(":")+1, std::string::npos );
41 
42 
43  std::string stage2Schema = "CMS_TRG_L1_CONF" ;
44  edm::LogInfo( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "Producing L1TMuonBarrelParams with TSC key =" << tscKey << " and RS key = " << rsKey ;
45 
46  // first, find keys for the algo and RS tables
47 
48  // ALGO and HW
49  std::vector< std::string > queryStrings ;
50  queryStrings.push_back( "ALGO" ) ;
51  queryStrings.push_back( "HW" ) ;
52 
53  std::string algo_key, hw_key;
54 
55  // select ALGO,HW from CMS_TRG_L1_CONF.BMTF_KEYS where ID = tscKey ;
56  l1t::OMDSReader::QueryResults queryResult =
57  m_omdsReader.basicQuery( queryStrings,
58  stage2Schema,
59  "BMTF_KEYS",
60  "BMTF_KEYS.ID",
62  ) ;
63 
64  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
65  edm::LogError( "L1-O2O" ) << "Cannot get BMTF_KEYS.{ALGO,HW}" ;
66  throw std::runtime_error("Broken key");
68  }
69 
70  if( !queryResult.fillVariable( "ALGO", algo_key) ) algo_key = "";
71  if( !queryResult.fillVariable( "HW", hw_key ) ) hw_key = "";
72 
73 
74  // RS
75  queryStrings.clear() ;
76  queryStrings.push_back( "MP7" ) ;
77  queryStrings.push_back( "DAQTTC" ) ;
78 
79  std::string rs_mp7_key, rs_amc13_key;
80 
81  // select RS from CMS_TRG_L1_CONF.BMTF_RS_KEYS where ID = rsKey ;
82  queryResult =
83  m_omdsReader.basicQuery( queryStrings,
84  stage2Schema,
85  "BMTF_RS_KEYS",
86  "BMTF_RS_KEYS.ID",
88  ) ;
89 
90  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
91  edm::LogError( "L1-O2O" ) << "Cannot get BMTF_RS_KEYS.{MP7,DAQTTC}" ;
92  throw std::runtime_error("Broken key");
94  }
95 
96  if( !queryResult.fillVariable( "MP7", rs_mp7_key ) ) rs_mp7_key = "";
97  if( !queryResult.fillVariable( "DAQTTC", rs_amc13_key) ) rs_amc13_key = "";
98 
99 
100  // At this point we have four keys: one ALGO key, one HW key, and two RS keys; now query the payloads for these keys
101  // Now querry the actual payloads
102  enum {kALGO=0, kRS, kHW, NUM_TYPES};
103  std::map<std::string,std::string> payloads[NUM_TYPES]; // associates key -> XML payload for a given type of payloads
104  std::string xmlPayload;
105 
106  queryStrings.clear();
107  queryStrings.push_back( "CONF" );
108 
109  // query ALGO configuration
110  queryResult =
111  m_omdsReader.basicQuery( queryStrings,
112  stage2Schema,
113  "BMTF_ALGO",
114  "BMTF_ALGO.ID",
115  m_omdsReader.singleAttribute(algo_key)
116  ) ;
117 
118  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
119  edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "Cannot get BMTF_ALGO.CONF for ID="<<algo_key;
120  throw std::runtime_error("Broken key");
122  }
123 
124  if( !queryResult.fillVariable( "CONF", xmlPayload ) ) xmlPayload = "";
125  // remember ALGO configuration
126  payloads[kALGO][algo_key] = xmlPayload;
127 
128  // query HW configuration
129  queryResult =
130  m_omdsReader.basicQuery( queryStrings,
131  stage2Schema,
132  "BMTF_HW",
133  "BMTF_HW.ID",
135  ) ;
136 
137  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
138  edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "Cannot get BMTF_HW.CONF for ID="<<hw_key;
139  throw std::runtime_error("Broken key");
141  }
142 
143  if( !queryResult.fillVariable( "CONF", xmlPayload ) ) xmlPayload = "";
144  // remember HW configuration
145  payloads[kHW][hw_key] = xmlPayload;
146 
147  // query MP7 RS configuration
148  queryResult =
149  m_omdsReader.basicQuery( queryStrings,
150  stage2Schema,
151  "BMTF_RS",
152  "BMTF_RS.ID",
153  m_omdsReader.singleAttribute(rs_mp7_key)
154  ) ;
155 
156  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
157  edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "Cannot get BMTF_RS.CONF for ID="<<rs_mp7_key;
158  throw std::runtime_error("Broken key");
160  }
161 
162  if( !queryResult.fillVariable( "CONF", xmlPayload ) ) xmlPayload = "";
163  // remember MP7 RS configuration
164  payloads[kRS][rs_mp7_key] = xmlPayload;
165 
166  // query AMC13 RS configuration
167  queryResult =
168  m_omdsReader.basicQuery( queryStrings,
169  stage2Schema,
170  "BMTF_RS",
171  "BMTF_RS.ID",
172  m_omdsReader.singleAttribute(rs_amc13_key)
173  ) ;
174 
175  if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){
176  edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "Cannot get BMTF_RS.CONF for ID="<<rs_amc13_key;
177  throw std::runtime_error("Broken key");
179  }
180 
181  if( !queryResult.fillVariable( "CONF", xmlPayload ) ) xmlPayload = "";
182  // remember AMC13 RS configuration
183  payloads[kRS][rs_amc13_key] = xmlPayload;
184 
185 // for debugging dump the configs to local files
186 for(auto &conf : payloads[kHW]){
187  std::ofstream output(std::string("/tmp/").append(conf.first.substr(0,conf.first.find("/"))).append(".xml"));
188  output<<conf.second;
189  output.close();
190 }
191 for(auto &conf : payloads[kALGO]){
192  std::ofstream output(std::string("/tmp/").append(conf.first.substr(0,conf.first.find("/"))).append(".xml"));
193  output<<conf.second;
194  output.close();
195 }
196 for(auto &conf : payloads[kRS]){
197  std::ofstream output(std::string("/tmp/").append(conf.first.substr(0,conf.first.find("/"))).append(".xml"));
198  output<<conf.second;
199  output.close();
200 }
201 
202  // finally, push all payloads to the XML parser and construct the TrigSystem objects with each of those
203  l1t::XmlConfigReader xmlRdr;
204  l1t::TrigSystem parsedXMLs;
205 // parsedXMLs.addProcRole("processors", "procMP7");
206  // HW settings should always go first
207  for(auto &conf : payloads[ kHW ]){
208  xmlRdr.readDOMFromString( conf.second );
209  xmlRdr.readRootElement ( parsedXMLs );
210  }
211  // now let's parse ALGO and then RS settings
212  for(auto &conf : payloads[ kALGO ]){
213  xmlRdr.readDOMFromString( conf.second );
214  xmlRdr.readRootElement ( parsedXMLs );
215  }
216  for(auto &conf : payloads[ kRS ]){
217  xmlRdr.readDOMFromString( conf.second );
218  xmlRdr.readRootElement ( parsedXMLs );
219  }
220  parsedXMLs.setConfigured();
221 
222  // for debugging also dump the configs to local files
223  for(size_t type=0; type<NUM_TYPES; type++)
224  for(auto &conf : payloads[ type ]){
225  std::ofstream output(std::string("/tmp/").append(conf.first.substr(0,conf.first.find("/"))).append(".xml"));
226  output<<conf.second;
227  output.close();
228  }
229 
230  L1TMuonBarrelParamsHelper m_params_helper(*(baseSettings.product()) );
231  m_params_helper.configFromDB(parsedXMLs);
232  std::shared_ptr< L1TMuonBarrelParams > retval = std::make_shared< L1TMuonBarrelParams>(m_params_helper);
233 
234  return retval;
235 
236 }
type
Definition: HCALResponse.h:21
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:295
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