Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:22

0001 /**
0002  * \class L1GtAnalyzer
0003  * 
0004  * 
0005  * Description: test analyzer to illustrate various methods for L1 GT trigger.
0006  *
0007  * Implementation:
0008  *    <TODO: enter implementation details>
0009  *   
0010  * \author: Vasile Mihai Ghete - HEPHY Vienna
0011  * 
0012  *
0013  */
0014 
0015 // this class header
0016 #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtAnalyzer.h"
0017 
0018 // system include files
0019 #include <memory>
0020 #include <iomanip>
0021 
0022 // user include files
0023 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
0024 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
0025 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerRecord.h"
0026 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h"
0027 
0028 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h"
0029 
0030 #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerPSB.h"
0031 #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerGTL.h"
0032 #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerFDL.h"
0033 
0034 #include "FWCore/Framework/interface/ESHandle.h"
0035 #include "FWCore/Framework/interface/LuminosityBlock.h"
0036 
0037 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
0038 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
0039 
0040 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0041 
0042 // constructor(s)
0043 L1GtAnalyzer::L1GtAnalyzer(const edm::ParameterSet& parSet)
0044     :
0045 
0046       m_retrieveL1Extra(parSet.getParameter<edm::ParameterSet>("L1ExtraInputTags"), consumesCollector()),
0047 
0048       m_printOutput(parSet.getUntrackedParameter<int>("PrintOutput", 3)),
0049 
0050       m_analyzeDecisionReadoutRecordEnable(parSet.getParameter<bool>("analyzeDecisionReadoutRecordEnable")),
0051       //
0052       m_analyzeL1GtUtilsMenuLiteEnable(parSet.getParameter<bool>("analyzeL1GtUtilsMenuLiteEnable")),
0053       m_analyzeL1GtUtilsEventSetupEnable(parSet.getParameter<bool>("analyzeL1GtUtilsEventSetupEnable")),
0054       m_analyzeL1GtUtilsEnable(parSet.getParameter<bool>("analyzeL1GtUtilsEnable")),
0055       m_analyzeTriggerEnable(parSet.getParameter<bool>("analyzeTriggerEnable")),
0056       //
0057       m_analyzeObjectMapEnable(parSet.getParameter<bool>("analyzeObjectMapEnable")),
0058       //
0059       m_analyzeL1GtTriggerMenuLiteEnable(parSet.getParameter<bool>("analyzeL1GtTriggerMenuLiteEnable")),
0060       //
0061       m_analyzeConditionsInRunBlockEnable(parSet.getParameter<bool>("analyzeConditionsInRunBlockEnable")),
0062       m_analyzeConditionsInLumiBlockEnable(parSet.getParameter<bool>("analyzeConditionsInLumiBlockEnable")),
0063       m_analyzeConditionsInEventBlockEnable(parSet.getParameter<bool>("analyzeConditionsInEventBlockEnable")),
0064 
0065       // input tag for GT DAQ product
0066       m_l1GtDaqReadoutRecordInputTag(parSet.getParameter<edm::InputTag>("L1GtDaqReadoutRecordInputTag")),
0067 
0068       // input tag for L1GlobalTriggerRecord
0069       m_l1GtRecordInputTag(parSet.getParameter<edm::InputTag>("L1GtRecordInputTag")),
0070 
0071       // input tag for GT object map collection L1GlobalTriggerObjectMapRecord
0072       m_l1GtObjectMapTag(parSet.getParameter<edm::InputTag>("L1GtObjectMapTag")),
0073 
0074       // input tag for GT object map collection L1GlobalTriggerObjectMaps
0075       m_l1GtObjectMapsInputTag(parSet.getParameter<edm::InputTag>("L1GtObjectMapsInputTag")),
0076 
0077       // input tag for muon collection from GMT
0078       m_l1GmtInputTag(parSet.getParameter<edm::InputTag>("L1GmtInputTag")),
0079 
0080       // input tag for L1GtTriggerMenuLite
0081       m_l1GtTmLInputTag(parSet.getParameter<edm::InputTag>("L1GtTmLInputTag")),
0082 
0083       // input tag for ConditionInEdm products
0084       m_condInEdmInputTag(parSet.getParameter<edm::InputTag>("CondInEdmInputTag")),
0085 
0086       // an algorithm and a condition in that algorithm to test the object maps
0087       m_nameAlgTechTrig(parSet.getParameter<std::string>("AlgorithmName")),
0088       m_condName(parSet.getParameter<std::string>("ConditionName")),
0089       m_bitNumber(parSet.getParameter<unsigned int>("BitNumber")),
0090 
0091       m_l1GtUtilsConfiguration(parSet.getParameter<unsigned int>("L1GtUtilsConfiguration")),
0092       m_l1GtTmLInputTagProv(parSet.getParameter<bool>("L1GtTmLInputTagProv")),
0093       m_l1GtRecordsInputTagProv(parSet.getParameter<bool>("L1GtRecordsInputTagProv")),
0094       m_l1GtUtilsConfigureBeginRun(parSet.getParameter<bool>("L1GtUtilsConfigureBeginRun")),
0095       m_l1GtUtilsLogicalExpression(parSet.getParameter<std::string>("L1GtUtilsLogicalExpression")),
0096       m_l1GtUtilsProv(parSet,
0097                       consumesCollector(),
0098                       m_l1GtUtilsConfiguration == 0 || m_l1GtUtilsConfiguration == 100000,
0099                       *this,
0100                       edm::InputTag(),
0101                       edm::InputTag(),
0102                       m_l1GtTmLInputTagProv ? edm::InputTag() : m_l1GtTmLInputTag),
0103       m_l1GtUtils(parSet,
0104                   consumesCollector(),
0105                   m_l1GtUtilsConfiguration == 0 || m_l1GtUtilsConfiguration == 100000,
0106                   *this,
0107                   m_l1GtRecordInputTag,
0108                   m_l1GtDaqReadoutRecordInputTag,
0109                   m_l1GtTmLInputTagProv ? edm::InputTag() : m_l1GtTmLInputTag),
0110       m_logicalExpressionL1ResultsProv(m_l1GtUtilsLogicalExpression, m_l1GtUtilsProv),
0111       m_logicalExpressionL1Results(m_l1GtUtilsLogicalExpression, m_l1GtUtils) {
0112   m_l1GtDaqReadoutRecordToken = consumes<L1GlobalTriggerReadoutRecord>(m_l1GtDaqReadoutRecordInputTag);
0113   m_l1GtObjectMapToken = consumes<L1GlobalTriggerObjectMapRecord>(m_l1GtObjectMapTag);
0114   m_l1GtObjectMapsToken = consumes<L1GlobalTriggerObjectMaps>(m_l1GtObjectMapsInputTag);
0115   m_l1GtTmLToken = consumes<L1GtTriggerMenuLite, edm::InRun>(m_l1GtTmLInputTag);
0116   m_condInRunToken = consumes<edm::ConditionsInRunBlock, edm::InRun>(m_condInEdmInputTag);
0117   m_condInLumiToken = consumes<edm::ConditionsInLumiBlock, edm::InLumi>(m_condInEdmInputTag);
0118   m_condInEventToken = consumes<edm::ConditionsInEventBlock>(m_condInEdmInputTag);
0119 
0120   LogDebug("L1GtAnalyzer") << "\n Input parameters for L1 GT test analyzer"
0121                            << "\n   L1 GT DAQ product:            " << m_l1GtDaqReadoutRecordInputTag
0122                            << "\n   L1GlobalTriggerRecord product:           " << m_l1GtRecordInputTag
0123                            << "\n   L1 GT object map collection:  " << m_l1GtObjectMapTag
0124                            << "\n   Muon collection from GMT:     " << m_l1GmtInputTag
0125                            << "\n   L1 trigger menu lite product: " << m_l1GtTmLInputTag
0126                            << "\n   Algorithm name or alias, technical trigger name:  " << m_nameAlgTechTrig
0127                            << "\n   Condition, if an algorithm trigger is requested:   " << m_condName
0128                            << "\n   Bit number for an algorithm or technical trigger: " << m_bitNumber
0129                            << "\n   Requested L1 trigger configuration: " << m_l1GtUtilsConfiguration
0130                            << "\n   Retrieve input tag from provenance for L1GtTriggerMenuLite in the L1GtUtils: "
0131                            << m_l1GtTmLInputTagProv
0132                            << "\n   Retrieve input tag from provenance for L1GlobalTriggerReadoutRecord "
0133                            << "\n   and / or L1GlobalTriggerRecord in the L1GtUtils: " << m_l1GtRecordsInputTagProv
0134                            << "\n   Configure L1GtUtils in beginRun(...): " << m_l1GtUtilsConfigureBeginRun << " \n"
0135                            << std::endl;
0136 }
0137 
0138 // destructor
0139 L1GtAnalyzer::~L1GtAnalyzer() {
0140   // empty
0141 }
0142 
0143 // method called once each job just before starting event loop
0144 void L1GtAnalyzer::beginJob() {
0145   // empty
0146 }
0147 
0148 void L1GtAnalyzer::beginRun(const edm::Run& iRun, const edm::EventSetup& evSetup) {
0149   if (m_analyzeConditionsInRunBlockEnable) {
0150     analyzeConditionsInRunBlock(iRun, evSetup);
0151   }
0152 
0153   // L1GtUtils
0154 
0155   if (m_l1GtUtilsConfigureBeginRun) {
0156     //   for tests, use only one of the following methods for m_l1GtUtilsConfiguration
0157 
0158     bool useL1EventSetup = false;
0159     bool useL1GtTriggerMenuLite = false;
0160 
0161     switch (m_l1GtUtilsConfiguration) {
0162       case 0: {
0163         useL1EventSetup = false;
0164         useL1GtTriggerMenuLite = true;
0165 
0166       } break;
0167       case 100000: {
0168         useL1EventSetup = true;
0169         useL1GtTriggerMenuLite = true;
0170 
0171       } break;
0172       case 200000: {
0173         useL1EventSetup = true;
0174         useL1GtTriggerMenuLite = false;
0175 
0176       } break;
0177       default: {
0178         // do nothing
0179       } break;
0180     }
0181 
0182     m_l1GtUtilsProv.getL1GtRunCache(iRun, evSetup, useL1EventSetup, useL1GtTriggerMenuLite);
0183 
0184     m_l1GtUtils.getL1GtRunCache(iRun, evSetup, useL1EventSetup, useL1GtTriggerMenuLite);
0185 
0186     // check if the parsing of the logical expression was successful
0187 
0188     if (m_logicalExpressionL1ResultsProv.isValid()) {
0189       m_logicalExpressionL1ResultsProv.logicalExpressionRunUpdate(iRun, evSetup);
0190     } else {
0191       // do whatever is necessary if parsing fails - the size of all vectors with L1 results is zero in this case
0192       // a LogWarning message is written in L1GtUtils
0193     }
0194 
0195     //        if (m_logicalExpressionL1Results.isValid()) {
0196     //            m_logicalExpressionL1Results.logicalExpressionRunUpdate(iRun,
0197     //                    evSetup);
0198     //        } else {
0199     //            // do whatever is necessary if parsing fails - the size of all vectors with L1 results is zero in this case
0200     //            // a LogWarning message is written in L1GtUtils
0201     //        }
0202 
0203     // if the logical expression is changed, one has to check it's validity after the logicalExpressionRunUpdate call
0204     // (...dirty testing with the same logical expression)
0205     m_logicalExpressionL1Results.logicalExpressionRunUpdate(iRun, evSetup, m_l1GtUtilsLogicalExpression);
0206     if (!(m_logicalExpressionL1Results.isValid())) {
0207       // do whatever is necessary if parsing fails - the size of all vectors with L1 results is zero in this case
0208       // a LogWarning message is written in L1GtUtils
0209     }
0210   }
0211 }
0212 
0213 void L1GtAnalyzer::beginLuminosityBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup& evSetup) {
0214   if (m_analyzeConditionsInLumiBlockEnable) {
0215     analyzeConditionsInLumiBlock(iLumi, evSetup);
0216   }
0217 }
0218 
0219 // member functions
0220 
0221 // analyze: decision and decision word
0222 //   bunch cross in event BxInEvent = 0 - L1Accept event
0223 void L1GtAnalyzer::analyzeDecisionReadoutRecord(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
0224   LogDebug("L1GtAnalyzer") << "\n**** L1GtAnalyzer::analyzeDecisionReadoutRecord ****\n" << std::endl;
0225 
0226   // define an output stream to print into
0227   // it can then be directed to whatever log level is desired
0228   std::ostringstream myCoutStream;
0229 
0230   // get L1GlobalTriggerReadoutRecord
0231   edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecord;
0232   iEvent.getByToken(m_l1GtDaqReadoutRecordToken, gtReadoutRecord);
0233 
0234   if (!gtReadoutRecord.isValid()) {
0235     LogDebug("L1GtAnalyzer") << "\nL1GlobalTriggerReadoutRecord with \n  " << m_l1GtDaqReadoutRecordInputTag
0236                              << "\nrequested in configuration, but not found in the event."
0237                              << "\nExit the method.\n"
0238                              << std::endl;
0239 
0240     return;
0241   }
0242 
0243   // get Global Trigger decision and the decision word
0244   bool gtDecision = gtReadoutRecord->decision();
0245   DecisionWord gtDecisionWord = gtReadoutRecord->decisionWord();
0246 
0247   // print Global Trigger decision and the decision word
0248   edm::LogVerbatim("L1GtAnalyzer") << "\n GlobalTrigger decision: " << gtDecision << std::endl;
0249 
0250   // print via supplied "print" function (
0251   gtReadoutRecord->printGtDecision(myCoutStream);
0252 
0253   // print technical trigger word via supplied "print" function
0254   gtReadoutRecord->printTechnicalTrigger(myCoutStream);
0255 
0256   printOutput(myCoutStream);
0257 }
0258 
0259 void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
0260   // define an output stream to print into
0261   // it can then be directed to whatever log level is desired
0262   std::ostringstream myCoutStream;
0263 
0264   // example to access L1 trigger results using public methods from L1GtUtils
0265   // methods must be called after retrieving the L1 configuration
0266 
0267   // testing which environment is used
0268 
0269   int iErrorCode = -1;
0270   int l1ConfCode = -1;
0271 
0272   const bool l1Conf = m_l1GtUtils.availableL1Configuration(iErrorCode, l1ConfCode);
0273 
0274   myCoutStream << "\nL1 configuration code: \n"
0275                << "\n Legend: "
0276                << "\n      0 - Retrieve L1 trigger configuration from L1GtTriggerMenuLite only"
0277                << "\n  10000     L1GtTriggerMenuLite product is valid"
0278                << "\n  99999     L1GtTriggerMenuLite product not valid. Error."
0279                << "\n"
0280                << "\n 100000 - Fall through: try first L1GtTriggerMenuLite; if not valid,try event setup."
0281                << "\n 110000     L1GtTriggerMenuLite product is valid"
0282                << "\n 120000     L1GtTriggerMenuLite product not valid, event setup valid."
0283                << "\n 199999     L1GtTriggerMenuLite product not valid, event setup not valid. Error."
0284                << "\n"
0285                << "\n 200000 - Retrieve L1 trigger configuration from event setup only."
0286                << "\n 210000     Event setup valid."
0287                << "\n 299999     Event setup not valid. Error."
0288                << "\n"
0289                << "\n 300000 - No L1 trigger configuration requested to be retrieved. Error"
0290                << "\n            Must call before using L1GtUtils methods: "
0291                << "\n                getL1GtRunCache(const edm::Event& iEvent, const edm::EventSetup& evSetup,"
0292                << "\n                                const bool useL1EventSetup, const bool useL1GtTriggerMenuLite)"
0293                << "\n"
0294                << std::endl;
0295 
0296   if (l1Conf) {
0297     myCoutStream << "\nL1 configuration code:" << l1ConfCode << "\nValid L1 trigger configuration." << std::endl;
0298 
0299     myCoutStream << "\nL1 trigger menu name and implementation:"
0300                  << "\n"
0301                  << m_l1GtUtils.l1TriggerMenu() << "\n"
0302                  << m_l1GtUtils.l1TriggerMenuImplementation() << std::endl;
0303 
0304   } else {
0305     myCoutStream << "\nL1 configuration code:" << l1ConfCode << "\nNo valid L1 trigger configuration available."
0306                  << "\nSee text above for error code interpretation"
0307                  << "\nNo return here, in order to test each method, protected against configuration error."
0308                  << std::endl;
0309   }
0310 
0311   myCoutStream << "\n******** Results found with input tags retrieved from provenance ******** \n" << std::endl;
0312 
0313   //
0314   // no input tags; for the appropriate EDM product, it will be found
0315   // from provenance
0316 
0317   // the following methods share the same error code, therefore one can check only once
0318   // the validity of the result
0319 
0320   iErrorCode = -1;
0321 
0322   bool decisionBeforeMaskAlgTechTrig = m_l1GtUtilsProv.decisionBeforeMask(iEvent, m_nameAlgTechTrig, iErrorCode);
0323 
0324   bool decisionAfterMaskAlgTechTrig = m_l1GtUtilsProv.decisionAfterMask(iEvent, m_nameAlgTechTrig, iErrorCode);
0325 
0326   bool decisionAlgTechTrig = m_l1GtUtilsProv.decision(iEvent, m_nameAlgTechTrig, iErrorCode);
0327 
0328   int prescaleFactorAlgTechTrig = m_l1GtUtilsProv.prescaleFactor(iEvent, m_nameAlgTechTrig, iErrorCode);
0329 
0330   int triggerMaskAlgTechTrig = m_l1GtUtilsProv.triggerMask(iEvent, m_nameAlgTechTrig, iErrorCode);
0331 
0332   myCoutStream << "\n\nMethods:"
0333                << "\n  decisionBeforeMask(iEvent, m_nameAlgTechTrig, iErrorCode)"
0334                << "\n  decisionAfterMask(iEvent, m_nameAlgTechTrig, iErrorCode)"
0335                << "\n  decision(iEvent, m_nameAlgTechTrig, iErrorCode)"
0336                << "\n  prescaleFactor(iEvent, m_nameAlgTechTrig, iErrorCode)"
0337                << "\n  triggerMask(iEvent, m_nameAlgTechTrig, iErrorCode)"
0338                << "\n  triggerMask(m_nameAlgTechTrig,iErrorCode)"
0339                << "\n\n"
0340                << std::endl;
0341 
0342   if (iErrorCode == 0) {
0343     myCoutStream << "\nDecision before trigger mask for " << m_nameAlgTechTrig << ":   "
0344                  << decisionBeforeMaskAlgTechTrig << std::endl;
0345     myCoutStream << "Decision after trigger mask for " << m_nameAlgTechTrig << ":    " << decisionAfterMaskAlgTechTrig
0346                  << std::endl;
0347     myCoutStream << "Decision (after trigger mask) for " << m_nameAlgTechTrig << ":  " << decisionAlgTechTrig
0348                  << std::endl;
0349 
0350     myCoutStream << "Prescale factor for " << m_nameAlgTechTrig << ":                " << prescaleFactorAlgTechTrig
0351                  << std::endl;
0352 
0353     myCoutStream << "Trigger mask for " << m_nameAlgTechTrig << ":                   " << triggerMaskAlgTechTrig
0354                  << std::endl;
0355 
0356   } else if (iErrorCode == 1) {
0357     myCoutStream << "\n"
0358                  << m_nameAlgTechTrig << " does not exist in the L1 menu " << m_l1GtUtilsProv.l1TriggerMenu() << "\n"
0359                  << std::endl;
0360 
0361   } else {
0362     myCoutStream << "\nError: "
0363                  << "\n  An error was encountered when retrieving decision, mask and prescale factor for "
0364                  << m_nameAlgTechTrig << "\n  L1 Menu: " << m_l1GtUtilsProv.l1TriggerMenu()
0365                  << "\n  Error code: " << iErrorCode << std::endl;
0366   }
0367 
0368   // another method to get the trigger mask (no common errorCode)
0369 
0370   iErrorCode = -1;
0371   triggerMaskAlgTechTrig = m_l1GtUtilsProv.triggerMask(m_nameAlgTechTrig, iErrorCode);
0372 
0373   if (iErrorCode == 0) {
0374     myCoutStream << "\nTrigger mask for " << m_nameAlgTechTrig << "(faster method):    " << triggerMaskAlgTechTrig
0375                  << std::endl;
0376 
0377   } else if (iErrorCode == 1) {
0378     myCoutStream << "\n"
0379                  << m_nameAlgTechTrig << " does not exist in the L1 menu " << m_l1GtUtilsProv.l1TriggerMenu() << "\n"
0380                  << std::endl;
0381 
0382   } else {
0383     myCoutStream << "\nError: "
0384                  << "\n  An error was encountered when fast retrieving trigger mask for " << m_nameAlgTechTrig
0385                  << "\n  L1 Menu: " << m_l1GtUtilsProv.l1TriggerMenu() << "\n  Error code: " << iErrorCode << std::endl;
0386   }
0387 
0388   // index of the actual prescale factor set, and the actual prescale
0389   // factor set for algorithm triggers
0390 
0391   L1GtUtils::TriggerCategory trigCategory = L1GtUtils::AlgorithmTrigger;
0392 
0393   myCoutStream << "\nMethods:"
0394                << "\n  prescaleFactorSetIndex(iEvent, trigCategory, iErrorCode)"
0395                << "\n  prescaleFactorSet(iEvent, trigCategory,iErrorCode)\n"
0396                << std::endl;
0397 
0398   iErrorCode = -1;
0399   const int pfSetIndexAlgorithmTrigger = m_l1GtUtilsProv.prescaleFactorSetIndex(iEvent, trigCategory, iErrorCode);
0400 
0401   if (iErrorCode == 0) {
0402     myCoutStream << "\nAlgorithm triggers: index for prescale factor set = " << pfSetIndexAlgorithmTrigger
0403                  << "\nfor run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock()
0404                  << ", with L1 menu \n  " << m_l1GtUtilsProv.l1TriggerMenu() << std::endl;
0405 
0406   } else {
0407     myCoutStream << "\nError encountered when retrieving the prescale factor set index"
0408                  << "\n  for algorithm triggers, for run " << iEvent.run() << ", luminosity block "
0409                  << iEvent.luminosityBlock() << " with L1 menu \n  " << m_l1GtUtilsProv.l1TriggerMenu()
0410                  << "\n  Error code: " << iErrorCode << "\n"
0411                  << std::endl;
0412   }
0413 
0414   iErrorCode = -1;
0415   const std::vector<int>& pfSetAlgorithmTrigger = m_l1GtUtilsProv.prescaleFactorSet(iEvent, trigCategory, iErrorCode);
0416 
0417   if (iErrorCode == 0) {
0418     myCoutStream << "\nAlgorithm triggers: prescale factor set index = " << pfSetIndexAlgorithmTrigger << "\nfor run "
0419                  << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() << ", with L1 menu \n  "
0420                  << m_l1GtUtilsProv.l1TriggerMenu() << std::endl;
0421 
0422     int iBit = -1;
0423     for (std::vector<int>::const_iterator cItBit = pfSetAlgorithmTrigger.begin(); cItBit != pfSetAlgorithmTrigger.end();
0424          ++cItBit) {
0425       iBit++;
0426       myCoutStream << "Bit number " << std::right << std::setw(4) << iBit << ": prescale factor = " << (*cItBit)
0427                    << std::endl;
0428     }
0429 
0430   } else {
0431     myCoutStream << "\nError encountered when retrieving the prescale factor set "
0432                  << "\n  for algorithm triggers, for run " << iEvent.run() << ", luminosity block "
0433                  << iEvent.luminosityBlock() << " with L1 menu \n  " << m_l1GtUtilsProv.l1TriggerMenu()
0434                  << "\n  Error code: " << iErrorCode << "\n"
0435                  << std::endl;
0436   }
0437 
0438   // the actual trigger mask set for algorithm triggers
0439 
0440   myCoutStream << "\nMethod:"
0441                << "\n  triggerMaskSet(trigCategory, iErrorCode)" << std::endl;
0442 
0443   iErrorCode = -1;
0444   const std::vector<unsigned int>& tmSetAlgorithmTrigger = m_l1GtUtilsProv.triggerMaskSet(trigCategory, iErrorCode);
0445 
0446   if (iErrorCode == 0) {
0447     myCoutStream << "\nAlgorithm triggers: trigger mask set for run " << iEvent.run() << ", luminosity block "
0448                  << iEvent.luminosityBlock() << ", with L1 menu \n  " << m_l1GtUtilsProv.l1TriggerMenu() << "\n"
0449                  << std::endl;
0450 
0451     int iBit = -1;
0452     for (std::vector<unsigned int>::const_iterator cItBit = tmSetAlgorithmTrigger.begin();
0453          cItBit != tmSetAlgorithmTrigger.end();
0454          ++cItBit) {
0455       iBit++;
0456       myCoutStream << "Bit number " << std::right << std::setw(4) << iBit << ": trigger mask = " << (*cItBit)
0457                    << std::endl;
0458     }
0459 
0460   } else {
0461     myCoutStream << "\nError encountered when retrieving the trigger mask set "
0462                  << "\n  for algorithm triggers, for run " << iEvent.run() << ", luminosity block "
0463                  << iEvent.luminosityBlock() << " with L1 menu \n  " << m_l1GtUtilsProv.l1TriggerMenu()
0464                  << "\n  Error code: " << iErrorCode << "\n"
0465                  << std::endl;
0466   }
0467 
0468   // index of the actual prescale factor set, and the actual prescale
0469   // factor set for technical triggers
0470 
0471   trigCategory = L1GtUtils::TechnicalTrigger;
0472 
0473   myCoutStream << "\nMethods:"
0474                << "\n  prescaleFactorSetIndex(iEvent, trigCategory, iErrorCode)"
0475                << "\n  prescaleFactorSet(iEvent, trigCategory,iErrorCode)\n"
0476                << std::endl;
0477 
0478   iErrorCode = -1;
0479   const int pfSetIndexTechnicalTrigger = m_l1GtUtilsProv.prescaleFactorSetIndex(iEvent, trigCategory, iErrorCode);
0480 
0481   if (iErrorCode == 0) {
0482     myCoutStream << "\nTechnical triggers: index for prescale factor set = " << pfSetIndexTechnicalTrigger
0483                  << "\nfor run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock()
0484                  << ", with L1 menu \n  " << m_l1GtUtilsProv.l1TriggerMenu()
0485                  << "\nMethod: prescaleFactorSetIndex(iEvent, trigCategory, iErrorCode)\n"
0486                  << std::endl;
0487 
0488   } else {
0489     myCoutStream << "\nError encountered when retrieving the prescale factor set index"
0490                  << "\n  for technical triggers, for run " << iEvent.run() << ", luminosity block "
0491                  << iEvent.luminosityBlock() << " with L1 menu \n  " << m_l1GtUtilsProv.l1TriggerMenu()
0492                  << "\n  Error code: " << iErrorCode << "\n"
0493                  << std::endl;
0494   }
0495 
0496   iErrorCode = -1;
0497   const std::vector<int>& pfSetTechnicalTrigger = m_l1GtUtilsProv.prescaleFactorSet(iEvent, trigCategory, iErrorCode);
0498 
0499   if (iErrorCode == 0) {
0500     myCoutStream << "\nTechnical triggers: prescale factor set index = " << pfSetIndexTechnicalTrigger << "\nfor run "
0501                  << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() << ", with L1 menu \n  "
0502                  << m_l1GtUtilsProv.l1TriggerMenu() << "\nMethod: prescaleFactorSet(iEvent, trigCategory,iErrorCode)\n"
0503                  << std::endl;
0504 
0505     int iBit = -1;
0506     for (std::vector<int>::const_iterator cItBit = pfSetTechnicalTrigger.begin(); cItBit != pfSetTechnicalTrigger.end();
0507          ++cItBit) {
0508       iBit++;
0509       myCoutStream << "Bit number " << std::right << std::setw(4) << iBit << ": prescale factor = " << (*cItBit)
0510                    << std::endl;
0511     }
0512 
0513   } else {
0514     myCoutStream << "\nError encountered when retrieving the prescale factor set "
0515                  << "\n  for technical triggers, for run " << iEvent.run() << ", luminosity block "
0516                  << iEvent.luminosityBlock() << " with L1 menu \n  " << m_l1GtUtilsProv.l1TriggerMenu()
0517                  << "\n  Error code: " << iErrorCode << "\n"
0518                  << std::endl;
0519   }
0520 
0521   // the actual trigger mask set for technical triggers
0522 
0523   myCoutStream << "\nMethod:"
0524                << "\n  triggerMaskSet(trigCategory, iErrorCode)" << std::endl;
0525 
0526   iErrorCode = -1;
0527   const std::vector<unsigned int>& tmSetTechnicalTrigger = m_l1GtUtilsProv.triggerMaskSet(trigCategory, iErrorCode);
0528 
0529   if (iErrorCode == 0) {
0530     myCoutStream << "\nTechnical triggers: trigger mask set for run " << iEvent.run() << ", luminosity block "
0531                  << iEvent.luminosityBlock() << ", with L1 menu \n  " << m_l1GtUtilsProv.l1TriggerMenu() << "\n"
0532                  << std::endl;
0533 
0534     int iBit = -1;
0535     for (std::vector<unsigned int>::const_iterator cItBit = tmSetTechnicalTrigger.begin();
0536          cItBit != tmSetTechnicalTrigger.end();
0537          ++cItBit) {
0538       iBit++;
0539       myCoutStream << "Bit number " << std::right << std::setw(4) << iBit << ": trigger mask = " << (*cItBit)
0540                    << std::endl;
0541     }
0542 
0543   } else {
0544     myCoutStream << "\nError encountered when retrieving the trigger mask set "
0545                  << "\n  for technical triggers, for run " << iEvent.run() << ", luminosity block "
0546                  << iEvent.luminosityBlock() << " with L1 menu \n  " << m_l1GtUtilsProv.l1TriggerMenu()
0547                  << "\n  Error code: " << iErrorCode << "\n"
0548                  << std::endl;
0549   }
0550 
0551   // results for logical expressions
0552 
0553   // errorCodes must be called before any other method is used
0554   const std::vector<std::pair<std::string, int> >& errorCodesProv = m_logicalExpressionL1ResultsProv.errorCodes(iEvent);
0555 
0556   const std::vector<L1GtLogicParser::OperandToken>& expL1TriggersProv =
0557       m_logicalExpressionL1ResultsProv.expL1Triggers();
0558 
0559   const std::vector<std::pair<std::string, bool> >& decisionsBeforeMaskProv =
0560       m_logicalExpressionL1ResultsProv.decisionsBeforeMask();
0561   const std::vector<std::pair<std::string, bool> >& decisionsAfterMaskProv =
0562       m_logicalExpressionL1ResultsProv.decisionsAfterMask();
0563   const std::vector<std::pair<std::string, int> >& prescaleFactorsProv =
0564       m_logicalExpressionL1ResultsProv.prescaleFactors();
0565   const std::vector<std::pair<std::string, int> >& triggerMasksProv = m_logicalExpressionL1ResultsProv.triggerMasks();
0566 
0567   myCoutStream << std::endl;
0568   myCoutStream << "\nLogical expression\n  " << m_l1GtUtilsLogicalExpression << std::endl;
0569 
0570   for (size_t iTrig = 0; iTrig < errorCodesProv.size(); ++iTrig) {
0571     if ((errorCodesProv[iTrig]).second != 0) {
0572       myCoutStream << "\nError encountered when retrieving L1 results for trigger " << (errorCodesProv[iTrig]).first
0573                    << " (bit number " << (expL1TriggersProv[iTrig]).tokenNumber << ")\n  for run " << iEvent.run()
0574                    << ", luminosity block " << iEvent.luminosityBlock() << " with L1 menu \n  "
0575                    << m_l1GtUtilsProv.l1TriggerMenu() << "\n  Error code: " << (errorCodesProv[iTrig]).second << "\n"
0576                    << std::endl;
0577 
0578     } else {
0579       myCoutStream << "\n"
0580                    << (errorCodesProv[iTrig]).first << " - bit number " << (expL1TriggersProv[iTrig]).tokenNumber
0581                    << std::endl;
0582 
0583       myCoutStream << "    decision before mask = " << (decisionsBeforeMaskProv[iTrig]).second << std::endl;
0584 
0585       myCoutStream << "    decision after mask  = " << (decisionsAfterMaskProv[iTrig]).second << std::endl;
0586 
0587       myCoutStream << "    prescale factor      = " << (prescaleFactorsProv[iTrig]).second << std::endl;
0588 
0589       myCoutStream << "    trigger mask         = " << (triggerMasksProv[iTrig]).second << std::endl;
0590 
0591       myCoutStream << "    error code           = " << (errorCodesProv[iTrig]).second << std::endl;
0592     }
0593   }
0594 
0595   //
0596   // same methods as above, but with input tag given explicitly, allowing to select
0597   // the EDM products used to get the results
0598 
0599   myCoutStream << "\n******** Results found with input tags provided in the configuration file ******** \n"
0600                << "\n  L1GlobalTriggerRecord: " << m_l1GtRecordInputTag
0601                << "\n  L1GlobalTriggerReadoutRecord: " << m_l1GtDaqReadoutRecordInputTag << std::endl;
0602 
0603   // the following methods share the same error code, therefore one can check only once
0604   // the validity of the result
0605 
0606   iErrorCode = -1;
0607 
0608   bool decisionBeforeMaskAlgTechTrigITag = m_l1GtUtils.decisionBeforeMask(iEvent, m_nameAlgTechTrig, iErrorCode);
0609 
0610   bool decisionAfterMaskAlgTechTrigITag = m_l1GtUtils.decisionAfterMask(iEvent, m_nameAlgTechTrig, iErrorCode);
0611 
0612   bool decisionAlgTechTrigITag = m_l1GtUtils.decision(iEvent, m_nameAlgTechTrig, iErrorCode);
0613 
0614   int prescaleFactorAlgTechTrigITag = m_l1GtUtils.prescaleFactor(iEvent, m_nameAlgTechTrig, iErrorCode);
0615 
0616   int triggerMaskAlgTechTrigITag = m_l1GtUtils.triggerMask(iEvent, m_nameAlgTechTrig, iErrorCode);
0617 
0618   myCoutStream
0619       << "\n\nMethods:"
0620       << "\n  decisionBeforeMask(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, "
0621          "iErrorCode)"
0622       << "\n  decisionAfterMask(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, "
0623          "iErrorCode)"
0624       << "\n  decision(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode)"
0625       << "\n  prescaleFactor(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, "
0626          "iErrorCode)"
0627       << "\n  triggerMask(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode)"
0628       << "\n\n"
0629       << std::endl;
0630 
0631   if (iErrorCode == 0) {
0632     myCoutStream << "\nDecision before trigger mask for " << m_nameAlgTechTrig << ":   "
0633                  << decisionBeforeMaskAlgTechTrigITag << std::endl;
0634     myCoutStream << "Decision after trigger mask for " << m_nameAlgTechTrig << ":    "
0635                  << decisionAfterMaskAlgTechTrigITag << std::endl;
0636     myCoutStream << "Decision (after trigger mask) for " << m_nameAlgTechTrig << ":  " << decisionAlgTechTrigITag
0637                  << std::endl;
0638 
0639     myCoutStream << "Prescale factor for " << m_nameAlgTechTrig << ":                " << prescaleFactorAlgTechTrigITag
0640                  << std::endl;
0641 
0642     myCoutStream << "Trigger mask for " << m_nameAlgTechTrig << ":                   " << triggerMaskAlgTechTrigITag
0643                  << std::endl;
0644 
0645   } else if (iErrorCode == 1) {
0646     myCoutStream << "\n"
0647                  << m_nameAlgTechTrig << " does not exist in the L1 menu " << m_l1GtUtils.l1TriggerMenu() << "\n"
0648                  << std::endl;
0649 
0650   } else {
0651     myCoutStream << "\nError: "
0652                  << "\n  An error was encountered when retrieving decision, mask and prescale factor for "
0653                  << m_nameAlgTechTrig << "\n  L1 Menu: " << m_l1GtUtils.l1TriggerMenu()
0654                  << "\n  Error code: " << iErrorCode << std::endl;
0655   }
0656 
0657   // index of the actual prescale factor set, and the actual prescale
0658   // factor set for algorithm triggers
0659 
0660   trigCategory = L1GtUtils::AlgorithmTrigger;
0661 
0662   myCoutStream << "\nMethods:"
0663                << "\n  prescaleFactorSetIndex(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, "
0664                   "trigCategory, iErrorCode)"
0665                << "\n  prescaleFactorSet(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, "
0666                   "trigCategory,iErrorCode)\n"
0667                << std::endl;
0668 
0669   iErrorCode = -1;
0670   const int pfSetIndexAlgorithmTriggerITag = m_l1GtUtils.prescaleFactorSetIndex(iEvent, trigCategory, iErrorCode);
0671 
0672   if (iErrorCode == 0) {
0673     myCoutStream << "\nAlgorithm triggers: index for prescale factor set = " << pfSetIndexAlgorithmTriggerITag
0674                  << "\nfor run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock()
0675                  << ", with L1 menu \n  " << m_l1GtUtils.l1TriggerMenu() << std::endl;
0676 
0677   } else {
0678     myCoutStream << "\nError encountered when retrieving the prescale factor set index"
0679                  << "\n  for algorithm triggers, for run " << iEvent.run() << ", luminosity block "
0680                  << iEvent.luminosityBlock() << " with L1 menu \n  " << m_l1GtUtils.l1TriggerMenu()
0681                  << "\n  Error code: " << iErrorCode << "\n"
0682                  << std::endl;
0683   }
0684 
0685   iErrorCode = -1;
0686   const std::vector<int>& pfSetAlgorithmTriggerITag = m_l1GtUtils.prescaleFactorSet(iEvent, trigCategory, iErrorCode);
0687 
0688   if (iErrorCode == 0) {
0689     myCoutStream << "\nAlgorithm triggers: prescale factor set index = " << pfSetIndexAlgorithmTriggerITag
0690                  << "\nfor run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock()
0691                  << ", with L1 menu \n  " << m_l1GtUtils.l1TriggerMenu() << std::endl;
0692 
0693     int iBit = -1;
0694     for (std::vector<int>::const_iterator cItBit = pfSetAlgorithmTriggerITag.begin();
0695          cItBit != pfSetAlgorithmTriggerITag.end();
0696          ++cItBit) {
0697       iBit++;
0698       myCoutStream << "Bit number " << std::right << std::setw(4) << iBit << ": prescale factor = " << (*cItBit)
0699                    << std::endl;
0700     }
0701 
0702   } else {
0703     myCoutStream << "\nError encountered when retrieving the prescale factor set "
0704                  << "\n  for algorithm triggers, for run " << iEvent.run() << ", luminosity block "
0705                  << iEvent.luminosityBlock() << " with L1 menu \n  " << m_l1GtUtils.l1TriggerMenu()
0706                  << "\n  Error code: " << iErrorCode << "\n"
0707                  << std::endl;
0708   }
0709 
0710   // index of the actual prescale factor set, and the actual prescale
0711   // factor set for technical triggers
0712 
0713   trigCategory = L1GtUtils::TechnicalTrigger;
0714 
0715   myCoutStream << "\nMethods:"
0716                << "\n  prescaleFactorSetIndex(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, "
0717                   "trigCategory, iErrorCode)"
0718                << "\n  prescaleFactorSet(iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, "
0719                   "trigCategory,iErrorCode)\n"
0720                << std::endl;
0721 
0722   iErrorCode = -1;
0723   const int pfSetIndexTechnicalTriggerITag = m_l1GtUtils.prescaleFactorSetIndex(iEvent, trigCategory, iErrorCode);
0724 
0725   if (iErrorCode == 0) {
0726     myCoutStream << "\nTechnical triggers: index for prescale factor set = " << pfSetIndexTechnicalTriggerITag
0727                  << "\nfor run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock()
0728                  << ", with L1 menu \n  " << m_l1GtUtils.l1TriggerMenu() << std::endl;
0729 
0730   } else {
0731     myCoutStream << "\nError encountered when retrieving the prescale factor set index"
0732                  << "\n  for technical triggers, for run " << iEvent.run() << ", luminosity block "
0733                  << iEvent.luminosityBlock() << " with L1 menu \n  " << m_l1GtUtils.l1TriggerMenu()
0734                  << "\n  Error code: " << iErrorCode << "\n"
0735                  << std::endl;
0736   }
0737 
0738   iErrorCode = -1;
0739   const std::vector<int>& pfSetTechnicalTriggerITag = m_l1GtUtils.prescaleFactorSet(iEvent, trigCategory, iErrorCode);
0740 
0741   if (iErrorCode == 0) {
0742     myCoutStream << "\nTechnical triggers: prescale factor set index = " << pfSetIndexTechnicalTriggerITag
0743                  << "\nfor run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock()
0744                  << ", with L1 menu \n  " << m_l1GtUtils.l1TriggerMenu() << std::endl;
0745 
0746     int iBit = -1;
0747     for (std::vector<int>::const_iterator cItBit = pfSetTechnicalTriggerITag.begin();
0748          cItBit != pfSetTechnicalTriggerITag.end();
0749          ++cItBit) {
0750       iBit++;
0751       myCoutStream << "Bit number " << std::right << std::setw(4) << iBit << ": prescale factor = " << (*cItBit)
0752                    << std::endl;
0753     }
0754 
0755   } else {
0756     myCoutStream << "\nError encountered when retrieving the prescale factor set "
0757                  << "\n  for technical triggers, for run " << iEvent.run() << ", luminosity block "
0758                  << iEvent.luminosityBlock() << " with L1 menu \n  " << m_l1GtUtils.l1TriggerMenu()
0759                  << "\n  Error code: " << iErrorCode << "\n"
0760                  << std::endl;
0761   }
0762 
0763   // results for logical expressions
0764 
0765   // errorCodes must be called before any other method is used
0766   const std::vector<std::pair<std::string, int> >& errorCodes = m_logicalExpressionL1Results.errorCodes(iEvent);
0767 
0768   const std::vector<L1GtLogicParser::OperandToken>& expL1Triggers = m_logicalExpressionL1Results.expL1Triggers();
0769 
0770   const std::vector<std::pair<std::string, bool> >& decisionsBeforeMask =
0771       m_logicalExpressionL1Results.decisionsBeforeMask();
0772   const std::vector<std::pair<std::string, bool> >& decisionsAfterMask =
0773       m_logicalExpressionL1Results.decisionsAfterMask();
0774   const std::vector<std::pair<std::string, int> >& prescaleFactors = m_logicalExpressionL1Results.prescaleFactors();
0775   const std::vector<std::pair<std::string, int> >& triggerMasks = m_logicalExpressionL1Results.triggerMasks();
0776 
0777   myCoutStream << std::endl;
0778   myCoutStream << "\nLogical expression\n  " << m_l1GtUtilsLogicalExpression << std::endl;
0779 
0780   for (size_t iTrig = 0; iTrig < errorCodes.size(); ++iTrig) {
0781     if ((errorCodes[iTrig]).second != 0) {
0782       myCoutStream << "\nError encountered when retrieving L1 results for trigger " << (errorCodes[iTrig]).first
0783                    << " (bit number " << (expL1Triggers[iTrig]).tokenNumber << ")\n  for run " << iEvent.run()
0784                    << ", luminosity block " << iEvent.luminosityBlock() << " with L1 menu \n  "
0785                    << m_l1GtUtils.l1TriggerMenu() << "\n  Error code: " << (errorCodes[iTrig]).second << "\n"
0786                    << std::endl;
0787 
0788     } else {
0789       myCoutStream << "\n"
0790                    << (errorCodes[iTrig]).first << " - bit number " << (expL1Triggers[iTrig]).tokenNumber << std::endl;
0791 
0792       myCoutStream << "    decision before mask = " << (decisionsBeforeMask[iTrig]).second << std::endl;
0793 
0794       myCoutStream << "    decision after mask  = " << (decisionsAfterMask[iTrig]).second << std::endl;
0795 
0796       myCoutStream << "    prescale factor      = " << (prescaleFactors[iTrig]).second << std::endl;
0797 
0798       myCoutStream << "    trigger mask         = " << (triggerMasks[iTrig]).second << std::endl;
0799 
0800       myCoutStream << "    error code           = " << (errorCodes[iTrig]).second << std::endl;
0801     }
0802   }
0803 
0804   printOutput(myCoutStream);
0805 }
0806 
0807 void L1GtAnalyzer::analyzeL1GtUtilsMenuLite(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
0808   LogDebug("L1GtAnalyzer") << "\n**** L1GtAnalyzer::analyzeL1GtUtilsMenuLite ****\n" << std::endl;
0809 
0810   // before accessing any result from L1GtUtils, one must retrieve and cache
0811   // the L1GtTriggerMenuLite product
0812   // add this call in the analyze / produce / filter method of your
0813   // analyzer / producer / filter
0814 
0815   bool useL1EventSetup = false;
0816   bool useL1GtTriggerMenuLite = true;
0817 
0818   m_l1GtUtilsProv.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite);
0819 
0820   m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite);
0821 
0822   analyzeL1GtUtilsCore(iEvent, evSetup);
0823 }
0824 
0825 void L1GtAnalyzer::analyzeL1GtUtilsEventSetup(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
0826   LogDebug("L1GtAnalyzer") << "\n**** L1GtAnalyzer::analyzeL1GtUtilsEventSetup ****\n" << std::endl;
0827 
0828   // before accessing any result from L1GtUtils, one must retrieve and cache
0829   // the L1 trigger event setup
0830   // add this call in the analyze / produce / filter method of your
0831   // analyzer / producer / filter
0832 
0833   bool useL1EventSetup = true;
0834   bool useL1GtTriggerMenuLite = false;
0835 
0836   m_l1GtUtilsProv.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite);
0837 
0838   m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite);
0839 
0840   analyzeL1GtUtilsCore(iEvent, evSetup);
0841 }
0842 
0843 void L1GtAnalyzer::analyzeL1GtUtils(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
0844   LogDebug("L1GtAnalyzer") << "\n**** L1GtAnalyzer::analyzeL1GtUtils: fall-through case ****\n" << std::endl;
0845 
0846   // before accessing any result from L1GtUtils, one must retrieve and cache
0847   // the L1 trigger event setup and the L1GtTriggerMenuLite product
0848   // add this call in the analyze / produce / filter method of your
0849   // analyzer / producer / filter
0850 
0851   bool useL1EventSetup = true;
0852   bool useL1GtTriggerMenuLite = true;
0853 
0854   m_l1GtUtilsProv.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite);
0855 
0856   m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite);
0857 
0858   analyzeL1GtUtilsCore(iEvent, evSetup);
0859 }
0860 
0861 void L1GtAnalyzer::analyzeTrigger(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
0862   LogDebug("L1GtAnalyzer") << "\n**** L1GtAnalyzer::analyzeTrigger ****\n" << std::endl;
0863 
0864   // define an output stream to print into
0865   // it can then be directed to whatever log level is desired
0866   std::ostringstream myCoutStream;
0867 
0868   // print all the stuff if at LogDebug level
0869   myCoutStream << "\n\nFull analysis of an algorithm or technical trigger"
0870                << "\nMethod:  L1GtAnalyzer::analyzeTrigger"
0871                << "\nTrigger: " << m_nameAlgTechTrig << "\n"
0872                << std::endl;
0873 
0874   const unsigned int runNumber = iEvent.run();
0875   const unsigned int lsNumber = iEvent.luminosityBlock();
0876   const unsigned int eventNumber = iEvent.id().event();
0877 
0878   myCoutStream << "Run: " << runNumber << " LS: " << lsNumber << " Event: " << eventNumber << "\n\n" << std::endl;
0879 
0880   // before accessing any result from L1GtUtils, one must retrieve and cache
0881   // the L1 trigger event setup and the L1GtTriggerMenuLite product
0882   // add this call in the analyze / produce / filter method of your
0883   // analyzer / producer / filter
0884 
0885   bool useL1EventSetup = false;
0886   bool useL1GtTriggerMenuLite = false;
0887 
0888   switch (m_l1GtUtilsConfiguration) {
0889     case 0: {
0890       useL1EventSetup = false;
0891       useL1GtTriggerMenuLite = true;
0892 
0893     } break;
0894     case 100000: {
0895       useL1EventSetup = true;
0896       useL1GtTriggerMenuLite = true;
0897 
0898     } break;
0899     case 200000: {
0900       useL1EventSetup = true;
0901       useL1GtTriggerMenuLite = false;
0902 
0903     } break;
0904     default: {
0905       // do nothing
0906     } break;
0907   }
0908 
0909   m_l1GtUtilsProv.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite);
0910 
0911   m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite);
0912 
0913   // testing which environment is used
0914 
0915   int iErrorCode = -1;
0916   int l1ConfCode = -1;
0917 
0918   const bool l1Conf = m_l1GtUtils.availableL1Configuration(iErrorCode, l1ConfCode);
0919 
0920   if (l1Conf) {
0921     LogDebug("L1GtAnalyzer") << "\nL1 configuration code:" << l1ConfCode << "\nValid L1 trigger configuration.\n"
0922                              << std::endl;
0923 
0924     LogTrace("L1GtAnalyzer") << "\nL1 trigger menu name and implementation:"
0925                              << "\n"
0926                              << m_l1GtUtils.l1TriggerMenu() << "\n"
0927                              << m_l1GtUtils.l1TriggerMenuImplementation() << "\n"
0928                              << std::endl;
0929 
0930   } else {
0931     myCoutStream << "\nL1 configuration code:" << l1ConfCode << "\nNo valid L1 trigger configuration available."
0932                  << "\nCheck L1GtUtils wiki page for error code interpretation\n"
0933                  << std::endl;
0934     return;
0935   }
0936 
0937   // the following methods share the same error code, therefore one can check only once
0938   // the validity of the result
0939 
0940   iErrorCode = -1;
0941 
0942   bool decisionBeforeMaskAlgTechTrig = false;
0943   bool decisionAfterMaskAlgTechTrig = false;
0944   bool decisionAlgTechTrig = false;
0945   int prescaleFactorAlgTechTrig = -1;
0946   int triggerMaskAlgTechTrig = -1;
0947 
0948   if (m_l1GtRecordsInputTagProv) {
0949     decisionBeforeMaskAlgTechTrig = m_l1GtUtilsProv.decisionBeforeMask(iEvent, m_nameAlgTechTrig, iErrorCode);
0950 
0951     decisionAfterMaskAlgTechTrig = m_l1GtUtilsProv.decisionAfterMask(iEvent, m_nameAlgTechTrig, iErrorCode);
0952 
0953     decisionAlgTechTrig = m_l1GtUtilsProv.decision(iEvent, m_nameAlgTechTrig, iErrorCode);
0954 
0955     prescaleFactorAlgTechTrig = m_l1GtUtilsProv.prescaleFactor(iEvent, m_nameAlgTechTrig, iErrorCode);
0956 
0957     triggerMaskAlgTechTrig = m_l1GtUtilsProv.triggerMask(iEvent, m_nameAlgTechTrig, iErrorCode);
0958 
0959   } else {
0960     decisionBeforeMaskAlgTechTrig = m_l1GtUtils.decisionBeforeMask(iEvent, m_nameAlgTechTrig, iErrorCode);
0961 
0962     decisionAfterMaskAlgTechTrig = m_l1GtUtils.decisionAfterMask(iEvent, m_nameAlgTechTrig, iErrorCode);
0963 
0964     decisionAlgTechTrig = m_l1GtUtils.decision(iEvent, m_nameAlgTechTrig, iErrorCode);
0965 
0966     prescaleFactorAlgTechTrig = m_l1GtUtils.prescaleFactor(iEvent, m_nameAlgTechTrig, iErrorCode);
0967 
0968     triggerMaskAlgTechTrig = m_l1GtUtils.triggerMask(iEvent, m_nameAlgTechTrig, iErrorCode);
0969   }
0970 
0971   switch (iErrorCode) {
0972     case 0: {
0973       // do nothing here
0974     } break;
0975     case 1: {
0976       myCoutStream << "\n"
0977                    << m_nameAlgTechTrig << " does not exist in the L1 menu " << m_l1GtUtils.l1TriggerMenu() << "\n"
0978                    << std::endl;
0979       return;
0980     } break;
0981     default: {
0982       myCoutStream << "\nError: "
0983                    << "\n  An error was encountered when retrieving decision, mask and prescale factor for "
0984                    << m_nameAlgTechTrig << "\n  L1 Menu: " << m_l1GtUtils.l1TriggerMenu()
0985                    << "\n  Error code: " << iErrorCode << "\n  Check L1GtUtils wiki page for error code interpretation"
0986                    << std::endl;
0987     } break;
0988   }
0989 
0990   // retrieve L1Extra
0991   // for object maps, only BxInEvent = 0 (aka L1A bunch cross) is relevant
0992 
0993   m_retrieveL1Extra.retrieveL1ExtraObjects(iEvent, evSetup);
0994 
0995   // print all L1Extra collections from all BxInEvent
0996   myCoutStream << "\nL1Extra collections from all BxInEvent" << std::endl;
0997   m_retrieveL1Extra.printL1Extra(myCoutStream);
0998 
0999   int bxInEvent = 0;
1000   myCoutStream << "\nL1Extra collections from BxInEvent = 0 (BX for L1A)" << std::endl;
1001   m_retrieveL1Extra.printL1Extra(myCoutStream, bxInEvent);
1002 
1003   // retrieve L1GlobalTriggerObjectMapRecord and L1GlobalTriggerObjectMaps products
1004   // the module returns an error code only if both payloads are missing
1005 
1006   int iErrorRecord = 0;
1007 
1008   bool validRecord = false;
1009   bool gtObjectMapRecordValid = false;
1010 
1011   edm::Handle<L1GlobalTriggerObjectMaps> gtObjectMaps;
1012   iEvent.getByToken(m_l1GtObjectMapsToken, gtObjectMaps);
1013 
1014   if (gtObjectMaps.isValid()) {
1015     validRecord = true;
1016 
1017   } else {
1018     iErrorRecord = 10;
1019     LogDebug("L1GtAnalyzer") << "\nL1GlobalTriggerObjectMaps with \n  " << m_l1GtObjectMapsInputTag
1020                              << "\nnot found in the event." << std::endl;
1021   }
1022 
1023   edm::Handle<L1GlobalTriggerObjectMapRecord> gtObjectMapRecord;
1024   iEvent.getByToken(m_l1GtObjectMapToken, gtObjectMapRecord);
1025 
1026   if (gtObjectMapRecord.isValid()) {
1027     gtObjectMapRecordValid = true;
1028     validRecord = true;
1029 
1030   } else {
1031     iErrorRecord = iErrorRecord + 100;
1032     LogDebug("L1GtAnalyzer") << "\nL1GlobalTriggerObjectMapRecord with \n  " << m_l1GtObjectMapTag
1033                              << "\nnot found in the event." << std::endl;
1034   }
1035 
1036   //FIXME remove when validRecord and gtObjectMapRecordValid are used - avoid warning here :-)
1037   if (validRecord && gtObjectMapRecordValid) {
1038     // do nothing
1039   }
1040 
1041   // get the RPN vector
1042 
1043   //    int pfIndexTechTrig = -1;
1044   //    int pfIndexAlgoTrig = -1;
1045   //
1046   //    if (validRecord) {
1047   //        if (gtObjectMapRecordValid) {
1048   //
1049   //            pfIndexTechTrig
1050   //                    = (gtObjectMapRecord->gtFdlWord()).gtPrescaleFactorIndexTech();
1051   //            pfIndexAlgoTrig
1052   //                    = (gtObjectMapRecord->gtFdlWord()).gtPrescaleFactorIndexAlgo();
1053   //
1054   //        } else {
1055   //
1056   //            pfIndexTechTrig
1057   //                    = static_cast<int> (gtObjectMaps->gtPrescaleFactorIndexTech());
1058   //            pfIndexAlgoTrig
1059   //                    = static_cast<int> (gtObjectMaps->gtPrescaleFactorIndexAlgo());
1060   //
1061   //        }
1062   //
1063   //    } else {
1064   //
1065   //        LogDebug("L1GtAnalyzer") << "\nError: "
1066   //                << "\nNo valid L1GlobalTriggerRecord with \n  "
1067   //                << l1GtRecordInputTag << "\nfound in the event."
1068   //                << "\nNo valid L1GlobalTriggerReadoutRecord with \n  "
1069   //                << l1GtReadoutRecordInputTag << "\nfound in the event."
1070   //                << std::endl;
1071   //
1072   //        iError = l1ConfCode + iErrorRecord;
1073   //        return;
1074   //
1075   //    }
1076 
1077   //
1078   myCoutStream << "\nResults for trigger " << m_nameAlgTechTrig
1079                << "\n  Trigger mask:          " << triggerMaskAlgTechTrig
1080                << "\n  Prescale factor:       " << prescaleFactorAlgTechTrig
1081                << "\n  Decision before mask:  " << decisionBeforeMaskAlgTechTrig
1082                << "\n  Decision after mask:   " << decisionAfterMaskAlgTechTrig
1083                << "\n  Decision (after mask): " << decisionAlgTechTrig << "\n"
1084                << std::endl;
1085 
1086   printOutput(myCoutStream);
1087 }
1088 
1089 // analyze: object map product
1090 void L1GtAnalyzer::analyzeObjectMap(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
1091   LogDebug("L1GtAnalyzer") << "\n**** L1GtAnalyzer::analyzeObjectMap object map product ****\n" << std::endl;
1092 
1093   // define an output stream to print into
1094   // it can then be directed to whatever log level is desired
1095   std::ostringstream myCoutStream;
1096 
1097   // get a handle to the object map product
1098   // the product can come only from emulator - no hardware ObjectMapRecord
1099   edm::Handle<L1GlobalTriggerObjectMapRecord> gtObjectMapRecord;
1100   iEvent.getByToken(m_l1GtObjectMapToken, gtObjectMapRecord);
1101 
1102   if (!gtObjectMapRecord.isValid()) {
1103     LogDebug("L1GtAnalyzer") << "\nWarning: L1GlobalTriggerObjectMapRecord with input tag " << m_l1GtObjectMapTag
1104                              << "\nrequested in configuration, but not found in the event."
1105                              << "\nExit the method.\n"
1106                              << std::endl;
1107 
1108     return;
1109   }
1110 
1111   // get all object maps
1112   const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->gtObjectMap();
1113 
1114   // print every object map via the implemented print
1115   for (std::vector<L1GlobalTriggerObjectMap>::const_iterator it = objMapVec.begin(); it != objMapVec.end(); ++it) {
1116     (*it).print(myCoutStream);
1117   }
1118 
1119   //
1120   const CombinationsInCond* comb = gtObjectMapRecord->getCombinationsInCond(m_nameAlgTechTrig, m_condName);
1121 
1122   // number of combinations
1123   if (comb != nullptr) {
1124     myCoutStream << "\n  Number of combinations passing (" << m_nameAlgTechTrig << ", " << m_condName
1125                  << "): " << comb->size() << std::endl;
1126   } else {
1127     myCoutStream << "\n  No combination passes (" << m_nameAlgTechTrig << ", " << m_condName << ") " << std::endl;
1128   }
1129 
1130   // condition result
1131   const bool result = gtObjectMapRecord->getConditionResult(m_nameAlgTechTrig, m_condName);
1132 
1133   myCoutStream << "\n  Result for condition " << m_condName << " in algorithm " << m_nameAlgTechTrig << ": " << result
1134                << std::endl;
1135 
1136   printOutput(myCoutStream);
1137 }
1138 
1139 // analyze: usage of L1GtTriggerMenuLite
1140 void L1GtAnalyzer::analyzeL1GtTriggerMenuLite(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
1141   LogDebug("L1GtAnalyzer") << "\n**** L1GtAnalyzer::analyzeL1GtTriggerMenuLite ****\n" << std::endl;
1142 
1143   // define an output stream to print into
1144   // it can then be directed to whatever log level is desired
1145   std::ostringstream myCoutStream;
1146 
1147   // get Run Data - the same code can be run in beginRun, with getByLabel from edm::Run
1148   const edm::Run& iRun = iEvent.getRun();
1149 
1150   // get L1GtTriggerMenuLite
1151   edm::Handle<L1GtTriggerMenuLite> triggerMenuLite;
1152   iRun.getByToken(m_l1GtTmLToken, triggerMenuLite);
1153 
1154   if (!triggerMenuLite.isValid()) {
1155     LogDebug("L1GtAnalyzer") << "\nL1GtTriggerMenuLite with \n  " << m_l1GtTmLInputTag
1156                              << "\nrequested in configuration, but not found in the event."
1157                              << "\nExit the method.\n"
1158                              << std::endl;
1159 
1160     return;
1161   }
1162 
1163   // print via supplied "print" function
1164   myCoutStream << (*triggerMenuLite);
1165 
1166   // test the individual methods
1167 
1168   const std::string& triggerMenuInterface = triggerMenuLite->gtTriggerMenuInterface();
1169   const std::string& triggerMenuName = triggerMenuLite->gtTriggerMenuName();
1170   const std::string& triggerMenuImplementation = triggerMenuLite->gtTriggerMenuImplementation();
1171   const std::string& scaleDbKey = triggerMenuLite->gtScaleDbKey();
1172 
1173   const L1GtTriggerMenuLite::L1TriggerMap& algorithmMap = triggerMenuLite->gtAlgorithmMap();
1174   const L1GtTriggerMenuLite::L1TriggerMap& algorithmAliasMap = triggerMenuLite->gtAlgorithmAliasMap();
1175   const L1GtTriggerMenuLite::L1TriggerMap& technicalTriggerMap = triggerMenuLite->gtTechnicalTriggerMap();
1176 
1177   const std::vector<unsigned int>& triggerMaskAlgoTrig = triggerMenuLite->gtTriggerMaskAlgoTrig();
1178   const std::vector<unsigned int>& triggerMaskTechTrig = triggerMenuLite->gtTriggerMaskTechTrig();
1179 
1180   const std::vector<std::vector<int> >& prescaleFactorsAlgoTrig = triggerMenuLite->gtPrescaleFactorsAlgoTrig();
1181   const std::vector<std::vector<int> >& prescaleFactorsTechTrig = triggerMenuLite->gtPrescaleFactorsTechTrig();
1182 
1183   // print in the same format as in L1GtTriggerMenuLite definition
1184 
1185   size_t nrDefinedAlgo = algorithmMap.size();
1186   size_t nrDefinedTech = technicalTriggerMap.size();
1187 
1188   // header for printing algorithms
1189 
1190   myCoutStream << "\n   ********** L1 Trigger Menu - printing   ********** \n"
1191                << "\nL1 Trigger Menu Interface: " << triggerMenuInterface
1192                << "\nL1 Trigger Menu Name:      " << triggerMenuName
1193                << "\nL1 Trigger Menu Implementation: " << triggerMenuImplementation
1194                << "\nAssociated Scale DB Key: " << scaleDbKey << "\n\n"
1195                << "\nL1 Physics Algorithms: " << nrDefinedAlgo << " algorithms defined."
1196                << "\n\n"
1197                << "Bit Number " << std::right << std::setw(35) << "Algorithm Name"
1198                << "  " << std::right << std::setw(35) << "Algorithm Alias"
1199                << "  " << std::right << std::setw(12) << "Trigger Mask";
1200   for (unsigned iSet = 0; iSet < prescaleFactorsAlgoTrig.size(); iSet++) {
1201     myCoutStream << std::right << std::setw(10) << "PF Set " << std::right << std::setw(2) << iSet;
1202   }
1203 
1204   myCoutStream << std::endl;
1205 
1206   for (L1GtTriggerMenuLite::CItL1Trig itTrig = algorithmMap.begin(); itTrig != algorithmMap.end(); itTrig++) {
1207     const unsigned int bitNumber = itTrig->first;
1208     const std::string& aName = itTrig->second;
1209 
1210     std::string aAlias;
1211     L1GtTriggerMenuLite::CItL1Trig itAlias = algorithmAliasMap.find(bitNumber);
1212     if (itAlias != algorithmAliasMap.end()) {
1213       aAlias = itAlias->second;
1214     }
1215 
1216     myCoutStream << std::setw(6) << bitNumber << "     " << std::right << std::setw(35) << aName << "  " << std::right
1217                  << std::setw(35) << aAlias << "  " << std::right << std::setw(12) << triggerMaskAlgoTrig[bitNumber];
1218     for (unsigned iSet = 0; iSet < prescaleFactorsAlgoTrig.size(); iSet++) {
1219       myCoutStream << std::right << std::setw(12) << prescaleFactorsAlgoTrig[iSet][bitNumber];
1220     }
1221 
1222     myCoutStream << std::endl;
1223   }
1224 
1225   myCoutStream << "\nL1 Technical Triggers: " << nrDefinedTech << " technical triggers defined."
1226                << "\n\n"
1227                << std::endl;
1228   if (nrDefinedTech) {
1229     myCoutStream << std::right << std::setw(6) << "Bit Number " << std::right << std::setw(45)
1230                  << " Technical trigger name "
1231                  << "  " << std::right << std::setw(12) << "Trigger Mask";
1232     for (unsigned iSet = 0; iSet < prescaleFactorsTechTrig.size(); iSet++) {
1233       myCoutStream << std::right << std::setw(10) << "PF Set " << std::right << std::setw(2) << iSet;
1234     }
1235 
1236     myCoutStream << std::endl;
1237   }
1238 
1239   for (L1GtTriggerMenuLite::CItL1Trig itTrig = technicalTriggerMap.begin(); itTrig != technicalTriggerMap.end();
1240        itTrig++) {
1241     unsigned int bitNumber = itTrig->first;
1242     std::string aName = itTrig->second;
1243 
1244     myCoutStream << std::setw(6) << bitNumber << "       " << std::right << std::setw(45) << aName << std::right
1245                  << std::setw(12) << triggerMaskTechTrig[bitNumber];
1246     for (unsigned iSet = 0; iSet < prescaleFactorsTechTrig.size(); iSet++) {
1247       myCoutStream << std::right << std::setw(12) << prescaleFactorsTechTrig[iSet][bitNumber];
1248     }
1249 
1250     myCoutStream << std::endl;
1251   }
1252 
1253   // individual methods
1254 
1255   int errorCode = -1;
1256   const std::string* algorithmAlias = triggerMenuLite->gtAlgorithmAlias(m_bitNumber, errorCode);
1257   if (errorCode) {
1258     myCoutStream << "\nError code retrieving alias for algorithm with bit number " << m_bitNumber << ": " << errorCode
1259                  << std::endl;
1260   } else {
1261     myCoutStream << "\nAlias for algorithm with bit number " << m_bitNumber << ": " << (*algorithmAlias) << std::endl;
1262   }
1263 
1264   errorCode = -1;
1265   const std::string* algorithmName = triggerMenuLite->gtAlgorithmName(m_bitNumber, errorCode);
1266   if (errorCode) {
1267     myCoutStream << "\nError code retrieving name for algorithm with bit number " << m_bitNumber << ": " << errorCode
1268                  << std::endl;
1269   } else {
1270     myCoutStream << "\nName for algorithm with bit number " << m_bitNumber << ": " << (*algorithmName) << std::endl;
1271   }
1272 
1273   errorCode = -1;
1274   const std::string* techTrigName = triggerMenuLite->gtTechTrigName(m_bitNumber, errorCode);
1275   if (errorCode) {
1276     myCoutStream << "\nError code retrieving name for technical trigger with bit number " << m_bitNumber << ": "
1277                  << errorCode << std::endl;
1278   } else {
1279     myCoutStream << "\nName for technical trigger with bit number " << m_bitNumber << ": " << (*techTrigName)
1280                  << std::endl;
1281   }
1282 
1283   errorCode = -1;
1284   const unsigned int bitNumber = triggerMenuLite->gtBitNumber(m_nameAlgTechTrig, errorCode);
1285   if (errorCode) {
1286     myCoutStream << "\nError code retrieving bit number for algorithm/technical trigger " << m_nameAlgTechTrig << ": "
1287                  << errorCode << std::endl;
1288   } else {
1289     myCoutStream << "\nBit number for algorithm/technical trigger " << m_nameAlgTechTrig << ": " << bitNumber
1290                  << std::endl;
1291   }
1292 
1293   // not tested
1294   //errorCode = -1;
1295   //const bool triggerMenuLite->gtTriggerResult( m_nameAlgTechTrig,
1296   //        const std::vector<bool>& decWord,  errorCode);
1297 
1298   printOutput(myCoutStream);
1299 }
1300 
1301 // analyze: usage of ConditionsInEdm
1302 void L1GtAnalyzer::analyzeConditionsInRunBlock(const edm::Run& iRun, const edm::EventSetup& evSetup) {
1303   LogDebug("L1GtAnalyzer") << "\n**** L1GtAnalyzer::analyzeConditionsInRunBlock ****\n" << std::endl;
1304 
1305   // define an output stream to print into
1306   // it can then be directed to whatever log level is desired
1307   std::ostringstream myCoutStream;
1308 
1309   // get ConditionsInRunBlock
1310   edm::Handle<edm::ConditionsInRunBlock> condInRunBlock;
1311   iRun.getByToken(m_condInRunToken, condInRunBlock);
1312 
1313   if (!condInRunBlock.isValid()) {
1314     LogDebug("L1GtAnalyzer") << "\nConditionsInRunBlock with \n  " << m_condInEdmInputTag
1315                              << "\nrequested in configuration, but not found in the event."
1316                              << "\nExit the method.\n"
1317                              << std::endl;
1318 
1319     return;
1320   }
1321 
1322   const uint16_t beamModeVal = condInRunBlock->beamMode;
1323   const uint16_t beamMomentumVal = condInRunBlock->beamMomentum;
1324   const uint32_t lhcFillNumberVal = condInRunBlock->lhcFillNumber;
1325 
1326   // print via supplied "print" function
1327   myCoutStream << "\nLHC quantities in run " << iRun.run() << "\n  Beam Mode = " << beamModeVal
1328                << "\n  Beam Momentum = " << beamMomentumVal << " GeV"
1329                << "\n  LHC Fill Number = " << lhcFillNumberVal << std::endl;
1330 
1331   printOutput(myCoutStream);
1332 }
1333 
1334 void L1GtAnalyzer::analyzeConditionsInLumiBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup& evSetup) {
1335   LogDebug("L1GtAnalyzer") << "\n**** L1GtAnalyzer::analyzeConditionsInLumiBlock ****\n" << std::endl;
1336 
1337   // define an output stream to print into
1338   // it can then be directed to whatever log level is desired
1339   std::ostringstream myCoutStream;
1340 
1341   // get ConditionsInLumiBlock
1342   edm::Handle<edm::ConditionsInLumiBlock> condInLumiBlock;
1343   iLumi.getByToken(m_condInLumiToken, condInLumiBlock);
1344 
1345   if (!condInLumiBlock.isValid()) {
1346     LogDebug("L1GtAnalyzer") << "\nConditionsInLumiBlock with \n  " << m_condInEdmInputTag
1347                              << "\nrequested in configuration, but not found in the event."
1348                              << "\nExit the method.\n"
1349                              << std::endl;
1350 
1351     return;
1352   }
1353 
1354   const uint32_t totalIntensityBeam1Val = condInLumiBlock->totalIntensityBeam1;
1355   const uint32_t totalIntensityBeam2Val = condInLumiBlock->totalIntensityBeam2;
1356 
1357   myCoutStream << "\nLHC quantities in luminosity section "
1358 
1359                << iLumi.luminosityBlock() << " from run " << iLumi.run()
1360                << "\n  Total Intensity Beam 1 (Integer × 10E10 charges)  = " << totalIntensityBeam1Val
1361                << "\n  Total Intensity Beam 2 (Integer × 10E10 charges)  = " << totalIntensityBeam2Val << std::endl;
1362 
1363   printOutput(myCoutStream);
1364 }
1365 
1366 void L1GtAnalyzer::analyzeConditionsInEventBlock(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
1367   // define an output stream to print into
1368   // it can then be directed to whatever log level is desired
1369   std::ostringstream myCoutStream;
1370 
1371   // get ConditionsInEventBlock
1372   edm::Handle<edm::ConditionsInEventBlock> condInEventBlock;
1373   iEvent.getByToken(m_condInEventToken, condInEventBlock);
1374 
1375   if (!condInEventBlock.isValid()) {
1376     LogDebug("L1GtAnalyzer") << "\nConditionsInEventBlock with \n  " << m_condInEdmInputTag
1377                              << "\nrequested in configuration, but not found in the event."
1378                              << "\nExit the method.\n"
1379                              << std::endl;
1380 
1381     return;
1382   }
1383 
1384   const uint16_t bstMasterStatusVal = condInEventBlock->bstMasterStatus;
1385   const uint32_t turnCountNumberVal = condInEventBlock->turnCountNumber;
1386 
1387   myCoutStream << "\nLHC quantities in event " << iEvent.id().event() << " from luminosity section "
1388                << iEvent.luminosityBlock() << " from run " << iEvent.run()
1389                << "\n  BST Master Status = " << bstMasterStatusVal << "\n  Turn count number = " << turnCountNumberVal
1390                << std::endl;
1391 
1392   printOutput(myCoutStream);
1393 }
1394 
1395 void L1GtAnalyzer::printOutput(std::ostringstream& myCout) {
1396   switch (m_printOutput) {
1397     case 0: {
1398       std::cout << myCout.str() << std::endl;
1399 
1400     }
1401 
1402     break;
1403     case 1: {
1404       LogTrace("L1GtAnalyzer") << myCout.str() << std::endl;
1405 
1406     } break;
1407 
1408     case 2: {
1409       edm::LogVerbatim("L1GtAnalyzer") << myCout.str() << std::endl;
1410 
1411     }
1412 
1413     break;
1414     case 3: {
1415       edm::LogInfo("L1GtAnalyzer") << myCout.str();
1416 
1417     }
1418 
1419     break;
1420     default: {
1421       std::cout << "\n\n  L1GtAnalyzer: Error - no print output = " << m_printOutput
1422                 << " defined! \n  Check available values in the cfi file."
1423                 << "\n"
1424                 << std::endl;
1425 
1426     } break;
1427   }
1428 
1429   myCout.str("");
1430   myCout.clear();
1431 }
1432 
1433 // analyze each event: event loop
1434 void L1GtAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
1435   // analyze: decision and decision word
1436   //   bunch cross in event BxInEvent = 0 - L1Accept event
1437   if (m_analyzeDecisionReadoutRecordEnable) {
1438     analyzeDecisionReadoutRecord(iEvent, evSetup);
1439   }
1440 
1441   // analyze: decision for a given algorithm using L1GtUtils functions
1442   //   for tests, use only one of the following methods
1443 
1444   switch (m_l1GtUtilsConfiguration) {
1445     case 0: {
1446       if (m_analyzeL1GtUtilsMenuLiteEnable) {
1447         analyzeL1GtUtilsMenuLite(iEvent, evSetup);
1448       }
1449 
1450       // full analysis of an algorithm or technical trigger
1451       if (m_analyzeTriggerEnable) {
1452         analyzeTrigger(iEvent, evSetup);
1453       }
1454 
1455     } break;
1456     case 100000: {
1457       if (m_analyzeL1GtUtilsEnable) {
1458         analyzeL1GtUtils(iEvent, evSetup);
1459       }
1460 
1461       // full analysis of an algorithm or technical trigger
1462       if (m_analyzeTriggerEnable) {
1463         analyzeTrigger(iEvent, evSetup);
1464       }
1465 
1466     } break;
1467     case 200000: {
1468       if (m_analyzeL1GtUtilsEventSetupEnable) {
1469         analyzeL1GtUtilsEventSetup(iEvent, evSetup);
1470       }
1471 
1472       // full analysis of an algorithm or technical trigger
1473       if (m_analyzeTriggerEnable) {
1474         analyzeTrigger(iEvent, evSetup);
1475       }
1476 
1477     } break;
1478     default: {
1479       // do nothing
1480     } break;
1481   }
1482 
1483   // analyze: object map product
1484   if (m_analyzeObjectMapEnable) {
1485     analyzeObjectMap(iEvent, evSetup);
1486   }
1487 
1488   // analyze: L1GtTriggerMenuLite
1489   if (m_analyzeL1GtUtilsMenuLiteEnable) {
1490     analyzeL1GtTriggerMenuLite(iEvent, evSetup);
1491   }
1492 
1493   // analyze: usage of ConditionsInEdm
1494   if (m_analyzeConditionsInEventBlockEnable) {
1495     analyzeConditionsInEventBlock(iEvent, evSetup);
1496   }
1497 }
1498 
1499 // end section
1500 void L1GtAnalyzer::endLuminosityBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup& evSetup) {
1501   // empty
1502 }
1503 void L1GtAnalyzer::endRun(const edm::Run& iRun, const edm::EventSetup& evSetup) {
1504   // empty
1505 }
1506 
1507 // method called once each job just after ending the event loop
1508 void L1GtAnalyzer::endJob() {
1509   // empty
1510 }