CMS 3D CMS Logo

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::shared_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::shared_ptr< L1GtParametersproduce (const L1GtParametersRcd &iRecord)
 
 ~L1ConfigOnlineProdBase () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- 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< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 
- 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, std::shared_ptr< L1GtParameters > data, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
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())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 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::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 33 of file L1GtParametersConfigOnlineProd.cc.

33  {
34 
35  // empty
36 
37 }

Member Function Documentation

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

public methods

Implements L1ConfigOnlineProdBase< L1GtParametersRcd, L1GtParameters >.

Definition at line 41 of file L1GtParametersConfigOnlineProd.cc.

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

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