CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1GtTriggerMenuConfigOnlineProd.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <string>
20 #include <vector>
21 #include <map>
22 #include <list>
23 #include <utility>
24 #include <algorithm>
25 
26 // user include files
28 
31 
33 
36 
37 // constructor
39  : L1ConfigOnlineProdBase<L1GtTriggerMenuRcd, L1GtTriggerMenu>(parSet), m_isDebugEnabled(edm::isDebugEnabled()) {
40  // empty
41 }
42 
43 // destructor
45  // empty
46 }
47 
48 // public methods
49 
50 // initialize the class (mainly reserve/resize)
51 void L1GtTriggerMenuConfigOnlineProd::init(const int numberConditionChips) {
52  // resize the vectors of condition maps
53  // the number of condition chips should be correctly set
54 
55  m_vecMuonTemplate.resize(numberConditionChips);
56  m_vecCaloTemplate.resize(numberConditionChips);
57  m_vecEnergySumTemplate.resize(numberConditionChips);
58  m_vecJetCountsTemplate.resize(numberConditionChips);
59  m_vecCastorTemplate.resize(numberConditionChips);
60  m_vecHfBitCountsTemplate.resize(numberConditionChips);
61  m_vecHfRingEtSumsTemplate.resize(numberConditionChips);
62  m_vecBptxTemplate.resize(numberConditionChips);
63  m_vecExternalTemplate.resize(numberConditionChips);
64 
65  m_vecCorrelationTemplate.resize(numberConditionChips);
66  m_corMuonTemplate.resize(numberConditionChips);
67  m_corCaloTemplate.resize(numberConditionChips);
68  m_corEnergySumTemplate.resize(numberConditionChips);
69 }
70 
71 std::unique_ptr<L1GtTriggerMenu> L1GtTriggerMenuConfigOnlineProd::newObject(const std::string& objectKey) {
72  // FIXME seems to not work anymore in constructor...
74 
75  auto pL1GtTriggerMenuEmpty = std::make_unique<L1GtTriggerMenu>();
76 
77  // FIXME get it from L1GtStableParameters?
78  // initialize once, from outside
79  const unsigned int numberConditionChips = 2;
80  init(numberConditionChips);
81 
82  const std::string gtSchema = "CMS_GT";
83 
84  // l1GtTriggerMenu: parameters in table GTFE_SETUP_FK
85  // the objectKey for the menu obtained from GT_SETUP is the L1T_MENU_IMPL key
86 
87  // SQL queries:
88 
89  // retrieve table with general menu parameters from DB, view L1T_MENU_GENERAL_VIEW
90  if (!tableMenuGeneralFromDB(gtSchema, objectKey)) {
91  return pL1GtTriggerMenuEmpty;
92  }
93 
94  // build the menu name
95  std::string menuName =
97 
98  // retrieve table with physics algorithms from DB, view L1T_MENU_ALGO_VIEW
99  if (!tableMenuAlgoFromDB(gtSchema, objectKey)) {
100  return pL1GtTriggerMenuEmpty;
101  }
102 
103  // retrieve table with conditions associated to physics algorithms from DB
104  if (!tableMenuAlgoCondFromDB(gtSchema, objectKey)) {
105  return pL1GtTriggerMenuEmpty;
106  }
107 
108  // retrieve table with list of conditions in the menu
109  if (!tableMenuCondFromDB(gtSchema, objectKey)) {
110  return pL1GtTriggerMenuEmpty;
111  }
112 
113  // retrieve table with object parameters from DB, view CMS_GT.L1T_MENU_OP_VIEW
114  if (!tableMenuObjectParametersFromDB(gtSchema, objectKey)) {
115  return pL1GtTriggerMenuEmpty;
116  }
117 
118  // retrieve table with technical triggers from DB, view L1T_MENU_TECHTRIG_VIEW
119  if (!tableMenuTechTrigFromDB(gtSchema, objectKey)) {
120  return pL1GtTriggerMenuEmpty;
121  }
122 
123  // build the algorithm map in the menu
125 
126  // build the technical trigger map in the menu
128 
129  // add the conditions from a menu to the corresponding list
130  addConditions();
131 
132  // fill the record
133  auto pL1GtTriggerMenu = std::make_unique<L1GtTriggerMenu>(menuName,
134  numberConditionChips,
148 
149  pL1GtTriggerMenu->setGtTriggerMenuInterface(m_tableMenuGeneral.menuInterface);
150  pL1GtTriggerMenu->setGtTriggerMenuImplementation(m_tableMenuGeneral.menuImplementation);
151  pL1GtTriggerMenu->setGtScaleDbKey(m_tableMenuGeneral.scalesKey);
152 
153  pL1GtTriggerMenu->setGtAlgorithmMap(m_algorithmMap);
154  pL1GtTriggerMenu->setGtAlgorithmAliasMap(m_algorithmAliasMap);
155  pL1GtTriggerMenu->setGtTechnicalTriggerMap(m_technicalTriggerMap);
156 
157  if (m_isDebugEnabled) {
158  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\nThe following L1GtTriggerMenu record was read from OMDS: \n"
159  << std::endl;
160 
161  std::ostringstream myCoutStream;
162  int verbosity = 0;
163  pL1GtTriggerMenu->print(myCoutStream, verbosity);
164  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n" << std::endl;
165 
166  verbosity = 2;
167  pL1GtTriggerMenu->print(myCoutStream, verbosity);
168  LogTrace("L1GtTriggerMenuConfigOnlineProd") << myCoutStream.str() << "\n" << std::endl;
169  }
170 
171  return pL1GtTriggerMenu;
172 }
173 
174 // retrieve table with general menu parameters from DB
176  const std::string& objectKey) {
177  // select * from CMS_GT.L1T_MENU_GENERAL_VIEW
178  // where L1T_MENU_GENERAL_VIEW.MENU_IMPLEMENTATION = objectKey
179 
180  const std::vector<std::string>& columns = m_omdsReader.columnNamesView(gtSchema, "L1T_MENU_GENERAL_VIEW");
181 
182  if (m_isDebugEnabled) {
183  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n List of columns in L1T_MENU_GENERAL_VIEW:\n" << std::endl;
184  for (std::vector<std::string>::const_iterator iter = columns.begin(); iter != columns.end(); iter++) {
185  LogTrace("L1GtTriggerMenuConfigOnlineProd") << (*iter) << std::endl;
186  }
187  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n\n" << std::endl;
188  }
189 
191  gtSchema,
192  "L1T_MENU_GENERAL_VIEW",
193  "L1T_MENU_GENERAL_VIEW.MENU_IMPLEMENTATION",
194  m_omdsReader.singleAttribute(objectKey));
195 
196  // check if query was successful
197  if (results.queryFailed()) {
198  edm::LogError("L1-O2O")
199  << "Problem to get content of L1T_MENU_GENERAL_VIEW for L1GtTriggerMenu implementation key: " << objectKey;
200  return false;
201  }
202 
203  // retrieve menu interface name, scales key, algorithm implementation tag
204 
205  for (std::vector<std::string>::const_iterator constIt = columns.begin(); constIt != columns.end(); ++constIt) {
206  if ((*constIt) == "MENU_IMPLEMENTATION") {
208 
209  } else if ((*constIt) == "INTERFACE") {
210  results.fillVariable(*constIt, m_tableMenuGeneral.menuInterface);
211 
212  } else if ((*constIt) == "SCALES_KEY") {
213  results.fillVariable(*constIt, m_tableMenuGeneral.scalesKey);
214 
215  } else if ((*constIt) == "ALGO_IMPL_TAG") {
216  results.fillVariable(*constIt, m_tableMenuGeneral.algoImplTag);
217 
218  } else {
219  // do nothing
220  }
221  }
222 
223  // cross checks
224  if (m_tableMenuGeneral.menuImplementation != objectKey) {
225  LogTrace("L1GtTriggerMenuConfigOnlineProd")
226  << "\n L1 trigger menu implementation read from querying view not identical"
227  << "\n with menu key:"
228  << "\n from view: " << m_tableMenuGeneral.menuImplementation << "\n from key: " << objectKey
229  << "\n Menu implementation name set from key." << std::endl;
231  }
232 
233  //
234  return true;
235 }
236 
237 // retrieve table with physics algorithms from DB
239  // select * from CMS_GT.L1T_MENU_ALGO_VIEW
240  // where L1T_MENU_ALGO_VIEW.MENU_IMPLEMENTATION = objectKey
241 
242  const std::vector<std::string>& columnsMenuAlgo = m_omdsReader.columnNamesView(gtSchema, "L1T_MENU_ALGO_VIEW");
243 
244  if (m_isDebugEnabled) {
245  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n List of columns in L1T_MENU_ALGO_VIEW:\n" << std::endl;
246  for (std::vector<std::string>::const_iterator iter = columnsMenuAlgo.begin(); iter != columnsMenuAlgo.end();
247  iter++) {
248  LogTrace("L1GtTriggerMenuConfigOnlineProd") << (*iter) << std::endl;
249  }
250  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n\n" << std::endl;
251  }
252 
253  l1t::OMDSReader::QueryResults resultsMenuAlgo = m_omdsReader.basicQueryView(columnsMenuAlgo,
254  gtSchema,
255  "L1T_MENU_ALGO_VIEW",
256  "L1T_MENU_ALGO_VIEW.MENU_IMPLEMENTATION",
257  m_omdsReader.singleAttribute(objectKey));
258 
259  // check if query was successful is based on size of returned list
260  // BUT one can have menus w/o physics algorithms - no error for empty list, but a warning!
261  if (resultsMenuAlgo.queryFailed()) {
262  edm::LogWarning("L1-O2O") << "Warning: Content of L1T_MENU_ALGO_VIEW for L1GtTriggerMenu implementation key: "
263  << "\n " << objectKey << "\nis empty!"
264  << "\nNo physics algorithms are found for this menu.";
265  }
266 
267  TableMenuAlgo menuAlgo;
268  int resultsMenuAlgoRows = resultsMenuAlgo.numberRows();
269 
270  for (int iRow = 0; iRow < resultsMenuAlgoRows; ++iRow) {
271  for (std::vector<std::string>::const_iterator constIt = columnsMenuAlgo.begin(); constIt != columnsMenuAlgo.end();
272  ++constIt) {
273  if ((*constIt) == "ALGO_INDEX") {
274  resultsMenuAlgo.fillVariableFromRow(*constIt, iRow, menuAlgo.bitNumberSh);
275 
276  } else if ((*constIt) == "NAME") {
277  resultsMenuAlgo.fillVariableFromRow(*constIt, iRow, menuAlgo.algName);
278 
279  } else if ((*constIt) == "ALIAS") {
280  resultsMenuAlgo.fillVariableFromRow(*constIt, iRow, menuAlgo.algAlias);
281 
282  } else if ((*constIt) == "LOGICEXPR") {
283  resultsMenuAlgo.fillVariableFromRow(*constIt, iRow, menuAlgo.logExpression);
284 
285  } else {
286  // do nothing
287  }
288  }
289 
290  LogTrace("L1GtTriggerMenuConfigOnlineProd")
291  << "Row " << iRow << ": index = " << menuAlgo.bitNumberSh << " algName = " << menuAlgo.algName
292  << " algAlias = " << menuAlgo.algAlias << " logExpression = '" << menuAlgo.logExpression << "'" << std::endl;
293 
294  m_tableMenuAlgo.push_back(menuAlgo);
295  }
296 
297  if (m_isDebugEnabled) {
298  LogTrace("L1GtTriggerMenuConfigOnlineProd")
299  << "\n Number of rows read from L1T_MENU_ALGO_VIEW: " << resultsMenuAlgoRows << std::endl;
300  }
301 
302  return true;
303 }
304 
305 // retrieve table with conditions associated to physics algorithms from DB
307  const std::string& objectKey) {
308  // get list of conditions associated with the algorithms
309 
310  // select * from CMS_GT.L1T_MENU_ALGO_COND_VIEW
311  // where L1T_MENU_ALGO_COND_VIEW.MENU_IMPLEMENTATION = objectKey
312 
313  const std::vector<std::string>& columnsMenuAlgoCond =
314  m_omdsReader.columnNamesView(gtSchema, "L1T_MENU_ALGO_COND_VIEW");
315 
316  if (m_isDebugEnabled) {
317  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n List of columns in L1T_MENU_ALGO_COND_VIEW:\n" << std::endl;
318  for (std::vector<std::string>::const_iterator iter = columnsMenuAlgoCond.begin(); iter != columnsMenuAlgoCond.end();
319  iter++) {
320  LogTrace("L1GtTriggerMenuConfigOnlineProd") << (*iter) << std::endl;
321  }
322  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n\n" << std::endl;
323  }
324 
325  l1t::OMDSReader::QueryResults resultsMenuAlgoCond =
326  m_omdsReader.basicQueryView(columnsMenuAlgoCond,
327  gtSchema,
328  "L1T_MENU_ALGO_COND_VIEW",
329  "L1T_MENU_ALGO_COND_VIEW.MENU_IMPLEMENTATION",
330  m_omdsReader.singleAttribute(objectKey));
331 
332  // check if query was successful is based on size of returned list
333  // BUT one can have menus w/o algorithms and conditions - no error for empty list, but a warning!
334  if (resultsMenuAlgoCond.queryFailed()) {
335  edm::LogWarning("L1-O2O") << "Warning: Content of L1T_MENU_ALGO_COND_VIEW for L1GtTriggerMenu implementation key: "
336  << "\n " << objectKey << "\nis empty!"
337  << "\nNo list of condition associated to each algorithm are found for this menu.";
338  }
339 
340  //
341  TableMenuAlgoCond menuAlgoCond;
342  int resultsMenuAlgoCondRows = resultsMenuAlgoCond.numberRows();
343 
344  for (int iRow = 0; iRow < resultsMenuAlgoCondRows; ++iRow) {
345  for (std::vector<std::string>::const_iterator constIt = columnsMenuAlgoCond.begin();
346  constIt != columnsMenuAlgoCond.end();
347  ++constIt) {
348  if ((*constIt) == "ALGO_INDEX") {
349  resultsMenuAlgoCond.fillVariableFromRow(*constIt, iRow, menuAlgoCond.bitNumberSh);
350 
351  } else if ((*constIt) == "COND_INDEX") {
352  resultsMenuAlgoCond.fillVariableFromRow(*constIt, iRow, menuAlgoCond.condIndexF);
353 
354  } else if ((*constIt) == "COND_FK") {
355  resultsMenuAlgoCond.fillVariableFromRow(*constIt, iRow, menuAlgoCond.condFK);
356 
357  } else {
358  // do nothing
359  }
360  }
361 
362  LogTrace("L1GtTriggerMenuConfigOnlineProd")
363  << "Row " << iRow << ": ALGO_INDEX = " << menuAlgoCond.bitNumberSh
364  << " COND_INDEX = " << menuAlgoCond.condIndexF << " COND_FK = " << menuAlgoCond.condFK << std::endl;
365 
366  m_tableMenuAlgoCond.push_back(menuAlgoCond);
367  }
368 
369  if (m_isDebugEnabled) {
370  LogTrace("L1GtTriggerMenuConfigOnlineProd")
371  << "\n Number of rows read from L1T_MENU_ALGO_COND_VIEW: " << resultsMenuAlgoCondRows << std::endl;
372  }
373 
374  return true;
375 }
376 
377 // retrieve table with list of conditions in the menu
379  // select * from CMS_GT.L1T_MENU_COND_VIEW
380  // where L1T_MENU_COND_VIEW.MENU_IMPLEMENTATION = objectKey
381 
382  const std::vector<std::string>& columnsMenuCond = m_omdsReader.columnNamesView(gtSchema, "L1T_MENU_COND_VIEW");
383 
384  if (m_isDebugEnabled) {
385  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n List of columns in L1T_MENU_COND_VIEW:\n" << std::endl;
386  for (std::vector<std::string>::const_iterator iter = columnsMenuCond.begin(); iter != columnsMenuCond.end();
387  iter++) {
388  LogTrace("L1GtTriggerMenuConfigOnlineProd") << (*iter) << std::endl;
389  }
390  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n\n" << std::endl;
391  }
392 
393  l1t::OMDSReader::QueryResults resultsMenuCond = m_omdsReader.basicQueryView(columnsMenuCond,
394  gtSchema,
395  "L1T_MENU_COND_VIEW",
396  "L1T_MENU_COND_VIEW.MENU_IMPLEMENTATION",
397  m_omdsReader.singleAttribute(objectKey));
398 
399  // check if query was successful is based on size of returned list
400  // BUT one can have menus w/o conditions - no error for empty list, but a warning!
401  if (resultsMenuCond.queryFailed()) {
402  edm::LogWarning("L1-O2O") << "Warning: Content of L1T_MENU_COND_VIEW for L1GtTriggerMenu implementation key: "
403  << "\n " << objectKey << "\nis empty!"
404  << "\nNo conditions associated to menu are found for this menu.";
405  }
406 
407  //
408  TableMenuCond menuCond;
409  int resultsMenuCondRows = resultsMenuCond.numberRows();
410 
411  for (int iRow = 0; iRow < resultsMenuCondRows; ++iRow) {
412  for (std::vector<std::string>::const_iterator constIt = columnsMenuCond.begin(); constIt != columnsMenuCond.end();
413  ++constIt) {
414  if ((*constIt) == "COND") {
415  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.cond);
416 
417  } else if ((*constIt) == "COND_CATEGORY") {
418  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.condCategory);
419 
420  } else if ((*constIt) == "COND_TYPE") {
421  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.condType);
422 
423  } else if ((*constIt) == "GT_OBJECT_1") {
424  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.gtObject1);
425 
426  } else if ((*constIt) == "GT_OBJECT_2") {
427  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.gtObject2);
428 
429  } else if ((*constIt) == "COND_GEQ") {
430  //float condGEqFloat = -1;
431  //resultsMenuCond.fillVariableFromRow(*constIt, iRow, condGEqFloat);
432  //menuCond.condGEq = (condGEqFloat > 0.5) ? true : false;
433  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.condGEq);
434 
435  } else if ((*constIt) == "COUNT_INDEX") {
436  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.countIndex);
437 
438  } else if ((*constIt) == "COUNT_THRESHOLD") {
439  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.countThreshold);
440 
441  } else if ((*constIt) == "CHARGE_CORRELATION") {
442  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.chargeCorrelation);
443 
444  } else if ((*constIt) == "OBJECT_PARAMETER_1_FK") {
445  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.objectParameter1FK);
446 
447  } else if ((*constIt) == "OBJECT_PARAMETER_2_FK") {
448  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.objectParameter2FK);
449 
450  } else if ((*constIt) == "OBJECT_PARAMETER_3_FK") {
451  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.objectParameter3FK);
452 
453  } else if ((*constIt) == "OBJECT_PARAMETER_4_FK") {
454  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.objectParameter4FK);
455 
456  } else if ((*constIt) == "DELTA_ETA_RANGE") {
457  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.deltaEtaRange);
458 
459  } else if ((*constIt) == "DELTA_PHI_RANGE") {
460  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.deltaPhiRange);
461 
462  } else {
463  // do nothing
464  }
465  }
466 
467  LogTrace("L1GtTriggerMenuConfigOnlineProd")
468  << " COND " << menuCond.cond << " COND_CATEGORY " << menuCond.condCategory << " COND_TYPE " << menuCond.condType
469  << " GT_OBJECT_1 " << menuCond.gtObject1 << " GT_OBJECT_2 " << menuCond.gtObject2 << " COND_GEQ "
470  << menuCond.condGEq << "\n"
471  << " COUNT_INDEX " << menuCond.countIndex << " COUNT_THRESHOLD " << menuCond.countThreshold << "\n"
472  << " CHARGE_CORRELATION " << menuCond.chargeCorrelation << "\n"
473  << " OBJECT_PARAMETER_1_FK " << menuCond.objectParameter1FK << " OBJECT_PARAMETER_2_FK "
474  << menuCond.objectParameter2FK << " OBJECT_PARAMETER_3_FK " << menuCond.objectParameter3FK
475  << " OBJECT_PARAMETER_4_FK " << menuCond.objectParameter4FK << "\n"
476  << " DELTA_ETA_RANGE " << menuCond.deltaEtaRange << " DELTA_PHI_RANGE " << menuCond.deltaPhiRange;
477 
478  m_tableMenuCond.push_back(menuCond);
479  }
480 
481  if (m_isDebugEnabled) {
482  LogTrace("L1GtTriggerMenuConfigOnlineProd")
483  << "\n Number of rows read from L1T_MENU_COND_VIEW: " << resultsMenuCondRows << std::endl;
484  }
485 
486  return true;
487 }
488 
489 // retrieve table with object parameters from DB
491  const std::string& objectKey) {
492  // get the list of object parameters in the menu
493 
494  // select * from CMS_GT.L1T_MENU_OP_VIEW
495  // where L1T_MENU_OP_VIEW.MENU_IMPLEMENTATION = objectKey
496 
497  const std::vector<std::string>& columnsMenuOp = m_omdsReader.columnNamesView(gtSchema, "L1T_MENU_OP_VIEW");
498 
499  if (m_isDebugEnabled) {
500  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n List of columns in L1T_MENU_OP_VIEW:\n" << std::endl;
501  for (std::vector<std::string>::const_iterator iter = columnsMenuOp.begin(); iter != columnsMenuOp.end(); iter++) {
502  LogTrace("L1GtTriggerMenuConfigOnlineProd") << (*iter) << std::endl;
503  }
504  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n\n" << std::endl;
505  }
506 
507  l1t::OMDSReader::QueryResults resultsMenuOp = m_omdsReader.basicQueryView(columnsMenuOp,
508  gtSchema,
509  "L1T_MENU_OP_VIEW",
510  "L1T_MENU_OP_VIEW.MENU_IMPLEMENTATION",
511  m_omdsReader.singleAttribute(objectKey));
512 
513  // check if query was successful is based on size of returned list
514  // BUT one can have menus w/o object parameters - no error for empty list, but a warning!
515  if (resultsMenuOp.queryFailed()) {
516  edm::LogWarning("L1-O2O") << "Warning: Content of L1T_MENU_OP_VIEW for L1GtTriggerMenu implementation key: "
517  << "\n " << objectKey << "\nis empty!"
518  << "\nNo object parameters associated to menu are found for this menu.";
519  }
520 
521  TableMenuObjectParameters menuObjectParameters;
522  int resultsMenuOpRows = resultsMenuOp.numberRows();
523 
524  for (int iRow = 0; iRow < resultsMenuOpRows; ++iRow) {
525  for (std::vector<std::string>::const_iterator constIt = columnsMenuOp.begin(); constIt != columnsMenuOp.end();
526  ++constIt) {
527  if ((*constIt) == "ID") {
528  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.opId);
529 
530  } else if ((*constIt) == "PT_HIGH_THRESHOLD") {
531  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.ptHighThreshold);
532 
533  } else if ((*constIt) == "PT_LOW_THRESHOLD") {
534  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.ptLowThreshold);
535 
536  } else if ((*constIt) == "ENABLE_MIP") {
537  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.enableMip);
538 
539  } else if ((*constIt) == "ENABLE_ISO") {
540  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.enableIso);
541 
542  } else if ((*constIt) == "REQUEST_ISO") {
543  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.requestIso);
544 
545  } else if ((*constIt) == "ENERGY_OVERFLOW") {
546  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.energyOverflow);
547 
548  } else if ((*constIt) == "ET_THRESHOLD") {
549  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.etThreshold);
550 
551  } else if ((*constIt) == "ETA_RANGE") {
552  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.etaRange);
553 
554  } else if ((*constIt) == "PHI_RANGE") {
555  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.phiRange);
556 
557  } else if ((*constIt) == "PHI_LOW") {
558  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.phiLow);
559 
560  } else if ((*constIt) == "PHI_HIGH") {
561  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.phiHigh);
562 
563  } else if ((*constIt) == "QUALITY_RANGE") {
564  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.qualityRange);
565 
566  } else if ((*constIt) == "CHARGE") {
567  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.charge);
568 
569  } else {
570  // do nothing
571  }
572  }
573 
574  LogTrace("L1GtTriggerMenuConfigOnlineProd")
575  << " ID " << menuObjectParameters.opId << " PT_HIGH_THRESHOLD " << menuObjectParameters.ptHighThreshold
576  << " PT_LOW_THRESHOLD " << menuObjectParameters.ptLowThreshold << " ENABLE_MIP "
577  << menuObjectParameters.enableMip << " ENABLE_ISO " << menuObjectParameters.enableIso << " REQUEST_ISO "
578  << menuObjectParameters.requestIso << " ENERGY_OVERFLOW " << menuObjectParameters.energyOverflow
579  << " ET_THRESHOLD " << menuObjectParameters.etThreshold << " ETA_RANGE " << menuObjectParameters.etaRange
580  << " PHI_RANGE " << menuObjectParameters.phiRange << " PHI_LOW " << menuObjectParameters.phiLow << " PHI_HIGH "
581  << menuObjectParameters.phiHigh << " QUALITY_RANGE " << menuObjectParameters.qualityRange << " CHARGE "
582  << menuObjectParameters.charge << std::endl;
583 
584  m_tableMenuObjectParameters.push_back(menuObjectParameters);
585  }
586 
587  if (m_isDebugEnabled) {
588  LogTrace("L1GtTriggerMenuConfigOnlineProd")
589  << "\n Number of rows read from L1T_MENU_OP_VIEW: " << resultsMenuOpRows << std::endl;
590  }
591 
592  return true;
593 }
594 
595 // retrieve table with technical triggers from DB
597  const std::string& objectKey) {
598  // select * from CMS_GT.L1T_MENU_TECHTRIG_VIEW
599  // where L1T_MENU_TECHTRIG_VIEW.MENU_IMPLEMENTATION = objectKey
600 
601  const std::vector<std::string>& columnsMenuTechTrig =
602  m_omdsReader.columnNamesView(gtSchema, "L1T_MENU_TECHTRIG_VIEW");
603 
604  if (m_isDebugEnabled) {
605  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n List of columns in L1T_MENU_TECHTRIG_VIEW:\n" << std::endl;
606  for (std::vector<std::string>::const_iterator iter = columnsMenuTechTrig.begin(); iter != columnsMenuTechTrig.end();
607  iter++) {
608  LogTrace("L1GtTriggerMenuConfigOnlineProd") << (*iter) << std::endl;
609  }
610  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n\n" << std::endl;
611  }
612 
613  l1t::OMDSReader::QueryResults resultsMenuTechTrig =
614  m_omdsReader.basicQueryView(columnsMenuTechTrig,
615  gtSchema,
616  "L1T_MENU_TECHTRIG_VIEW",
617  "L1T_MENU_TECHTRIG_VIEW.MENU_IMPLEMENTATION",
618  m_omdsReader.singleAttribute(objectKey));
619 
620  // check if query was successful is based on size of returned list
621  // BUT one can have menus w/o technical triggers - no error for empty list, but a warning!
622  if (resultsMenuTechTrig.queryFailed()) {
623  edm::LogWarning("L1-O2O") << "Warning: Content of L1T_MENU_TECHTRIG_VIEW for L1GtTriggerMenu implementation key: "
624  << "\n " << objectKey << "\nis empty!"
625  << "\nNo technical triggers are found for this menu.";
626  }
627 
628  TableMenuTechTrig menuTechTrig;
629  int resultsMenuTechTrigRows = resultsMenuTechTrig.numberRows();
630 
631  for (int iRow = 0; iRow < resultsMenuTechTrigRows; ++iRow) {
632  for (std::vector<std::string>::const_iterator constIt = columnsMenuTechTrig.begin();
633  constIt != columnsMenuTechTrig.end();
634  ++constIt) {
635  if ((*constIt) == "TECHTRIG_INDEX") {
636  resultsMenuTechTrig.fillVariableFromRow(*constIt, iRow, menuTechTrig.bitNumberSh);
637 
638  } else if ((*constIt) == "NAME") {
639  resultsMenuTechTrig.fillVariableFromRow(*constIt, iRow, menuTechTrig.techName);
640 
641  } else {
642  // do nothing
643  }
644  }
645 
646  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "Row " << iRow << ": index = " << menuTechTrig.bitNumberSh
647  << " techName = " << menuTechTrig.techName << std::endl;
648 
649  m_tableMenuTechTrig.push_back(menuTechTrig);
650  }
651 
652  if (m_isDebugEnabled) {
653  LogTrace("L1GtTriggerMenuConfigOnlineProd")
654  << "\n Number of rows read from L1T_MENU_TECHTRIG_VIEW: " << resultsMenuTechTrigRows << std::endl;
655  }
656 
657  return true;
658 }
659 
660 // return for an algorithm with bitNr the mapping between the integer index in logical expression
661 // and the condition name (FK)
662 const std::map<int, std::string> L1GtTriggerMenuConfigOnlineProd::condIndexNameMap(const short bitNr) const {
663  std::map<int, std::string> mapIndexName;
664 
665  for (std::vector<TableMenuAlgoCond>::const_iterator constIt = m_tableMenuAlgoCond.begin();
666  constIt != m_tableMenuAlgoCond.end();
667  ++constIt) {
668  if (bitNr == (*constIt).bitNumberSh) {
669  mapIndexName[static_cast<int>((*constIt).condIndexF)] = (*constIt).condFK;
670  }
671  }
672 
673  if (m_isDebugEnabled) {
674  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Bit number : " << bitNr << std::endl;
675 
676  for (std::map<int, std::string>::const_iterator constIt = mapIndexName.begin(); constIt != mapIndexName.end();
677  ++constIt) {
678  LogTrace("L1GtTriggerMenuConfigOnlineProd")
679  << " Condition index -> name: " << ((*constIt).first) << " " << ((*constIt).second) << std::endl;
680  }
681  }
682 
683  return mapIndexName;
684 }
685 
686 // convert a logical expression with indices to a logical expression with names
688  const std::string& expressionIndices, const std::map<int, std::string>& mapCondIndexName) const {
689  std::string expressionNames;
690 
691  L1GtLogicParser parserIndices = L1GtLogicParser(expressionIndices);
692  parserIndices.convertIntToNameLogicalExpression(mapCondIndexName);
693  expressionNames = parserIndices.logicalExpression();
694 
695  return expressionNames;
696 }
697 
698 // return the chip number for an algorithm with index bitNumberSh
699 int L1GtTriggerMenuConfigOnlineProd::chipNumber(short bitNumberSh) const {
700  // FIXME get it from Event Setup
701  const unsigned numberConditionChips = 2;
702  const unsigned pinsOnConditionChip = 96;
703  std::vector<int> orderConditionChip;
704  orderConditionChip.push_back(2);
705  orderConditionChip.push_back(1);
706 
707  int posChip = (static_cast<unsigned>(bitNumberSh) / pinsOnConditionChip) + 1;
708  for (unsigned int iChip = 0; iChip < numberConditionChips; ++iChip) {
709  if (posChip == orderConditionChip[iChip]) {
710  return static_cast<int>(iChip);
711  }
712  }
713 
714  // chip number not found
715  return -1;
716 }
717 
718 // build the algorithm map in the menu
720  // temporary value
721  int bitNumber = -1;
722  std::string logicalExpression;
723 
724  // loop over m_tableMenuAlgo
725  for (std::vector<TableMenuAlgo>::const_iterator constIt = m_tableMenuAlgo.begin(); constIt != m_tableMenuAlgo.end();
726  constIt++) {
727  bitNumber = static_cast<int>((*constIt).bitNumberSh);
728 
729  const std::map<int, std::string>& condIndexName = condIndexNameMap((*constIt).bitNumberSh);
730  logicalExpression = convertLogicalExpression((*constIt).logExpression, condIndexName);
731 
732  // create a new algorithm and insert it into algorithm map
733  L1GtAlgorithm alg((*constIt).algName, logicalExpression, bitNumber);
734  alg.setAlgoAlias((*constIt).algAlias);
735 
736  // set algorithm chip number:
737  int algChipNr = chipNumber((*constIt).bitNumberSh);
738  alg.setAlgoChipNumber(algChipNr);
739 
740  // insert algorithm
741  m_algorithmMap[(*constIt).algName] = alg;
742  m_algorithmAliasMap[(*constIt).algAlias] = alg;
743  }
744 }
745 
746 // build the technical trigger map in the menu
748  // temporary value
749  int bitNumber = -1;
750  std::string logicalExpression;
751 
752  // loop over m_tableMenuTechTrig
753  for (std::vector<TableMenuTechTrig>::const_iterator constIt = m_tableMenuTechTrig.begin();
754  constIt != m_tableMenuTechTrig.end();
755  constIt++) {
756  bitNumber = static_cast<int>((*constIt).bitNumberSh);
757 
758  // create a new technical trigger and insert it into technical trigger map
759  // technical triggers have L1GtAlgorithm class
760  L1GtAlgorithm techTrig((*constIt).techName, logicalExpression, bitNumber);
761 
762  // chip number set in constructor to -1 - no meaning for technical triggers
763 
764  // insert technical trigger
765  m_technicalTriggerMap[(*constIt).techName] = techTrig;
766 
767  // no alias is defined for technical triggers
768  }
769 }
770 
772  if (strCategory == "CondMuon") {
773  return CondMuon;
774  } else if (strCategory == "CondCalo") {
775  return CondCalo;
776  } else if (strCategory == "CondEnergySum") {
777  return CondEnergySum;
778  } else if (strCategory == "CondJetCounts") {
779  return CondJetCounts;
780  } else if (strCategory == "CondCorrelation") {
781  return CondCorrelation;
782  } else if (strCategory == "CondCastor") {
783  return CondCastor;
784  } else if (strCategory == "CondHfBitCounts") {
785  return CondHfBitCounts;
786  } else if (strCategory == "CondHfRingEtSums") {
787  return CondHfRingEtSums;
788  } else if (strCategory == "CondBptx") {
789  return CondBptx;
790  } else if (strCategory == "CondExternal") {
791  return CondExternal;
792  } else if (strCategory == "CondNull") {
793  return CondNull;
794  } else {
795  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
796  << "\n Warning: string " << strCategory << " not defined. Returning CondNull.\n"
797  << std::endl;
798  return CondNull;
799  }
800 
801  return CondNull;
802 }
803 
804 // string to enum L1GtConditionType conversion
806  if (strType == "1s") {
807  return Type1s;
808  } else if (strType == "2s") {
809  return Type2s;
810  } else if (strType == "2wsc") {
811  return Type2wsc;
812  } else if (strType == "2cor") {
813  return Type2cor;
814  } else if (strType == "3s") {
815  return Type3s;
816  } else if (strType == "4s") {
817  return Type4s;
818  } else if (strType == "ETM") {
819  return TypeETM;
820  } else if (strType == "ETT") {
821  return TypeETT;
822  } else if (strType == "HTT") {
823  return TypeHTT;
824  } else if (strType == "HTM") {
825  return TypeHTM;
826  } else if (strType == "JetCounts") {
827  return TypeJetCounts;
828  } else if (strType == "Castor") {
829  return TypeCastor;
830  } else if (strType == "HfBitCounts") {
831  return TypeHfBitCounts;
832  } else if (strType == "HfRingEtSums") {
833  return TypeHfRingEtSums;
834  } else if (strType == "Bptx") {
835  return TypeBptx;
836  } else if (strType == "TypeExternal") {
837  return TypeExternal;
838  } else {
839  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
840  << "\n Warning: string " << strType << " not associated to any L1GtConditionType. Returning TypeNull.\n"
841  << std::endl;
842  return TypeNull;
843  }
844 
845  return TypeNull;
846 }
847 
848 // string to enum L1GtObject conversion
850  if (strObject == "Mu") {
851  return Mu;
852  } else if (strObject == "NoIsoEG") {
853  return NoIsoEG;
854  } else if (strObject == "IsoEG") {
855  return IsoEG;
856  } else if (strObject == "CenJet") {
857  return CenJet;
858  } else if (strObject == "ForJet") {
859  return ForJet;
860  } else if (strObject == "TauJet") {
861  return TauJet;
862  } else if (strObject == "ETM") {
863  return ETM;
864  } else if (strObject == "ETT") {
865  return ETT;
866  } else if (strObject == "HTT") {
867  return HTT;
868  } else if (strObject == "HTM") {
869  return HTM;
870  } else if (strObject == "JetCounts") {
871  return JetCounts;
872  } else if (strObject == "HfBitCounts") {
873  return HfBitCounts;
874  } else if (strObject == "HfRingEtSums") {
875  return HfRingEtSums;
876  } else if (strObject == "TechTrig") {
877  return TechTrig;
878  } else if (strObject == "Castor") {
879  return Castor;
880  } else if (strObject == "BPTX") {
881  return BPTX;
882  } else if (strObject == "GtExternal") {
883  return GtExternal;
884  } else {
885  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
886  << "\n Warning: string " << strObject << " not associated to any L1GtObject. Returning Mu (no Null type).\n"
887  << std::endl;
888  return Mu;
889  }
890 
891  // no null type, so returning Mu - should never arrive here
892  return Mu;
893 }
894 
896  std::string& hex0WordStr,
897  std::string& hex1WordStr) {
898  unsigned int lenHexStr = hexStr.length();
899 
900  if (lenHexStr < 3) {
901  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Warning: string " << hexStr << " has length less than 3."
902  << "\n Not possible to split it in two 64-bit words."
903  << "\n Return two zero strings." << std::endl;
904  hex0WordStr = "0x0";
905  hex1WordStr = "0x0";
906 
907  return;
908  }
909 
910  unsigned int lenHex = lenHexStr - 2;
911  unsigned int len0Word = lenHex > 16 ? 16 : lenHex;
912  unsigned int len1Word = lenHex - len0Word;
913 
914  unsigned int pos0Word = lenHexStr - len0Word;
915  hex0WordStr = "0x" + hexStr.substr(pos0Word, len0Word);
916 
917  if (len1Word > 0) {
918  unsigned int pos1Word = pos0Word - len1Word;
919  hex1WordStr = "0x" + hexStr.substr(pos1Word, len1Word);
920  } else {
921  hex1WordStr = "0x0";
922  }
923 }
924 
925 // get a list of chip numbers from the m_tableMenuAlgoCond table for a condition
927  std::list<int> chipList;
928 
929  // loop over m_tableMenuAlgoCond
930  for (std::vector<TableMenuAlgoCond>::const_iterator constIt = m_tableMenuAlgoCond.begin();
931  constIt != m_tableMenuAlgoCond.end();
932  constIt++) {
933  if (condFK == (*constIt).condFK) {
934  int chipNr = chipNumber((*constIt).bitNumberSh);
935  chipList.push_back(chipNr);
936  }
937  }
938 
939  return chipList;
940 }
941 
944  // loop over m_tableMenuCond
945  for (std::vector<TableMenuObjectParameters>::const_iterator constIt = m_tableMenuObjectParameters.begin();
946  constIt != m_tableMenuObjectParameters.end();
947  constIt++) {
948  if (opFK == (*constIt).opId) {
949  objPar.ptHighThreshold = static_cast<unsigned int>((*constIt).ptHighThreshold);
950  objPar.ptLowThreshold = static_cast<unsigned int>((*constIt).ptLowThreshold);
951  objPar.enableMip = static_cast<bool>((*constIt).enableMip);
952  objPar.enableIso = static_cast<bool>((*constIt).enableIso);
953  objPar.requestIso = static_cast<bool>((*constIt).requestIso);
954  objPar.etaRange = lexical_cast_from_hex<unsigned long long>((*constIt).etaRange);
955  objPar.phiHigh = static_cast<unsigned int>((*constIt).phiHigh);
956  objPar.phiLow = static_cast<unsigned int>((*constIt).phiLow);
957  objPar.qualityRange = lexical_cast_from_hex<unsigned int>((*constIt).qualityRange);
958  //objPar.charge = static_cast<unsigned int> ( ( *constIt ).charge);
959 
960  // can break after it is found - DB consistency
961  break;
962  }
963  }
964 }
965 
967  L1GtMuonTemplate muonCond(condDB.cond);
968  muonCond.setCondType(strToEnumCondType(condDB.condType));
969 
970  // object types - all muons
971  int nrObj = muonCond.nrObjects();
972  std::vector<L1GtObject> objType(nrObj, Mu);
973  muonCond.setObjectType(objType);
974 
975  muonCond.setCondGEq(condDB.condGEq);
976 
977  // temporary storage of the parameters
978  std::vector<L1GtMuonTemplate::ObjectParameter> objParameter(nrObj);
979 
980  for (int iObj = 0; iObj < nrObj; ++iObj) {
981  if (iObj == 0) {
982  fillMuonObjectParameter(condDB.objectParameter1FK, objParameter[iObj]);
983  } else if (iObj == 1) {
984  fillMuonObjectParameter(condDB.objectParameter2FK, objParameter[iObj]);
985  } else if (iObj == 2) {
986  fillMuonObjectParameter(condDB.objectParameter3FK, objParameter[iObj]);
987  } else if (iObj == 3) {
988  fillMuonObjectParameter(condDB.objectParameter4FK, objParameter[iObj]);
989  } else {
990  LogTrace("L1GtTriggerMenuConfigOnlineProd")
991  << "\n Warning: number of objects requested " << nrObj << " not available in DB."
992  << "\n Maximum 4 object parameters implemented. \n"
993  << std::endl;
994  }
995  }
996 
998  corrParameter.chargeCorrelation = static_cast<unsigned int>(condDB.chargeCorrelation);
999  if (muonCond.wsc()) {
1000  corrParameter.deltaEtaRange = lexical_cast_from_hex<unsigned long long>(condDB.deltaEtaRange);
1001 
1002  std::string word0;
1003  std::string word1;
1004  splitHexStringInTwo64bitWords(condDB.deltaPhiRange, word0, word1);
1005 
1006  corrParameter.deltaPhiRange0Word = lexical_cast_from_hex<unsigned long long>(word0);
1007  corrParameter.deltaPhiRange1Word = lexical_cast_from_hex<unsigned long long>(word1);
1008 
1009  corrParameter.deltaPhiMaxbits = 0; // not used anymore
1010  }
1011 
1012  muonCond.setConditionParameter(objParameter, corrParameter);
1013 
1014  // get chip number list
1015  std::list<int> chipList = listChipNumber(condDB.cond);
1016 
1017  // eliminate duplicates
1018  chipList.sort();
1019  chipList.unique();
1020 
1021  // add the same condition once to every chip where required
1022  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1023  muonCond.setCondChipNr(*itChip);
1024 
1025  // no check for uniqueness - done by DB
1026  (m_vecMuonTemplate[*itChip]).push_back(muonCond);
1027 
1028  if (m_isDebugEnabled) {
1029  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1030  << "\n Adding condition " << (condDB.cond) << " on chip " << (*itChip) << "\n " << std::endl;
1031 
1032  LogTrace("L1GtTriggerMenuConfigOnlineProd") << muonCond << "\n" << std::endl;
1033  }
1034  }
1035 }
1036 
1039  // loop over m_tableMenuCond
1040  for (std::vector<TableMenuObjectParameters>::const_iterator constIt = m_tableMenuObjectParameters.begin();
1041  constIt != m_tableMenuObjectParameters.end();
1042  constIt++) {
1043  if (opFK == (*constIt).opId) {
1044  objPar.etThreshold = static_cast<unsigned int>((*constIt).etThreshold);
1045  objPar.etaRange = lexical_cast_from_hex<unsigned int>((*constIt).etaRange);
1046  objPar.phiRange = lexical_cast_from_hex<unsigned int>((*constIt).phiRange);
1047 
1048  // can break after it is found - DB consistency
1049  break;
1050  }
1051  }
1052 }
1053 
1055  L1GtCaloTemplate caloCond(condDB.cond);
1056  caloCond.setCondType(strToEnumCondType(condDB.condType));
1057 
1058  // object types - all have the same type, so reading it for first object is OK
1059  int nrObj = caloCond.nrObjects();
1060 
1062  std::vector<L1GtObject> objType(nrObj, obj);
1063  caloCond.setObjectType(objType);
1064 
1065  caloCond.setCondGEq(condDB.condGEq);
1066 
1067  // temporary storage of the parameters
1068  std::vector<L1GtCaloTemplate::ObjectParameter> objParameter(nrObj);
1069 
1070  for (int iObj = 0; iObj < nrObj; ++iObj) {
1071  if (iObj == 0) {
1072  fillCaloObjectParameter(condDB.objectParameter1FK, objParameter[iObj]);
1073  } else if (iObj == 1) {
1074  fillCaloObjectParameter(condDB.objectParameter2FK, objParameter[iObj]);
1075  } else if (iObj == 2) {
1076  fillCaloObjectParameter(condDB.objectParameter3FK, objParameter[iObj]);
1077  } else if (iObj == 3) {
1078  fillCaloObjectParameter(condDB.objectParameter4FK, objParameter[iObj]);
1079  } else {
1080  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1081  << "\n Warning: number of objects requested " << nrObj << " not available in DB."
1082  << "\n Maximum 4 object parameters implemented. \n"
1083  << std::endl;
1084  }
1085  }
1086 
1088  if (caloCond.wsc()) {
1089  corrParameter.deltaEtaRange = lexical_cast_from_hex<unsigned long long>(condDB.deltaEtaRange);
1090 
1091  corrParameter.deltaPhiRange = lexical_cast_from_hex<unsigned long long>(condDB.deltaPhiRange);
1092  corrParameter.deltaPhiMaxbits = 0; // FIXME check correlations
1093  }
1094 
1095  caloCond.setConditionParameter(objParameter, corrParameter);
1096 
1097  // get chip number list
1098  std::list<int> chipList = listChipNumber(condDB.cond);
1099 
1100  // eliminate duplicates
1101  chipList.sort();
1102  chipList.unique();
1103 
1104  // add the same condition once to every chip where required
1105  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1106  caloCond.setCondChipNr(*itChip);
1107 
1108  // no check for uniqueness - done by DB
1109  (m_vecCaloTemplate[*itChip]).push_back(caloCond);
1110 
1111  if (m_isDebugEnabled) {
1112  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1113  << "\n Adding condition " << (condDB.cond) << " on chip " << (*itChip) << "\n " << std::endl;
1114 
1115  LogTrace("L1GtTriggerMenuConfigOnlineProd") << caloCond << "\n" << std::endl;
1116  }
1117  }
1118 }
1119 
1122  const L1GtObject& obj) {
1123  // loop over m_tableMenuCond
1124  for (std::vector<TableMenuObjectParameters>::const_iterator constIt = m_tableMenuObjectParameters.begin();
1125  constIt != m_tableMenuObjectParameters.end();
1126  constIt++) {
1127  if (opFK == (*constIt).opId) {
1128  objPar.etThreshold = static_cast<unsigned int>((*constIt).etThreshold);
1129  objPar.energyOverflow = static_cast<bool>((*constIt).energyOverflow); // not used
1130 
1131  std::string word0;
1132  std::string word1;
1133  splitHexStringInTwo64bitWords((*constIt).phiRange, word0, word1);
1134 
1135  if (obj == ETM) {
1136  objPar.phiRange0Word = lexical_cast_from_hex<unsigned long long>(word0);
1137  objPar.phiRange1Word = lexical_cast_from_hex<unsigned long long>(word1);
1138 
1139  } else if (obj == HTM) {
1140  objPar.phiRange0Word = lexical_cast_from_hex<unsigned long long>(word0);
1141  }
1142 
1143  // can break after it is found - DB consistency
1144  break;
1145  }
1146  }
1147 }
1148 
1150  L1GtEnergySumTemplate esumCond(condDB.cond);
1151  esumCond.setCondType(strToEnumCondType(condDB.condType));
1152 
1153  // object types - all energy sums are global - so 1 object
1154  int nrObj = 1;
1155 
1157  std::vector<L1GtObject> objType(nrObj, obj);
1158  esumCond.setObjectType(objType);
1159 
1160  esumCond.setCondGEq(condDB.condGEq);
1161 
1162  // temporary storage of the parameters - no CorrelationParameter
1163  std::vector<L1GtEnergySumTemplate::ObjectParameter> objParameter(nrObj);
1164  fillEnergySumObjectParameter(condDB.objectParameter1FK, objParameter[0], objType[0]);
1165 
1166  esumCond.setConditionParameter(objParameter);
1167 
1168  // get chip number list
1169  std::list<int> chipList = listChipNumber(condDB.cond);
1170 
1171  // eliminate duplicates
1172  chipList.sort();
1173  chipList.unique();
1174 
1175  // add the same condition once to every chip where required
1176  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1177  esumCond.setCondChipNr(*itChip);
1178 
1179  // no check for uniqueness - done by DB
1180  (m_vecEnergySumTemplate[*itChip]).push_back(esumCond);
1181 
1182  if (m_isDebugEnabled) {
1183  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1184  << "\n Adding condition " << (condDB.cond) << " on chip " << (*itChip) << "\n " << std::endl;
1185 
1186  LogTrace("L1GtTriggerMenuConfigOnlineProd") << esumCond << "\n" << std::endl;
1187  }
1188  }
1189 }
1190 
1192  L1GtJetCountsTemplate jcCond(condDB.cond);
1193  jcCond.setCondType(strToEnumCondType(condDB.condType));
1194 
1195  // object types - jet counts are "global"
1196  int nrObj = 1;
1197 
1199  std::vector<L1GtObject> objType(nrObj, obj);
1200  jcCond.setObjectType(objType);
1201 
1202  jcCond.setCondGEq(condDB.condGEq);
1203 
1204  // temporary storage of the parameters - no CorrelationParameter
1205  // for counts, the DB implementation is without OP, directly in TableMenuCond
1206  std::vector<L1GtJetCountsTemplate::ObjectParameter> objParameter(nrObj);
1207  objParameter.at(0).countIndex = static_cast<unsigned int>(condDB.countIndex);
1208  objParameter.at(0).countThreshold = static_cast<unsigned int>(condDB.countThreshold);
1209  objParameter.at(0).countOverflow = false; // not used
1210 
1211  jcCond.setConditionParameter(objParameter);
1212 
1213  // get chip number list
1214  std::list<int> chipList = listChipNumber(condDB.cond);
1215 
1216  // eliminate duplicates
1217  chipList.sort();
1218  chipList.unique();
1219 
1220  // add the same condition once to every chip where required
1221  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1222  jcCond.setCondChipNr(*itChip);
1223 
1224  // no check for uniqueness - done by DB
1225  (m_vecJetCountsTemplate[*itChip]).push_back(jcCond);
1226 
1227  if (m_isDebugEnabled) {
1228  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1229  << "\n Adding condition " << (condDB.cond) << " on chip " << (*itChip) << "\n " << std::endl;
1230 
1231  LogTrace("L1GtTriggerMenuConfigOnlineProd") << jcCond << "\n" << std::endl;
1232  }
1233  }
1234 }
1235 
1237  L1GtHfBitCountsTemplate countsCond(condDB.cond);
1238  countsCond.setCondType(strToEnumCondType(condDB.condType));
1239 
1240  // object types - HF bit counts are "global"
1241  int nrObj = 1;
1242 
1244  std::vector<L1GtObject> objType(nrObj, obj);
1245  countsCond.setObjectType(objType);
1246 
1247  countsCond.setCondGEq(condDB.condGEq);
1248 
1249  // temporary storage of the parameters - no CorrelationParameter
1250  // for counts, the DB implementation is without OP, directly in TableMenuCond
1251  std::vector<L1GtHfBitCountsTemplate::ObjectParameter> objParameter(nrObj);
1252  objParameter.at(0).countIndex = static_cast<unsigned int>(condDB.countIndex);
1253  objParameter.at(0).countThreshold = static_cast<unsigned int>(condDB.countThreshold);
1254 
1255  countsCond.setConditionParameter(objParameter);
1256 
1257  // get chip number list
1258  std::list<int> chipList = listChipNumber(condDB.cond);
1259 
1260  // eliminate duplicates
1261  chipList.sort();
1262  chipList.unique();
1263 
1264  // add the same condition once to every chip where required
1265  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1266  countsCond.setCondChipNr(*itChip);
1267 
1268  // no check for uniqueness - done by DB
1269  (m_vecHfBitCountsTemplate[*itChip]).push_back(countsCond);
1270 
1271  if (m_isDebugEnabled) {
1272  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1273  << "\n Adding condition " << (condDB.cond) << " on chip " << (*itChip) << "\n " << std::endl;
1274 
1275  LogTrace("L1GtTriggerMenuConfigOnlineProd") << countsCond << "\n" << std::endl;
1276  }
1277  }
1278 }
1279 
1281  L1GtHfRingEtSumsTemplate esumCond(condDB.cond);
1282  esumCond.setCondType(strToEnumCondType(condDB.condType));
1283 
1284  // object types - HF energy sums are "global"
1285  int nrObj = 1;
1286 
1288  std::vector<L1GtObject> objType(nrObj, obj);
1289  esumCond.setObjectType(objType);
1290 
1291  esumCond.setCondGEq(condDB.condGEq);
1292 
1293  // temporary storage of the parameters - no CorrelationParameter
1294  // for HF energy sums, the DB implementation is without OP, directly in TableMenuCond
1295  std::vector<L1GtHfRingEtSumsTemplate::ObjectParameter> objParameter(nrObj);
1296  objParameter.at(0).etSumIndex = static_cast<unsigned int>(condDB.countIndex);
1297  objParameter.at(0).etSumThreshold = static_cast<unsigned int>(condDB.countThreshold);
1298 
1299  esumCond.setConditionParameter(objParameter);
1300 
1301  // get chip number list
1302  std::list<int> chipList = listChipNumber(condDB.cond);
1303 
1304  // eliminate duplicates
1305  chipList.sort();
1306  chipList.unique();
1307 
1308  // add the same condition once to every chip where required
1309  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1310  esumCond.setCondChipNr(*itChip);
1311 
1312  // no check for uniqueness - done by DB
1313  (m_vecHfRingEtSumsTemplate[*itChip]).push_back(esumCond);
1314 
1315  if (m_isDebugEnabled) {
1316  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1317  << "\n Adding condition " << (condDB.cond) << " on chip " << (*itChip) << "\n " << std::endl;
1318 
1319  LogTrace("L1GtTriggerMenuConfigOnlineProd") << esumCond << "\n" << std::endl;
1320  }
1321  }
1322 }
1323 
1325  L1GtCastorTemplate castorCond(condDB.cond);
1326  castorCond.setCondType(strToEnumCondType(condDB.condType));
1327 
1328  // object types - logical conditions have no objects associated in GT
1329  // one put however a "Castor" object type
1330  int nrObj = 1;
1331 
1333  std::vector<L1GtObject> objType(nrObj, obj);
1334  castorCond.setObjectType(objType);
1335 
1336  // irrelevant, set to false for completeness
1337  castorCond.setCondGEq(false);
1338 
1339  // logical conditions have no ObjectParameter, no CorrelationParameter
1340 
1341  // get chip number list
1342  std::list<int> chipList = listChipNumber(condDB.cond);
1343 
1344  // eliminate duplicates
1345  chipList.sort();
1346  chipList.unique();
1347 
1348  // add the same condition once to every chip where required
1349  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1350  castorCond.setCondChipNr(*itChip);
1351 
1352  // no check for uniqueness - done by DB
1353  (m_vecCastorTemplate[*itChip]).push_back(castorCond);
1354 
1355  if (m_isDebugEnabled) {
1356  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1357  << "\n Adding condition " << (condDB.cond) << " on chip " << (*itChip) << "\n " << std::endl;
1358 
1359  LogTrace("L1GtTriggerMenuConfigOnlineProd") << castorCond << "\n" << std::endl;
1360  }
1361  }
1362 }
1363 
1365  L1GtBptxTemplate bptxCond(condDB.cond);
1366  bptxCond.setCondType(strToEnumCondType(condDB.condType));
1367 
1368  // object types - logical conditions have no objects associated in GT
1369  // one put however a "Bptx" object type
1370  int nrObj = 1;
1371 
1373  std::vector<L1GtObject> objType(nrObj, obj);
1374  bptxCond.setObjectType(objType);
1375 
1376  // irrelevant, set to false for completeness
1377  bptxCond.setCondGEq(false);
1378 
1379  // logical conditions have no ObjectParameter, no CorrelationParameter
1380 
1381  // get chip number list
1382  std::list<int> chipList = listChipNumber(condDB.cond);
1383 
1384  // eliminate duplicates
1385  chipList.sort();
1386  chipList.unique();
1387 
1388  // add the same condition once to every chip where required
1389  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1390  bptxCond.setCondChipNr(*itChip);
1391 
1392  // no check for uniqueness - done by DB
1393  (m_vecBptxTemplate[*itChip]).push_back(bptxCond);
1394 
1395  if (m_isDebugEnabled) {
1396  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1397  << "\n Adding condition " << (condDB.cond) << " on chip " << (*itChip) << "\n " << std::endl;
1398 
1399  LogTrace("L1GtTriggerMenuConfigOnlineProd") << bptxCond << "\n" << std::endl;
1400  }
1401  }
1402 }
1403 
1405  L1GtExternalTemplate externalCond(condDB.cond);
1406  externalCond.setCondType(strToEnumCondType(condDB.condType));
1407 
1408  // object types - logical conditions have no objects associated in GT
1409  // one put however a "External" object type
1410  int nrObj = 1;
1411 
1413  std::vector<L1GtObject> objType(nrObj, obj);
1414  externalCond.setObjectType(objType);
1415 
1416  // irrelevant, set to false for completeness
1417  externalCond.setCondGEq(false);
1418 
1419  // logical conditions have no ObjectParameter, no CorrelationParameter
1420 
1421  // get chip number list
1422  std::list<int> chipList = listChipNumber(condDB.cond);
1423 
1424  // eliminate duplicates
1425  chipList.sort();
1426  chipList.unique();
1427 
1428  // add the same condition once to every chip where required
1429  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1430  externalCond.setCondChipNr(*itChip);
1431 
1432  // no check for uniqueness - done by DB
1433  (m_vecExternalTemplate[*itChip]).push_back(externalCond);
1434 
1435  if (m_isDebugEnabled) {
1436  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1437  << "\n Adding condition " << (condDB.cond) << " on chip " << (*itChip) << "\n " << std::endl;
1438 
1439  LogTrace("L1GtTriggerMenuConfigOnlineProd") << externalCond << "\n" << std::endl;
1440  }
1441  }
1442 }
1443 
1445  // create a new correlation condition
1446  L1GtCorrelationTemplate correlationCond(condDB.cond);
1447  correlationCond.setCondType(strToEnumCondType(condDB.condType));
1448 
1449  // two objects (for sure) - type taken from DB
1450  const int nrObj = 2;
1451 
1452  std::vector<L1GtObject> objType(nrObj);
1454  objType[0] = obj;
1455 
1456  obj = strToEnumL1GtObject(condDB.gtObject2);
1457  objType[1] = obj;
1458 
1459  correlationCond.setObjectType(objType);
1460 
1461  // irrelevant, it is set for each subcondition
1462  correlationCond.setCondGEq(condDB.condGEq);
1463 
1464  // get chip number list, eliminate duplicates
1465  std::list<int> chipList = listChipNumber(condDB.cond);
1466  chipList.sort();
1467  chipList.unique();
1468 
1469  // temporary vectors for sub-conditions
1470  std::vector<L1GtConditionCategory> subcondCategory(nrObj);
1471  std::vector<int> subcondIndex(nrObj);
1472 
1473  bool wrongSubcondition = false;
1474 
1475  for (int iObj = 0; iObj < nrObj; ++iObj) {
1476  L1GtObject gtObj = objType[iObj];
1477 
1478  // sub-conditions (all have the same condGEq as the correlation condition).
1479  switch (gtObj) {
1480  case Mu: {
1481  subcondCategory[iObj] = CondMuon;
1482 
1483  // temporary storage of the parameters
1484  std::vector<L1GtMuonTemplate::ObjectParameter> objParameter(1);
1485 
1486  std::string subcondName;
1487  if (iObj == 0) {
1488  fillMuonObjectParameter(condDB.objectParameter1FK, objParameter[0]);
1489  subcondName = condDB.objectParameter1FK;
1490  } else if (iObj == 1) {
1491  subcondName = condDB.objectParameter2FK;
1492  fillMuonObjectParameter(condDB.objectParameter2FK, objParameter[0]);
1493  }
1494 
1495  // chargeCorrelation must be set for muons
1496  // put it to ignore
1498  corrPar.chargeCorrelation = 1;
1499 
1500  L1GtMuonTemplate subcond(subcondName, Type1s);
1501  subcond.setCondGEq(condDB.condGEq);
1502  subcond.setObjectType(std::vector<L1GtObject>(1, gtObj));
1503  subcond.setConditionParameter(objParameter, corrPar);
1504 
1505  // add the same sub-condition once to every chip where required
1506  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1507  subcond.setCondChipNr(*itChip);
1508 
1509  // no check for uniqueness - done by DB
1510  (m_corMuonTemplate[*itChip]).push_back(subcond);
1511 
1512  // index
1513  subcondIndex[iObj] = (m_corMuonTemplate[*itChip]).size() - 1;
1514 
1515  if (m_isDebugEnabled) {
1516  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1517  << "\n Adding condition " << (condDB.cond) << " on chip " << (*itChip) << "\n " << std::endl;
1518 
1519  LogTrace("L1GtTriggerMenuConfigOnlineProd") << subcond << "\n" << std::endl;
1520  }
1521  }
1522 
1523  } break;
1524 
1525  case IsoEG:
1526  case NoIsoEG:
1527  case CenJet:
1528  case ForJet:
1529  case TauJet: {
1530  subcondCategory[iObj] = CondCalo;
1531 
1532  // temporary storage of the parameters
1533  std::vector<L1GtCaloTemplate::ObjectParameter> objParameter(1);
1534 
1535  std::string subcondName;
1536  if (iObj == 0) {
1537  fillCaloObjectParameter(condDB.objectParameter1FK, objParameter[0]);
1538  subcondName = condDB.objectParameter1FK;
1539  } else if (iObj == 1) {
1540  subcondName = condDB.objectParameter2FK;
1541  fillCaloObjectParameter(condDB.objectParameter2FK, objParameter[0]);
1542  }
1543 
1544  L1GtCaloTemplate::CorrelationParameter corrPar; // dummy
1545 
1546  L1GtCaloTemplate subcond(subcondName, Type1s);
1547  subcond.setCondGEq(condDB.condGEq);
1548  subcond.setObjectType(std::vector<L1GtObject>(1, gtObj));
1549  subcond.setConditionParameter(objParameter, corrPar);
1550 
1551  // add the same sub-condition once to every chip where required
1552  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1553  subcond.setCondChipNr(*itChip);
1554 
1555  // no check for uniqueness - done by DB
1556  (m_corCaloTemplate[*itChip]).push_back(subcond);
1557 
1558  // index
1559  subcondIndex[iObj] = (m_corCaloTemplate[*itChip]).size() - 1;
1560 
1561  if (m_isDebugEnabled) {
1562  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1563  << "\n Adding condition " << (condDB.cond) << " on chip " << (*itChip) << "\n " << std::endl;
1564 
1565  LogTrace("L1GtTriggerMenuConfigOnlineProd") << subcond << "\n" << std::endl;
1566  }
1567  }
1568  } break;
1569 
1570  case ETM:
1571  case HTM: {
1572  subcondCategory[iObj] = CondEnergySum;
1573 
1574  // temporary storage of the parameters
1575  std::vector<L1GtEnergySumTemplate::ObjectParameter> objParameter(1);
1576 
1577  std::string subcondName;
1578  if (iObj == 0) {
1579  fillEnergySumObjectParameter(condDB.objectParameter1FK, objParameter[0], gtObj);
1580  subcondName = condDB.objectParameter1FK;
1581  } else if (iObj == 1) {
1582  subcondName = condDB.objectParameter2FK;
1583  fillEnergySumObjectParameter(condDB.objectParameter2FK, objParameter[0], gtObj);
1584  }
1585 
1586  L1GtConditionType condType;
1587 
1588  switch (gtObj) {
1589  case ETM: {
1590  condType = TypeETM;
1591  } break;
1592  case HTM: {
1593  condType = TypeHTM;
1594  } break;
1595  default: {
1596  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
1597  << "\n Warning: wrong L1GtConditionType " << gtObj << std::endl;
1598 
1599  } break;
1600  }
1601 
1602  L1GtEnergySumTemplate subcond(subcondName, condType);
1603  subcond.setCondGEq(condDB.condGEq);
1604  subcond.setObjectType(std::vector<L1GtObject>(1, gtObj));
1605  subcond.setConditionParameter(objParameter);
1606 
1607  // add the same sub-condition once to every chip where required
1608  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1609  subcond.setCondChipNr(*itChip);
1610 
1611  // no check for uniqueness - done by DB
1612  (m_corEnergySumTemplate[*itChip]).push_back(subcond);
1613 
1614  // index
1615  subcondIndex[iObj] = (m_corEnergySumTemplate[*itChip]).size() - 1;
1616 
1617  if (m_isDebugEnabled) {
1618  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1619  << "\n Adding condition " << (condDB.cond) << " on chip " << (*itChip) << "\n " << std::endl;
1620 
1621  LogTrace("L1GtTriggerMenuConfigOnlineProd") << subcond << "\n" << std::endl;
1622  }
1623  }
1624  } break;
1625  case ETT:
1626  case HTT:
1627  case JetCounts:
1628  case HfBitCounts:
1629  case HfRingEtSums:
1630  case Castor:
1631  case BPTX:
1632  case GtExternal:
1633  case TechTrig: {
1634  wrongSubcondition = true;
1635  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
1636  << "\n Warning: correlation condition " << (condDB.cond) << " with invalid sub-condition object type "
1637  << gtObj << "\n Condition ignored!" << std::endl;
1638  }
1639  [[fallthrough]];
1640  default: {
1641  wrongSubcondition = true;
1642  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
1643  << "\n Warning: correlation condition " << (condDB.cond) << " with invalid sub-condition object type "
1644  << gtObj << "\n Condition ignored!" << std::endl;
1645 
1646  //
1647 
1648  } break;
1649  }
1650  }
1651 
1652  if (wrongSubcondition) {
1653  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
1654  << "\n Warning: wrong sub-condition for correlation condition " << (condDB.cond)
1655  << "\n Condition not inserted in menu. \n A sub-condition may be left in the menu" << std::endl;
1656  return;
1657  }
1658 
1659  // get the correlation parameters for the correlation condition (std::string)
1661  corrParameter.deltaEtaRange = condDB.deltaEtaRange;
1662  corrParameter.deltaPhiRange = condDB.deltaPhiRange;
1663 
1664  // set condition categories
1665  correlationCond.setCond0Category(subcondCategory[0]);
1666  correlationCond.setCond1Category(subcondCategory[1]);
1667 
1668  // set condition indices in correlation vector
1669  correlationCond.setCond0Index(subcondIndex[0]);
1670  correlationCond.setCond1Index(subcondIndex[1]);
1671 
1672  // set correlation parameter
1673  corrParameter.deltaPhiMaxbits = 0; // TODO
1674  correlationCond.setCorrelationParameter(corrParameter);
1675 
1676  // add the same condition once to every chip where required
1677  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1678  correlationCond.setCondChipNr(*itChip);
1679 
1680  // no check for uniqueness - done by DB
1681  (m_vecCorrelationTemplate[*itChip]).push_back(correlationCond);
1682 
1683  if (m_isDebugEnabled) {
1684  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1685  << "\n Adding condition " << (condDB.cond) << " on chip " << (*itChip) << "\n " << std::endl;
1686 
1687  LogTrace("L1GtTriggerMenuConfigOnlineProd") << correlationCond << "\n" << std::endl;
1688  }
1689  }
1690 }
1691 
1692 // add the conditions from a menu to the corresponding list
1694  // loop over m_tableMenuCond
1695  for (std::vector<TableMenuCond>::const_iterator constIt = m_tableMenuCond.begin(); constIt != m_tableMenuCond.end();
1696  constIt++) {
1697  L1GtConditionCategory conCategory = strToEnumCondCategory((*constIt).condCategory);
1698 
1699  switch (conCategory) {
1700  case CondMuon: {
1701  addMuonCondition(*constIt);
1702 
1703  } break;
1704  case CondCalo: {
1705  addCaloCondition(*constIt);
1706 
1707  } break;
1708  case CondEnergySum: {
1709  addEnergySumCondition(*constIt);
1710 
1711  } break;
1712  case CondJetCounts: {
1713  addJetCountsCondition(*constIt);
1714 
1715  } break;
1716  case CondHfBitCounts: {
1717  addHfBitCountsCondition(*constIt);
1718 
1719  } break;
1720  case CondHfRingEtSums: {
1721  addHfRingEtSumsCondition(*constIt);
1722 
1723  } break;
1724  case CondCastor: {
1725  addCastorCondition(*constIt);
1726 
1727  } break;
1728  case CondBptx: {
1729  addBptxCondition(*constIt);
1730 
1731  } break;
1732  case CondExternal: {
1733  addExternalCondition(*constIt);
1734 
1735  } break;
1736  case CondCorrelation: {
1737  addCorrelationCondition(*constIt);
1738 
1739  } break;
1740  case CondNull: {
1741  // do nothing
1742 
1743  } break;
1744  default: {
1745  // do nothing
1746 
1747  } break;
1748  }
1749  }
1750 }
1751 
const std::map< int, std::string > condIndexNameMap(const short bitNr) const
std::string logicalExpression() const
return the logical expression
bool isDebugEnabled()
L1GtTriggerMenuConfigOnlineProd(const edm::ParameterSet &)
constructor
void fillMuonObjectParameter(const std::string &opFK, L1GtMuonTemplate::ObjectParameter &)
bool tableMenuAlgoCondFromDB(const std::string &gtSchema, const std::string &objKey)
retrieve table with conditions associated to physics algorithms from DB
const int nrObjects() const
get number of trigger objects
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:274
Definition: L1GtObject.h:38
void setCond1Category(const L1GtConditionCategory &)
bool tableMenuAlgoFromDB(const std::string &gtSchema, const std::string &objKey)
retrieve table with physics algorithms from DB
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
void setAlgoAlias(const std::string &algoAliasValue)
Definition: L1GtAlgorithm.h:59
Definition: L1GtObject.h:35
void fillCaloObjectParameter(const std::string &opFK, L1GtCaloTemplate::ObjectParameter &)
L1GtConditionType
dictionary results
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
std::vector< std::vector< L1GtCorrelationTemplate > > m_vecCorrelationTemplate
bool tableMenuCondFromDB(const std::string &gtSchema, const std::string &objKey)
retrieve table with list of conditions in the menu
void setCondGEq(const bool &cGEq)
Definition: L1GtCondition.h:74
std::vector< std::vector< L1GtJetCountsTemplate > > m_vecJetCountsTemplate
std::unique_ptr< L1GtTriggerMenu > newObject(const std::string &objectKey) override
public methods
Log< level::Error, false > LogError
void fillEnergySumObjectParameter(const std::string &opFK, L1GtEnergySumTemplate::ObjectParameter &, const L1GtObject &)
#define LogTrace(id)
std::vector< std::vector< L1GtBptxTemplate > > m_vecBptxTemplate
std::vector< std::vector< L1GtCaloTemplate > > m_corCaloTemplate
void setAlgoChipNumber(const int algoChipNumberValue)
Definition: L1GtAlgorithm.h:79
void convertIntToNameLogicalExpression(const std::map< int, std::string > &intToNameMap)
Definition: L1GtObject.h:37
std::vector< std::vector< L1GtCaloTemplate > > m_vecCaloTemplate
std::vector< std::vector< L1GtExternalTemplate > > m_vecExternalTemplate
AlgorithmMap m_algorithmAliasMap
map containing the physics algorithms (by alias)
void setCond0Category(const L1GtConditionCategory &)
std::vector< std::vector< L1GtCastorTemplate > > m_vecCastorTemplate
TableMenuGeneral m_tableMenuGeneral
member to keep various tables retrieved from DB
void setConditionParameter(const std::vector< ObjectParameter > &objParameter, const CorrelationParameter &corrParameter)
set functions
void setObjectType(const std::vector< L1GtObject > &objType)
Definition: L1GtCondition.h:69
void setCorrelationParameter(const CorrelationParameter &corrParameter)
L1GtConditionType strToEnumCondType(const std::string &strType)
string to enum L1GtConditionType conversion
const bool wsc() const
void buildAlgorithmMap()
build the algorithm map in the menu
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:279
std::vector< TableMenuTechTrig > m_tableMenuTechTrig
std::string convertLogicalExpression(const std::string &, const std::map< int, std::string > &) const
convert a logical expression with indices to a logical expression with names
typedef for a single object template
typedef for correlation parameters
void addConditions()
add the conditions from a menu to the corresponding list
std::list< int > listChipNumber(const std::string &)
get a list of chip numbers from the m_tableMenuAlgoCond table for a condition
bool tableMenuTechTrigFromDB(const std::string &gtSchema, const std::string &objKey)
retrieve table with technical triggers from DB
AlgorithmMap m_technicalTriggerMap
map containing the technical triggers
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
int chipNumber(short) const
return the chip number for an algorithm with index bitNumberSh
bool tableMenuGeneralFromDB(const std::string &gtSchema, const std::string &objKey)
methods to retrieve the tables from DB
std::vector< std::string > columnNamesView(const std::string &schemaName, const std::string &viewName)
Definition: OMDSReader.cc:234
Definition: L1GtObject.h:29
std::vector< TableMenuObjectParameters > m_tableMenuObjectParameters
std::vector< std::vector< L1GtMuonTemplate > > m_vecMuonTemplate
void splitHexStringInTwo64bitWords(const std::string &hexStr, std::string &hex0WordStr, std::string &hex1WordStr)
split a hex string in two 64-bit words returned as hex strings
void setCondChipNr(const int &cChipNr)
Definition: L1GtCondition.h:79
const QueryResults basicQueryView(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &viewName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="")
Definition: OMDSReader.cc:158
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void buildTechnicalTriggerMap()
build the technical trigger map in the menu
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
void init(const int numberConditionChips)
initialize the class (mainly reserve/resize)
void addHfRingEtSumsCondition(const TableMenuCond &)
Definition: L1GtObject.h:36
std::vector< TableMenuAlgoCond > m_tableMenuAlgoCond
void setCondType(const L1GtConditionType &cType)
Definition: L1GtCondition.h:64
tuple columns
Definition: mps_check.py:244
std::vector< std::vector< L1GtEnergySumTemplate > > m_vecEnergySumTemplate
std::vector< std::vector< L1GtEnergySumTemplate > > m_corEnergySumTemplate
std::vector< std::vector< L1GtMuonTemplate > > m_corMuonTemplate
Log< level::Warning, false > LogWarning
AlgorithmMap m_algorithmMap
map containing the physics algorithms (by name)
L1GtConditionCategory
condition categories
std::vector< std::vector< L1GtHfBitCountsTemplate > > m_vecHfBitCountsTemplate
std::vector< std::vector< L1GtHfRingEtSumsTemplate > > m_vecHfRingEtSumsTemplate
L1GtConditionCategory strToEnumCondCategory(const std::string &strCategory)
string to enum L1GtConditionCategory conversion
bool tableMenuObjectParametersFromDB(const std::string &gtSchema, const std::string &objKey)
retrieve table with object parameters from DB
void setConditionParameter(const std::vector< ObjectParameter > &objParameter, const CorrelationParameter &corrParameter)
set functions
tuple size
Write out results.
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
typedef for a single object template
L1GtObject strToEnumL1GtObject(const std::string &strObject)
string to enum L1GtObject conversion