Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-08 05:11:43

0001 /**
0002  * \class L1GlobalTriggerGTL
0003  *
0004  *
0005  * Description: Global Trigger Logic board, see header file for details.
0006  *
0007  * Implementation:
0008  *    <TODO: enter implementation details>
0009  *
0010  * \author: M. Fierro            - HEPHY Vienna - ORCA version
0011  * \author: Vasile Mihai Ghete   - HEPHY Vienna - CMSSW version
0012  *
0013  *
0014  */
0015 
0016 // this class header
0017 #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerGTL.h"
0018 
0019 // user include files
0020 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h"
0021 
0022 #include "CondFormats/L1TObjects/interface/L1GtFwd.h"
0023 
0024 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
0025 
0026 #include "CondFormats/L1TObjects/interface/L1GtAlgorithm.h"
0027 #include "CondFormats/L1TObjects/interface/L1GtCondition.h"
0028 
0029 #include "CondFormats/L1TObjects/interface/L1GtBptxTemplate.h"
0030 #include "CondFormats/L1TObjects/interface/L1GtCaloTemplate.h"
0031 #include "CondFormats/L1TObjects/interface/L1GtCastorTemplate.h"
0032 #include "CondFormats/L1TObjects/interface/L1GtCorrelationTemplate.h"
0033 #include "CondFormats/L1TObjects/interface/L1GtEnergySumTemplate.h"
0034 #include "CondFormats/L1TObjects/interface/L1GtExternalTemplate.h"
0035 #include "CondFormats/L1TObjects/interface/L1GtHfBitCountsTemplate.h"
0036 #include "CondFormats/L1TObjects/interface/L1GtHfRingEtSumsTemplate.h"
0037 #include "CondFormats/L1TObjects/interface/L1GtJetCountsTemplate.h"
0038 #include "CondFormats/L1TObjects/interface/L1GtMuonTemplate.h"
0039 
0040 #include "CondFormats/L1TObjects/interface/L1CaloGeometry.h"
0041 #include "CondFormats/L1TObjects/interface/L1MuTriggerScales.h"
0042 
0043 #include "L1Trigger/GlobalTrigger/interface/L1GtAlgorithmEvaluation.h"
0044 #include "L1Trigger/GlobalTrigger/interface/L1GtConditionEvaluation.h"
0045 
0046 #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerPSB.h"
0047 
0048 #include "L1Trigger/GlobalTrigger/interface/L1GtBptxCondition.h"
0049 #include "L1Trigger/GlobalTrigger/interface/L1GtCaloCondition.h"
0050 #include "L1Trigger/GlobalTrigger/interface/L1GtCastorCondition.h"
0051 #include "L1Trigger/GlobalTrigger/interface/L1GtCorrelationCondition.h"
0052 #include "L1Trigger/GlobalTrigger/interface/L1GtEnergySumCondition.h"
0053 #include "L1Trigger/GlobalTrigger/interface/L1GtExternalCondition.h"
0054 #include "L1Trigger/GlobalTrigger/interface/L1GtHfBitCountsCondition.h"
0055 #include "L1Trigger/GlobalTrigger/interface/L1GtHfRingEtSumsCondition.h"
0056 #include "L1Trigger/GlobalTrigger/interface/L1GtJetCountsCondition.h"
0057 #include "L1Trigger/GlobalTrigger/interface/L1GtMuonCondition.h"
0058 
0059 #include "L1Trigger/GlobalTrigger/interface/L1GtEtaPhiConversions.h"
0060 
0061 #include "FWCore/Utilities/interface/Exception.h"
0062 
0063 #include "FWCore/MessageLogger/interface/MessageDrop.h"
0064 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0065 
0066 // forward declarations
0067 
0068 // constructor
0069 L1GlobalTriggerGTL::L1GlobalTriggerGTL(const edm::InputTag &m_muGmtInputTag, edm::ConsumesCollector &&iC)
0070     : m_l1GtMenuToken(iC.esConsumes()),
0071       m_l1CaloGeometryToken(iC.esConsumes()),
0072       m_l1MuTriggerScalesToken(iC.esConsumes()),
0073       m_candL1Mu(new std::vector<const L1MuGMTCand *>),
0074       m_isDebugEnabled(edm::isDebugEnabled()) {
0075   m_gtlAlgorithmOR.reset();
0076   m_gtlDecisionWord.reset();
0077 
0078   // initialize cached IDs
0079   m_l1CaloGeometryCacheID = 0ULL;
0080   m_l1MuTriggerScalesCacheID = 0ULL;
0081 
0082   // pointer to conversion - actually done in the event loop (cached)
0083   m_gtEtaPhiConversions = new L1GtEtaPhiConversions();
0084   m_gtEtaPhiConversions->setVerbosity(m_verbosity);
0085 
0086   iC.consumes<std::vector<L1MuGMTCand>>(m_muGmtInputTag);
0087 }
0088 
0089 // destructor
0090 L1GlobalTriggerGTL::~L1GlobalTriggerGTL() {
0091   reset();
0092   delete m_candL1Mu;
0093   delete m_gtEtaPhiConversions;
0094 }
0095 
0096 // operations
0097 void L1GlobalTriggerGTL::init(const int nrL1Mu, const int numberPhysTriggers) {
0098   m_candL1Mu->reserve(nrL1Mu);
0099 
0100   // FIXME move from bitset to std::vector<bool> to be able to use
0101   // numberPhysTriggers from EventSetup
0102 
0103   // m_gtlAlgorithmOR.reserve(numberPhysTriggers);
0104   // m_gtlAlgorithmOR.assign(numberPhysTriggers, false);
0105 
0106   // m_gtlDecisionWord.reserve(numberPhysTriggers);
0107   // m_gtlDecisionWord.assign(numberPhysTriggers, false);
0108 }
0109 
0110 // receive data from Global Muon Trigger
0111 void L1GlobalTriggerGTL::receiveGmtObjectData(edm::Event &iEvent,
0112                                               const edm::InputTag &muGmtInputTag,
0113                                               const int iBxInEvent,
0114                                               const bool receiveMu,
0115                                               const int nrL1Mu) {
0116   if (m_verbosity) {
0117     LogDebug("L1GlobalTrigger") << "\n**** L1GlobalTriggerGTL receiving muon data for BxInEvent = " << iBxInEvent
0118                                 << "\n     from input tag " << muGmtInputTag << "\n"
0119                                 << std::endl;
0120   }
0121 
0122   reset();
0123 
0124   // get data from Global Muon Trigger
0125   if (receiveMu) {
0126     edm::Handle<std::vector<L1MuGMTCand>> muonData;
0127     iEvent.getByLabel(muGmtInputTag, muonData);
0128 
0129     if (!muonData.isValid()) {
0130       if (m_verbosity) {
0131         edm::LogWarning("L1GlobalTrigger") << "\nWarning: std::vector<L1MuGMTCand> with input tag " << muGmtInputTag
0132                                            << "\nrequested in configuration, but not found in the event.\n"
0133                                            << std::endl;
0134       }
0135     } else {
0136       std::vector<L1MuGMTCand>::const_iterator itMuon;
0137       for (itMuon = muonData->begin(); itMuon != muonData->end(); itMuon++) {
0138         if ((*itMuon).bx() == iBxInEvent) {
0139           (*m_candL1Mu).push_back(&(*itMuon));
0140           // LogTrace("L1GlobalTrigger") << (*itMuon)
0141           //        << std::endl;
0142         }
0143       }
0144     }
0145   }
0146 
0147   if (m_verbosity && m_isDebugEnabled) {
0148     printGmtData(iBxInEvent);
0149   }
0150 }
0151 
0152 // run GTL
0153 void L1GlobalTriggerGTL::run(edm::Event &iEvent,
0154                              const edm::EventSetup &evSetup,
0155                              const L1GlobalTriggerPSB *ptrGtPSB,
0156                              const bool produceL1GtObjectMapRecord,
0157                              const int iBxInEvent,
0158                              L1GlobalTriggerObjectMapRecord *gtObjectMapRecord,
0159                              const unsigned int numberPhysTriggers,
0160                              const int nrL1Mu,
0161                              const int nrL1NoIsoEG,
0162                              const int nrL1IsoEG,
0163                              const int nrL1CenJet,
0164                              const int nrL1ForJet,
0165                              const int nrL1TauJet,
0166                              const int nrL1JetCounts,
0167                              const int ifMuEtaNumberBits,
0168                              const int ifCaloEtaNumberBits) {
0169   // get / update the trigger menu from the EventSetup
0170   const auto &l1GtMenu = evSetup.getData(m_l1GtMenuToken);
0171 
0172   const std::vector<ConditionMap> &conditionMap = l1GtMenu.gtConditionMap();
0173   const AlgorithmMap &algorithmMap = l1GtMenu.gtAlgorithmMap();
0174 
0175   const std::vector<std::vector<L1GtMuonTemplate>> &corrMuon = l1GtMenu.corMuonTemplate();
0176 
0177   const std::vector<std::vector<L1GtCaloTemplate>> &corrCalo = l1GtMenu.corCaloTemplate();
0178 
0179   const std::vector<std::vector<L1GtEnergySumTemplate>> &corrEnergySum = l1GtMenu.corEnergySumTemplate();
0180 
0181   // conversion needed for correlation conditions
0182   // done in the condition loop when the first correlation template is in the
0183   // menu
0184   bool convertScale = false;
0185 
0186   // get / update the calorimeter geometry from the EventSetup
0187   // local cache & check on cacheIdentifier
0188   unsigned long long l1CaloGeometryCacheID = evSetup.get<L1CaloGeometryRecord>().cacheIdentifier();
0189 
0190   if (m_l1CaloGeometryCacheID != l1CaloGeometryCacheID) {
0191     m_l1CaloGeometry = &evSetup.getData(m_l1CaloGeometryToken);
0192     m_l1CaloGeometryCacheID = l1CaloGeometryCacheID;
0193     convertScale = true;
0194   }
0195 
0196   // get / update the eta and phi muon trigger scales from the EventSetup
0197   // local cache & check on cacheIdentifier
0198   unsigned long long l1MuTriggerScalesCacheID = evSetup.get<L1MuTriggerScalesRcd>().cacheIdentifier();
0199 
0200   if (m_l1MuTriggerScalesCacheID != l1MuTriggerScalesCacheID) {
0201     m_l1MuTriggerScales = &evSetup.getData(m_l1MuTriggerScalesToken);
0202     m_l1MuTriggerScalesCacheID = l1MuTriggerScalesCacheID;
0203     convertScale = true;
0204   }
0205 
0206   if (convertScale) {
0207     m_gtEtaPhiConversions->setVerbosity(m_verbosity);
0208     m_gtEtaPhiConversions->convertL1Scales(
0209         m_l1CaloGeometry, m_l1MuTriggerScales, ifCaloEtaNumberBits, ifMuEtaNumberBits);
0210 
0211     // print the conversions if DEBUG and verbosity enabled
0212 
0213     if (m_verbosity && m_isDebugEnabled) {
0214       std::ostringstream myCout;
0215       m_gtEtaPhiConversions->print(myCout);
0216 
0217       LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0218     }
0219   }
0220 
0221   // loop over condition maps (one map per condition chip)
0222   // then loop over conditions in the map
0223   // save the results in temporary maps
0224 
0225   // never happens in production but at first event...
0226   if (m_conditionResultMaps.size() != conditionMap.size()) {
0227     m_conditionResultMaps.clear();
0228     m_conditionResultMaps.resize(conditionMap.size());
0229   }
0230 
0231   int iChip = -1;
0232 
0233   for (std::vector<ConditionMap>::const_iterator itCondOnChip = conditionMap.begin();
0234        itCondOnChip != conditionMap.end();
0235        itCondOnChip++) {
0236     iChip++;
0237 
0238     // L1GtAlgorithmEvaluation::ConditionEvaluationMap cMapResults;
0239     // L1GtAlgorithmEvaluation::ConditionEvaluationMap
0240     // cMapResults((*itCondOnChip).size()); // hash map
0241     L1GtAlgorithmEvaluation::ConditionEvaluationMap &cMapResults = m_conditionResultMaps[iChip];
0242 
0243     for (CItCond itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
0244       // evaluate condition
0245       switch ((itCond->second)->condCategory()) {
0246         case CondMuon: {
0247           L1GtMuonCondition *muCondition = new L1GtMuonCondition(itCond->second, this, nrL1Mu, ifMuEtaNumberBits);
0248 
0249           muCondition->setVerbosity(m_verbosity);
0250           muCondition->setGtCorrParDeltaPhiNrBins((m_gtEtaPhiConversions->gtObjectNrBinsPhi(Mu)) / 2 + 1);
0251           muCondition->evaluateConditionStoreResult();
0252 
0253           cMapResults[itCond->first] = muCondition;
0254 
0255           if (m_verbosity && m_isDebugEnabled) {
0256             std::ostringstream myCout;
0257             muCondition->print(myCout);
0258 
0259             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0260           }
0261 
0262           // delete muCondition;
0263 
0264         } break;
0265         case CondCalo: {
0266           L1GtCaloCondition *caloCondition = new L1GtCaloCondition(
0267               itCond->second, ptrGtPSB, nrL1NoIsoEG, nrL1IsoEG, nrL1CenJet, nrL1ForJet, nrL1TauJet, ifCaloEtaNumberBits);
0268 
0269           caloCondition->setVerbosity(m_verbosity);
0270           caloCondition->setGtCorrParDeltaPhiNrBins(
0271               (m_gtEtaPhiConversions->gtObjectNrBinsPhi(((itCond->second)->objectType())[0])) / 2 + 1);
0272           caloCondition->evaluateConditionStoreResult();
0273 
0274           cMapResults[itCond->first] = caloCondition;
0275 
0276           if (m_verbosity && m_isDebugEnabled) {
0277             std::ostringstream myCout;
0278             caloCondition->print(myCout);
0279 
0280             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0281           }
0282           //                    delete caloCondition;
0283 
0284         } break;
0285         case CondEnergySum: {
0286           L1GtEnergySumCondition *eSumCondition = new L1GtEnergySumCondition(itCond->second, ptrGtPSB);
0287 
0288           eSumCondition->setVerbosity(m_verbosity);
0289           eSumCondition->evaluateConditionStoreResult();
0290 
0291           cMapResults[itCond->first] = eSumCondition;
0292 
0293           if (m_verbosity && m_isDebugEnabled) {
0294             std::ostringstream myCout;
0295             eSumCondition->print(myCout);
0296 
0297             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0298           }
0299           //                    delete eSumCondition;
0300 
0301         } break;
0302         case CondJetCounts: {
0303           L1GtJetCountsCondition *jcCondition = new L1GtJetCountsCondition(itCond->second, ptrGtPSB, nrL1JetCounts);
0304 
0305           jcCondition->setVerbosity(m_verbosity);
0306           jcCondition->evaluateConditionStoreResult();
0307 
0308           cMapResults[itCond->first] = jcCondition;
0309 
0310           if (m_verbosity && m_isDebugEnabled) {
0311             std::ostringstream myCout;
0312             jcCondition->print(myCout);
0313 
0314             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0315           }
0316 
0317           //                  delete jcCondition;
0318 
0319         } break;
0320         case CondHfBitCounts: {
0321           L1GtHfBitCountsCondition *bcCondition = new L1GtHfBitCountsCondition(itCond->second, ptrGtPSB);
0322 
0323           bcCondition->setVerbosity(m_verbosity);
0324           bcCondition->evaluateConditionStoreResult();
0325 
0326           cMapResults[itCond->first] = bcCondition;
0327 
0328           if (m_isDebugEnabled) {
0329             std::ostringstream myCout;
0330             bcCondition->print(myCout);
0331 
0332             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0333           }
0334 
0335           //                  delete bcCondition;
0336 
0337         } break;
0338         case CondHfRingEtSums: {
0339           L1GtHfRingEtSumsCondition *etCondition = new L1GtHfRingEtSumsCondition(itCond->second, ptrGtPSB);
0340 
0341           etCondition->setVerbosity(m_verbosity);
0342           etCondition->evaluateConditionStoreResult();
0343 
0344           cMapResults[itCond->first] = etCondition;
0345 
0346           if (m_verbosity && m_isDebugEnabled) {
0347             std::ostringstream myCout;
0348             etCondition->print(myCout);
0349 
0350             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0351           }
0352 
0353           //                  delete etCondition;
0354 
0355         } break;
0356         case CondCastor: {
0357           bool castorCondResult = false;
0358 
0359           // FIXME need a solution to read CASTOR
0360           // if (castorConditionFlag) {
0361           //    castorCondResult = castorData->conditionResult(itCond->first);
0362           //}
0363 
0364           L1GtCastorCondition *castorCondition = new L1GtCastorCondition(itCond->second, castorCondResult);
0365 
0366           castorCondition->setVerbosity(m_verbosity);
0367           castorCondition->evaluateConditionStoreResult();
0368 
0369           cMapResults[itCond->first] = castorCondition;
0370 
0371           if (m_verbosity && m_isDebugEnabled) {
0372             std::ostringstream myCout;
0373             castorCondition->print(myCout);
0374 
0375             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0376           }
0377 
0378           //                  delete castorCondition;
0379 
0380         } break;
0381         case CondBptx: {
0382           bool bptxCondResult = true;
0383 
0384           // FIXME need a solution to read BPTX with real value
0385 
0386           L1GtBptxCondition *bptxCondition = new L1GtBptxCondition(itCond->second, bptxCondResult);
0387 
0388           bptxCondition->setVerbosity(m_verbosity);
0389           bptxCondition->evaluateConditionStoreResult();
0390 
0391           cMapResults[itCond->first] = bptxCondition;
0392 
0393           if (m_verbosity && m_isDebugEnabled) {
0394             std::ostringstream myCout;
0395             bptxCondition->print(myCout);
0396 
0397             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0398           }
0399 
0400           //                  delete bptxCondition;
0401 
0402         } break;
0403         case CondExternal: {
0404           bool externalCondResult = true;
0405 
0406           // FIXME need a solution to read External with real value
0407 
0408           L1GtExternalCondition *externalCondition = new L1GtExternalCondition(itCond->second, externalCondResult);
0409 
0410           externalCondition->setVerbosity(m_verbosity);
0411           externalCondition->evaluateConditionStoreResult();
0412 
0413           cMapResults[itCond->first] = externalCondition;
0414 
0415           if (m_verbosity && m_isDebugEnabled) {
0416             std::ostringstream myCout;
0417             externalCondition->print(myCout);
0418 
0419             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0420           }
0421 
0422           //                  delete externalCondition;
0423 
0424         } break;
0425         case CondCorrelation: {
0426           // get first the sub-conditions
0427           const L1GtCorrelationTemplate *corrTemplate = static_cast<const L1GtCorrelationTemplate *>(itCond->second);
0428           const L1GtConditionCategory cond0Categ = corrTemplate->cond0Category();
0429           const L1GtConditionCategory cond1Categ = corrTemplate->cond1Category();
0430           const int cond0Ind = corrTemplate->cond0Index();
0431           const int cond1Ind = corrTemplate->cond1Index();
0432 
0433           const L1GtCondition *cond0Condition = nullptr;
0434           const L1GtCondition *cond1Condition = nullptr;
0435 
0436           // maximum number of objects received for evaluation of Type1s condition
0437           int cond0NrL1Objects = 0;
0438           int cond1NrL1Objects = 0;
0439 
0440           int cond0EtaBits = 0;
0441           int cond1EtaBits = 0;
0442 
0443           switch (cond0Categ) {
0444             case CondMuon: {
0445               cond0Condition = &((corrMuon[iChip])[cond0Ind]);
0446               cond0NrL1Objects = nrL1Mu;
0447               cond0EtaBits = ifMuEtaNumberBits;
0448             } break;
0449             case CondCalo: {
0450               cond0Condition = &((corrCalo[iChip])[cond0Ind]);
0451 
0452               switch ((cond0Condition->objectType())[0]) {
0453                 case NoIsoEG:
0454                   cond0NrL1Objects = nrL1NoIsoEG;
0455                   break;
0456                 case IsoEG:
0457                   cond0NrL1Objects = nrL1IsoEG;
0458                   break;
0459                 case CenJet:
0460                   cond0NrL1Objects = nrL1CenJet;
0461                   break;
0462                 case ForJet:
0463                   cond0NrL1Objects = nrL1ForJet;
0464                   break;
0465                 case TauJet:
0466                   cond0NrL1Objects = nrL1TauJet;
0467                   break;
0468                 default:
0469                   cond0NrL1Objects = 0;
0470                   break;
0471               }
0472 
0473               cond0EtaBits = ifCaloEtaNumberBits;
0474             } break;
0475             case CondEnergySum: {
0476               cond0Condition = &((corrEnergySum[iChip])[cond0Ind]);
0477               cond0NrL1Objects = 1;
0478             } break;
0479             default: {
0480               // do nothing, should not arrive here
0481             } break;
0482           }
0483 
0484           switch (cond1Categ) {
0485             case CondMuon: {
0486               cond1Condition = &((corrMuon[iChip])[cond1Ind]);
0487               cond1NrL1Objects = nrL1Mu;
0488               cond1EtaBits = ifMuEtaNumberBits;
0489             } break;
0490             case CondCalo: {
0491               cond1Condition = &((corrCalo[iChip])[cond1Ind]);
0492 
0493               switch ((cond1Condition->objectType())[0]) {
0494                 case NoIsoEG:
0495                   cond1NrL1Objects = nrL1NoIsoEG;
0496                   break;
0497                 case IsoEG:
0498                   cond1NrL1Objects = nrL1IsoEG;
0499                   break;
0500                 case CenJet:
0501                   cond1NrL1Objects = nrL1CenJet;
0502                   break;
0503                 case ForJet:
0504                   cond1NrL1Objects = nrL1ForJet;
0505                   break;
0506                 case TauJet:
0507                   cond1NrL1Objects = nrL1TauJet;
0508                   break;
0509                 default:
0510                   cond1NrL1Objects = 0;
0511                   break;
0512               }
0513 
0514               cond1EtaBits = ifCaloEtaNumberBits;
0515             } break;
0516             case CondEnergySum: {
0517               cond1Condition = &((corrEnergySum[iChip])[cond1Ind]);
0518               cond1NrL1Objects = 1;
0519             } break;
0520             default: {
0521               // do nothing, should not arrive here
0522             } break;
0523           }
0524 
0525           L1GtCorrelationCondition *correlationCond = new L1GtCorrelationCondition(itCond->second,
0526                                                                                    cond0Condition,
0527                                                                                    cond1Condition,
0528                                                                                    cond0NrL1Objects,
0529                                                                                    cond1NrL1Objects,
0530                                                                                    cond0EtaBits,
0531                                                                                    cond1EtaBits,
0532                                                                                    this,
0533                                                                                    ptrGtPSB,
0534                                                                                    m_gtEtaPhiConversions);
0535 
0536           correlationCond->setVerbosity(m_verbosity);
0537           correlationCond->evaluateConditionStoreResult();
0538 
0539           cMapResults[itCond->first] = correlationCond;
0540 
0541           if (m_verbosity && m_isDebugEnabled) {
0542             std::ostringstream myCout;
0543             correlationCond->print(myCout);
0544 
0545             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0546           }
0547 
0548           //                  delete correlationCond;
0549 
0550         } break;
0551         case CondNull: {
0552           // do nothing
0553 
0554         } break;
0555         default: {
0556           // do nothing
0557 
0558         } break;
0559       }
0560     }
0561   }
0562 
0563   // loop over algorithm map
0564 
0565   // empty vector for object maps - filled during loop
0566   std::vector<L1GlobalTriggerObjectMap> objMapVec;
0567   if (produceL1GtObjectMapRecord && (iBxInEvent == 0))
0568     objMapVec.reserve(numberPhysTriggers);
0569 
0570   for (CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
0571     L1GtAlgorithmEvaluation gtAlg(itAlgo->second);
0572     gtAlg.evaluateAlgorithm((itAlgo->second).algoChipNumber(), m_conditionResultMaps);
0573 
0574     int algBitNumber = (itAlgo->second).algoBitNumber();
0575     bool algResult = gtAlg.gtAlgoResult();
0576 
0577     if (algResult) {
0578       m_gtlAlgorithmOR.set(algBitNumber);
0579     }
0580 
0581     if (m_verbosity && m_isDebugEnabled) {
0582       std::ostringstream myCout;
0583       (itAlgo->second).print(myCout);
0584       gtAlg.print(myCout);
0585 
0586       LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0587     }
0588 
0589     // object maps only for BxInEvent = 0
0590     if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
0591       // set object map
0592       L1GlobalTriggerObjectMap objMap;
0593 
0594       objMap.setAlgoName(itAlgo->first);
0595       objMap.setAlgoBitNumber(algBitNumber);
0596       objMap.setAlgoGtlResult(algResult);
0597       objMap.swapOperandTokenVector(gtAlg.operandTokenVector());
0598       objMap.swapCombinationVector(gtAlg.gtAlgoCombinationVector());
0599       // gtAlg is empty now...
0600 
0601       if (m_verbosity && m_isDebugEnabled) {
0602         std::ostringstream myCout1;
0603         objMap.print(myCout1);
0604 
0605         LogTrace("L1GlobalTrigger") << myCout1.str() << std::endl;
0606       }
0607 
0608       objMapVec.push_back(objMap);
0609     }
0610   }
0611 
0612   // object maps only for BxInEvent = 0
0613   if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
0614     gtObjectMapRecord->swapGtObjectMap(objMapVec);
0615   }
0616 
0617   // loop over condition maps (one map per condition chip)
0618   // then loop over conditions in the map
0619   // delete the conditions created with new, zero pointer, do not clear map,
0620   // keep the vector as is...
0621   for (std::vector<L1GtAlgorithmEvaluation::ConditionEvaluationMap>::iterator itCondOnChip =
0622            m_conditionResultMaps.begin();
0623        itCondOnChip != m_conditionResultMaps.end();
0624        itCondOnChip++) {
0625     for (L1GtAlgorithmEvaluation::ItEvalMap itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
0626       delete itCond->second;
0627       itCond->second = nullptr;
0628     }
0629   }
0630 }
0631 
0632 // clear GTL
0633 void L1GlobalTriggerGTL::reset() {
0634   m_candL1Mu->clear();
0635 
0636   m_gtlDecisionWord.reset();
0637   m_gtlAlgorithmOR.reset();
0638 }
0639 
0640 // print Global Muon Trigger data received by GTL
0641 void L1GlobalTriggerGTL::printGmtData(const int iBxInEvent) const {
0642   LogTrace("L1GlobalTrigger") << "\nL1GlobalTrigger: GMT data received for BxInEvent = " << iBxInEvent << std::endl;
0643 
0644   int nrL1Mu = m_candL1Mu->size();
0645   LogTrace("L1GlobalTrigger") << "Number of GMT muons = " << nrL1Mu << "\n" << std::endl;
0646 
0647   for (std::vector<const L1MuGMTCand *>::const_iterator iter = m_candL1Mu->begin(); iter != m_candL1Mu->end(); iter++) {
0648     LogTrace("L1GlobalTrigger") << *(*iter) << std::endl;
0649   }
0650 
0651   LogTrace("L1GlobalTrigger") << std::endl;
0652 }