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

$Date$ $Revision$

Definition at line 34 of file L1GtParametersConfigOnlineProd.h.

Constructor & Destructor Documentation

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

destructor

Definition at line 35 of file L1GtParametersConfigOnlineProd.cc.

35  {
36 
37  // empty
38 
39 }

Member Function Documentation

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

public methods

Implements L1ConfigOnlineProdBase< L1GtParametersRcd, L1GtParameters >.

Definition at line 43 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, and l1t::OMDSReader::singleAttribute().

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