CMS 3D CMS Logo

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