CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GtAnalyzer.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <memory>
20 #include <iomanip>
21 
22 // user include files
27 
29 
33 
36 
39 
41 
42 // constructor(s)
44 
45  m_retrieveL1Extra(
46  parSet.getParameter<edm::ParameterSet> ("L1ExtraInputTags"),consumesCollector()),
47 
48  m_printOutput(parSet.getUntrackedParameter<int>("PrintOutput", 3)),
49 
50  m_analyzeDecisionReadoutRecordEnable(parSet.getParameter<bool> ("analyzeDecisionReadoutRecordEnable")),
51  //
52  m_analyzeL1GtUtilsMenuLiteEnable(parSet.getParameter<bool> ("analyzeL1GtUtilsMenuLiteEnable")),
53  m_analyzeL1GtUtilsEventSetupEnable(parSet.getParameter<bool> ("analyzeL1GtUtilsEventSetupEnable")),
54  m_analyzeL1GtUtilsEnable(parSet.getParameter<bool> ("analyzeL1GtUtilsEnable")),
55  m_analyzeTriggerEnable(parSet.getParameter<bool> ("analyzeTriggerEnable")),
56  //
57  m_analyzeObjectMapEnable(parSet.getParameter<bool> ("analyzeObjectMapEnable")),
58  //
59  m_analyzeL1GtTriggerMenuLiteEnable(parSet.getParameter<bool> ("analyzeL1GtTriggerMenuLiteEnable")),
60  //
61  m_analyzeConditionsInRunBlockEnable(parSet.getParameter<bool> ("analyzeConditionsInRunBlockEnable")),
62  m_analyzeConditionsInLumiBlockEnable(parSet.getParameter<bool> ("analyzeConditionsInLumiBlockEnable")),
63  m_analyzeConditionsInEventBlockEnable(parSet.getParameter<bool> ("analyzeConditionsInEventBlockEnable")),
64 
65 
66  // input tag for GT DAQ product
67  m_l1GtDaqReadoutRecordInputTag(parSet.getParameter<edm::InputTag>(
68  "L1GtDaqReadoutRecordInputTag")),
69 
70  // input tag for L1GlobalTriggerRecord
71  m_l1GtRecordInputTag(parSet.getParameter<edm::InputTag>(
72  "L1GtRecordInputTag")),
73 
74  // input tag for GT object map collection L1GlobalTriggerObjectMapRecord
75  m_l1GtObjectMapTag(parSet.getParameter<edm::InputTag>(
76  "L1GtObjectMapTag")),
77 
78  // input tag for GT object map collection L1GlobalTriggerObjectMaps
79  m_l1GtObjectMapsInputTag(parSet.getParameter<edm::InputTag>(
80  "L1GtObjectMapsInputTag")),
81 
82  // input tag for muon collection from GMT
83  m_l1GmtInputTag(parSet.getParameter<edm::InputTag>(
84  "L1GmtInputTag")),
85 
86  // input tag for L1GtTriggerMenuLite
87  m_l1GtTmLInputTag(parSet.getParameter<edm::InputTag> (
88  "L1GtTmLInputTag")),
89 
90  // input tag for ConditionInEdm products
91  m_condInEdmInputTag(parSet.getParameter<edm::InputTag> (
92  "CondInEdmInputTag")),
93 
94  // an algorithm and a condition in that algorithm to test the object maps
95  m_nameAlgTechTrig(parSet.getParameter<std::string> ("AlgorithmName")),
96  m_condName(parSet.getParameter<std::string> ("ConditionName")),
97  m_bitNumber(parSet.getParameter<unsigned int> ("BitNumber")),
98 
99  m_l1GtUtilsConfiguration(parSet.getParameter<unsigned int> ("L1GtUtilsConfiguration")),
100  m_l1GtTmLInputTagProv(parSet.getParameter<bool> ("L1GtTmLInputTagProv")),
101  m_l1GtRecordsInputTagProv(parSet.getParameter<bool> ("L1GtRecordsInputTagProv")),
102  m_l1GtUtilsConfigureBeginRun(parSet.getParameter<bool> ("L1GtUtilsConfigureBeginRun")),
103  m_l1GtUtilsLogicalExpression(parSet.getParameter<std::string>("L1GtUtilsLogicalExpression")),
104  m_l1GtUtilsProv(parSet,
105  consumesCollector(),
106  m_l1GtUtilsConfiguration == 0 || m_l1GtUtilsConfiguration == 100000,
107  *this,
108  edm::InputTag(),
109  edm::InputTag(),
110  m_l1GtTmLInputTagProv ? edm::InputTag() : m_l1GtTmLInputTag),
111  m_l1GtUtils(parSet,
112  consumesCollector(),
113  m_l1GtUtilsConfiguration == 0 || m_l1GtUtilsConfiguration == 100000,
114  *this,
115  m_l1GtRecordInputTag,
116  m_l1GtDaqReadoutRecordInputTag,
117  m_l1GtTmLInputTagProv ? edm::InputTag() : m_l1GtTmLInputTag),
118  m_logicalExpressionL1ResultsProv(m_l1GtUtilsLogicalExpression, m_l1GtUtilsProv),
119  m_logicalExpressionL1Results(m_l1GtUtilsLogicalExpression, m_l1GtUtils)
120 {
121  m_l1GtDaqReadoutRecordToken = consumes<L1GlobalTriggerReadoutRecord>(m_l1GtDaqReadoutRecordInputTag);
122  m_l1GtObjectMapToken = consumes<L1GlobalTriggerObjectMapRecord>(m_l1GtObjectMapTag);
123  m_l1GtObjectMapsToken = consumes<L1GlobalTriggerObjectMaps>(m_l1GtObjectMapsInputTag);
124  m_l1GtTmLToken = consumes<L1GtTriggerMenuLite,edm::InRun>(m_l1GtTmLInputTag);
125  m_condInRunToken = consumes<edm::ConditionsInRunBlock,edm::InRun>(m_condInEdmInputTag);
126  m_condInLumiToken = consumes<edm::ConditionsInLumiBlock,edm::InLumi>(m_condInEdmInputTag);
127  m_condInEventToken = consumes<edm::ConditionsInEventBlock>(m_condInEdmInputTag);
128 
129  LogDebug("L1GtAnalyzer")
130  << "\n Input parameters for L1 GT test analyzer"
131  << "\n L1 GT DAQ product: "
133  << "\n L1GlobalTriggerRecord product: "
135  << "\n L1 GT object map collection: "
137  << "\n Muon collection from GMT: "
138  << m_l1GmtInputTag
139  << "\n L1 trigger menu lite product: "
141  << "\n Algorithm name or alias, technical trigger name: " << m_nameAlgTechTrig
142  << "\n Condition, if an algorithm trigger is requested: " << m_condName
143  << "\n Bit number for an algorithm or technical trigger: " << m_bitNumber
144  << "\n Requested L1 trigger configuration: " << m_l1GtUtilsConfiguration
145  << "\n Retrieve input tag from provenance for L1GtTriggerMenuLite in the L1GtUtils: "
147  << "\n Retrieve input tag from provenance for L1GlobalTriggerReadoutRecord "
148  << "\n and / or L1GlobalTriggerRecord in the L1GtUtils: "
150  << "\n Configure L1GtUtils in beginRun(...): "
152  << " \n" << std::endl;
153 
154 }
155 
156 // destructor
158 
159  // empty
160 
161 }
162 
163 // method called once each job just before starting event loop
165 {
166 
167  // empty
168 
169 }
170 
172  const edm::EventSetup& evSetup) {
173 
175  analyzeConditionsInRunBlock(iRun, evSetup);
176  }
177 
178  // L1GtUtils
179 
181 
182  // for tests, use only one of the following methods for m_l1GtUtilsConfiguration
183 
184  bool useL1EventSetup = false;
185  bool useL1GtTriggerMenuLite = false;
186 
187  switch (m_l1GtUtilsConfiguration) {
188  case 0: {
189  useL1EventSetup = false;
190  useL1GtTriggerMenuLite = true;
191 
192  }
193  break;
194  case 100000: {
195  useL1EventSetup = true;
196  useL1GtTriggerMenuLite = true;
197 
198  }
199  break;
200  case 200000: {
201  useL1EventSetup = true;
202  useL1GtTriggerMenuLite = false;
203 
204  }
205  break;
206  default: {
207  // do nothing
208  }
209  break;
210  }
211 
212  m_l1GtUtilsProv.getL1GtRunCache(iRun, evSetup, useL1EventSetup,
213  useL1GtTriggerMenuLite);
214 
215  m_l1GtUtils.getL1GtRunCache(iRun, evSetup, useL1EventSetup,
216  useL1GtTriggerMenuLite);
217 
218  // check if the parsing of the logical expression was successful
219 
222  evSetup);
223  } else {
224  // do whatever is necessary if parsing fails - the size of all vectors with L1 results is zero in this case
225  // a LogWarning message is written in L1GtUtils
226  }
227 
228 // if (m_logicalExpressionL1Results.isValid()) {
229 // m_logicalExpressionL1Results.logicalExpressionRunUpdate(iRun,
230 // evSetup);
231 // } else {
232 // // do whatever is necessary if parsing fails - the size of all vectors with L1 results is zero in this case
233 // // a LogWarning message is written in L1GtUtils
234 // }
235 
236  // if the logical expression is changed, one has to check it's validity after the logicalExpressionRunUpdate call
237  // (...dirty testing with the same logical expression)
241  // do whatever is necessary if parsing fails - the size of all vectors with L1 results is zero in this case
242  // a LogWarning message is written in L1GtUtils
243  }
244 
245  }
246 
247 }
248 
249 
251  const edm::EventSetup& evSetup) {
252 
254  analyzeConditionsInLumiBlock(iLumi, evSetup);
255  }
256 
257 }
258 
259 
260 // member functions
261 
262 // analyze: decision and decision word
263 // bunch cross in event BxInEvent = 0 - L1Accept event
265 {
266 
267  LogDebug("L1GtAnalyzer")
268  << "\n**** L1GtAnalyzer::analyzeDecisionReadoutRecord ****\n"
269  << std::endl;
270 
271  // define an output stream to print into
272  // it can then be directed to whatever log level is desired
273  std::ostringstream myCoutStream;
274 
275  // get L1GlobalTriggerReadoutRecord
277  iEvent.getByToken(m_l1GtDaqReadoutRecordToken, gtReadoutRecord);
278 
279  if (!gtReadoutRecord.isValid()) {
280 
281  LogDebug("L1GtAnalyzer") << "\nL1GlobalTriggerReadoutRecord with \n "
283  << "\nrequested in configuration, but not found in the event."
284  << "\nExit the method.\n" << std::endl;
285 
286  return;
287  }
288 
289  // get Global Trigger decision and the decision word
290  bool gtDecision = gtReadoutRecord->decision();
291  DecisionWord gtDecisionWord = gtReadoutRecord->decisionWord();
292 
293  // print Global Trigger decision and the decision word
294  edm::LogVerbatim("L1GtAnalyzer")
295  << "\n GlobalTrigger decision: " << gtDecision << std::endl;
296 
297  // print via supplied "print" function (
298  gtReadoutRecord->printGtDecision(myCoutStream);
299 
300  // print technical trigger word via supplied "print" function
301  gtReadoutRecord->printTechnicalTrigger(myCoutStream);
302 
303  printOutput(myCoutStream);
304 
305 }
306 
307 
309  const edm::EventSetup& evSetup) {
310 
311 
312  // define an output stream to print into
313  // it can then be directed to whatever log level is desired
314  std::ostringstream myCoutStream;
315 
316 
317  // example to access L1 trigger results using public methods from L1GtUtils
318  // methods must be called after retrieving the L1 configuration
319 
320  // testing which environment is used
321 
322  int iErrorCode = -1;
323  int l1ConfCode = -1;
324 
325  const bool l1Conf = m_l1GtUtils.availableL1Configuration(iErrorCode, l1ConfCode);
326 
327  myCoutStream << "\nL1 configuration code: \n"
328  << "\n Legend: "
329  << "\n 0 - Retrieve L1 trigger configuration from L1GtTriggerMenuLite only"
330  << "\n 10000 L1GtTriggerMenuLite product is valid"
331  << "\n 99999 L1GtTriggerMenuLite product not valid. Error."
332  << "\n"
333  << "\n 100000 - Fall through: try first L1GtTriggerMenuLite; if not valid,try event setup."
334  << "\n 110000 L1GtTriggerMenuLite product is valid"
335  << "\n 120000 L1GtTriggerMenuLite product not valid, event setup valid."
336  << "\n 199999 L1GtTriggerMenuLite product not valid, event setup not valid. Error."
337  << "\n"
338  << "\n 200000 - Retrieve L1 trigger configuration from event setup only."
339  << "\n 210000 Event setup valid."
340  << "\n 299999 Event setup not valid. Error."
341  << "\n"
342  << "\n 300000 - No L1 trigger configuration requested to be retrieved. Error"
343  << "\n Must call before using L1GtUtils methods: "
344  << "\n getL1GtRunCache(const edm::Event& iEvent, const edm::EventSetup& evSetup,"
345  << "\n const bool useL1EventSetup, const bool useL1GtTriggerMenuLite)"
346  << "\n"
347  << std::endl;
348 
349 
350  if (l1Conf) {
351  myCoutStream << "\nL1 configuration code:" << l1ConfCode
352  << "\nValid L1 trigger configuration." << std::endl;
353 
354  myCoutStream << "\nL1 trigger menu name and implementation:" << "\n"
355  << m_l1GtUtils.l1TriggerMenu() << "\n"
356  << m_l1GtUtils.l1TriggerMenuImplementation() << std::endl;
357 
358  } else {
359  myCoutStream << "\nL1 configuration code:" << l1ConfCode
360  << "\nNo valid L1 trigger configuration available."
361  << "\nSee text above for error code interpretation"
362  << "\nNo return here, in order to test each method, protected against configuration error."
363  << std::endl;
364  }
365 
366 
367 
368  myCoutStream
369  << "\n******** Results found with input tags retrieved from provenance ******** \n"
370  << std::endl;
371 
372  //
373  // no input tags; for the appropriate EDM product, it will be found
374  // from provenance
375 
376  // the following methods share the same error code, therefore one can check only once
377  // the validity of the result
378 
379  iErrorCode = -1;
380 
381  bool decisionBeforeMaskAlgTechTrig = m_l1GtUtilsProv.decisionBeforeMask(iEvent,
382  m_nameAlgTechTrig, iErrorCode);
383 
384  bool decisionAfterMaskAlgTechTrig = m_l1GtUtilsProv.decisionAfterMask(iEvent,
385  m_nameAlgTechTrig, iErrorCode);
386 
387  bool decisionAlgTechTrig = m_l1GtUtilsProv.decision(iEvent, m_nameAlgTechTrig,
388  iErrorCode);
389 
390  int prescaleFactorAlgTechTrig = m_l1GtUtilsProv.prescaleFactor(iEvent,
391  m_nameAlgTechTrig, iErrorCode);
392 
393  int triggerMaskAlgTechTrig = m_l1GtUtilsProv.triggerMask(iEvent,
394  m_nameAlgTechTrig, iErrorCode);
395 
396  myCoutStream << "\n\nMethods:"
397  << "\n decisionBeforeMask(iEvent, m_nameAlgTechTrig, iErrorCode)"
398  << "\n decisionAfterMask(iEvent, m_nameAlgTechTrig, iErrorCode)"
399  << "\n decision(iEvent, m_nameAlgTechTrig, iErrorCode)"
400  << "\n prescaleFactor(iEvent, m_nameAlgTechTrig, iErrorCode)"
401  << "\n triggerMask(iEvent, m_nameAlgTechTrig, iErrorCode)"
402  << "\n triggerMask(m_nameAlgTechTrig,iErrorCode)"
403  << "\n\n" << std::endl;
404 
405 
406  if (iErrorCode == 0) {
407  myCoutStream << "\nDecision before trigger mask for "
408  << m_nameAlgTechTrig << ": " << decisionBeforeMaskAlgTechTrig
409  << std::endl;
410  myCoutStream << "Decision after trigger mask for " << m_nameAlgTechTrig
411  << ": " << decisionAfterMaskAlgTechTrig << std::endl;
412  myCoutStream << "Decision (after trigger mask) for "
413  << m_nameAlgTechTrig << ": " << decisionAlgTechTrig
414  << std::endl;
415 
416  myCoutStream << "Prescale factor for " << m_nameAlgTechTrig
417  << ": " << prescaleFactorAlgTechTrig
418  << std::endl;
419 
420  myCoutStream << "Trigger mask for " << m_nameAlgTechTrig
421  << ": " << triggerMaskAlgTechTrig
422  << std::endl;
423 
424  } else if (iErrorCode == 1) {
425  myCoutStream << "\n" << m_nameAlgTechTrig
426  << " does not exist in the L1 menu "
427  << m_l1GtUtilsProv.l1TriggerMenu() << "\n" << std::endl;
428 
429  } else {
430  myCoutStream << "\nError: "
431  << "\n An error was encountered when retrieving decision, mask and prescale factor for "
432  << m_nameAlgTechTrig << "\n L1 Menu: "
433  << m_l1GtUtilsProv.l1TriggerMenu() << "\n Error code: "
434  << iErrorCode << std::endl;
435 
436  }
437 
438  // another method to get the trigger mask (no common errorCode)
439 
440  iErrorCode = -1;
441  triggerMaskAlgTechTrig = m_l1GtUtilsProv.triggerMask(m_nameAlgTechTrig,
442  iErrorCode);
443 
444  if (iErrorCode == 0) {
445  myCoutStream << "\nTrigger mask for " << m_nameAlgTechTrig
446  << "(faster method): " << triggerMaskAlgTechTrig
447  << std::endl;
448 
449  } else if (iErrorCode == 1) {
450  myCoutStream << "\n" << m_nameAlgTechTrig
451  << " does not exist in the L1 menu "
452  << m_l1GtUtilsProv.l1TriggerMenu() << "\n" << std::endl;
453 
454  } else {
455  myCoutStream << "\nError: "
456  << "\n An error was encountered when fast retrieving trigger mask for "
457  << m_nameAlgTechTrig << "\n L1 Menu: "
458  << m_l1GtUtilsProv.l1TriggerMenu() << "\n Error code: "
459  << iErrorCode << std::endl;
460 
461  }
462 
463  // index of the actual prescale factor set, and the actual prescale
464  // factor set for algorithm triggers
465 
466 
467 
469 
470  myCoutStream << "\nMethods:"
471  << "\n prescaleFactorSetIndex(iEvent, trigCategory, iErrorCode)"
472  << "\n prescaleFactorSet(iEvent, trigCategory,iErrorCode)\n"
473  << std::endl;
474 
475  iErrorCode = -1;
476  const int pfSetIndexAlgorithmTrigger = m_l1GtUtilsProv.prescaleFactorSetIndex(
477  iEvent, trigCategory, iErrorCode);
478 
479  if (iErrorCode == 0) {
480  myCoutStream
481  << "\nAlgorithm triggers: index for prescale factor set = "
482  << pfSetIndexAlgorithmTrigger << "\nfor run " << iEvent.run()
483  << ", luminosity block " << iEvent.luminosityBlock()
484  << ", with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu()
485  << std::endl;
486 
487 
488  } else {
489  myCoutStream
490  << "\nError encountered when retrieving the prescale factor set index"
491  << "\n for algorithm triggers, for run " << iEvent.run()
492  << ", luminosity block " << iEvent.luminosityBlock()
493  << " with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu()
494  << "\n Error code: " << iErrorCode << "\n" << std::endl;
495  }
496 
497  iErrorCode = -1;
498  const std::vector<int>& pfSetAlgorithmTrigger =
499  m_l1GtUtilsProv.prescaleFactorSet(iEvent, trigCategory, iErrorCode);
500 
501  if (iErrorCode == 0) {
502  myCoutStream << "\nAlgorithm triggers: prescale factor set index = "
503  << pfSetIndexAlgorithmTrigger << "\nfor run " << iEvent.run()
504  << ", luminosity block " << iEvent.luminosityBlock()
505  << ", with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu()
506  << std::endl;
507 
508  int iBit = -1;
509  for (std::vector<int>::const_iterator cItBit =
510  pfSetAlgorithmTrigger.begin(); cItBit
511  != pfSetAlgorithmTrigger.end(); ++cItBit) {
512 
513  iBit++;
514  myCoutStream << "Bit number " << std::right << std::setw(4) << iBit
515  << ": prescale factor = " << (*cItBit) << std::endl;
516 
517  }
518 
519  } else {
520  myCoutStream
521  << "\nError encountered when retrieving the prescale factor set "
522  << "\n for algorithm triggers, for run " << iEvent.run()
523  << ", luminosity block " << iEvent.luminosityBlock()
524  << " with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu()
525  << "\n Error code: " << iErrorCode << "\n" << std::endl;
526  }
527 
528  // the actual trigger mask set for algorithm triggers
529 
530  myCoutStream << "\nMethod:"
531  << "\n triggerMaskSet(trigCategory, iErrorCode)"
532  << std::endl;
533 
534  iErrorCode = -1;
535  const std::vector<unsigned int>& tmSetAlgorithmTrigger =
536  m_l1GtUtilsProv.triggerMaskSet(trigCategory, iErrorCode);
537 
538  if (iErrorCode == 0) {
539  myCoutStream << "\nAlgorithm triggers: trigger mask set for run "
540  << iEvent.run() << ", luminosity block "
541  << iEvent.luminosityBlock() << ", with L1 menu \n "
542  << m_l1GtUtilsProv.l1TriggerMenu() << "\n" << std::endl;
543 
544  int iBit = -1;
545  for (std::vector<unsigned int>::const_iterator cItBit =
546  tmSetAlgorithmTrigger.begin(); cItBit
547  != tmSetAlgorithmTrigger.end(); ++cItBit) {
548 
549  iBit++;
550  myCoutStream << "Bit number " << std::right << std::setw(4) << iBit
551  << ": trigger mask = " << (*cItBit) << std::endl;
552 
553  }
554 
555  } else {
556  myCoutStream
557  << "\nError encountered when retrieving the trigger mask set "
558  << "\n for algorithm triggers, for run " << iEvent.run()
559  << ", luminosity block " << iEvent.luminosityBlock()
560  << " with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu()
561  << "\n Error code: " << iErrorCode << "\n" << std::endl;
562  }
563 
564 
565 
566 
567  // index of the actual prescale factor set, and the actual prescale
568  // factor set for technical triggers
569 
570  trigCategory = L1GtUtils::TechnicalTrigger;
571 
572  myCoutStream << "\nMethods:"
573  << "\n prescaleFactorSetIndex(iEvent, trigCategory, iErrorCode)"
574  << "\n prescaleFactorSet(iEvent, trigCategory,iErrorCode)\n"
575  << std::endl;
576 
577  iErrorCode = -1;
578  const int pfSetIndexTechnicalTrigger = m_l1GtUtilsProv.prescaleFactorSetIndex(
579  iEvent, trigCategory, iErrorCode);
580 
581  if (iErrorCode == 0) {
582  myCoutStream
583  << "\nTechnical triggers: index for prescale factor set = "
584  << pfSetIndexTechnicalTrigger << "\nfor run " << iEvent.run()
585  << ", luminosity block " << iEvent.luminosityBlock()
586  << ", with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu()
587  << "\nMethod: prescaleFactorSetIndex(iEvent, trigCategory, iErrorCode)\n"
588  << std::endl;
589 
590  } else {
591  myCoutStream
592  << "\nError encountered when retrieving the prescale factor set index"
593  << "\n for technical triggers, for run " << iEvent.run()
594  << ", luminosity block " << iEvent.luminosityBlock()
595  << " with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu()
596  << "\n Error code: " << iErrorCode << "\n" << std::endl;
597  }
598 
599  iErrorCode = -1;
600  const std::vector<int>& pfSetTechnicalTrigger =
601  m_l1GtUtilsProv.prescaleFactorSet(iEvent, trigCategory, iErrorCode);
602 
603  if (iErrorCode == 0) {
604  myCoutStream << "\nTechnical triggers: prescale factor set index = "
605  << pfSetIndexTechnicalTrigger << "\nfor run " << iEvent.run()
606  << ", luminosity block " << iEvent.luminosityBlock()
607  << ", with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu()
608  << "\nMethod: prescaleFactorSet(iEvent, trigCategory,iErrorCode)\n"
609  << std::endl;
610 
611  int iBit = -1;
612  for (std::vector<int>::const_iterator cItBit =
613  pfSetTechnicalTrigger.begin(); cItBit
614  != pfSetTechnicalTrigger.end(); ++cItBit) {
615 
616  iBit++;
617  myCoutStream << "Bit number " << std::right << std::setw(4) << iBit
618  << ": prescale factor = " << (*cItBit) << std::endl;
619 
620  }
621 
622  } else {
623  myCoutStream
624  << "\nError encountered when retrieving the prescale factor set "
625  << "\n for technical triggers, for run " << iEvent.run()
626  << ", luminosity block " << iEvent.luminosityBlock()
627  << " with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu()
628  << "\n Error code: " << iErrorCode << "\n" << std::endl;
629  }
630 
631  // the actual trigger mask set for technical triggers
632 
633  myCoutStream << "\nMethod:"
634  << "\n triggerMaskSet(trigCategory, iErrorCode)"
635  << std::endl;
636 
637  iErrorCode = -1;
638  const std::vector<unsigned int>& tmSetTechnicalTrigger =
639  m_l1GtUtilsProv.triggerMaskSet(trigCategory, iErrorCode);
640 
641  if (iErrorCode == 0) {
642  myCoutStream << "\nTechnical triggers: trigger mask set for run "
643  << iEvent.run() << ", luminosity block "
644  << iEvent.luminosityBlock() << ", with L1 menu \n "
645  << m_l1GtUtilsProv.l1TriggerMenu() << "\n" << std::endl;
646 
647  int iBit = -1;
648  for (std::vector<unsigned int>::const_iterator cItBit =
649  tmSetTechnicalTrigger.begin(); cItBit
650  != tmSetTechnicalTrigger.end(); ++cItBit) {
651 
652  iBit++;
653  myCoutStream << "Bit number " << std::right << std::setw(4) << iBit
654  << ": trigger mask = " << (*cItBit) << std::endl;
655 
656  }
657 
658  } else {
659  myCoutStream
660  << "\nError encountered when retrieving the trigger mask set "
661  << "\n for technical triggers, for run " << iEvent.run()
662  << ", luminosity block " << iEvent.luminosityBlock()
663  << " with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu()
664  << "\n Error code: " << iErrorCode << "\n" << std::endl;
665  }
666 
667 
668  // results for logical expressions
669 
670  // errorCodes must be called before any other method is used
671  const std::vector<std::pair<std::string, int> >& errorCodesProv =
673 
674  const std::vector<L1GtLogicParser::OperandToken>& expL1TriggersProv =
676 
677  const std::vector<std::pair<std::string, bool> >& decisionsBeforeMaskProv =
679  const std::vector<std::pair<std::string, bool> >& decisionsAfterMaskProv =
681  const std::vector<std::pair<std::string, int> >& prescaleFactorsProv =
683  const std::vector<std::pair<std::string, int> >& triggerMasksProv =
685 
686  myCoutStream << std::endl;
687  myCoutStream << "\nLogical expression\n "
688  << m_l1GtUtilsLogicalExpression << std::endl;
689 
690  for (size_t iTrig = 0; iTrig < errorCodesProv.size(); ++iTrig) {
691  if ((errorCodesProv[iTrig]).second != 0) {
692  myCoutStream
693  << "\nError encountered when retrieving L1 results for trigger "
694  << (errorCodesProv[iTrig]).first << " (bit number "
695  << (expL1TriggersProv[iTrig]).tokenNumber << ")\n for run "
696  << iEvent.run() << ", luminosity block "
697  << iEvent.luminosityBlock() << " with L1 menu \n "
698  << m_l1GtUtilsProv.l1TriggerMenu() << "\n Error code: "
699  << (errorCodesProv[iTrig]).second << "\n" << std::endl;
700 
701  } else {
702 
703  myCoutStream << "\n" << (errorCodesProv[iTrig]).first
704  << " - bit number " << (expL1TriggersProv[iTrig]).tokenNumber
705  << std::endl;
706 
707  myCoutStream << " decision before mask = "
708  << (decisionsBeforeMaskProv[iTrig]).second << std::endl;
709 
710  myCoutStream << " decision after mask = "
711  << (decisionsAfterMaskProv[iTrig]).second << std::endl;
712 
713  myCoutStream << " prescale factor = "
714  << (prescaleFactorsProv[iTrig]).second << std::endl;
715 
716  myCoutStream << " trigger mask = "
717  << (triggerMasksProv[iTrig]).second << std::endl;
718 
719  myCoutStream << " error code = "
720  << (errorCodesProv[iTrig]).second << std::endl;
721 
722  }
723  }
724 
725  //
726  // same methods as above, but with input tag given explicitly, allowing to select
727  // the EDM products used to get the results
728 
729 
730 
731  myCoutStream
732  << "\n******** Results found with input tags provided in the configuration file ******** \n"
733  << "\n L1GlobalTriggerRecord: " << m_l1GtRecordInputTag
734  << "\n L1GlobalTriggerReadoutRecord: "
735  << m_l1GtDaqReadoutRecordInputTag << std::endl;
736 
737 
738  // the following methods share the same error code, therefore one can check only once
739  // the validity of the result
740 
741  iErrorCode = -1;
742 
743  bool decisionBeforeMaskAlgTechTrigITag = m_l1GtUtils.decisionBeforeMask(iEvent,
744  m_nameAlgTechTrig, iErrorCode);
745 
746  bool decisionAfterMaskAlgTechTrigITag = m_l1GtUtils.decisionAfterMask(iEvent,
747  m_nameAlgTechTrig, iErrorCode);
748 
749  bool decisionAlgTechTrigITag = m_l1GtUtils.decision(iEvent,
750  m_nameAlgTechTrig, iErrorCode);
751 
752  int prescaleFactorAlgTechTrigITag = m_l1GtUtils.prescaleFactor(iEvent,
753  m_nameAlgTechTrig, iErrorCode);
754 
755  int triggerMaskAlgTechTrigITag = m_l1GtUtils.triggerMask(iEvent,
756  m_nameAlgTechTrig, iErrorCode);
757 
758  myCoutStream << "\n\nMethods:"
759  << "\n decisionBeforeMask(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode)"
760  << "\n decisionAfterMask(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode)"
761  << "\n decision(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode)"
762  << "\n prescaleFactor(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode)"
763  << "\n triggerMask(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode)"
764  << "\n\n"
765  << std::endl;
766 
767 
768  if (iErrorCode == 0) {
769  myCoutStream << "\nDecision before trigger mask for "
770  << m_nameAlgTechTrig << ": " << decisionBeforeMaskAlgTechTrigITag
771  << std::endl;
772  myCoutStream << "Decision after trigger mask for " << m_nameAlgTechTrig
773  << ": " << decisionAfterMaskAlgTechTrigITag << std::endl;
774  myCoutStream << "Decision (after trigger mask) for "
775  << m_nameAlgTechTrig << ": " << decisionAlgTechTrigITag
776  << std::endl;
777 
778  myCoutStream << "Prescale factor for " << m_nameAlgTechTrig
779  << ": " << prescaleFactorAlgTechTrigITag
780  << std::endl;
781 
782  myCoutStream << "Trigger mask for " << m_nameAlgTechTrig
783  << ": " << triggerMaskAlgTechTrigITag
784  << std::endl;
785 
786  } else if (iErrorCode == 1) {
787  myCoutStream << "\n" << m_nameAlgTechTrig
788  << " does not exist in the L1 menu "
789  << m_l1GtUtils.l1TriggerMenu() << "\n" << std::endl;
790 
791  } else {
792  myCoutStream << "\nError: "
793  << "\n An error was encountered when retrieving decision, mask and prescale factor for "
794  << m_nameAlgTechTrig << "\n L1 Menu: "
795  << m_l1GtUtils.l1TriggerMenu() << "\n Error code: "
796  << iErrorCode << std::endl;
797 
798  }
799 
800 
801  // index of the actual prescale factor set, and the actual prescale
802  // factor set for algorithm triggers
803 
804 
805 
806  trigCategory = L1GtUtils::AlgorithmTrigger;
807 
808  myCoutStream << "\nMethods:"
809  << "\n prescaleFactorSetIndex(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, trigCategory, iErrorCode)"
810  << "\n prescaleFactorSet(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, trigCategory,iErrorCode)\n"
811  << std::endl;
812 
813  iErrorCode = -1;
814  const int pfSetIndexAlgorithmTriggerITag = m_l1GtUtils.prescaleFactorSetIndex(
815  iEvent, trigCategory, iErrorCode);
816 
817  if (iErrorCode == 0) {
818  myCoutStream
819  << "\nAlgorithm triggers: index for prescale factor set = "
820  << pfSetIndexAlgorithmTriggerITag << "\nfor run " << iEvent.run()
821  << ", luminosity block " << iEvent.luminosityBlock()
822  << ", with L1 menu \n " << m_l1GtUtils.l1TriggerMenu()
823  << std::endl;
824 
825 
826  } else {
827  myCoutStream
828  << "\nError encountered when retrieving the prescale factor set index"
829  << "\n for algorithm triggers, for run " << iEvent.run()
830  << ", luminosity block " << iEvent.luminosityBlock()
831  << " with L1 menu \n " << m_l1GtUtils.l1TriggerMenu()
832  << "\n Error code: " << iErrorCode << "\n" << std::endl;
833  }
834 
835  iErrorCode = -1;
836  const std::vector<int>& pfSetAlgorithmTriggerITag =
837  m_l1GtUtils.prescaleFactorSet(iEvent, trigCategory, iErrorCode);
838 
839  if (iErrorCode == 0) {
840  myCoutStream << "\nAlgorithm triggers: prescale factor set index = "
841  << pfSetIndexAlgorithmTriggerITag << "\nfor run " << iEvent.run()
842  << ", luminosity block " << iEvent.luminosityBlock()
843  << ", with L1 menu \n " << m_l1GtUtils.l1TriggerMenu()
844  << std::endl;
845 
846  int iBit = -1;
847  for (std::vector<int>::const_iterator cItBit =
848  pfSetAlgorithmTriggerITag.begin(); cItBit
849  != pfSetAlgorithmTriggerITag.end(); ++cItBit) {
850 
851  iBit++;
852  myCoutStream << "Bit number " << std::right << std::setw(4) << iBit
853  << ": prescale factor = " << (*cItBit) << std::endl;
854 
855  }
856 
857  } else {
858  myCoutStream
859  << "\nError encountered when retrieving the prescale factor set "
860  << "\n for algorithm triggers, for run " << iEvent.run()
861  << ", luminosity block " << iEvent.luminosityBlock()
862  << " with L1 menu \n " << m_l1GtUtils.l1TriggerMenu()
863  << "\n Error code: " << iErrorCode << "\n" << std::endl;
864  }
865 
866 
867 
868 
869 
870 
871  // index of the actual prescale factor set, and the actual prescale
872  // factor set for technical triggers
873 
874  trigCategory = L1GtUtils::TechnicalTrigger;
875 
876  myCoutStream << "\nMethods:"
877  << "\n prescaleFactorSetIndex(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, trigCategory, iErrorCode)"
878  << "\n prescaleFactorSet(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, trigCategory,iErrorCode)\n"
879  << std::endl;
880 
881  iErrorCode = -1;
882  const int pfSetIndexTechnicalTriggerITag = m_l1GtUtils.prescaleFactorSetIndex(
883  iEvent, trigCategory, iErrorCode);
884 
885  if (iErrorCode == 0) {
886  myCoutStream
887  << "\nTechnical triggers: index for prescale factor set = "
888  << pfSetIndexTechnicalTriggerITag << "\nfor run " << iEvent.run()
889  << ", luminosity block " << iEvent.luminosityBlock()
890  << ", with L1 menu \n " << m_l1GtUtils.l1TriggerMenu()
891  << std::endl;
892 
893  } else {
894  myCoutStream
895  << "\nError encountered when retrieving the prescale factor set index"
896  << "\n for technical triggers, for run " << iEvent.run()
897  << ", luminosity block " << iEvent.luminosityBlock()
898  << " with L1 menu \n " << m_l1GtUtils.l1TriggerMenu()
899  << "\n Error code: " << iErrorCode << "\n" << std::endl;
900  }
901 
902  iErrorCode = -1;
903  const std::vector<int>& pfSetTechnicalTriggerITag =
904  m_l1GtUtils.prescaleFactorSet(iEvent, trigCategory, iErrorCode);
905 
906  if (iErrorCode == 0) {
907  myCoutStream << "\nTechnical triggers: prescale factor set index = "
908  << pfSetIndexTechnicalTriggerITag << "\nfor run " << iEvent.run()
909  << ", luminosity block " << iEvent.luminosityBlock()
910  << ", with L1 menu \n " << m_l1GtUtils.l1TriggerMenu()
911  << std::endl;
912 
913  int iBit = -1;
914  for (std::vector<int>::const_iterator cItBit =
915  pfSetTechnicalTriggerITag.begin(); cItBit
916  != pfSetTechnicalTriggerITag.end(); ++cItBit) {
917 
918  iBit++;
919  myCoutStream << "Bit number " << std::right << std::setw(4) << iBit
920  << ": prescale factor = " << (*cItBit) << std::endl;
921 
922  }
923 
924  } else {
925  myCoutStream
926  << "\nError encountered when retrieving the prescale factor set "
927  << "\n for technical triggers, for run " << iEvent.run()
928  << ", luminosity block " << iEvent.luminosityBlock()
929  << " with L1 menu \n " << m_l1GtUtils.l1TriggerMenu()
930  << "\n Error code: " << iErrorCode << "\n" << std::endl;
931  }
932 
933 
934  // results for logical expressions
935 
936  // errorCodes must be called before any other method is used
937  const std::vector<std::pair<std::string, int> >& errorCodes =
939 
940  const std::vector<L1GtLogicParser::OperandToken>& expL1Triggers =
942 
943 
944  const std::vector<std::pair<std::string, bool> >& decisionsBeforeMask =
946  const std::vector<std::pair<std::string, bool> >& decisionsAfterMask =
948  const std::vector<std::pair<std::string, int> >& prescaleFactors =
950  const std::vector<std::pair<std::string, int> >& triggerMasks =
952 
953  myCoutStream << std::endl;
954  myCoutStream << "\nLogical expression\n "
955  << m_l1GtUtilsLogicalExpression << std::endl;
956 
957  for (size_t iTrig = 0; iTrig < errorCodes.size(); ++iTrig) {
958  if ((errorCodes[iTrig]).second != 0) {
959  myCoutStream
960  << "\nError encountered when retrieving L1 results for trigger "
961  << (errorCodes[iTrig]).first << " (bit number "
962  << (expL1Triggers[iTrig]).tokenNumber << ")\n for run "
963  << iEvent.run() << ", luminosity block "
964  << iEvent.luminosityBlock() << " with L1 menu \n "
965  << m_l1GtUtils.l1TriggerMenu() << "\n Error code: "
966  << (errorCodes[iTrig]).second << "\n" << std::endl;
967 
968  } else {
969 
970  myCoutStream << "\n" << (errorCodes[iTrig]).first
971  << " - bit number " << (expL1Triggers[iTrig]).tokenNumber
972  << std::endl;
973 
974  myCoutStream << " decision before mask = "
975  << (decisionsBeforeMask[iTrig]).second << std::endl;
976 
977  myCoutStream << " decision after mask = "
978  << (decisionsAfterMask[iTrig]).second << std::endl;
979 
980  myCoutStream << " prescale factor = "
981  << (prescaleFactors[iTrig]).second << std::endl;
982 
983  myCoutStream << " trigger mask = "
984  << (triggerMasks[iTrig]).second << std::endl;
985 
986  myCoutStream << " error code = "
987  << (errorCodes[iTrig]).second << std::endl;
988 
989  }
990  }
991 
992 
993  printOutput(myCoutStream);
994 }
995 
997  const edm::EventSetup& evSetup) {
998 
999  LogDebug("L1GtAnalyzer")
1000  << "\n**** L1GtAnalyzer::analyzeL1GtUtilsMenuLite ****\n"
1001  << std::endl;
1002 
1003  // before accessing any result from L1GtUtils, one must retrieve and cache
1004  // the L1GtTriggerMenuLite product
1005  // add this call in the analyze / produce / filter method of your
1006  // analyzer / producer / filter
1007 
1008  bool useL1EventSetup = false;
1009  bool useL1GtTriggerMenuLite = true;
1010 
1011  m_l1GtUtilsProv.getL1GtRunCache(iEvent, evSetup, useL1EventSetup,
1012  useL1GtTriggerMenuLite);
1013 
1014  m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup,
1015  useL1GtTriggerMenuLite);
1016 
1017  analyzeL1GtUtilsCore(iEvent, evSetup);
1018 }
1019 
1021  const edm::EventSetup& evSetup) {
1022 
1023  LogDebug("L1GtAnalyzer")
1024  << "\n**** L1GtAnalyzer::analyzeL1GtUtilsEventSetup ****\n"
1025  << std::endl;
1026 
1027  // before accessing any result from L1GtUtils, one must retrieve and cache
1028  // the L1 trigger event setup
1029  // add this call in the analyze / produce / filter method of your
1030  // analyzer / producer / filter
1031 
1032  bool useL1EventSetup = true;
1033  bool useL1GtTriggerMenuLite = false;
1034 
1035  m_l1GtUtilsProv.getL1GtRunCache(iEvent, evSetup, useL1EventSetup,
1036  useL1GtTriggerMenuLite);
1037 
1038  m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup,
1039  useL1GtTriggerMenuLite);
1040 
1041  analyzeL1GtUtilsCore(iEvent, evSetup);
1042 
1043 }
1044 
1046  const edm::EventSetup& evSetup) {
1047 
1048  LogDebug("L1GtAnalyzer")
1049  << "\n**** L1GtAnalyzer::analyzeL1GtUtils: fall-through case ****\n"
1050  << std::endl;
1051 
1052  // before accessing any result from L1GtUtils, one must retrieve and cache
1053  // the L1 trigger event setup and the L1GtTriggerMenuLite product
1054  // add this call in the analyze / produce / filter method of your
1055  // analyzer / producer / filter
1056 
1057  bool useL1EventSetup = true;
1058  bool useL1GtTriggerMenuLite = true;
1059 
1060  m_l1GtUtilsProv.getL1GtRunCache(iEvent, evSetup, useL1EventSetup,
1061  useL1GtTriggerMenuLite);
1062 
1063  m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup,
1064  useL1GtTriggerMenuLite);
1065 
1066  analyzeL1GtUtilsCore(iEvent, evSetup);
1067 }
1068 
1070  const edm::EventSetup& evSetup) {
1071 
1072  LogDebug("L1GtAnalyzer") << "\n**** L1GtAnalyzer::analyzeTrigger ****\n"
1073  << std::endl;
1074 
1075  // define an output stream to print into
1076  // it can then be directed to whatever log level is desired
1077  std::ostringstream myCoutStream;
1078 
1079  // print all the stuff if at LogDebug level
1080  myCoutStream << "\n\nFull analysis of an algorithm or technical trigger"
1081  << "\nMethod: L1GtAnalyzer::analyzeTrigger" << "\nTrigger: "
1082  << m_nameAlgTechTrig << "\n" << std::endl;
1083 
1084  const unsigned int runNumber = iEvent.run();
1085  const unsigned int lsNumber = iEvent.luminosityBlock();
1086  const unsigned int eventNumber = iEvent.id().event();
1087 
1088  myCoutStream << "Run: " << runNumber << " LS: " << lsNumber << " Event: "
1089  << eventNumber << "\n\n" << std::endl;
1090 
1091 
1092  // before accessing any result from L1GtUtils, one must retrieve and cache
1093  // the L1 trigger event setup and the L1GtTriggerMenuLite product
1094  // add this call in the analyze / produce / filter method of your
1095  // analyzer / producer / filter
1096 
1097  bool useL1EventSetup = false;
1098  bool useL1GtTriggerMenuLite = false;
1099 
1100  switch (m_l1GtUtilsConfiguration) {
1101  case 0: {
1102  useL1EventSetup = false;
1103  useL1GtTriggerMenuLite = true;
1104 
1105  }
1106  break;
1107  case 100000: {
1108  useL1EventSetup = true;
1109  useL1GtTriggerMenuLite = true;
1110 
1111  }
1112  break;
1113  case 200000: {
1114  useL1EventSetup = true;
1115  useL1GtTriggerMenuLite = false;
1116 
1117  }
1118  break;
1119  default: {
1120  // do nothing
1121  }
1122  break;
1123  }
1124 
1125  m_l1GtUtilsProv.getL1GtRunCache(iEvent, evSetup, useL1EventSetup,
1126  useL1GtTriggerMenuLite);
1127 
1128  m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup,
1129  useL1GtTriggerMenuLite);
1130 
1131  // testing which environment is used
1132 
1133  int iErrorCode = -1;
1134  int l1ConfCode = -1;
1135 
1136  const bool l1Conf = m_l1GtUtils.availableL1Configuration(iErrorCode,
1137  l1ConfCode);
1138 
1139  if (l1Conf) {
1140  LogDebug("L1GtAnalyzer") << "\nL1 configuration code:" << l1ConfCode
1141  << "\nValid L1 trigger configuration.\n" << std::endl;
1142 
1143  LogTrace("L1GtAnalyzer") << "\nL1 trigger menu name and implementation:"
1144  << "\n" << m_l1GtUtils.l1TriggerMenu() << "\n"
1146  << std::endl;
1147 
1148  } else {
1149  myCoutStream << "\nL1 configuration code:" << l1ConfCode
1150  << "\nNo valid L1 trigger configuration available."
1151  << "\nCheck L1GtUtils wiki page for error code interpretation\n"
1152  << std::endl;
1153  return;
1154  }
1155 
1156  // the following methods share the same error code, therefore one can check only once
1157  // the validity of the result
1158 
1159  iErrorCode = -1;
1160 
1161  bool decisionBeforeMaskAlgTechTrig = false;
1162  bool decisionAfterMaskAlgTechTrig = false;
1163  bool decisionAlgTechTrig = false;
1164  int prescaleFactorAlgTechTrig = -1;
1165  int triggerMaskAlgTechTrig = -1;
1166 
1168  decisionBeforeMaskAlgTechTrig = m_l1GtUtilsProv.decisionBeforeMask(iEvent,
1169  m_nameAlgTechTrig, iErrorCode);
1170 
1171  decisionAfterMaskAlgTechTrig = m_l1GtUtilsProv.decisionAfterMask(iEvent,
1172  m_nameAlgTechTrig, iErrorCode);
1173 
1174  decisionAlgTechTrig = m_l1GtUtilsProv.decision(iEvent, m_nameAlgTechTrig,
1175  iErrorCode);
1176 
1177  prescaleFactorAlgTechTrig = m_l1GtUtilsProv.prescaleFactor(iEvent,
1178  m_nameAlgTechTrig, iErrorCode);
1179 
1180  triggerMaskAlgTechTrig = m_l1GtUtilsProv.triggerMask(iEvent,
1181  m_nameAlgTechTrig, iErrorCode);
1182 
1183  } else {
1184  decisionBeforeMaskAlgTechTrig = m_l1GtUtils.decisionBeforeMask(iEvent,
1185  m_nameAlgTechTrig, iErrorCode);
1186 
1187  decisionAfterMaskAlgTechTrig = m_l1GtUtils.decisionAfterMask(iEvent,
1188  m_nameAlgTechTrig, iErrorCode);
1189 
1190  decisionAlgTechTrig = m_l1GtUtils.decision(iEvent,
1191  m_nameAlgTechTrig, iErrorCode);
1192 
1193  prescaleFactorAlgTechTrig = m_l1GtUtils.prescaleFactor(iEvent,
1194  m_nameAlgTechTrig, iErrorCode);
1195 
1196  triggerMaskAlgTechTrig = m_l1GtUtils.triggerMask(iEvent,
1197  m_nameAlgTechTrig, iErrorCode);
1198  }
1199 
1200  switch (iErrorCode) {
1201  case 0: {
1202  // do nothing here
1203  }
1204  break;
1205  case 1: {
1206  myCoutStream << "\n" << m_nameAlgTechTrig
1207  << " does not exist in the L1 menu "
1208  << m_l1GtUtils.l1TriggerMenu() << "\n" << std::endl;
1209  return;
1210  }
1211  break;
1212  default: {
1213  myCoutStream << "\nError: "
1214  << "\n An error was encountered when retrieving decision, mask and prescale factor for "
1215  << m_nameAlgTechTrig << "\n L1 Menu: "
1216  << m_l1GtUtils.l1TriggerMenu() << "\n Error code: "
1217  << iErrorCode
1218  << "\n Check L1GtUtils wiki page for error code interpretation"
1219  << std::endl;
1220  }
1221  break;
1222  }
1223 
1224  // retrieve L1Extra
1225  // for object maps, only BxInEvent = 0 (aka L1A bunch cross) is relevant
1226 
1227  m_retrieveL1Extra.retrieveL1ExtraObjects(iEvent, evSetup);
1228 
1229  // print all L1Extra collections from all BxInEvent
1230  myCoutStream << "\nL1Extra collections from all BxInEvent" << std::endl;
1231  m_retrieveL1Extra.printL1Extra(myCoutStream);
1232 
1233  int bxInEvent = 0;
1234  myCoutStream << "\nL1Extra collections from BxInEvent = 0 (BX for L1A)" << std::endl;
1235  m_retrieveL1Extra.printL1Extra(myCoutStream, bxInEvent);
1236 
1237  // retrieve L1GlobalTriggerObjectMapRecord and L1GlobalTriggerObjectMaps products
1238  // the module returns an error code only if both payloads are missing
1239 
1240  int iErrorRecord = 0;
1241 
1242  bool validRecord = false;
1243  bool gtObjectMapRecordValid = false;
1244 
1246  iEvent.getByToken(m_l1GtObjectMapsToken, gtObjectMaps);
1247 
1248  if (gtObjectMaps.isValid()) {
1249 
1250  validRecord = true;
1251 
1252  } else {
1253 
1254  iErrorRecord = 10;
1255  LogDebug("L1GtAnalyzer") << "\nL1GlobalTriggerObjectMaps with \n "
1256  << m_l1GtObjectMapsInputTag << "\nnot found in the event."
1257  << std::endl;
1258  }
1259 
1261  iEvent.getByToken(m_l1GtObjectMapToken, gtObjectMapRecord);
1262 
1263  if (gtObjectMapRecord.isValid()) {
1264 
1265  gtObjectMapRecordValid = true;
1266  validRecord = true;
1267 
1268  } else {
1269 
1270  iErrorRecord = iErrorRecord + 100;
1271  LogDebug("L1GtAnalyzer") << "\nL1GlobalTriggerObjectMapRecord with \n "
1272  << m_l1GtObjectMapTag << "\nnot found in the event."
1273  << std::endl;
1274 
1275  }
1276 
1277  //FIXME remove when validRecord and gtObjectMapRecordValid are used - avoid warning here :-)
1278  if (validRecord && gtObjectMapRecordValid) {
1279  // do nothing
1280  }
1281 
1282 
1283  // get the RPN vector
1284 
1285 
1286 // int pfIndexTechTrig = -1;
1287 // int pfIndexAlgoTrig = -1;
1288 //
1289 // if (validRecord) {
1290 // if (gtObjectMapRecordValid) {
1291 //
1292 // pfIndexTechTrig
1293 // = (gtObjectMapRecord->gtFdlWord()).gtPrescaleFactorIndexTech();
1294 // pfIndexAlgoTrig
1295 // = (gtObjectMapRecord->gtFdlWord()).gtPrescaleFactorIndexAlgo();
1296 //
1297 // } else {
1298 //
1299 // pfIndexTechTrig
1300 // = static_cast<int> (gtObjectMaps->gtPrescaleFactorIndexTech());
1301 // pfIndexAlgoTrig
1302 // = static_cast<int> (gtObjectMaps->gtPrescaleFactorIndexAlgo());
1303 //
1304 // }
1305 //
1306 // } else {
1307 //
1308 // LogDebug("L1GtAnalyzer") << "\nError: "
1309 // << "\nNo valid L1GlobalTriggerRecord with \n "
1310 // << l1GtRecordInputTag << "\nfound in the event."
1311 // << "\nNo valid L1GlobalTriggerReadoutRecord with \n "
1312 // << l1GtReadoutRecordInputTag << "\nfound in the event."
1313 // << std::endl;
1314 //
1315 // iError = l1ConfCode + iErrorRecord;
1316 // return;
1317 //
1318 // }
1319 
1320  //
1321  myCoutStream << "\nResults for trigger " << m_nameAlgTechTrig
1322  << "\n Trigger mask: " << triggerMaskAlgTechTrig
1323  << "\n Prescale factor: " << prescaleFactorAlgTechTrig
1324  << "\n Decision before mask: " << decisionBeforeMaskAlgTechTrig
1325  << "\n Decision after mask: " << decisionAfterMaskAlgTechTrig
1326  << "\n Decision (after mask): " << decisionAlgTechTrig << "\n"
1327  << std::endl;
1328 
1329 
1330  printOutput(myCoutStream);
1331 }
1332 
1333 // analyze: object map product
1335  const edm::EventSetup& evSetup) {
1336 
1337  LogDebug("L1GtAnalyzer")
1338  << "\n**** L1GtAnalyzer::analyzeObjectMap object map product ****\n"
1339  << std::endl;
1340 
1341  // define an output stream to print into
1342  // it can then be directed to whatever log level is desired
1343  std::ostringstream myCoutStream;
1344 
1345  // get a handle to the object map product
1346  // the product can come only from emulator - no hardware ObjectMapRecord
1348  iEvent.getByToken(m_l1GtObjectMapToken, gtObjectMapRecord);
1349 
1350  if (!gtObjectMapRecord.isValid()) {
1351  LogDebug("L1GtAnalyzer")
1352  << "\nWarning: L1GlobalTriggerObjectMapRecord with input tag "
1354  << "\nrequested in configuration, but not found in the event."
1355  << "\nExit the method.\n" << std::endl;
1356 
1357  return;
1358  }
1359 
1360  // get all object maps
1361  const std::vector<L1GlobalTriggerObjectMap>& objMapVec =
1362  gtObjectMapRecord->gtObjectMap();
1363 
1364  // print every object map via the implemented print
1365  for (std::vector<L1GlobalTriggerObjectMap>::const_iterator it =
1366  objMapVec.begin(); it != objMapVec.end(); ++it) {
1367 
1368  (*it).print(myCoutStream);
1369  }
1370 
1371  //
1372  const CombinationsInCond* comb = gtObjectMapRecord->getCombinationsInCond(
1374 
1375  // number of combinations
1376  if (comb != 0) {
1377  myCoutStream << "\n Number of combinations passing ("
1378  << m_nameAlgTechTrig << ", " << m_condName << "): "
1379  << comb->size() << std::endl;
1380  } else {
1381  myCoutStream << "\n No combination passes (" << m_nameAlgTechTrig
1382  << ", " << m_condName << ") " << std::endl;
1383 
1384  }
1385 
1386  // condition result
1387  const bool result = gtObjectMapRecord->getConditionResult(
1389 
1390  myCoutStream << "\n Result for condition " << m_condName
1391  << " in algorithm " << m_nameAlgTechTrig << ": " << result
1392  << std::endl;
1393 
1394  printOutput(myCoutStream);
1395 
1396 }
1397 
1398 // analyze: usage of L1GtTriggerMenuLite
1400  const edm::EventSetup& evSetup) {
1401 
1402  LogDebug("L1GtAnalyzer")
1403  << "\n**** L1GtAnalyzer::analyzeL1GtTriggerMenuLite ****\n"
1404  << std::endl;
1405 
1406  // define an output stream to print into
1407  // it can then be directed to whatever log level is desired
1408  std::ostringstream myCoutStream;
1409 
1410  // get Run Data - the same code can be run in beginRun, with getByLabel from edm::Run
1411  const edm::Run& iRun = iEvent.getRun();
1412 
1413 
1414  // get L1GtTriggerMenuLite
1415  edm::Handle<L1GtTriggerMenuLite> triggerMenuLite;
1416  iRun.getByToken(m_l1GtTmLToken, triggerMenuLite);
1417 
1418  if (!triggerMenuLite.isValid()) {
1419 
1420  LogDebug("L1GtAnalyzer") << "\nL1GtTriggerMenuLite with \n "
1422  << "\nrequested in configuration, but not found in the event."
1423  << "\nExit the method.\n" << std::endl;
1424 
1425  return;
1426  }
1427 
1428  // print via supplied "print" function
1429  myCoutStream << (*triggerMenuLite);
1430 
1431  // test the individual methods
1432 
1433  const std::string& triggerMenuInterface =
1434  triggerMenuLite->gtTriggerMenuInterface();
1435  const std::string& triggerMenuName = triggerMenuLite->gtTriggerMenuName();
1436  const std::string& triggerMenuImplementation =
1437  triggerMenuLite->gtTriggerMenuImplementation();
1438  const std::string& scaleDbKey = triggerMenuLite->gtScaleDbKey();
1439 
1440  const L1GtTriggerMenuLite::L1TriggerMap& algorithmMap = triggerMenuLite->gtAlgorithmMap();
1441  const L1GtTriggerMenuLite::L1TriggerMap& algorithmAliasMap =
1442  triggerMenuLite->gtAlgorithmAliasMap();
1443  const L1GtTriggerMenuLite::L1TriggerMap& technicalTriggerMap =
1444  triggerMenuLite->gtTechnicalTriggerMap();
1445 
1446  const std::vector<unsigned int>& triggerMaskAlgoTrig =
1447  triggerMenuLite->gtTriggerMaskAlgoTrig();
1448  const std::vector<unsigned int>& triggerMaskTechTrig =
1449  triggerMenuLite->gtTriggerMaskTechTrig();
1450 
1451  const std::vector<std::vector<int> >& prescaleFactorsAlgoTrig =
1452  triggerMenuLite->gtPrescaleFactorsAlgoTrig();
1453  const std::vector<std::vector<int> >& prescaleFactorsTechTrig =
1454  triggerMenuLite->gtPrescaleFactorsTechTrig();
1455 
1456  // print in the same format as in L1GtTriggerMenuLite definition
1457 
1458  size_t nrDefinedAlgo = algorithmMap.size();
1459  size_t nrDefinedTech = technicalTriggerMap.size();
1460 
1461  // header for printing algorithms
1462 
1463  myCoutStream << "\n ********** L1 Trigger Menu - printing ********** \n"
1464  << "\nL1 Trigger Menu Interface: " << triggerMenuInterface
1465  << "\nL1 Trigger Menu Name: " << triggerMenuName
1466  << "\nL1 Trigger Menu Implementation: " << triggerMenuImplementation
1467  << "\nAssociated Scale DB Key: " << scaleDbKey << "\n\n"
1468  << "\nL1 Physics Algorithms: " << nrDefinedAlgo << " algorithms defined." << "\n\n"
1469  << "Bit Number "
1470  << std::right << std::setw(35) << "Algorithm Name" << " "
1471  << std::right << std::setw(35) << "Algorithm Alias" << " "
1472  << std::right << std::setw(12) << "Trigger Mask";
1473  for (unsigned iSet = 0; iSet < prescaleFactorsAlgoTrig.size(); iSet++) {
1474  myCoutStream << std::right << std::setw(10) << "PF Set "
1475  << std::right << std::setw(2) << iSet;
1476  }
1477 
1478  myCoutStream << std::endl;
1479 
1480 
1481  for (L1GtTriggerMenuLite::CItL1Trig itTrig = algorithmMap.begin(); itTrig
1482  != algorithmMap.end(); itTrig++) {
1483 
1484  const unsigned int bitNumber = itTrig->first;
1485  const std::string& aName = itTrig->second;
1486 
1487  std::string aAlias;
1488  L1GtTriggerMenuLite::CItL1Trig itAlias = algorithmAliasMap.find(bitNumber);
1489  if (itAlias != algorithmAliasMap.end()) {
1490  aAlias = itAlias->second;
1491  }
1492 
1493  myCoutStream << std::setw(6) << bitNumber << " "
1494  << std::right << std::setw(35) << aName << " "
1495  << std::right << std::setw(35) << aAlias << " "
1496  << std::right << std::setw(12) << triggerMaskAlgoTrig[bitNumber];
1497  for (unsigned iSet = 0; iSet < prescaleFactorsAlgoTrig.size(); iSet++) {
1498  myCoutStream << std::right << std::setw(12) << prescaleFactorsAlgoTrig[iSet][bitNumber];
1499  }
1500 
1501  myCoutStream << std::endl;
1502  }
1503 
1504  myCoutStream << "\nL1 Technical Triggers: " << nrDefinedTech
1505  << " technical triggers defined." << "\n\n" << std::endl;
1506  if (nrDefinedTech) {
1507  myCoutStream
1508  << std::right << std::setw(6) << "Bit Number "
1509  << std::right << std::setw(45) << " Technical trigger name " << " "
1510  << std::right << std::setw(12) << "Trigger Mask";
1511  for (unsigned iSet = 0; iSet < prescaleFactorsTechTrig.size(); iSet++) {
1512  myCoutStream << std::right << std::setw(10) << "PF Set "
1513  << std::right << std::setw(2) << iSet;
1514  }
1515 
1516  myCoutStream << std::endl;
1517  }
1518 
1519  for (L1GtTriggerMenuLite::CItL1Trig itTrig = technicalTriggerMap.begin(); itTrig
1520  != technicalTriggerMap.end(); itTrig++) {
1521 
1522  unsigned int bitNumber = itTrig->first;
1523  std::string aName = itTrig->second;
1524 
1525  myCoutStream << std::setw(6) << bitNumber << " "
1526  << std::right << std::setw(45) << aName
1527  << std::right << std::setw(12) << triggerMaskTechTrig[bitNumber];
1528  for (unsigned iSet = 0; iSet < prescaleFactorsTechTrig.size(); iSet++) {
1529  myCoutStream << std::right << std::setw(12) << prescaleFactorsTechTrig[iSet][bitNumber];
1530  }
1531 
1532  myCoutStream << std::endl;
1533 
1534  }
1535 
1536  // individual methods
1537 
1538  int errorCode = -1;
1539  const std::string* algorithmAlias = triggerMenuLite->gtAlgorithmAlias(
1540  m_bitNumber, errorCode);
1541  if (errorCode) {
1542  myCoutStream
1543  << "\nError code retrieving alias for algorithm with bit number "
1544  << m_bitNumber << ": " << errorCode << std::endl;
1545  } else {
1546  myCoutStream << "\nAlias for algorithm with bit number " << m_bitNumber
1547  << ": " << (*algorithmAlias) << std::endl;
1548  }
1549 
1550  errorCode = -1;
1551  const std::string* algorithmName = triggerMenuLite->gtAlgorithmName(
1552  m_bitNumber, errorCode);
1553  if (errorCode) {
1554  myCoutStream
1555  << "\nError code retrieving name for algorithm with bit number "
1556  << m_bitNumber << ": " << errorCode << std::endl;
1557  } else {
1558  myCoutStream << "\nName for algorithm with bit number " << m_bitNumber
1559  << ": " << (*algorithmName) << std::endl;
1560  }
1561 
1562  errorCode = -1;
1563  const std::string* techTrigName = triggerMenuLite->gtTechTrigName(
1564  m_bitNumber, errorCode);
1565  if (errorCode) {
1566  myCoutStream
1567  << "\nError code retrieving name for technical trigger with bit number "
1568  << m_bitNumber << ": " << errorCode << std::endl;
1569  } else {
1570  myCoutStream << "\nName for technical trigger with bit number "
1571  << m_bitNumber << ": " << (*techTrigName) << std::endl;
1572  }
1573 
1574  errorCode = -1;
1575  const unsigned int bitNumber = triggerMenuLite->gtBitNumber(
1576  m_nameAlgTechTrig, errorCode);
1577  if (errorCode) {
1578  myCoutStream
1579  << "\nError code retrieving bit number for algorithm/technical trigger "
1580  << m_nameAlgTechTrig << ": " << errorCode << std::endl;
1581  } else {
1582  myCoutStream << "\nBit number for algorithm/technical trigger "
1583  << m_nameAlgTechTrig << ": " << bitNumber << std::endl;
1584  }
1585 
1586  // not tested
1587  //errorCode = -1;
1588  //const bool triggerMenuLite->gtTriggerResult( m_nameAlgTechTrig,
1589  // const std::vector<bool>& decWord, errorCode);
1590 
1591 
1592  printOutput(myCoutStream);
1593 
1594 }
1595 
1596 // analyze: usage of ConditionsInEdm
1598  const edm::EventSetup& evSetup) {
1599 
1600  LogDebug("L1GtAnalyzer")
1601  << "\n**** L1GtAnalyzer::analyzeConditionsInRunBlock ****\n"
1602  << std::endl;
1603 
1604  // define an output stream to print into
1605  // it can then be directed to whatever log level is desired
1606  std::ostringstream myCoutStream;
1607 
1608  // get ConditionsInRunBlock
1610  iRun.getByToken(m_condInRunToken, condInRunBlock);
1611 
1612  if (!condInRunBlock.isValid()) {
1613 
1614  LogDebug("L1GtAnalyzer") << "\nConditionsInRunBlock with \n "
1616  << "\nrequested in configuration, but not found in the event."
1617  << "\nExit the method.\n" << std::endl;
1618 
1619  return;
1620  }
1621 
1622  const boost::uint16_t beamModeVal = condInRunBlock->beamMode;
1623  const boost::uint16_t beamMomentumVal = condInRunBlock->beamMomentum;
1624  const boost::uint32_t lhcFillNumberVal = condInRunBlock->lhcFillNumber;
1625 
1626  // print via supplied "print" function
1627  myCoutStream << "\nLHC quantities in run " << iRun.run()
1628  << "\n Beam Mode = " << beamModeVal
1629  << "\n Beam Momentum = " << beamMomentumVal << " GeV"
1630  << "\n LHC Fill Number = " << lhcFillNumberVal
1631  << std::endl;
1632 
1633  printOutput(myCoutStream);
1634 
1635 }
1636 
1637 
1639  const edm::LuminosityBlock& iLumi, const edm::EventSetup& evSetup) {
1640  LogDebug("L1GtAnalyzer")
1641  << "\n**** L1GtAnalyzer::analyzeConditionsInLumiBlock ****\n"
1642  << std::endl;
1643 
1644  // define an output stream to print into
1645  // it can then be directed to whatever log level is desired
1646  std::ostringstream myCoutStream;
1647 
1648  // get ConditionsInLumiBlock
1650  iLumi.getByToken(m_condInLumiToken, condInLumiBlock);
1651 
1652  if (!condInLumiBlock.isValid()) {
1653 
1654  LogDebug("L1GtAnalyzer") << "\nConditionsInLumiBlock with \n "
1656  << "\nrequested in configuration, but not found in the event."
1657  << "\nExit the method.\n" << std::endl;
1658 
1659  return;
1660  }
1661 
1662  const boost::uint32_t totalIntensityBeam1Val =
1663  condInLumiBlock->totalIntensityBeam1;
1664  const boost::uint32_t totalIntensityBeam2Val =
1665  condInLumiBlock->totalIntensityBeam2;
1666 
1667  myCoutStream << "\nLHC quantities in luminosity section "
1668 
1669  << iLumi.luminosityBlock() << " from run " << iLumi.run()
1670  << "\n Total Intensity Beam 1 (Integer × 10E10 charges) = "
1671  << totalIntensityBeam1Val
1672  << "\n Total Intensity Beam 2 (Integer × 10E10 charges) = "
1673  << totalIntensityBeam2Val << std::endl;
1674 
1675  printOutput(myCoutStream);
1676 
1677 }
1678 
1680  const edm::EventSetup& evSetup) {
1681  // define an output stream to print into
1682  // it can then be directed to whatever log level is desired
1683  std::ostringstream myCoutStream;
1684 
1685  // get ConditionsInEventBlock
1687  iEvent.getByToken(m_condInEventToken, condInEventBlock);
1688 
1689  if (!condInEventBlock.isValid()) {
1690 
1691  LogDebug("L1GtAnalyzer") << "\nConditionsInEventBlock with \n "
1693  << "\nrequested in configuration, but not found in the event."
1694  << "\nExit the method.\n" << std::endl;
1695 
1696  return;
1697  }
1698 
1699  const boost::uint16_t bstMasterStatusVal =
1700  condInEventBlock->bstMasterStatus;
1701  const boost::uint32_t turnCountNumberVal =
1702  condInEventBlock->turnCountNumber;
1703 
1704  myCoutStream << "\nLHC quantities in event " << iEvent.id().event()
1705  << " from luminosity section " << iEvent.luminosityBlock()
1706  << " from run " << iEvent.run() << "\n BST Master Status = "
1707  << bstMasterStatusVal << "\n Turn count number = "
1708  << turnCountNumberVal << std::endl;
1709 
1710  printOutput(myCoutStream);
1711 
1712 }
1713 
1714 void L1GtAnalyzer::printOutput(std::ostringstream& myCout) {
1715 
1716  switch (m_printOutput) {
1717  case 0: {
1718 
1719  std::cout << myCout.str() << std::endl;
1720 
1721  }
1722 
1723  break;
1724  case 1: {
1725 
1726  LogTrace("L1GtAnalyzer") << myCout.str() << std::endl;
1727 
1728  }
1729  break;
1730 
1731  case 2: {
1732 
1733  edm::LogVerbatim("L1GtAnalyzer") << myCout.str() << std::endl;
1734 
1735  }
1736 
1737  break;
1738  case 3: {
1739 
1740  edm::LogInfo("L1GtAnalyzer") << myCout.str();
1741 
1742  }
1743 
1744  break;
1745  default: {
1746  std::cout << "\n\n L1GtAnalyzer: Error - no print output = "
1747  << m_printOutput
1748  << " defined! \n Check available values in the cfi file."
1749  << "\n" << std::endl;
1750 
1751  }
1752  break;
1753  }
1754 
1755  myCout.str("");
1756  myCout.clear();
1757 
1758 }
1759 
1760 // analyze each event: event loop
1762  const edm::EventSetup& evSetup) {
1763 
1764  // analyze: decision and decision word
1765  // bunch cross in event BxInEvent = 0 - L1Accept event
1767  analyzeDecisionReadoutRecord(iEvent, evSetup);
1768  }
1769 
1770  // analyze: decision for a given algorithm using L1GtUtils functions
1771  // for tests, use only one of the following methods
1772 
1773  switch (m_l1GtUtilsConfiguration) {
1774  case 0: {
1776  analyzeL1GtUtilsMenuLite(iEvent, evSetup);
1777  }
1778 
1779  // full analysis of an algorithm or technical trigger
1780  if (m_analyzeTriggerEnable) {
1781  analyzeTrigger(iEvent, evSetup);
1782  }
1783 
1784  }
1785  break;
1786  case 100000: {
1788  analyzeL1GtUtils(iEvent, evSetup);
1789  }
1790 
1791  // full analysis of an algorithm or technical trigger
1792  if (m_analyzeTriggerEnable) {
1793  analyzeTrigger(iEvent, evSetup);
1794  }
1795 
1796  }
1797  break;
1798  case 200000: {
1800  analyzeL1GtUtilsEventSetup(iEvent, evSetup);
1801  }
1802 
1803  // full analysis of an algorithm or technical trigger
1804  if (m_analyzeTriggerEnable) {
1805  analyzeTrigger(iEvent, evSetup);
1806  }
1807 
1808  }
1809  break;
1810  default: {
1811  // do nothing
1812  }
1813  break;
1814  }
1815 
1816  // analyze: object map product
1818  analyzeObjectMap(iEvent, evSetup);
1819  }
1820 
1821  // analyze: L1GtTriggerMenuLite
1823  analyzeL1GtTriggerMenuLite(iEvent, evSetup);
1824  }
1825 
1826  // analyze: usage of ConditionsInEdm
1828  analyzeConditionsInEventBlock(iEvent, evSetup);
1829  }
1830 
1831 }
1832 
1833 // end section
1835  const edm::EventSetup& evSetup) {
1836 
1837  // empty
1838 
1839 }
1840 void L1GtAnalyzer::endRun(const edm::Run& iRun, const edm::EventSetup& evSetup) {
1841 
1842  // empty
1843 
1844 }
1845 
1846 // method called once each job just after ending the event loop
1848 
1849  // empty
1850 
1851 }
1852 
#define LogDebug(id)
virtual void analyzeObjectMap(const edm::Event &, const edm::EventSetup &)
analyze: object map product
EventNumber_t event() const
Definition: EventID.h:41
edm::InputTag m_l1GmtInputTag
input tag for muon collection from GMT
Definition: L1GtAnalyzer.h:147
edm::EDGetTokenT< edm::ConditionsInRunBlock > m_condInRunToken
Definition: L1GtAnalyzer.h:155
const int logicalExpressionRunUpdate(const edm::Run &, const edm::EventSetup &, const std::string &)
Definition: L1GtUtils.cc:2197
RunNumber_t run() const
Definition: RunBase.h:40
edm::EDGetTokenT< L1GtTriggerMenuLite > m_l1GtTmLToken
Definition: L1GtAnalyzer.h:151
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void analyzeDecisionReadoutRecord(const edm::Event &, const edm::EventSetup &)
edm::InputTag m_condInEdmInputTag
input tag for ConditionInEdm products
Definition: L1GtAnalyzer.h:154
const int prescaleFactorSetIndex(const edm::Event &iEvent, const TriggerCategory &trigCategory, int &errorCode) const
Definition: L1GtUtils.cc:1458
edm::InputTag m_l1GtRecordInputTag
input tags for GT lite product
Definition: L1GtAnalyzer.h:136
virtual void endJob()
end of job
const bool availableL1Configuration(int &errorCode, int &l1ConfCode) const
Definition: L1GtUtils.cc:1948
bool m_analyzeObjectMapEnable
Definition: L1GtAnalyzer.h:121
virtual void analyze(const edm::Event &, const edm::EventSetup &)
analyze each event: event loop over various code snippets
bool m_analyzeConditionsInRunBlockEnable
Definition: L1GtAnalyzer.h:125
edm::EDGetTokenT< L1GlobalTriggerObjectMaps > m_l1GtObjectMapsToken
Definition: L1GtAnalyzer.h:144
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:62
const std::vector< std::pair< std::string, int > > & prescaleFactors()
Definition: L1GtUtils.cc:2340
const bool decision(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
Definition: L1GtUtils.cc:1208
std::string m_l1GtUtilsLogicalExpression
Definition: L1GtAnalyzer.h:184
Run const & getRun() const
Definition: Event.cc:65
const std::vector< unsigned int > & triggerMaskSet(const TriggerCategory &trigCategory, int &errorCode)
Definition: L1GtUtils.cc:1734
bool m_analyzeDecisionReadoutRecordEnable
enable / disable various analysis methods
Definition: L1GtAnalyzer.h:114
const std::vector< std::pair< std::string, int > > & triggerMasks()
Definition: L1GtUtils.cc:2353
const std::string & l1TriggerMenu() const
return the L1 trigger menu name
Definition: L1GtUtils.cc:1833
virtual void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
end section
void analyzeConditionsInEventBlock(const edm::Event &, const edm::EventSetup &)
to be used in analyze/produce/filter
void printL1Extra(std::ostream &oStr, const L1GtObject &gtObject, const bool checkBxInEvent, const int bxInEvent, const bool checkObjIndexInColl, const int objIndexInColl) const
tuple result
Definition: mps_fire.py:83
std::map< unsigned int, std::string > L1TriggerMap
map containing the physics algorithms or the technical triggers
LuminosityBlockNumber_t luminosityBlock() const
U second(std::pair< T, U > const &p)
void analyzeConditionsInRunBlock(const edm::Run &, const edm::EventSetup &)
const std::vector< std::pair< std::string, bool > > & decisionsAfterMask()
Definition: L1GtUtils.cc:2327
bool m_analyzeConditionsInEventBlockEnable
Definition: L1GtAnalyzer.h:127
void analyzeL1GtUtils(const edm::Event &, const edm::EventSetup &)
std::string m_nameAlgTechTrig
an algorithm trigger (name or alias) or a technical trigger name
Definition: L1GtAnalyzer.h:160
void printOutput(std::ostringstream &)
print the output stream to the required output, given by m_printOutput
const std::vector< std::pair< std::string, bool > > & decisionsBeforeMask()
Definition: L1GtUtils.cc:2314
virtual void endRun(const edm::Run &, const edm::EventSetup &)
int iEvent
Definition: GenABIO.cc:230
std::string m_condName
a condition in the algorithm trigger to test the object maps
Definition: L1GtAnalyzer.h:163
void analyzeL1GtTriggerMenuLite(const edm::Event &, const edm::EventSetup &)
analyze: usage of L1GtTriggerMenuLite
const std::string & l1TriggerMenuImplementation() const
return the L1 trigger menu implementation
Definition: L1GtUtils.cc:1858
edm::InputTag m_l1GtObjectMapTag
input tags for GT object map collection L1GlobalTriggerObjectMapRecord
Definition: L1GtAnalyzer.h:139
L1RetrieveL1Extra m_retrieveL1Extra
Definition: L1GtAnalyzer.h:107
std::vector< bool > DecisionWord
typedefs
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Run.h:258
dictionary comb
bool m_analyzeTriggerEnable
Definition: L1GtAnalyzer.h:119
edm::EDGetTokenT< edm::ConditionsInLumiBlock > m_condInLumiToken
Definition: L1GtAnalyzer.h:156
RunNumber_t run() const
Definition: Event.h:93
RunNumber_t run() const
bool m_analyzeL1GtUtilsEventSetupEnable
Definition: L1GtAnalyzer.h:117
edm::EDGetTokenT< edm::ConditionsInEventBlock > m_condInEventToken
Definition: L1GtAnalyzer.h:157
const std::vector< L1GtLogicParser::OperandToken > & expL1Triggers()
list of triggers in the logical expression, trigger decisions, prescale factors and masks...
Definition: L1GtUtils.h:159
unsigned int m_bitNumber
a bit number to retrieve the name and the alias
Definition: L1GtAnalyzer.h:166
bool isValid() const
Definition: HandleBase.h:75
L1GtUtils m_l1GtUtilsProv
Definition: L1GtAnalyzer.h:188
#define LogTrace(id)
const int triggerMask(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1238
L1GtUtils m_l1GtUtils
Definition: L1GtAnalyzer.h:189
L1TriggerMap::const_iterator CItL1Trig
iterators through map containing the physics algorithms or the technical triggers ...
int m_printOutput
print output
Definition: L1GtAnalyzer.h:110
void analyzeConditionsInLumiBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
to be used in beginLuminosityBlock
const std::vector< int > & prescaleFactorSet(const edm::Event &iEvent, const TriggerCategory &trigCategory, int &errorCode)
Definition: L1GtUtils.cc:1662
const bool decisionBeforeMask(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return decision before trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1178
virtual void beginJob()
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDaqReadoutRecordToken
Definition: L1GtAnalyzer.h:133
static const bool useL1GtTriggerMenuLite(true)
unsigned int m_l1GtUtilsConfiguration
L1 configuration code for L1GtUtils.
Definition: L1GtAnalyzer.h:169
bool m_analyzeConditionsInLumiBlockEnable
Definition: L1GtAnalyzer.h:126
edm::InputTag m_l1GtDaqReadoutRecordInputTag
input tags for GT DAQ product
Definition: L1GtAnalyzer.h:132
L1GtUtils::LogicalExpressionL1Results m_logicalExpressionL1ResultsProv
Definition: L1GtAnalyzer.h:190
bool m_l1GtUtilsConfigureBeginRun
if true, configure (partially) L1GtUtils in beginRun using getL1GtRunCache
Definition: L1GtAnalyzer.h:180
L1GtAnalyzer(const edm::ParameterSet &)
Definition: L1GtAnalyzer.cc:43
edm::InputTag m_l1GtObjectMapsInputTag
input tags for GT object map collection L1GlobalTriggerObjectMaps
Definition: L1GtAnalyzer.h:143
edm::EventID id() const
Definition: EventBase.h:59
int iErrorCode
void getL1GtRunCache(const edm::Run &, const edm::EventSetup &, const bool, const bool)
get all the run-constant quantities for L1 trigger and cache them
Definition: L1GtUtils.cc:319
bool m_l1GtTmLInputTagProv
Definition: L1GtAnalyzer.h:173
bool m_analyzeL1GtUtilsMenuLiteEnable
Definition: L1GtAnalyzer.h:116
bool m_analyzeL1GtUtilsEnable
Definition: L1GtAnalyzer.h:118
tuple cout
Definition: gather_cfg.py:145
bool m_l1GtRecordsInputTagProv
Definition: L1GtAnalyzer.h:177
void analyzeL1GtUtilsEventSetup(const edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > m_l1GtObjectMapToken
Definition: L1GtAnalyzer.h:140
const bool decisionAfterMask(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return decision after trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1193
std::vector< SingleCombInCond > CombinationsInCond
all the object combinations evaluated to true in the condition
void analyzeTrigger(const edm::Event &, const edm::EventSetup &)
full analysis of an algorithm or technical trigger
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
bool isValid()
return true if the logical expression is syntactically correct
Definition: L1GtUtils.h:144
void retrieveL1ExtraObjects(const edm::Event &, const edm::EventSetup &)
static const bool useL1EventSetup(true)
Definition: Run.h:43
void analyzeL1GtUtilsMenuLite(const edm::Event &, const edm::EventSetup &)
for tests, use only one of the following methods
L1GtUtils::LogicalExpressionL1Results m_logicalExpressionL1Results
Definition: L1GtAnalyzer.h:191
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
edm::InputTag m_l1GtTmLInputTag
input tag for L1GtTriggerMenuLite
Definition: L1GtAnalyzer.h:150
const std::vector< std::pair< std::string, int > > & errorCodes(const edm::Event &)
Definition: L1GtUtils.cc:2366
void analyzeL1GtUtilsCore(const edm::Event &, const edm::EventSetup &)
analyze: usage of L1GtUtils
const int prescaleFactor(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return prescale factor for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1223