CMS 3D CMS Logo

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