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