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