CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GtTriggerMenuConfigOnlineProd.cc
Go to the documentation of this file.
1 
17 // this class header
19 
20 // system include files
21 #include <string>
22 #include <vector>
23 #include <map>
24 #include <list>
25 #include <utility>
26 #include <algorithm>
27 
28 #include "boost/lexical_cast.hpp"
29 
30 // user include files
32 
35 
37 
40 
41 
42 // constructor
44  L1ConfigOnlineProdBase<L1GtTriggerMenuRcd, L1GtTriggerMenu> (parSet), m_isDebugEnabled(
45  edm::isDebugEnabled()) {
46 
47  // empty
48 
49 }
50 
51 // destructor
53 
54  // empty
55 
56 }
57 
58 // public methods
59 
60 // initialize the class (mainly reserve/resize)
61 void L1GtTriggerMenuConfigOnlineProd::init(const int numberConditionChips) {
62 
63  // resize the vectors of condition maps
64  // the number of condition chips should be correctly set
65 
66  m_vecMuonTemplate.resize(numberConditionChips);
67  m_vecCaloTemplate.resize(numberConditionChips);
68  m_vecEnergySumTemplate.resize(numberConditionChips);
69  m_vecJetCountsTemplate.resize(numberConditionChips);
70  m_vecCastorTemplate.resize(numberConditionChips);
71  m_vecHfBitCountsTemplate.resize(numberConditionChips);
72  m_vecHfRingEtSumsTemplate.resize(numberConditionChips);
73  m_vecBptxTemplate.resize(numberConditionChips);
74  m_vecExternalTemplate.resize(numberConditionChips);
75 
76  m_vecCorrelationTemplate.resize(numberConditionChips);
77  m_corMuonTemplate.resize(numberConditionChips);
78  m_corCaloTemplate.resize(numberConditionChips);
79  m_corEnergySumTemplate.resize(numberConditionChips);
80 
81 
82 }
83 
84 boost::shared_ptr<L1GtTriggerMenu> L1GtTriggerMenuConfigOnlineProd::newObject(
85  const std::string& objectKey) {
86 
87  // FIXME seems to not work anymore in constructor...
89 
90  // shared pointer for L1GtTriggerMenu - empty menu
91  boost::shared_ptr<L1GtTriggerMenu> pL1GtTriggerMenuEmpty =
92  boost::shared_ptr<L1GtTriggerMenu>(new L1GtTriggerMenu());
93 
94  // FIXME get it from L1GtStableParameters?
95  // initialize once, from outside
96  const unsigned int numberConditionChips = 2;
97  init(numberConditionChips);
98 
99  const std::string gtSchema = "CMS_GT";
100 
101  // l1GtTriggerMenu: parameters in table GTFE_SETUP_FK
102  // the objectKey for the menu obtained from GT_SETUP is the L1T_MENU_IMPL key
103 
104  // SQL queries:
105 
106  // retrieve table with general menu parameters from DB, view L1T_MENU_GENERAL_VIEW
107  if (!tableMenuGeneralFromDB(gtSchema, objectKey)) {
108  return pL1GtTriggerMenuEmpty;
109 
110  }
111 
112  // build the menu name
113  std::string menuName = m_tableMenuGeneral.menuInterface + "/" + m_tableMenuGeneral.scalesKey
115 
116 
117  // retrieve table with physics algorithms from DB, view L1T_MENU_ALGO_VIEW
118  if (!tableMenuAlgoFromDB(gtSchema, objectKey)) {
119  return pL1GtTriggerMenuEmpty;
120 
121  }
122 
123  // retrieve table with conditions associated to physics algorithms from DB
124  if (!tableMenuAlgoCondFromDB(gtSchema, objectKey)) {
125  return pL1GtTriggerMenuEmpty;
126 
127  }
128 
129  // retrieve table with list of conditions in the menu
130  if (!tableMenuCondFromDB(gtSchema, objectKey)) {
131  return pL1GtTriggerMenuEmpty;
132 
133  }
134 
135 
136  // retrieve table with object parameters from DB, view CMS_GT.L1T_MENU_OP_VIEW
137  if (!tableMenuObjectParametersFromDB(gtSchema, objectKey)) {
138  return pL1GtTriggerMenuEmpty;
139 
140  }
141 
142  // retrieve table with technical triggers from DB, view L1T_MENU_TECHTRIG_VIEW
143  if (!tableMenuTechTrigFromDB(gtSchema, objectKey)) {
144  return pL1GtTriggerMenuEmpty;
145 
146  }
147 
148  // build the algorithm map in the menu
150 
151  // build the technical trigger map in the menu
153 
154  // add the conditions from a menu to the corresponding list
155  addConditions();
156 
157  // fill the record
158  boost::shared_ptr<L1GtTriggerMenu> pL1GtTriggerMenu = boost::shared_ptr<L1GtTriggerMenu>(
159  new L1GtTriggerMenu(menuName, numberConditionChips,
173 
174  pL1GtTriggerMenu->setGtTriggerMenuInterface(m_tableMenuGeneral.menuInterface);
175  pL1GtTriggerMenu->setGtTriggerMenuImplementation(m_tableMenuGeneral.menuImplementation);
176  pL1GtTriggerMenu->setGtScaleDbKey(m_tableMenuGeneral.scalesKey);
177 
178  pL1GtTriggerMenu->setGtAlgorithmMap(m_algorithmMap);
179  pL1GtTriggerMenu->setGtAlgorithmAliasMap(m_algorithmAliasMap);
180  pL1GtTriggerMenu->setGtTechnicalTriggerMap(m_technicalTriggerMap);
181 
182 
183  if (m_isDebugEnabled) {
184  LogTrace("L1GtTriggerMenuConfigOnlineProd")
185  << "\nThe following L1GtTriggerMenu record was read from OMDS: \n"
186  << std::endl;
187 
188  std::ostringstream myCoutStream;
189  int verbosity = 0;
190  pL1GtTriggerMenu->print(myCoutStream, verbosity);
191  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n" << std::endl;
192 
193  verbosity = 2;
194  pL1GtTriggerMenu->print(myCoutStream, verbosity);
195  LogTrace("L1GtTriggerMenuConfigOnlineProd") << myCoutStream.str() << "\n" << std::endl;
196 
197  }
198 
199  return pL1GtTriggerMenu;
200 }
201 
202 // retrieve table with general menu parameters from DB
204  const std::string& gtSchema, const std::string& objectKey) {
205 
206  // select * from CMS_GT.L1T_MENU_GENERAL_VIEW
207  // where L1T_MENU_GENERAL_VIEW.MENU_IMPLEMENTATION = objectKey
208 
209  const std::vector<std::string>& columns = m_omdsReader.columnNamesView(
210  gtSchema, "L1T_MENU_GENERAL_VIEW");
211 
212  if (m_isDebugEnabled) {
213  LogTrace("L1GtTriggerMenuConfigOnlineProd")
214  << "\n List of columns in L1T_MENU_GENERAL_VIEW:\n" << std::endl;
215  for (std::vector<std::string>::const_iterator iter = columns.begin(); iter != columns.end(); iter++) {
216  LogTrace("L1GtTriggerMenuConfigOnlineProd") << ( *iter ) << std::endl;
217 
218  }
219  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n\n" << std::endl;
220  }
221 
223  columns, gtSchema, "L1T_MENU_GENERAL_VIEW",
224  "L1T_MENU_GENERAL_VIEW.MENU_IMPLEMENTATION", m_omdsReader.singleAttribute(objectKey));
225 
226  // check if query was successful
227  if (results.queryFailed()) {
228  edm::LogError("L1-O2O")
229  << "Problem to get content of L1T_MENU_GENERAL_VIEW for L1GtTriggerMenu implementation key: "
230  << objectKey;
231  return false;
232  }
233 
234  // retrieve menu interface name, scales key, algorithm implementation tag
235 
236  for (std::vector<std::string>::const_iterator constIt = columns.begin(); constIt
237  != columns.end(); ++constIt) {
238 
239  if ( ( *constIt ) == "MENU_IMPLEMENTATION") {
241 
242  } else if ( ( *constIt ) == "INTERFACE") {
243  results.fillVariable(*constIt, m_tableMenuGeneral.menuInterface);
244 
245  } else if ( ( *constIt ) == "SCALES_KEY") {
246  results.fillVariable(*constIt, m_tableMenuGeneral.scalesKey);
247 
248  } else if ( ( *constIt ) == "ALGO_IMPL_TAG") {
249  results.fillVariable(*constIt, m_tableMenuGeneral.algoImplTag);
250 
251  } else {
252  // do nothing
253 
254  }
255 
256  }
257 
258  // cross checks
259  if (m_tableMenuGeneral.menuImplementation != objectKey) {
260 
261  LogTrace("L1GtTriggerMenuConfigOnlineProd")
262  << "\n L1 trigger menu implementation read from querying view not identical"
263  << "\n with menu key:"
264  << "\n from view: " << m_tableMenuGeneral.menuImplementation
265  << "\n from key: " << objectKey
266  << "\n Menu implementation name set from key."
267  << std::endl;
269  }
270 
271  //
272  return true;
273 
274 }
275 
276 // retrieve table with physics algorithms from DB
278  const std::string& gtSchema, const std::string& objectKey) {
279 
280  // select * from CMS_GT.L1T_MENU_ALGO_VIEW
281  // where L1T_MENU_ALGO_VIEW.MENU_IMPLEMENTATION = objectKey
282 
283  const std::vector<std::string>& columnsMenuAlgo = m_omdsReader.columnNamesView(
284  gtSchema, "L1T_MENU_ALGO_VIEW");
285 
286  if (m_isDebugEnabled) {
287  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n List of columns in L1T_MENU_ALGO_VIEW:\n"
288  << std::endl;
289  for (std::vector<std::string>::const_iterator iter = columnsMenuAlgo.begin(); iter != columnsMenuAlgo.end(); iter++) {
290  LogTrace("L1GtTriggerMenuConfigOnlineProd") << ( *iter ) << std::endl;
291 
292  }
293  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n\n" << std::endl;
294  }
295 
297  columnsMenuAlgo, gtSchema, "L1T_MENU_ALGO_VIEW", "L1T_MENU_ALGO_VIEW.MENU_IMPLEMENTATION",
298  m_omdsReader.singleAttribute(objectKey));
299 
300 
301  // check if query was successful is based on size of returned list
302  // BUT one can have menus w/o physics algorithms - no error for empty list, but a warning!
303  if (resultsMenuAlgo.queryFailed()) {
304  edm::LogWarning("L1-O2O")
305  << "Warning: Content of L1T_MENU_ALGO_VIEW for L1GtTriggerMenu implementation key: "
306  << "\n " << objectKey << "\nis empty!"
307  << "\nNo physics algorithms are found for this menu.";
308 
309  }
310 
311  TableMenuAlgo menuAlgo;
312  int resultsMenuAlgoRows = resultsMenuAlgo.numberRows();
313 
314  for (int iRow = 0; iRow < resultsMenuAlgoRows; ++iRow) {
315 
316  for (std::vector<std::string>::const_iterator constIt = columnsMenuAlgo.begin(); constIt
317  != columnsMenuAlgo.end(); ++constIt) {
318 
319  if ( ( *constIt ) == "ALGO_INDEX") {
320  resultsMenuAlgo.fillVariableFromRow(*constIt, iRow, menuAlgo.bitNumberSh);
321 
322  } else if ( ( *constIt ) == "NAME") {
323  resultsMenuAlgo.fillVariableFromRow(*constIt, iRow, menuAlgo.algName);
324 
325  } else if ( ( *constIt ) == "ALIAS") {
326  resultsMenuAlgo.fillVariableFromRow(*constIt, iRow, menuAlgo.algAlias);
327 
328  } else if ( ( *constIt ) == "LOGICEXPR") {
329  resultsMenuAlgo.fillVariableFromRow(*constIt, iRow, menuAlgo.logExpression);
330 
331  } else {
332  // do nothing
333 
334  }
335 
336  }
337 
338  LogTrace("L1GtTriggerMenuConfigOnlineProd")
339  << "Row " << iRow << ": index = " << menuAlgo.bitNumberSh << " algName = " << menuAlgo.algName
340  << " algAlias = " << menuAlgo.algAlias << " logExpression = '" << menuAlgo.logExpression << "'"
341  << std::endl;
342 
343  m_tableMenuAlgo.push_back(menuAlgo);
344 
345 
346  }
347 
348  if (m_isDebugEnabled) {
349  LogTrace("L1GtTriggerMenuConfigOnlineProd")
350  << "\n Number of rows read from L1T_MENU_ALGO_VIEW: " << resultsMenuAlgoRows
351  << std::endl;
352 
353  }
354 
355  return true;
356 
357 }
358 
359 // retrieve table with conditions associated to physics algorithms from DB
361  const std::string& gtSchema, const std::string& objectKey) {
362 
363  // get list of conditions associated with the algorithms
364 
365  // select * from CMS_GT.L1T_MENU_ALGO_COND_VIEW
366  // where L1T_MENU_ALGO_COND_VIEW.MENU_IMPLEMENTATION = objectKey
367 
368  const std::vector<std::string>& columnsMenuAlgoCond = m_omdsReader.columnNamesView(
369  gtSchema, "L1T_MENU_ALGO_COND_VIEW");
370 
371  if (m_isDebugEnabled) {
372  LogTrace("L1GtTriggerMenuConfigOnlineProd")
373  << "\n List of columns in L1T_MENU_ALGO_COND_VIEW:\n" << std::endl;
374  for (std::vector<std::string>::const_iterator iter = columnsMenuAlgoCond.begin(); iter
375  != columnsMenuAlgoCond.end(); iter++) {
376  LogTrace("L1GtTriggerMenuConfigOnlineProd") << ( *iter ) << std::endl;
377 
378  }
379  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n\n" << std::endl;
380  }
381 
383  columnsMenuAlgoCond, gtSchema, "L1T_MENU_ALGO_COND_VIEW",
384  "L1T_MENU_ALGO_COND_VIEW.MENU_IMPLEMENTATION", m_omdsReader.singleAttribute(objectKey));
385 
386  // check if query was successful is based on size of returned list
387  // BUT one can have menus w/o algorithms and conditions - no error for empty list, but a warning!
388  if (resultsMenuAlgoCond.queryFailed()) {
389  edm::LogWarning("L1-O2O")
390  << "Warning: Content of L1T_MENU_ALGO_COND_VIEW for L1GtTriggerMenu implementation key: "
391  << "\n " << objectKey << "\nis empty!"
392  << "\nNo list of condition associated to each algorithm are found for this menu.";
393 
394  }
395 
396  //
397  TableMenuAlgoCond menuAlgoCond;
398  int resultsMenuAlgoCondRows = resultsMenuAlgoCond.numberRows();
399 
400  for (int iRow = 0; iRow < resultsMenuAlgoCondRows; ++iRow) {
401 
402  for (std::vector<std::string>::const_iterator constIt = columnsMenuAlgoCond.begin(); constIt
403  != columnsMenuAlgoCond.end(); ++constIt) {
404 
405  if ( ( *constIt ) == "ALGO_INDEX") {
406  resultsMenuAlgoCond.fillVariableFromRow(
407  *constIt, iRow, menuAlgoCond.bitNumberSh);
408 
409  } else if ( ( *constIt ) == "COND_INDEX") {
410  resultsMenuAlgoCond.fillVariableFromRow(
411  *constIt, iRow, menuAlgoCond.condIndexF);
412 
413  } else if ( ( *constIt ) == "COND_FK") {
414  resultsMenuAlgoCond.fillVariableFromRow(*constIt, iRow, menuAlgoCond.condFK);
415 
416  } else {
417  // do nothing
418 
419  }
420 
421  }
422 
423  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "Row " << iRow << ": ALGO_INDEX = "
424  << menuAlgoCond.bitNumberSh << " COND_INDEX = " << menuAlgoCond.condIndexF
425  << " COND_FK = " << menuAlgoCond.condFK << std::endl;
426 
427  m_tableMenuAlgoCond.push_back(menuAlgoCond);
428 
429  }
430 
431  if (m_isDebugEnabled) {
432  LogTrace("L1GtTriggerMenuConfigOnlineProd")
433  << "\n Number of rows read from L1T_MENU_ALGO_COND_VIEW: "
434  << resultsMenuAlgoCondRows << std::endl;
435  }
436 
437 
438  return true;
439 
440 }
441 
442 // retrieve table with list of conditions in the menu
444  const std::string& gtSchema, const std::string& objectKey) {
445 
446  // select * from CMS_GT.L1T_MENU_COND_VIEW
447  // where L1T_MENU_COND_VIEW.MENU_IMPLEMENTATION = objectKey
448 
449  const std::vector<std::string>& columnsMenuCond = m_omdsReader.columnNamesView(
450  gtSchema, "L1T_MENU_COND_VIEW");
451 
452  if (m_isDebugEnabled) {
453  LogTrace("L1GtTriggerMenuConfigOnlineProd")
454  << "\n List of columns in L1T_MENU_COND_VIEW:\n" << std::endl;
455  for (std::vector<std::string>::const_iterator iter = columnsMenuCond.begin(); iter
456  != columnsMenuCond.end(); iter++) {
457  LogTrace("L1GtTriggerMenuConfigOnlineProd") << ( *iter ) << std::endl;
458 
459  }
460  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n\n" << std::endl;
461  }
462 
464  columnsMenuCond, gtSchema, "L1T_MENU_COND_VIEW",
465  "L1T_MENU_COND_VIEW.MENU_IMPLEMENTATION", m_omdsReader.singleAttribute(objectKey));
466 
467  // check if query was successful is based on size of returned list
468  // BUT one can have menus w/o conditions - no error for empty list, but a warning!
469  if (resultsMenuCond.queryFailed()) {
470  edm::LogWarning("L1-O2O")
471  << "Warning: Content of L1T_MENU_COND_VIEW for L1GtTriggerMenu implementation key: "
472  << "\n " << objectKey << "\nis empty!"
473  << "\nNo conditions associated to menu are found for this menu.";
474 
475  }
476 
477  //
478  TableMenuCond menuCond;
479  int resultsMenuCondRows = resultsMenuCond.numberRows();
480 
481  for (int iRow = 0; iRow < resultsMenuCondRows; ++iRow) {
482 
483  for (std::vector<std::string>::const_iterator constIt = columnsMenuCond.begin(); constIt
484  != columnsMenuCond.end(); ++constIt) {
485 
486  if ( ( *constIt ) == "COND") {
487  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.cond);
488 
489  } else if ( ( *constIt ) == "COND_CATEGORY") {
490  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.condCategory);
491 
492  } else if ( ( *constIt ) == "COND_TYPE") {
493  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.condType);
494 
495  } else if ( ( *constIt ) == "GT_OBJECT_1") {
496  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.gtObject1);
497 
498  } else if ( ( *constIt ) == "GT_OBJECT_2") {
499  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.gtObject2);
500 
501  } else if ( ( *constIt ) == "COND_GEQ") {
502  float condGEqFloat = -1;
503  resultsMenuCond.fillVariableFromRow(*constIt, iRow, condGEqFloat);
504  menuCond.condGEq = (condGEqFloat > 0.5) ? true : false;
505 
506  } else if ( ( *constIt ) == "COUNT_INDEX") {
507  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.countIndex);
508 
509  } else if ( ( *constIt ) == "COUNT_THRESHOLD") {
510  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.countThreshold);
511 
512  } else if ( ( *constIt ) == "CHARGE_CORRELATION") {
513  resultsMenuCond.fillVariableFromRow(
514  *constIt, iRow, menuCond.chargeCorrelation);
515 
516  } else if ( ( *constIt ) == "OBJECT_PARAMETER_1_FK") {
517  resultsMenuCond.fillVariableFromRow(
518  *constIt, iRow, menuCond.objectParameter1FK);
519 
520  } else if ( ( *constIt ) == "OBJECT_PARAMETER_2_FK") {
521  resultsMenuCond.fillVariableFromRow(
522  *constIt, iRow, menuCond.objectParameter2FK);
523 
524  } else if ( ( *constIt ) == "OBJECT_PARAMETER_3_FK") {
525  resultsMenuCond.fillVariableFromRow(
526  *constIt, iRow, menuCond.objectParameter3FK);
527 
528  } else if ( ( *constIt ) == "OBJECT_PARAMETER_4_FK") {
529  resultsMenuCond.fillVariableFromRow(
530  *constIt, iRow, menuCond.objectParameter4FK);
531 
532  } else if ( ( *constIt ) == "DELTA_ETA_RANGE") {
533  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.deltaEtaRange);
534 
535  } else if ( ( *constIt ) == "DELTA_PHI_RANGE") {
536  resultsMenuCond.fillVariableFromRow(*constIt, iRow, menuCond.deltaPhiRange);
537 
538  } else {
539  // do nothing
540 
541  }
542 
543  }
544 
545  LogTrace("L1GtTriggerMenuConfigOnlineProd")
546  << " COND " << menuCond.cond
547  << " COND_CATEGORY " << menuCond.condCategory
548  << " COND_TYPE " << menuCond.condType
549  << " GT_OBJECT_1 " << menuCond.gtObject1
550  << " GT_OBJECT_2 " << menuCond.gtObject2
551  << " COND_GEQ " << menuCond.condGEq << "\n"
552  << " COUNT_INDEX " << menuCond.countIndex
553  << " COUNT_THRESHOLD " << menuCond.countThreshold << "\n"
554  << " CHARGE_CORRELATION " << menuCond.chargeCorrelation << "\n"
555  << " OBJECT_PARAMETER_1_FK " << menuCond.objectParameter1FK
556  << " OBJECT_PARAMETER_2_FK " << menuCond.objectParameter2FK
557  << " OBJECT_PARAMETER_3_FK " << menuCond.objectParameter3FK
558  << " OBJECT_PARAMETER_4_FK " << menuCond.objectParameter4FK << "\n"
559  << " DELTA_ETA_RANGE " << menuCond.deltaEtaRange
560  << " DELTA_PHI_RANGE " << menuCond.deltaPhiRange;
561 
562  m_tableMenuCond.push_back(menuCond);
563 
564 
565  }
566 
567  if (m_isDebugEnabled) {
568  LogTrace("L1GtTriggerMenuConfigOnlineProd")
569  << "\n Number of rows read from L1T_MENU_COND_VIEW: " << resultsMenuCondRows
570  << std::endl;
571 
572  }
573 
574  return true;
575 
576 }
577 
578 // retrieve table with object parameters from DB
580  const std::string& gtSchema, const std::string& objectKey) {
581 
582  // get the list of object parameters in the menu
583 
584  // select * from CMS_GT.L1T_MENU_OP_VIEW
585  // where L1T_MENU_OP_VIEW.MENU_IMPLEMENTATION = objectKey
586 
587  const std::vector<std::string>& columnsMenuOp = m_omdsReader.columnNamesView(
588  gtSchema, "L1T_MENU_OP_VIEW");
589 
590  if (m_isDebugEnabled) {
591  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n List of columns in L1T_MENU_OP_VIEW:\n"
592  << std::endl;
593  for (std::vector<std::string>::const_iterator iter = columnsMenuOp.begin(); iter
594  != columnsMenuOp.end(); iter++) {
595  LogTrace("L1GtTriggerMenuConfigOnlineProd") << ( *iter ) << std::endl;
596 
597  }
598  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n\n" << std::endl;
599  }
600 
602  columnsMenuOp, gtSchema, "L1T_MENU_OP_VIEW", "L1T_MENU_OP_VIEW.MENU_IMPLEMENTATION",
603  m_omdsReader.singleAttribute(objectKey));
604 
605  // check if query was successful is based on size of returned list
606  // BUT one can have menus w/o object parameters - no error for empty list, but a warning!
607  if (resultsMenuOp.queryFailed()) {
608  edm::LogWarning("L1-O2O")
609  << "Warning: Content of L1T_MENU_OP_VIEW for L1GtTriggerMenu implementation key: "
610  << "\n " << objectKey << "\nis empty!"
611  << "\nNo object parameters associated to menu are found for this menu.";
612 
613  }
614 
615  TableMenuObjectParameters menuObjectParameters;
616  int resultsMenuOpRows = resultsMenuOp.numberRows();
617 
618  for (int iRow = 0; iRow < resultsMenuOpRows; ++iRow) {
619 
620  for (std::vector<std::string>::const_iterator constIt = columnsMenuOp.begin(); constIt
621  != columnsMenuOp.end(); ++constIt) {
622 
623  if ( ( *constIt ) == "ID") {
624  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.opId);
625 
626  } else if ( ( *constIt ) == "PT_HIGH_THRESHOLD") {
627  resultsMenuOp.fillVariableFromRow(
628  *constIt, iRow, menuObjectParameters.ptHighThreshold);
629 
630  } else if ( ( *constIt ) == "PT_LOW_THRESHOLD") {
631  resultsMenuOp.fillVariableFromRow(
632  *constIt, iRow, menuObjectParameters.ptLowThreshold);
633 
634  } else if ( ( *constIt ) == "ENABLE_MIP") {
635  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.enableMip);
636 
637  } else if ( ( *constIt ) == "ENABLE_ISO") {
638  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.enableIso);
639 
640  } else if ( ( *constIt ) == "REQUEST_ISO") {
641  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.requestIso);
642 
643  } else if ( ( *constIt ) == "ENERGY_OVERFLOW") {
644  resultsMenuOp.fillVariableFromRow(
645  *constIt, iRow, menuObjectParameters.energyOverflow);
646 
647  } else if ( ( *constIt ) == "ET_THRESHOLD") {
648  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.etThreshold);
649 
650  } else if ( ( *constIt ) == "ETA_RANGE") {
651  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.etaRange);
652 
653  } else if ( ( *constIt ) == "PHI_RANGE") {
654  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.phiRange);
655 
656  } else if ( ( *constIt ) == "PHI_LOW") {
657  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.phiLow);
658 
659  } else if ( ( *constIt ) == "PHI_HIGH") {
660  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.phiHigh);
661 
662  } else if ( ( *constIt ) == "QUALITY_RANGE") {
663  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.qualityRange);
664 
665  } else if ( ( *constIt ) == "CHARGE") {
666  resultsMenuOp.fillVariableFromRow(*constIt, iRow, menuObjectParameters.charge);
667 
668  } else {
669  // do nothing
670 
671  }
672 
673  }
674 
675  LogTrace("L1GtTriggerMenuConfigOnlineProd")
676  << " ID " << menuObjectParameters.opId
677  << " PT_HIGH_THRESHOLD " << menuObjectParameters.ptHighThreshold
678  << " PT_LOW_THRESHOLD " << menuObjectParameters.ptLowThreshold
679  << " ENABLE_MIP " << menuObjectParameters.enableMip
680  << " ENABLE_ISO " << menuObjectParameters.enableIso
681  << " REQUEST_ISO " << menuObjectParameters.requestIso
682  << " ENERGY_OVERFLOW " << menuObjectParameters.energyOverflow
683  << " ET_THRESHOLD " << menuObjectParameters.etThreshold
684  << " ETA_RANGE " << menuObjectParameters.etaRange
685  << " PHI_RANGE " << menuObjectParameters.phiRange
686  << " PHI_LOW " << menuObjectParameters.phiLow
687  << " PHI_HIGH " << menuObjectParameters.phiHigh
688  << " QUALITY_RANGE " << menuObjectParameters.qualityRange
689  << " CHARGE " << menuObjectParameters.charge
690  << std::endl;
691 
692  m_tableMenuObjectParameters.push_back(menuObjectParameters);
693  }
694 
695  if (m_isDebugEnabled) {
696  LogTrace("L1GtTriggerMenuConfigOnlineProd")
697  << "\n Number of rows read from L1T_MENU_OP_VIEW: " << resultsMenuOpRows
698  << std::endl;
699 
700  }
701 
702  return true;
703 
704 }
705 
706 // retrieve table with technical triggers from DB
708  const std::string& gtSchema, const std::string& objectKey) {
709 
710  // select * from CMS_GT.L1T_MENU_TECHTRIG_VIEW
711  // where L1T_MENU_TECHTRIG_VIEW.MENU_IMPLEMENTATION = objectKey
712 
713  const std::vector<std::string>& columnsMenuTechTrig =
714  m_omdsReader.columnNamesView(gtSchema, "L1T_MENU_TECHTRIG_VIEW");
715 
716  if (m_isDebugEnabled) {
717  LogTrace("L1GtTriggerMenuConfigOnlineProd")
718  << "\n List of columns in L1T_MENU_TECHTRIG_VIEW:\n"
719  << std::endl;
720  for (std::vector<std::string>::const_iterator iter =
721  columnsMenuTechTrig.begin(); iter != columnsMenuTechTrig.end(); iter++) {
722  LogTrace("L1GtTriggerMenuConfigOnlineProd") << (*iter) << std::endl;
723 
724  }
725  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n\n" << std::endl;
726  }
727 
728  l1t::OMDSReader::QueryResults resultsMenuTechTrig =
729  m_omdsReader.basicQueryView(columnsMenuTechTrig, gtSchema,
730  "L1T_MENU_TECHTRIG_VIEW",
731  "L1T_MENU_TECHTRIG_VIEW.MENU_IMPLEMENTATION",
732  m_omdsReader.singleAttribute(objectKey));
733 
734  // check if query was successful is based on size of returned list
735  // BUT one can have menus w/o technical triggers - no error for empty list, but a warning!
736  if (resultsMenuTechTrig.queryFailed()) {
737  edm::LogWarning("L1-O2O")
738  << "Warning: Content of L1T_MENU_TECHTRIG_VIEW for L1GtTriggerMenu implementation key: "
739  << "\n " << objectKey << "\nis empty!"
740  << "\nNo technical triggers are found for this menu.";
741 
742  }
743 
744  TableMenuTechTrig menuTechTrig;
745  int resultsMenuTechTrigRows = resultsMenuTechTrig.numberRows();
746 
747  for (int iRow = 0; iRow < resultsMenuTechTrigRows; ++iRow) {
748 
749  for (std::vector<std::string>::const_iterator constIt =
750  columnsMenuTechTrig.begin(); constIt
751  != columnsMenuTechTrig.end(); ++constIt) {
752 
753  if ((*constIt) == "TECHTRIG_INDEX") {
754  resultsMenuTechTrig.fillVariableFromRow(*constIt, iRow,
755  menuTechTrig.bitNumberSh);
756 
757  } else if ((*constIt) == "NAME") {
758  resultsMenuTechTrig.fillVariableFromRow(*constIt, iRow,
759  menuTechTrig.techName);
760 
761  } else {
762  // do nothing
763 
764  }
765 
766  }
767 
768  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "Row " << iRow
769  << ": index = " << menuTechTrig.bitNumberSh << " techName = "
770  << menuTechTrig.techName << std::endl;
771 
772  m_tableMenuTechTrig.push_back(menuTechTrig);
773 
774  }
775 
776  if (m_isDebugEnabled) {
777  LogTrace("L1GtTriggerMenuConfigOnlineProd")
778  << "\n Number of rows read from L1T_MENU_TECHTRIG_VIEW: "
779  << resultsMenuTechTrigRows << std::endl;
780 
781  }
782 
783  return true;
784 
785 }
786 
787 // return for an algorithm with bitNr the mapping between the integer index in logical expression
788 // and the condition name (FK)
789 const std::map<int, std::string> L1GtTriggerMenuConfigOnlineProd::condIndexNameMap(
790  const short bitNr) const {
791 
792  std::map<int, std::string> mapIndexName;
793 
794  for (std::vector<TableMenuAlgoCond>::const_iterator constIt = m_tableMenuAlgoCond.begin(); constIt
795  != m_tableMenuAlgoCond.end(); ++constIt) {
796 
797  if (bitNr == (*constIt).bitNumberSh) {
798  mapIndexName[static_cast<int>((*constIt).condIndexF)] = (*constIt).condFK;
799  }
800 
801  }
802 
803  if (m_isDebugEnabled) {
804 
805  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Bit number : " << bitNr << std::endl;
806 
807  for (std::map<int, std::string>::const_iterator constIt = mapIndexName.begin(); constIt
808  != mapIndexName.end(); ++constIt) {
809 
810  LogTrace("L1GtTriggerMenuConfigOnlineProd") << " Condition index -> name: "
811  << ( ( *constIt ).first ) << " " << ( ( *constIt ).second ) << std::endl;
812 
813  }
814 
815  }
816 
817 
818  return mapIndexName;
819 
820 }
821 
822 // convert a logical expression with indices to a logical expression with names
824  const std::string& expressionIndices, const std::map<int, std::string>& mapCondIndexName) const {
825 
826  std::string expressionNames;
827 
828  L1GtLogicParser parserIndices = L1GtLogicParser(expressionIndices);
829  parserIndices.convertIntToNameLogicalExpression(mapCondIndexName);
830  expressionNames = parserIndices.logicalExpression();
831 
832  return expressionNames;
833 
834 }
835 
836 // return the chip number for an algorithm with index bitNumberSh
837 int L1GtTriggerMenuConfigOnlineProd::chipNumber(short bitNumberSh) const {
838 
839  // FIXME get it from Event Setup
840  const unsigned numberConditionChips = 2;
841  const unsigned pinsOnConditionChip = 96;
842  std::vector<int> orderConditionChip;
843  orderConditionChip.push_back(2);
844  orderConditionChip.push_back(1);
845 
846  int posChip = ( static_cast<unsigned> (bitNumberSh) / pinsOnConditionChip ) + 1;
847  for (unsigned int iChip = 0; iChip < numberConditionChips; ++iChip) {
848  if (posChip == orderConditionChip[iChip]) {
849  return static_cast<int>(iChip);
850  }
851  }
852 
853  // chip number not found
854  return -1;
855 
856 }
857 
858 // build the algorithm map in the menu
860 
861 
862  // temporary value
863  int bitNumber = -1;
864  std::string logicalExpression;
865 
866  // loop over m_tableMenuAlgo
867  for (std::vector<TableMenuAlgo>::const_iterator constIt = m_tableMenuAlgo.begin(); constIt
868  != m_tableMenuAlgo.end(); constIt++) {
869 
870  bitNumber = static_cast<int> ((*constIt).bitNumberSh);
871 
872  const std::map<int, std::string>& condIndexName = condIndexNameMap((*constIt).bitNumberSh);
873  logicalExpression = convertLogicalExpression((*constIt).logExpression, condIndexName);
874 
875  // create a new algorithm and insert it into algorithm map
876  L1GtAlgorithm alg((*constIt).algName, logicalExpression, bitNumber);
877  alg.setAlgoAlias((*constIt).algAlias);
878 
879  // set algorithm chip number:
880  int algChipNr = chipNumber((*constIt).bitNumberSh);
881  alg.setAlgoChipNumber(algChipNr);
882 
883  // insert algorithm
884  m_algorithmMap[(*constIt).algName] = alg;
885  m_algorithmAliasMap[(*constIt).algAlias] = alg;
886 
887  }
888 
889 }
890 
891 // build the technical trigger map in the menu
893 
894  // temporary value
895  int bitNumber = -1;
896  std::string logicalExpression;
897 
898  // loop over m_tableMenuTechTrig
899  for (std::vector<TableMenuTechTrig>::const_iterator constIt =
900  m_tableMenuTechTrig.begin(); constIt != m_tableMenuTechTrig.end(); constIt++) {
901 
902  bitNumber = static_cast<int> ((*constIt).bitNumberSh);
903 
904  // create a new technical trigger and insert it into technical trigger map
905  // technical triggers have L1GtAlgorithm class
906  L1GtAlgorithm techTrig((*constIt).techName, logicalExpression, bitNumber);
907 
908  // chip number set in constructor to -1 - no meaning for technical triggers
909 
910  // insert technical trigger
911  m_technicalTriggerMap[(*constIt).techName] = techTrig;
912 
913  // no alias is defined for technical triggers
914  }
915 
916 }
917 
918 
920  const std::string& strCategory) {
921 
922  if (strCategory == "CondMuon") {
923  return CondMuon;
924  } else if (strCategory == "CondCalo") {
925  return CondCalo;
926  } else if (strCategory == "CondEnergySum") {
927  return CondEnergySum;
928  } else if (strCategory == "CondJetCounts") {
929  return CondJetCounts;
930  } else if (strCategory == "CondCorrelation") {
931  return CondCorrelation;
932  } else if (strCategory == "CondCastor") {
933  return CondCastor;
934  } else if (strCategory == "CondHfBitCounts") {
935  return CondHfBitCounts;
936  } else if (strCategory == "CondHfRingEtSums") {
937  return CondHfRingEtSums;
938  } else if (strCategory == "CondBptx") {
939  return CondBptx;
940  } else if (strCategory == "CondExternal") {
941  return CondExternal;
942  } else if (strCategory == "CondNull") {
943  return CondNull;
944  } else {
945  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
946  << "\n Warning: string " << strCategory
947  << " not defined. Returning CondNull.\n" << std::endl;
948  return CondNull;
949  }
950 
951  return CondNull;
952 
953 }
954 
955 // string to enum L1GtConditionType conversion
957 
958  if (strType == "1s") {
959  return Type1s;
960  } else if (strType == "2s") {
961  return Type2s;
962  } else if (strType == "2wsc") {
963  return Type2wsc;
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
1081 std::list<int> L1GtTriggerMenuConfigOnlineProd::listChipNumber(const std::string& condFK) {
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; // FIXME check correlations
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 
1292  const std::string& opFK, L1GtEnergySumTemplate::ObjectParameter& objPar,
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  // get chip number list, eliminate duplicates
1662  std::list<int> chipList = listChipNumber(condDB.cond);
1663  chipList.sort();
1664  chipList.unique();
1665 
1666  // temporary vectors for sub-conditions
1667  std::vector<L1GtConditionCategory> subcondCategory(nrObj);
1668  std::vector<int> subcondIndex(nrObj);
1669 
1670  bool wrongSubcondition = false;
1671 
1672  for (int iObj = 0; iObj < nrObj; ++iObj) {
1673 
1674  L1GtObject gtObj = objType[iObj];
1675 
1676  // sub-conditions (all have the same condGEq as the correlation condition).
1677  switch (gtObj) {
1678  case Mu: {
1679  subcondCategory.push_back(CondMuon);
1680 
1681  // temporary storage of the parameters
1682  std::vector<L1GtMuonTemplate::ObjectParameter> objParameter(1);
1683 
1684  std::string subcondName;
1685  if (iObj == 0) {
1686  fillMuonObjectParameter(condDB.objectParameter1FK, objParameter[0]);
1687  subcondName = condDB.objectParameter1FK;
1688  } else if (iObj == 1) {
1689  subcondName = condDB.objectParameter2FK;
1690  fillMuonObjectParameter(condDB.objectParameter2FK, objParameter[0]);
1691  }
1692 
1693  L1GtMuonTemplate::CorrelationParameter corrPar; // dummy
1694 
1695  L1GtMuonTemplate subcond(subcondName, Type1s);
1696  subcond.setCondGEq(condDB.condGEq);
1697  subcond.setObjectType(std::vector<L1GtObject> (1, gtObj));
1698  subcond.setConditionParameter(objParameter, corrPar);
1699 
1700  // add the same sub-condition once to every chip where required
1701  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip
1702  != chipList.end(); ++itChip) {
1703 
1704  subcond.setCondChipNr(*itChip);
1705 
1706  // index
1707  subcondIndex[iObj] = ( m_corMuonTemplate[*itChip] ).size() - 1;
1708 
1709  // no check for uniqueness - done by DB
1710  ( m_corMuonTemplate[*itChip] ).push_back(subcond);
1711 
1712  if (m_isDebugEnabled) {
1713  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition "
1714  << ( condDB.cond ) << " on chip " << ( *itChip ) << "\n "
1715  << std::endl;
1716 
1717  LogTrace("L1GtTriggerMenuConfigOnlineProd") << subcond << "\n" << std::endl;
1718  }
1719  }
1720 
1721  }
1722  break;
1723 
1724  case IsoEG:
1725  case NoIsoEG:
1726  case CenJet:
1727  case ForJet:
1728  case TauJet: {
1729 
1730  subcondCategory.push_back(CondCalo);
1731 
1732  // temporary storage of the parameters
1733  std::vector<L1GtCaloTemplate::ObjectParameter> objParameter(1);
1734 
1735  std::string subcondName;
1736  if (iObj == 0) {
1737  fillCaloObjectParameter(condDB.objectParameter1FK, objParameter[0]);
1738  subcondName = condDB.objectParameter1FK;
1739  } else if (iObj == 1) {
1740  subcondName = condDB.objectParameter2FK;
1741  fillCaloObjectParameter(condDB.objectParameter2FK, objParameter[0]);
1742  }
1743 
1744  L1GtCaloTemplate::CorrelationParameter corrPar; // dummy
1745 
1746  L1GtCaloTemplate subcond(subcondName, Type1s);
1747  subcond.setCondGEq(condDB.condGEq);
1748  subcond.setObjectType(std::vector<L1GtObject> (1, gtObj));
1749  subcond.setConditionParameter(objParameter, corrPar);
1750 
1751  // add the same sub-condition once to every chip where required
1752  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip
1753  != chipList.end(); ++itChip) {
1754 
1755  subcond.setCondChipNr(*itChip);
1756 
1757  // index
1758  subcondIndex[iObj] = ( m_corCaloTemplate[*itChip] ).size() - 1;
1759 
1760  // no check for uniqueness - done by DB
1761  ( m_corCaloTemplate[*itChip] ).push_back(subcond);
1762 
1763  if (m_isDebugEnabled) {
1764  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition "
1765  << ( condDB.cond ) << " on chip " << ( *itChip ) << "\n "
1766  << std::endl;
1767 
1768  LogTrace("L1GtTriggerMenuConfigOnlineProd") << subcond << "\n" << std::endl;
1769  }
1770  }
1771  }
1772  break;
1773 
1774  case ETM:
1775  case HTM: {
1776 
1777  subcondCategory.push_back(CondEnergySum);
1778 
1779  // temporary storage of the parameters
1780  std::vector<L1GtEnergySumTemplate::ObjectParameter> objParameter(1);
1781 
1782  std::string subcondName;
1783  if (iObj == 0) {
1784  fillEnergySumObjectParameter(condDB.objectParameter1FK, objParameter[0], gtObj);
1785  subcondName = condDB.objectParameter1FK;
1786  } else if (iObj == 1) {
1787  subcondName = condDB.objectParameter2FK;
1788  fillEnergySumObjectParameter(condDB.objectParameter2FK, objParameter[0], gtObj);
1789  }
1790 
1791  L1GtConditionType condType;
1792 
1793  switch (gtObj) {
1794  case ETM: {
1795  condType = TypeETM;
1796  }
1797  break;
1798  case HTM: {
1799  condType = TypeHTM;
1800  }
1801  break;
1802  default: {
1803  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
1804  << "\n Warning: wrong L1GtConditionType "
1805  << gtObj << std::endl;
1806 
1807  }
1808  break;
1809  }
1810 
1811  L1GtEnergySumTemplate subcond(subcondName, condType);
1812  subcond.setCondGEq(condDB.condGEq);
1813  subcond.setObjectType(std::vector<L1GtObject> (1, gtObj));
1814  subcond.setConditionParameter(objParameter);
1815 
1816  // add the same sub-condition once to every chip where required
1817  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip
1818  != chipList.end(); ++itChip) {
1819 
1820  subcond.setCondChipNr(*itChip);
1821 
1822  // index
1823  subcondIndex[iObj] = ( m_corEnergySumTemplate[*itChip] ).size() - 1;
1824 
1825  // no check for uniqueness - done by DB
1826  ( m_corEnergySumTemplate[*itChip] ).push_back(subcond);
1827 
1828  if (m_isDebugEnabled) {
1829  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition "
1830  << ( condDB.cond ) << " on chip " << ( *itChip ) << "\n "
1831  << std::endl;
1832 
1833  LogTrace("L1GtTriggerMenuConfigOnlineProd") << subcond << "\n" << std::endl;
1834  }
1835  }
1836  }
1837  break;
1838  case ETT:
1839  case HTT:
1840  case JetCounts:
1841  case HfBitCounts:
1842  case HfRingEtSums:
1843  case Castor:
1844  case BPTX:
1845  case GtExternal:
1846  case TechTrig: {
1847  wrongSubcondition = true;
1848  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
1849  << "\n Warning: correlation condition "
1850  << (condDB.cond)
1851  << " with invalid sub-condition object type " << gtObj
1852  << "\n Condition ignored!" << std::endl;
1853  }
1854  default: {
1855  wrongSubcondition = true;
1856  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
1857  << "\n Warning: correlation condition "
1858  << (condDB.cond)
1859  << " with invalid sub-condition object type " << gtObj
1860  << "\n Condition ignored!" << std::endl;
1861 
1862  //
1863 
1864  }
1865  break;
1866  }
1867 
1868  }
1869 
1870  if (wrongSubcondition) {
1871  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
1872  << "\n Warning: wrong sub-condition for correlation condition "
1873  << (condDB.cond)
1874  << "\n Condition not inserted in menu. \n A sub-condition may be left in the menu"
1875  << std::endl;
1876  return;
1877 
1878  }
1879 
1880  // get the correlation parameters for the correlation condition (std::string)
1882  corrParameter.deltaEtaRange = condDB.deltaEtaRange;
1883  corrParameter.deltaPhiRange = condDB.deltaPhiRange;
1884 
1885  // set condition categories
1886  correlationCond.setCond0Category(subcondCategory[0]);
1887  correlationCond.setCond1Category(subcondCategory[1]);
1888 
1889  // set condition indices in correlation vector
1890  correlationCond.setCond0Index(subcondIndex[0]);
1891  correlationCond.setCond1Index(subcondIndex[1]);
1892 
1893  // set correlation parameter
1894  corrParameter.deltaPhiMaxbits = 0; // TODO
1895  correlationCond.setCorrelationParameter(corrParameter);
1896 
1897 
1898  // add the same condition once to every chip where required
1899  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1900 
1901  correlationCond.setCondChipNr(*itChip);
1902 
1903  // no check for uniqueness - done by DB
1904  ( m_vecCorrelationTemplate[*itChip] ).push_back(correlationCond);
1905 
1906  if (m_isDebugEnabled) {
1907  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition " << ( condDB.cond )
1908  << " on chip " << ( *itChip ) << "\n " << std::endl;
1909 
1910  LogTrace("L1GtTriggerMenuConfigOnlineProd") << correlationCond << "\n" << std::endl;
1911  }
1912  }
1913 
1914 }
1915 
1916 
1917 
1918 // add the conditions from a menu to the corresponding list
1920 
1921  // loop over m_tableMenuCond
1922  for (std::vector<TableMenuCond>::const_iterator constIt = m_tableMenuCond.begin(); constIt
1923  != m_tableMenuCond.end(); constIt++) {
1924 
1925  L1GtConditionCategory conCategory = strToEnumCondCategory((*constIt).condCategory);
1926 
1927  switch (conCategory) {
1928  case CondMuon: {
1929 
1930  addMuonCondition(*constIt);
1931 
1932  }
1933  break;
1934  case CondCalo: {
1935 
1936  addCaloCondition(*constIt);
1937 
1938  }
1939  break;
1940  case CondEnergySum: {
1941 
1942  addEnergySumCondition(*constIt);
1943 
1944  }
1945  break;
1946  case CondJetCounts: {
1947  addJetCountsCondition(*constIt);
1948 
1949  }
1950  break;
1951  case CondHfBitCounts: {
1952  addHfBitCountsCondition(*constIt);
1953 
1954  }
1955  break;
1956  case CondHfRingEtSums: {
1957  addHfRingEtSumsCondition(*constIt);
1958 
1959  }
1960  break;
1961  case CondCastor: {
1962 
1963  addCastorCondition(*constIt);
1964 
1965  }
1966  break;
1967  case CondBptx: {
1968 
1969  addBptxCondition(*constIt);
1970 
1971  }
1972  break;
1973  case CondExternal: {
1974 
1975  addExternalCondition(*constIt);
1976 
1977  }
1978  break;
1979  case CondCorrelation: {
1980 
1981  addCorrelationCondition(*constIt);
1982 
1983  }
1984  break;
1985  case CondNull: {
1986 
1987  // do nothing
1988 
1989  }
1990  break;
1991  default: {
1992 
1993  // do nothing
1994 
1995  }
1996  break;
1997  }
1998 
1999  }
2000 
2001 }
2002 
2003 
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
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:70
void fillCaloObjectParameter(const std::string &opFK, L1GtCaloTemplate::ObjectParameter &)
Definition: L1GtFwd.h:53
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
std::vector< std::vector< L1GtCorrelationTemplate > > m_vecCorrelationTemplate
std::vector< std::string > columnNamesView(const std::string &schemaName, const std::string &viewName) const
Definition: OMDSReader.cc:278
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
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)
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
tuple obj
Example code starts here #.
Definition: VarParsing.py:655
virtual boost::shared_ptr< L1GtTriggerMenu > newObject(const std::string &objectKey)
public methods
void setObjectType(const std::vector< L1GtObject > &objType)
Definition: L1GtCondition.h:93
void setCorrelationParameter(const CorrelationParameter &corrParameter)
L1GtConditionType strToEnumCondType(const std::string &strType)
string to enum L1GtConditionType conversion
Definition: L1GtFwd.h:53
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
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
const int verbosity
AlgorithmMap m_technicalTriggerMap
map containing the technical triggers
L1GtConditionType
Definition: L1GtFwd.h:52
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
int chipNumber(short) const
return the chip number for an algorithm with index bitNumberSh
Definition: L1GtFwd.h:53
bool tableMenuGeneralFromDB(const std::string &gtSchema, const std::string &objKey)
methods to retrieve the tables from DB
L1GtConditionCategory
condition categories
Definition: L1GtFwd.h:63
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)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:48
void buildTechnicalTriggerMap()
build the technical trigger map in the menu
Definition: L1GtFwd.h:53
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
void init(const int numberConditionChips)
initialize the class (mainly reserve/resize)
void addHfRingEtSumsCondition(const TableMenuCond &)
std::vector< TableMenuAlgoCond > m_tableMenuAlgoCond
void setCondType(const L1GtConditionType &cType)
Definition: L1GtCondition.h:82
std::vector< std::vector< L1GtEnergySumTemplate > > m_vecEnergySumTemplate
std::vector< std::vector< L1GtEnergySumTemplate > > m_corEnergySumTemplate
L1GtObject
GT objects.
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
tuple size
Write out results.
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
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="") const
Definition: OMDSReader.cc:191
typedef for a single object template
L1GtObject strToEnumL1GtObject(const std::string &strObject)
string to enum L1GtObject conversion