CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
L1GtParametersConfigOnlineProd Class Reference

#include <L1GtParametersConfigOnlineProd.h>

Inheritance diagram for L1GtParametersConfigOnlineProd:
L1ConfigOnlineProdBase< L1GtParametersRcd, L1GtParameters > edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 L1GtParametersConfigOnlineProd (const edm::ParameterSet &)
 constructor More...
 
virtual boost::shared_ptr
< L1GtParameters
newObject (const std::string &objectKey)
 public methods More...
 
 ~L1GtParametersConfigOnlineProd ()
 destructor More...
 
- Public Member Functions inherited from L1ConfigOnlineProdBase< L1GtParametersRcd, L1GtParameters >
 L1ConfigOnlineProdBase (const edm::ParameterSet &)
 
boost::shared_ptr< L1GtParametersproduce (const L1GtParametersRcd &iRecord)
 
 ~L1ConfigOnlineProdBase ()
 
- 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, boost::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 L1ConfigOnlineProdBase< L1GtParametersRcd, L1GtParameters >
bool getObjectKey (const L1GtParametersRcd &record, boost::shared_ptr< L1GtParameters > 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 L1ConfigOnlineProdBase< L1GtParametersRcd, L1GtParameters >
bool m_copyFromCondDB
 
cond::DbConnection m_dbConnection
 
cond::DbSession m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Description: online producer for L1GtParameters.

Implementation: <TODO: enter implementation details>

Author
: Vasile Mihai Ghete - HEPHY Vienna

Definition at line 32 of file L1GtParametersConfigOnlineProd.h.

Constructor & Destructor Documentation

L1GtParametersConfigOnlineProd::L1GtParametersConfigOnlineProd ( const edm::ParameterSet parSet)
L1GtParametersConfigOnlineProd::~L1GtParametersConfigOnlineProd ( )

destructor

Definition at line 33 of file L1GtParametersConfigOnlineProd.cc.

33  {
34 
35  // empty
36 
37 }

Member Function Documentation

boost::shared_ptr< L1GtParameters > L1GtParametersConfigOnlineProd::newObject ( const std::string &  objectKey)
virtual

public methods

Implements L1ConfigOnlineProdBase< L1GtParametersRcd, L1GtParameters >.

Definition at line 41 of file L1GtParametersConfigOnlineProd.cc.

References l1t::OMDSReader::basicQuery(), l1t::OMDSReader::QueryResults::fillVariable(), edm::isDebugEnabled(), LogTrace, L1ConfigOnlineProdBase< L1GtParametersRcd, L1GtParameters >::m_omdsReader, l1t::OMDSReader::QueryResults::queryFailed(), python.entryComment::results, l1t::OMDSReader::singleAttribute(), and AlCaHLTBitMon_QueryRunRegistry::string.

42  {
43 
44  // shared pointer for L1GtParameters
45  boost::shared_ptr<L1GtParameters> pL1GtParameters = boost::shared_ptr<L1GtParameters>(
46  new L1GtParameters());
47 
48  // l1GtParameters: parameters in table GTFE_SETUP_FK
49 
50  const std::string gtSchema = "CMS_GT";
51 
52  // SQL query:
53  // SELECT EVM_INCLUDE_TCS,
54  // EVM_INCLUDE_FDL,
55  // DAQ_INCLUDE_FDL,
56  // DAQ_INCLUDE_PSB0,
57  // DAQ_INCLUDE_PSB1,
58  // DAQ_INCLUDE_PSB2,
59  // DAQ_INCLUDE_PSB3,
60  // DAQ_INCLUDE_PSB4,
61  // DAQ_INCLUDE_PSB5,
62  // DAQ_INCLUDE_PSB6,
63  // DAQ_INCLUDE_GMT,
64  // DAQ_INCLUDE_TIM,
65  // DAQ_NB_BC_PER_EVENT_FDL,
66  // BST_DATA_NB_BYTES
67  // FROM CMS_GT.GT_GTFE_SETUP
68  // WHERE GT_GTFE_SETUP.ID = objectKey
69 
70  std::vector<std::string> columns;
71  columns.push_back("EVM_INCLUDE_TCS");
72  columns.push_back("EVM_INCLUDE_FDL");
73  columns.push_back("DAQ_INCLUDE_FDL");
74  columns.push_back("DAQ_INCLUDE_PSB0");
75  columns.push_back("DAQ_INCLUDE_PSB1");
76  columns.push_back("DAQ_INCLUDE_PSB2");
77  columns.push_back("DAQ_INCLUDE_PSB3");
78  columns.push_back("DAQ_INCLUDE_PSB4");
79  columns.push_back("DAQ_INCLUDE_PSB5");
80  columns.push_back("DAQ_INCLUDE_PSB6");
81  columns.push_back("DAQ_INCLUDE_GMT");
82  columns.push_back("DAQ_INCLUDE_TIM");
83  columns.push_back("DAQ_NB_BC_PER_EVENT_FDL");
84  columns.push_back("DAQ_NB_BC_PER_EVENT_PSB0");
85  columns.push_back("DAQ_NB_BC_PER_EVENT_PSB1");
86  columns.push_back("DAQ_NB_BC_PER_EVENT_PSB2");
87  columns.push_back("DAQ_NB_BC_PER_EVENT_PSB3");
88  columns.push_back("DAQ_NB_BC_PER_EVENT_PSB4");
89  columns.push_back("DAQ_NB_BC_PER_EVENT_PSB5");
90  columns.push_back("DAQ_NB_BC_PER_EVENT_PSB6");
91  columns.push_back("DAQ_NB_BC_PER_EVENT_GMT");
92  columns.push_back("DAQ_NB_BC_PER_EVENT_TIM");
93  columns.push_back("BST_DATA_NB_BYTES");
94 
95 
97  columns, gtSchema, "GT_GTFE_SETUP", "GT_GTFE_SETUP.ID", m_omdsReader.singleAttribute(
98  objectKey));
99 
100  // check if query was successful
101  if (results.queryFailed()) {
102  edm::LogError("L1-O2O") << "Problem with L1GtParameters key:" << objectKey;
103  return pL1GtParameters;
104  }
105 
106  bool activeBoardsEvmTCS = false;
107  results.fillVariable("EVM_INCLUDE_TCS", activeBoardsEvmTCS);
108 
109  bool activeBoardsEvmFDL = false;
110  results.fillVariable("EVM_INCLUDE_FDL", activeBoardsEvmFDL);
111 
112  bool activeBoardsDaqFDL = false;
113  results.fillVariable("DAQ_INCLUDE_FDL", activeBoardsDaqFDL);
114 
115  bool activeBoardsDaqPSB0 = false;
116  results.fillVariable("DAQ_INCLUDE_PSB0", activeBoardsDaqPSB0);
117 
118  bool activeBoardsDaqPSB1 = false;
119  results.fillVariable("DAQ_INCLUDE_PSB1", activeBoardsDaqPSB1);
120 
121  bool activeBoardsDaqPSB2 = false;
122  results.fillVariable("DAQ_INCLUDE_PSB2", activeBoardsDaqPSB2);
123 
124  bool activeBoardsDaqPSB3 = false;
125  results.fillVariable("DAQ_INCLUDE_PSB3", activeBoardsDaqPSB3);
126 
127  bool activeBoardsDaqPSB4;
128  results.fillVariable("DAQ_INCLUDE_PSB4", activeBoardsDaqPSB4);
129 
130  bool activeBoardsDaqPSB5 = false;
131  results.fillVariable("DAQ_INCLUDE_PSB5", activeBoardsDaqPSB5);
132 
133  bool activeBoardsDaqPSB6;
134  results.fillVariable("DAQ_INCLUDE_PSB6", activeBoardsDaqPSB6);
135 
136  bool activeBoardsDaqGMT;
137  results.fillVariable("DAQ_INCLUDE_GMT", activeBoardsDaqGMT);
138 
139  bool activeBoardsDaqTIM = false;
140  results.fillVariable("DAQ_INCLUDE_TIM", activeBoardsDaqTIM);
141 
142  std::string totalBxInEventStr;
143  results.fillVariable("DAQ_NB_BC_PER_EVENT_FDL", totalBxInEventStr);
144 
145  //
146  std::string daqNrBxBoardStrFDL;
147  results.fillVariable("DAQ_NB_BC_PER_EVENT_FDL", daqNrBxBoardStrFDL);
148 
149  std::string daqNrBxBoardStrPSB0;
150  results.fillVariable("DAQ_NB_BC_PER_EVENT_PSB0", daqNrBxBoardStrPSB0);
151 
152  std::string daqNrBxBoardStrPSB1;
153  results.fillVariable("DAQ_NB_BC_PER_EVENT_PSB1", daqNrBxBoardStrPSB1);
154 
155  std::string daqNrBxBoardStrPSB2;
156  results.fillVariable("DAQ_NB_BC_PER_EVENT_PSB2", daqNrBxBoardStrPSB2);
157 
158  std::string daqNrBxBoardStrPSB3;
159  results.fillVariable("DAQ_NB_BC_PER_EVENT_PSB3", daqNrBxBoardStrPSB3);
160 
161  std::string daqNrBxBoardStrPSB4;
162  results.fillVariable("DAQ_NB_BC_PER_EVENT_PSB4", daqNrBxBoardStrPSB4);
163 
164  std::string daqNrBxBoardStrPSB5;
165  results.fillVariable("DAQ_NB_BC_PER_EVENT_PSB5", daqNrBxBoardStrPSB5);
166 
167  std::string daqNrBxBoardStrPSB6;
168  results.fillVariable("DAQ_NB_BC_PER_EVENT_PSB6", daqNrBxBoardStrPSB6);
169 
170  std::string daqNrBxBoardStrGMT;
171  results.fillVariable("DAQ_NB_BC_PER_EVENT_GMT", daqNrBxBoardStrGMT);
172 
173  std::string daqNrBxBoardStrTIM;
174  results.fillVariable("DAQ_NB_BC_PER_EVENT_TIM", daqNrBxBoardStrTIM);
175 
176  std::string bstLengthBytesStr;
177  results.fillVariable("BST_DATA_NB_BYTES", bstLengthBytesStr);
178 
179  // fill the record
180 
181  // total Bx's in the event
182  int totalBxInEventVal = boost::lexical_cast<int>(totalBxInEventStr);
183  pL1GtParameters->setGtTotalBxInEvent(totalBxInEventVal);
184 
185  // FIXME: need board maps in DB, with active bit number...
186  // now, they are hardwired
187 
188  // get the mapping of boards to active bits
189 
190  // active boards in the L1 DAQ record & number of BXs per board
191  boost::uint16_t daqActiveBoardsVal = 0;
192 
193  int daqActiveBoardsLength = 16; // ...hard...
194  std::vector<int> daqNrBxBoard(daqActiveBoardsLength, 0);
195 
196  int iActiveBit = 0;
197  if (activeBoardsDaqFDL) {
198  daqActiveBoardsVal = daqActiveBoardsVal | ( 1 << iActiveBit );
199  }
200  daqNrBxBoard.at(iActiveBit) = boost::lexical_cast<int>(daqNrBxBoardStrFDL);
201 
202  iActiveBit = 1;
203  if (activeBoardsDaqPSB0) {
204  daqActiveBoardsVal = daqActiveBoardsVal | ( 1 << iActiveBit );
205  }
206  daqNrBxBoard.at(iActiveBit) = boost::lexical_cast<int>(daqNrBxBoardStrPSB0);
207 
208  iActiveBit = 2;
209  if (activeBoardsDaqPSB1) {
210  daqActiveBoardsVal = daqActiveBoardsVal | ( 1 << iActiveBit );
211  }
212  daqNrBxBoard.at(iActiveBit) = boost::lexical_cast<int>(daqNrBxBoardStrPSB1);
213 
214  iActiveBit = 3;
215  if (activeBoardsDaqPSB2) {
216  daqActiveBoardsVal = daqActiveBoardsVal | ( 1 << iActiveBit );
217  }
218  daqNrBxBoard.at(iActiveBit) = boost::lexical_cast<int>(daqNrBxBoardStrPSB2);
219 
220  iActiveBit = 4;
221  if (activeBoardsDaqPSB3) {
222  daqActiveBoardsVal = daqActiveBoardsVal | ( 1 << iActiveBit );
223  }
224  daqNrBxBoard.at(iActiveBit) = boost::lexical_cast<int>(daqNrBxBoardStrPSB3);
225 
226  iActiveBit = 5;
227  if (activeBoardsDaqPSB4) {
228  daqActiveBoardsVal = daqActiveBoardsVal | ( 1 << iActiveBit );
229  }
230  daqNrBxBoard.at(iActiveBit) = boost::lexical_cast<int>(daqNrBxBoardStrPSB4);
231 
232  iActiveBit = 6;
233  if (activeBoardsDaqPSB5) {
234  daqActiveBoardsVal = daqActiveBoardsVal | ( 1 << iActiveBit );
235  }
236  daqNrBxBoard.at(iActiveBit) = boost::lexical_cast<int>(daqNrBxBoardStrPSB5);
237 
238  iActiveBit = 7;
239  if (activeBoardsDaqPSB6) {
240  daqActiveBoardsVal = daqActiveBoardsVal | ( 1 << iActiveBit );
241  }
242  daqNrBxBoard.at(iActiveBit) = boost::lexical_cast<int>(daqNrBxBoardStrPSB6);
243 
244  iActiveBit = 8;
245  if (activeBoardsDaqGMT) {
246  daqActiveBoardsVal = daqActiveBoardsVal | ( 1 << iActiveBit );
247  }
248  daqNrBxBoard.at(iActiveBit) = boost::lexical_cast<int>(daqNrBxBoardStrGMT);
249 
250  // FIXME fix TIM active bit
251  //iActiveBit = 9;
252  //if (activeBoardsDaqTIM) {
253  // daqActiveBoardsVal = daqActiveBoardsVal | (1 << iActiveBit);
254  //}
255  //daqNrBxBoard.at(iActiveBit) = boost::lexical_cast<int>(daqNrBxBoardStrTIM);
256 
257  // active boards in the L1 EVM record
258  boost::uint16_t evmActiveBoardsVal = 0;
259 
260  int evmActiveBoardsLength = 16; // ...hard...
261  std::vector<int> evmNrBxBoard(evmActiveBoardsLength, 0);
262 
263  iActiveBit = 0;
264  if (activeBoardsEvmTCS) {
265  evmActiveBoardsVal = evmActiveBoardsVal | ( 1 << iActiveBit );
266  }
267  // always 1 TCS payload - hardcoded
268  evmNrBxBoard.at(iActiveBit) = 1;
269 
270  iActiveBit = 1;
271  if (activeBoardsEvmFDL) {
272  evmActiveBoardsVal = evmActiveBoardsVal | ( 1 << iActiveBit );
273  }
274  // FDL must have the same length in EVM and DAQ
275  evmNrBxBoard.at(iActiveBit) = boost::lexical_cast<int>(daqNrBxBoardStrFDL);
276 
277 
278  //
279  pL1GtParameters->setGtDaqActiveBoards(daqActiveBoardsVal);
280  pL1GtParameters->setGtEvmActiveBoards(evmActiveBoardsVal);
281  pL1GtParameters->setGtDaqNrBxBoard(daqNrBxBoard);
282  pL1GtParameters->setGtEvmNrBxBoard(evmNrBxBoard);
283 
284  //
285  unsigned int bstLengthBytesVal = boost::lexical_cast<unsigned int>(bstLengthBytesStr);
286  pL1GtParameters->setGtBstLengthBytes(bstLengthBytesVal);
287 
288  if (edm::isDebugEnabled()) {
289  std::ostringstream myCoutStream;
290  pL1GtParameters->print(myCoutStream);
291  LogTrace("L1GtParametersConfigOnlineProd")
292  << "\nThe following L1GtParameters record was read from OMDS: \n"
293  << myCoutStream.str() << "\n" << std::endl;
294  }
295 
296  return pL1GtParameters;
297 }
bool isDebugEnabled()
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:311
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:295
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="") const
Definition: OMDSReader.cc:87
#define LogTrace(id)