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 boost::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 &)
 
boost::shared_ptr
< L1TMuonBarrelParams
produce (const L1TMuonBarrelParamsO2ORcd &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< L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams >
bool getObjectKey (const L1TMuonBarrelParamsO2ORcd &record, boost::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::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< 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

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

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