CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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...
 
std::unique_ptr< L1GtParametersnewObject (const std::string &objectKey) override
 public methods More...
 
 ~L1GtParametersConfigOnlineProd () override
 destructor More...
 
- Public Member Functions inherited from L1ConfigOnlineProdBase< L1GtParametersRcd, L1GtParameters >
 L1ConfigOnlineProdBase (const edm::ParameterSet &)
 
virtual std::unique_ptr
< L1GtParameters
produce (const L1GtParametersRcd &iRecord)
 
 ~L1ConfigOnlineProdBase () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector
< ESProxyIndex > > 
updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy >>>
 
- Protected Member Functions inherited from L1ConfigOnlineProdBase< L1GtParametersRcd, L1GtParameters >
bool getObjectKey (const L1GtParametersRcd &record, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- 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 EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- Protected Attributes inherited from L1ConfigOnlineProdBase< L1GtParametersRcd, L1GtParameters >
bool m_copyFromCondDB
 
cond::persistency::Session 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 ( )
override

destructor

Definition at line 28 of file L1GtParametersConfigOnlineProd.cc.

28  {
29  // empty
30 }

Member Function Documentation

std::unique_ptr< L1GtParameters > L1GtParametersConfigOnlineProd::newObject ( const std::string &  objectKey)
overridevirtual

public methods

Implements L1ConfigOnlineProdBase< L1GtParametersRcd, L1GtParameters >.

Definition at line 34 of file L1GtParametersConfigOnlineProd.cc.

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

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