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  // FIXME
1161  // put it back from OMDS when fixing the bool problem
1162  // now, put it hardcoded to 1 - we never used another value up to now
1163  //corrParameter.chargeCorrelation = static_cast<unsigned int> (condDB.chargeCorrelation);
1164  corrParameter.chargeCorrelation = 1;
1165  if (muonCond.wsc()) {
1166  corrParameter.deltaEtaRange = lexical_cast_from_hex<unsigned long long> (
1167  condDB.deltaEtaRange);
1168 
1169  std::string word0;
1170  std::string word1;
1171  splitHexStringInTwo64bitWords(condDB.deltaPhiRange, word0, word1);
1172 
1173  corrParameter.deltaPhiRange0Word = lexical_cast_from_hex<unsigned long long> (word0);
1174  corrParameter.deltaPhiRange1Word = lexical_cast_from_hex<unsigned long long> (word1);
1175 
1176  corrParameter.deltaPhiMaxbits = 0; // FIXME check correlations
1177  }
1178 
1179  muonCond.setConditionParameter(objParameter, corrParameter);
1180 
1181  // get chip number list
1182  std::list<int> chipList = listChipNumber(condDB.cond);
1183 
1184  // eliminate duplicates
1185  chipList.sort();
1186  chipList.unique();
1187 
1188  // add the same condition once to every chip where required
1189  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1190 
1191  muonCond.setCondChipNr(*itChip);
1192 
1193  // no check for uniqueness - done by DB
1194  ( m_vecMuonTemplate[*itChip] ).push_back(muonCond);
1195 
1196  if (m_isDebugEnabled) {
1197  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition " << ( condDB.cond )
1198  << " on chip " << ( *itChip ) << "\n " << std::endl;
1199 
1200  LogTrace("L1GtTriggerMenuConfigOnlineProd") << muonCond << "\n" << std::endl;
1201  }
1202  }
1203 
1204 }
1205 
1207  const std::string& opFK, L1GtCaloTemplate::ObjectParameter& objPar) {
1208 
1209  // loop over m_tableMenuCond
1210  for (std::vector<TableMenuObjectParameters>::const_iterator constIt =
1211  m_tableMenuObjectParameters.begin(); constIt != m_tableMenuObjectParameters.end(); constIt++) {
1212 
1213  if (opFK == ( *constIt ).opId) {
1214  objPar.etThreshold = static_cast<unsigned int> ( ( *constIt ).etThreshold);
1215  objPar.etaRange = lexical_cast_from_hex<unsigned int> ( ( *constIt ).etaRange);
1216  objPar.phiRange = lexical_cast_from_hex<unsigned int> ( ( *constIt ).phiRange);
1217 
1218  // can break after it is found - DB consistency
1219  break;
1220  }
1221  }
1222 
1223 }
1224 
1226 
1227  L1GtCaloTemplate caloCond(condDB.cond);
1228  caloCond.setCondType(strToEnumCondType(condDB.condType));
1229 
1230  // object types - all have the same type, so reading it for first object is OK
1231  int nrObj = caloCond.nrObjects();
1232 
1234  std::vector<L1GtObject> objType(nrObj, obj);
1235  caloCond.setObjectType(objType);
1236 
1237  caloCond.setCondGEq(condDB.condGEq);
1238 
1239  // temporary storage of the parameters
1240  std::vector<L1GtCaloTemplate::ObjectParameter> objParameter(nrObj);
1241 
1242  for (int iObj = 0; iObj < nrObj; ++iObj) {
1243  if (iObj == 0) {
1244  fillCaloObjectParameter(condDB.objectParameter1FK, objParameter[iObj]);
1245  } else if (iObj == 1) {
1246  fillCaloObjectParameter(condDB.objectParameter2FK, objParameter[iObj]);
1247  } else if (iObj == 2) {
1248  fillCaloObjectParameter(condDB.objectParameter3FK, objParameter[iObj]);
1249  } else if (iObj == 3) {
1250  fillCaloObjectParameter(condDB.objectParameter4FK, objParameter[iObj]);
1251  } else {
1252  LogTrace("L1GtTriggerMenuConfigOnlineProd")
1253  << "\n Warning: number of objects requested " << nrObj
1254  << " not available in DB." << "\n Maximum 4 object parameters implemented. \n"
1255  << std::endl;
1256  }
1257  }
1258 
1260  if (caloCond.wsc()) {
1261  corrParameter.deltaEtaRange = lexical_cast_from_hex<unsigned long long> (
1262  condDB.deltaEtaRange);
1263 
1264  corrParameter.deltaPhiRange = lexical_cast_from_hex<unsigned long long> (
1265  condDB.deltaPhiRange);
1266  corrParameter.deltaPhiMaxbits = 0; // FIXME check correlations
1267  }
1268 
1269  caloCond.setConditionParameter(objParameter, corrParameter);
1270 
1271  // get chip number list
1272  std::list<int> chipList = listChipNumber(condDB.cond);
1273 
1274  // eliminate duplicates
1275  chipList.sort();
1276  chipList.unique();
1277 
1278  // add the same condition once to every chip where required
1279  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1280 
1281  caloCond.setCondChipNr(*itChip);
1282 
1283  // no check for uniqueness - done by DB
1284  ( m_vecCaloTemplate[*itChip] ).push_back(caloCond);
1285 
1286  if (m_isDebugEnabled) {
1287  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition " << ( condDB.cond )
1288  << " on chip " << ( *itChip ) << "\n " << std::endl;
1289 
1290  LogTrace("L1GtTriggerMenuConfigOnlineProd") << caloCond << "\n" << std::endl;
1291  }
1292  }
1293 
1294 }
1295 
1298  const L1GtObject& obj) {
1299 
1300  // loop over m_tableMenuCond
1301  for (std::vector<TableMenuObjectParameters>::const_iterator constIt =
1302  m_tableMenuObjectParameters.begin(); constIt != m_tableMenuObjectParameters.end(); constIt++) {
1303 
1304  if (opFK == ( *constIt ).opId) {
1305  objPar.etThreshold = static_cast<unsigned int> ( ( *constIt ).etThreshold);
1306  objPar.energyOverflow = static_cast<bool> ( ( *constIt ).energyOverflow); // not used
1307 
1308  std::string word0;
1309  std::string word1;
1310  splitHexStringInTwo64bitWords( ( *constIt ).phiRange, word0, word1);
1311 
1312  if (obj == ETM) {
1313  objPar.phiRange0Word = lexical_cast_from_hex<unsigned long long> (word0);
1314  objPar.phiRange1Word = lexical_cast_from_hex<unsigned long long> (word1);
1315 
1316  } else if (obj == HTM) {
1317  objPar.phiRange0Word = lexical_cast_from_hex<unsigned long long> (word0);
1318  }
1319 
1320  // can break after it is found - DB consistency
1321  break;
1322  }
1323  }
1324 
1325 }
1326 
1328 
1329  L1GtEnergySumTemplate esumCond(condDB.cond);
1330  esumCond.setCondType(strToEnumCondType(condDB.condType));
1331 
1332  // object types - all energy sums are global - so 1 object
1333  int nrObj = 1;
1334 
1336  std::vector<L1GtObject> objType(nrObj, obj);
1337  esumCond.setObjectType(objType);
1338 
1339  esumCond.setCondGEq(condDB.condGEq);
1340 
1341  // temporary storage of the parameters - no CorrelationParameter
1342  std::vector<L1GtEnergySumTemplate::ObjectParameter> objParameter(nrObj);
1343  fillEnergySumObjectParameter(condDB.objectParameter1FK, objParameter[0], objType[0]);
1344 
1345  esumCond.setConditionParameter(objParameter);
1346 
1347  // get chip number list
1348  std::list<int> chipList = listChipNumber(condDB.cond);
1349 
1350  // eliminate duplicates
1351  chipList.sort();
1352  chipList.unique();
1353 
1354  // add the same condition once to every chip where required
1355  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1356 
1357  esumCond.setCondChipNr(*itChip);
1358 
1359  // no check for uniqueness - done by DB
1360  ( m_vecEnergySumTemplate[*itChip] ).push_back(esumCond);
1361 
1362  if (m_isDebugEnabled) {
1363  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition " << ( condDB.cond )
1364  << " on chip " << ( *itChip ) << "\n " << std::endl;
1365 
1366  LogTrace("L1GtTriggerMenuConfigOnlineProd") << esumCond << "\n" << std::endl;
1367  }
1368  }
1369 
1370 }
1371 
1372 
1374 
1375  L1GtJetCountsTemplate jcCond(condDB.cond);
1376  jcCond.setCondType(strToEnumCondType(condDB.condType));
1377 
1378  // object types - jet counts are "global"
1379  int nrObj = 1;
1380 
1382  std::vector<L1GtObject> objType(nrObj, obj);
1383  jcCond.setObjectType(objType);
1384 
1385  jcCond.setCondGEq(condDB.condGEq);
1386 
1387  // temporary storage of the parameters - no CorrelationParameter
1388  // for counts, the DB implementation is without OP, directly in TableMenuCond
1389  std::vector<L1GtJetCountsTemplate::ObjectParameter> objParameter(nrObj);
1390  objParameter.at(0).countIndex = static_cast<unsigned int>(condDB.countIndex);
1391  objParameter.at(0).countThreshold = static_cast<unsigned int>(condDB.countThreshold);
1392  objParameter.at(0).countOverflow = false ; // not used
1393 
1394  jcCond.setConditionParameter(objParameter);
1395 
1396  // get chip number list
1397  std::list<int> chipList = listChipNumber(condDB.cond);
1398 
1399  // eliminate duplicates
1400  chipList.sort();
1401  chipList.unique();
1402 
1403  // add the same condition once to every chip where required
1404  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1405 
1406  jcCond.setCondChipNr(*itChip);
1407 
1408  // no check for uniqueness - done by DB
1409  ( m_vecJetCountsTemplate[*itChip] ).push_back(jcCond);
1410 
1411  if (m_isDebugEnabled) {
1412  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition " << ( condDB.cond )
1413  << " on chip " << ( *itChip ) << "\n " << std::endl;
1414 
1415  LogTrace("L1GtTriggerMenuConfigOnlineProd") << jcCond << "\n" << std::endl;
1416  }
1417  }
1418 
1419 }
1420 
1422 
1423  L1GtHfBitCountsTemplate countsCond(condDB.cond);
1424  countsCond.setCondType(strToEnumCondType(condDB.condType));
1425 
1426  // object types - HF bit counts are "global"
1427  int nrObj = 1;
1428 
1430  std::vector<L1GtObject> objType(nrObj, obj);
1431  countsCond.setObjectType(objType);
1432 
1433  countsCond.setCondGEq(condDB.condGEq);
1434 
1435  // temporary storage of the parameters - no CorrelationParameter
1436  // for counts, the DB implementation is without OP, directly in TableMenuCond
1437  std::vector<L1GtHfBitCountsTemplate::ObjectParameter> objParameter(nrObj);
1438  objParameter.at(0).countIndex = static_cast<unsigned int>(condDB.countIndex);
1439  objParameter.at(0).countThreshold = static_cast<unsigned int>(condDB.countThreshold);
1440 
1441  countsCond.setConditionParameter(objParameter);
1442 
1443  // get chip number list
1444  std::list<int> chipList = listChipNumber(condDB.cond);
1445 
1446  // eliminate duplicates
1447  chipList.sort();
1448  chipList.unique();
1449 
1450  // add the same condition once to every chip where required
1451  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1452 
1453  countsCond.setCondChipNr(*itChip);
1454 
1455  // no check for uniqueness - done by DB
1456  ( m_vecHfBitCountsTemplate[*itChip] ).push_back(countsCond);
1457 
1458  if (m_isDebugEnabled) {
1459  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition " << ( condDB.cond )
1460  << " on chip " << ( *itChip ) << "\n " << std::endl;
1461 
1462  LogTrace("L1GtTriggerMenuConfigOnlineProd") << countsCond << "\n" << std::endl;
1463  }
1464  }
1465 
1466 }
1467 
1469 
1470  L1GtHfRingEtSumsTemplate esumCond(condDB.cond);
1471  esumCond.setCondType(strToEnumCondType(condDB.condType));
1472 
1473  // object types - HF energy sums are "global"
1474  int nrObj = 1;
1475 
1477  std::vector<L1GtObject> objType(nrObj, obj);
1478  esumCond.setObjectType(objType);
1479 
1480  esumCond.setCondGEq(condDB.condGEq);
1481 
1482  // temporary storage of the parameters - no CorrelationParameter
1483  // for HF energy sums, the DB implementation is without OP, directly in TableMenuCond
1484  std::vector<L1GtHfRingEtSumsTemplate::ObjectParameter> objParameter(nrObj);
1485  objParameter.at(0).etSumIndex = static_cast<unsigned int>(condDB.countIndex);
1486  objParameter.at(0).etSumThreshold = static_cast<unsigned int>(condDB.countThreshold);
1487 
1488  esumCond.setConditionParameter(objParameter);
1489 
1490  // get chip number list
1491  std::list<int> chipList = listChipNumber(condDB.cond);
1492 
1493  // eliminate duplicates
1494  chipList.sort();
1495  chipList.unique();
1496 
1497  // add the same condition once to every chip where required
1498  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1499 
1500  esumCond.setCondChipNr(*itChip);
1501 
1502  // no check for uniqueness - done by DB
1503  ( m_vecHfRingEtSumsTemplate[*itChip] ).push_back(esumCond);
1504 
1505  if (m_isDebugEnabled) {
1506  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition " << ( condDB.cond )
1507  << " on chip " << ( *itChip ) << "\n " << std::endl;
1508 
1509  LogTrace("L1GtTriggerMenuConfigOnlineProd") << esumCond << "\n" << std::endl;
1510  }
1511  }
1512 
1513 }
1514 
1516 
1517  L1GtCastorTemplate castorCond(condDB.cond);
1518  castorCond.setCondType(strToEnumCondType(condDB.condType));
1519 
1520  // object types - logical conditions have no objects associated in GT
1521  // one put however a "Castor" object type
1522  int nrObj = 1;
1523 
1525  std::vector<L1GtObject> objType(nrObj, obj);
1526  castorCond.setObjectType(objType);
1527 
1528  // irrelevant, set to false for completeness
1529  castorCond.setCondGEq(false);
1530 
1531  // logical conditions have no ObjectParameter, no CorrelationParameter
1532 
1533  // get chip number list
1534  std::list<int> chipList = listChipNumber(condDB.cond);
1535 
1536  // eliminate duplicates
1537  chipList.sort();
1538  chipList.unique();
1539 
1540  // add the same condition once to every chip where required
1541  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1542 
1543  castorCond.setCondChipNr(*itChip);
1544 
1545  // no check for uniqueness - done by DB
1546  ( m_vecCastorTemplate[*itChip] ).push_back(castorCond);
1547 
1548  if (m_isDebugEnabled) {
1549  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition " << ( condDB.cond )
1550  << " on chip " << ( *itChip ) << "\n " << std::endl;
1551 
1552  LogTrace("L1GtTriggerMenuConfigOnlineProd") << castorCond << "\n" << std::endl;
1553  }
1554  }
1555 
1556 }
1557 
1559 
1560  L1GtBptxTemplate bptxCond(condDB.cond);
1561  bptxCond.setCondType(strToEnumCondType(condDB.condType));
1562 
1563  // object types - logical conditions have no objects associated in GT
1564  // one put however a "Bptx" object type
1565  int nrObj = 1;
1566 
1568  std::vector<L1GtObject> objType(nrObj, obj);
1569  bptxCond.setObjectType(objType);
1570 
1571  // irrelevant, set to false for completeness
1572  bptxCond.setCondGEq(false);
1573 
1574  // logical conditions have no ObjectParameter, no CorrelationParameter
1575 
1576  // get chip number list
1577  std::list<int> chipList = listChipNumber(condDB.cond);
1578 
1579 
1580 
1581  // eliminate duplicates
1582  chipList.sort();
1583  chipList.unique();
1584 
1585  // add the same condition once to every chip where required
1586  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1587 
1588  bptxCond.setCondChipNr(*itChip);
1589 
1590  // no check for uniqueness - done by DB
1591  ( m_vecBptxTemplate[*itChip] ).push_back(bptxCond);
1592 
1593  if (m_isDebugEnabled) {
1594  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition " << ( condDB.cond )
1595  << " on chip " << ( *itChip ) << "\n " << std::endl;
1596 
1597  LogTrace("L1GtTriggerMenuConfigOnlineProd") << bptxCond << "\n" << std::endl;
1598  }
1599  }
1600 
1601 }
1602 
1604 
1605  L1GtExternalTemplate externalCond(condDB.cond);
1606  externalCond.setCondType(strToEnumCondType(condDB.condType));
1607 
1608  // object types - logical conditions have no objects associated in GT
1609  // one put however a "External" object type
1610  int nrObj = 1;
1611 
1613  std::vector<L1GtObject> objType(nrObj, obj);
1614  externalCond.setObjectType(objType);
1615 
1616  // irrelevant, set to false for completeness
1617  externalCond.setCondGEq(false);
1618 
1619  // logical conditions have no ObjectParameter, no CorrelationParameter
1620 
1621  // get chip number list
1622  std::list<int> chipList = listChipNumber(condDB.cond);
1623 
1624 
1625 
1626  // eliminate duplicates
1627  chipList.sort();
1628  chipList.unique();
1629 
1630  // add the same condition once to every chip where required
1631  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1632 
1633  externalCond.setCondChipNr(*itChip);
1634 
1635  // no check for uniqueness - done by DB
1636  ( m_vecExternalTemplate[*itChip] ).push_back(externalCond);
1637 
1638  if (m_isDebugEnabled) {
1639  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition " << ( condDB.cond )
1640  << " on chip " << ( *itChip ) << "\n " << std::endl;
1641 
1642  LogTrace("L1GtTriggerMenuConfigOnlineProd") << externalCond << "\n" << std::endl;
1643  }
1644  }
1645 
1646 }
1647 
1649 
1650  // create a new correlation condition
1651  L1GtCorrelationTemplate correlationCond(condDB.cond);
1652  correlationCond.setCondType(strToEnumCondType(condDB.condType));
1653 
1654  // two objects (for sure) - type taken from DB
1655  const int nrObj = 2;
1656 
1657  std::vector<L1GtObject> objType(nrObj);
1659  objType[0] = obj;
1660 
1661  obj = strToEnumL1GtObject(condDB.gtObject2);
1662  objType[1] = obj;
1663 
1664  correlationCond.setObjectType(objType);
1665 
1666  // irrelevant, it is set for each subcondition
1667  correlationCond.setCondGEq(condDB.condGEq);
1668 
1669  // get chip number list, eliminate duplicates
1670  std::list<int> chipList = listChipNumber(condDB.cond);
1671  chipList.sort();
1672  chipList.unique();
1673 
1674  // temporary vectors for sub-conditions
1675  std::vector<L1GtConditionCategory> subcondCategory(nrObj);
1676  std::vector<int> subcondIndex(nrObj);
1677 
1678  bool wrongSubcondition = false;
1679 
1680  for (int iObj = 0; iObj < nrObj; ++iObj) {
1681 
1682  L1GtObject gtObj = objType[iObj];
1683 
1684  // sub-conditions (all have the same condGEq as the correlation condition).
1685  switch (gtObj) {
1686  case Mu: {
1687  subcondCategory[iObj] = CondMuon;
1688 
1689  // temporary storage of the parameters
1690  std::vector<L1GtMuonTemplate::ObjectParameter> objParameter(1);
1691 
1692  std::string subcondName;
1693  if (iObj == 0) {
1694  fillMuonObjectParameter(condDB.objectParameter1FK, objParameter[0]);
1695  subcondName = condDB.objectParameter1FK;
1696  } else if (iObj == 1) {
1697  subcondName = condDB.objectParameter2FK;
1698  fillMuonObjectParameter(condDB.objectParameter2FK, objParameter[0]);
1699  }
1700 
1701  // chargeCorrelation must be set for muons
1702  // FIXME check with the hardware if the charge for muons can be used
1703  // till then, put it to ignore
1705  corrPar.chargeCorrelation = 1;
1706 
1707  L1GtMuonTemplate subcond(subcondName, Type1s);
1708  subcond.setCondGEq(condDB.condGEq);
1709  subcond.setObjectType(std::vector<L1GtObject> (1, gtObj));
1710  subcond.setConditionParameter(objParameter, corrPar);
1711 
1712  // add the same sub-condition once to every chip where required
1713  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip
1714  != chipList.end(); ++itChip) {
1715 
1716  subcond.setCondChipNr(*itChip);
1717 
1718  // no check for uniqueness - done by DB
1719  ( m_corMuonTemplate[*itChip] ).push_back(subcond);
1720 
1721  // index
1722  subcondIndex[iObj] = ( m_corMuonTemplate[*itChip] ).size() - 1;
1723 
1724  if (m_isDebugEnabled) {
1725  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition "
1726  << ( condDB.cond ) << " on chip " << ( *itChip ) << "\n "
1727  << std::endl;
1728 
1729  LogTrace("L1GtTriggerMenuConfigOnlineProd") << subcond << "\n" << std::endl;
1730  }
1731  }
1732 
1733  }
1734  break;
1735 
1736  case IsoEG:
1737  case NoIsoEG:
1738  case CenJet:
1739  case ForJet:
1740  case TauJet: {
1741 
1742  subcondCategory[iObj] = CondCalo;
1743 
1744  // temporary storage of the parameters
1745  std::vector<L1GtCaloTemplate::ObjectParameter> objParameter(1);
1746 
1747  std::string subcondName;
1748  if (iObj == 0) {
1749  fillCaloObjectParameter(condDB.objectParameter1FK, objParameter[0]);
1750  subcondName = condDB.objectParameter1FK;
1751  } else if (iObj == 1) {
1752  subcondName = condDB.objectParameter2FK;
1753  fillCaloObjectParameter(condDB.objectParameter2FK, objParameter[0]);
1754  }
1755 
1756  L1GtCaloTemplate::CorrelationParameter corrPar; // dummy
1757 
1758  L1GtCaloTemplate subcond(subcondName, Type1s);
1759  subcond.setCondGEq(condDB.condGEq);
1760  subcond.setObjectType(std::vector<L1GtObject> (1, gtObj));
1761  subcond.setConditionParameter(objParameter, corrPar);
1762 
1763  // add the same sub-condition once to every chip where required
1764  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip
1765  != chipList.end(); ++itChip) {
1766 
1767  subcond.setCondChipNr(*itChip);
1768 
1769  // no check for uniqueness - done by DB
1770  ( m_corCaloTemplate[*itChip] ).push_back(subcond);
1771 
1772  // index
1773  subcondIndex[iObj] = ( m_corCaloTemplate[*itChip] ).size() - 1;
1774 
1775  if (m_isDebugEnabled) {
1776  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition "
1777  << ( condDB.cond ) << " on chip " << ( *itChip ) << "\n "
1778  << std::endl;
1779 
1780  LogTrace("L1GtTriggerMenuConfigOnlineProd") << subcond << "\n" << std::endl;
1781  }
1782  }
1783  }
1784  break;
1785 
1786  case ETM:
1787  case HTM: {
1788 
1789  subcondCategory[iObj] = CondEnergySum;
1790 
1791  // temporary storage of the parameters
1792  std::vector<L1GtEnergySumTemplate::ObjectParameter> objParameter(1);
1793 
1794  std::string subcondName;
1795  if (iObj == 0) {
1796  fillEnergySumObjectParameter(condDB.objectParameter1FK, objParameter[0], gtObj);
1797  subcondName = condDB.objectParameter1FK;
1798  } else if (iObj == 1) {
1799  subcondName = condDB.objectParameter2FK;
1800  fillEnergySumObjectParameter(condDB.objectParameter2FK, objParameter[0], gtObj);
1801  }
1802 
1803  L1GtConditionType condType;
1804 
1805  switch (gtObj) {
1806  case ETM: {
1807  condType = TypeETM;
1808  }
1809  break;
1810  case HTM: {
1811  condType = TypeHTM;
1812  }
1813  break;
1814  default: {
1815  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
1816  << "\n Warning: wrong L1GtConditionType "
1817  << gtObj << std::endl;
1818 
1819  }
1820  break;
1821  }
1822 
1823  L1GtEnergySumTemplate subcond(subcondName, condType);
1824  subcond.setCondGEq(condDB.condGEq);
1825  subcond.setObjectType(std::vector<L1GtObject> (1, gtObj));
1826  subcond.setConditionParameter(objParameter);
1827 
1828  // add the same sub-condition once to every chip where required
1829  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip
1830  != chipList.end(); ++itChip) {
1831 
1832  subcond.setCondChipNr(*itChip);
1833 
1834  // no check for uniqueness - done by DB
1835  ( m_corEnergySumTemplate[*itChip] ).push_back(subcond);
1836 
1837  // index
1838  subcondIndex[iObj] = ( m_corEnergySumTemplate[*itChip] ).size() - 1;
1839 
1840  if (m_isDebugEnabled) {
1841  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition "
1842  << ( condDB.cond ) << " on chip " << ( *itChip ) << "\n "
1843  << std::endl;
1844 
1845  LogTrace("L1GtTriggerMenuConfigOnlineProd") << subcond << "\n" << std::endl;
1846  }
1847  }
1848  }
1849  break;
1850  case ETT:
1851  case HTT:
1852  case JetCounts:
1853  case HfBitCounts:
1854  case HfRingEtSums:
1855  case Castor:
1856  case BPTX:
1857  case GtExternal:
1858  case TechTrig: {
1859  wrongSubcondition = true;
1860  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
1861  << "\n Warning: correlation condition "
1862  << (condDB.cond)
1863  << " with invalid sub-condition object type " << gtObj
1864  << "\n Condition ignored!" << std::endl;
1865  }
1866  default: {
1867  wrongSubcondition = true;
1868  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
1869  << "\n Warning: correlation condition "
1870  << (condDB.cond)
1871  << " with invalid sub-condition object type " << gtObj
1872  << "\n Condition ignored!" << std::endl;
1873 
1874  //
1875 
1876  }
1877  break;
1878  }
1879 
1880  }
1881 
1882  if (wrongSubcondition) {
1883  edm::LogWarning("L1GtTriggerMenuConfigOnlineProd")
1884  << "\n Warning: wrong sub-condition for correlation condition "
1885  << (condDB.cond)
1886  << "\n Condition not inserted in menu. \n A sub-condition may be left in the menu"
1887  << std::endl;
1888  return;
1889 
1890  }
1891 
1892  // get the correlation parameters for the correlation condition (std::string)
1894  corrParameter.deltaEtaRange = condDB.deltaEtaRange;
1895  corrParameter.deltaPhiRange = condDB.deltaPhiRange;
1896 
1897  // set condition categories
1898  correlationCond.setCond0Category(subcondCategory[0]);
1899  correlationCond.setCond1Category(subcondCategory[1]);
1900 
1901  // set condition indices in correlation vector
1902  correlationCond.setCond0Index(subcondIndex[0]);
1903  correlationCond.setCond1Index(subcondIndex[1]);
1904 
1905  // set correlation parameter
1906  corrParameter.deltaPhiMaxbits = 0; // TODO
1907  correlationCond.setCorrelationParameter(corrParameter);
1908 
1909 
1910  // add the same condition once to every chip where required
1911  for (std::list<int>::const_iterator itChip = chipList.begin(); itChip != chipList.end(); ++itChip) {
1912 
1913  correlationCond.setCondChipNr(*itChip);
1914 
1915  // no check for uniqueness - done by DB
1916  ( m_vecCorrelationTemplate[*itChip] ).push_back(correlationCond);
1917 
1918  if (m_isDebugEnabled) {
1919  LogTrace("L1GtTriggerMenuConfigOnlineProd") << "\n Adding condition " << ( condDB.cond )
1920  << " on chip " << ( *itChip ) << "\n " << std::endl;
1921 
1922  LogTrace("L1GtTriggerMenuConfigOnlineProd") << correlationCond << "\n" << std::endl;
1923  }
1924  }
1925 
1926 }
1927 
1928 
1929 
1930 // add the conditions from a menu to the corresponding list
1932 
1933  // loop over m_tableMenuCond
1934  for (std::vector<TableMenuCond>::const_iterator constIt = m_tableMenuCond.begin(); constIt
1935  != m_tableMenuCond.end(); constIt++) {
1936 
1937  L1GtConditionCategory conCategory = strToEnumCondCategory((*constIt).condCategory);
1938 
1939  switch (conCategory) {
1940  case CondMuon: {
1941 
1942  addMuonCondition(*constIt);
1943 
1944  }
1945  break;
1946  case CondCalo: {
1947 
1948  addCaloCondition(*constIt);
1949 
1950  }
1951  break;
1952  case CondEnergySum: {
1953 
1954  addEnergySumCondition(*constIt);
1955 
1956  }
1957  break;
1958  case CondJetCounts: {
1959  addJetCountsCondition(*constIt);
1960 
1961  }
1962  break;
1963  case CondHfBitCounts: {
1964  addHfBitCountsCondition(*constIt);
1965 
1966  }
1967  break;
1968  case CondHfRingEtSums: {
1969  addHfRingEtSumsCondition(*constIt);
1970 
1971  }
1972  break;
1973  case CondCastor: {
1974 
1975  addCastorCondition(*constIt);
1976 
1977  }
1978  break;
1979  case CondBptx: {
1980 
1981  addBptxCondition(*constIt);
1982 
1983  }
1984  break;
1985  case CondExternal: {
1986 
1987  addExternalCondition(*constIt);
1988 
1989  }
1990  break;
1991  case CondCorrelation: {
1992 
1993  addCorrelationCondition(*constIt);
1994 
1995  }
1996  break;
1997  case CondNull: {
1998 
1999  // do nothing
2000 
2001  }
2002  break;
2003  default: {
2004 
2005  // do nothing
2006 
2007  }
2008  break;
2009  }
2010 
2011  }
2012 
2013 }
2014 
2015 
const std::map< int, std::string > condIndexNameMap(const short bitNr) const
std::string logicalExpression() const
return the logical expression
bool isDebugEnabled()
L1GtTriggerMenuConfigOnlineProd(const edm::ParameterSet &)
constructor
void fillMuonObjectParameter(const std::string &opFK, L1GtMuonTemplate::ObjectParameter &)
bool tableMenuAlgoCondFromDB(const std::string &gtSchema, const std::string &objKey)
retrieve table with conditions associated to physics algorithms from DB
const int nrObjects() const
get number of trigger objects
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:311
Definition: L1GtObject.h:39
void setCond1Category(const L1GtConditionCategory &)
bool tableMenuAlgoFromDB(const std::string &gtSchema, const std::string &objKey)
retrieve table with physics algorithms from DB
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:295
void setAlgoAlias(const std::string &algoAliasValue)
Definition: L1GtAlgorithm.h:72
Definition: L1GtObject.h:36
void fillCaloObjectParameter(const std::string &opFK, L1GtCaloTemplate::ObjectParameter &)
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
std::vector< std::vector< L1GtCorrelationTemplate > > m_vecCorrelationTemplate
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
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:319
L1GtConditionCategory
condition categories
std::vector< TableMenuTechTrig > m_tableMenuTechTrig
std::string convertLogicalExpression(const std::string &, const std::map< int, std::string > &) const
convert a logical expression with indices to a logical expression with names
typedef for a single object template
typedef for correlation parameters
void addConditions()
add the conditions from a menu to the corresponding list
std::list< int > listChipNumber(const std::string &)
get a list of chip numbers from the m_tableMenuAlgoCond table for a condition
#define LogTrace(id)
bool tableMenuTechTrigFromDB(const std::string &gtSchema, const std::string &objKey)
retrieve table with technical triggers from DB
AlgorithmMap m_technicalTriggerMap
map containing the technical triggers
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
int chipNumber(short) const
return the chip number for an algorithm with index bitNumberSh
bool tableMenuGeneralFromDB(const std::string &gtSchema, const std::string &objKey)
methods to retrieve the tables from DB
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)
#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
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
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