Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-06-26 02:09: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     // set convertScale to false to avoid executing the conversion
0221     // more than once - in case the scales change it will be set to true
0222     // in the cache check
0223     convertScale = false;
0224   }
0225 
0226   // loop over condition maps (one map per condition chip)
0227   // then loop over conditions in the map
0228   // save the results in temporary maps
0229 
0230   // never happens in production but at first event...
0231   if (m_conditionResultMaps.size() != conditionMap.size()) {
0232     m_conditionResultMaps.clear();
0233     m_conditionResultMaps.resize(conditionMap.size());
0234   }
0235 
0236   int iChip = -1;
0237 
0238   for (std::vector<ConditionMap>::const_iterator itCondOnChip = conditionMap.begin();
0239        itCondOnChip != conditionMap.end();
0240        itCondOnChip++) {
0241     iChip++;
0242 
0243     // L1GtAlgorithmEvaluation::ConditionEvaluationMap cMapResults;
0244     // L1GtAlgorithmEvaluation::ConditionEvaluationMap
0245     // cMapResults((*itCondOnChip).size()); // hash map
0246     L1GtAlgorithmEvaluation::ConditionEvaluationMap &cMapResults = m_conditionResultMaps[iChip];
0247 
0248     for (CItCond itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
0249       // evaluate condition
0250       switch ((itCond->second)->condCategory()) {
0251         case CondMuon: {
0252           L1GtMuonCondition *muCondition = new L1GtMuonCondition(itCond->second, this, nrL1Mu, ifMuEtaNumberBits);
0253 
0254           muCondition->setVerbosity(m_verbosity);
0255           muCondition->setGtCorrParDeltaPhiNrBins((m_gtEtaPhiConversions->gtObjectNrBinsPhi(Mu)) / 2 + 1);
0256           muCondition->evaluateConditionStoreResult();
0257 
0258           cMapResults[itCond->first] = muCondition;
0259 
0260           if (m_verbosity && m_isDebugEnabled) {
0261             std::ostringstream myCout;
0262             muCondition->print(myCout);
0263 
0264             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0265           }
0266 
0267           // delete muCondition;
0268 
0269         } break;
0270         case CondCalo: {
0271           L1GtCaloCondition *caloCondition = new L1GtCaloCondition(
0272               itCond->second, ptrGtPSB, nrL1NoIsoEG, nrL1IsoEG, nrL1CenJet, nrL1ForJet, nrL1TauJet, ifCaloEtaNumberBits);
0273 
0274           caloCondition->setVerbosity(m_verbosity);
0275           caloCondition->setGtCorrParDeltaPhiNrBins(
0276               (m_gtEtaPhiConversions->gtObjectNrBinsPhi(((itCond->second)->objectType())[0])) / 2 + 1);
0277           caloCondition->evaluateConditionStoreResult();
0278 
0279           cMapResults[itCond->first] = caloCondition;
0280 
0281           if (m_verbosity && m_isDebugEnabled) {
0282             std::ostringstream myCout;
0283             caloCondition->print(myCout);
0284 
0285             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0286           }
0287           //                    delete caloCondition;
0288 
0289         } break;
0290         case CondEnergySum: {
0291           L1GtEnergySumCondition *eSumCondition = new L1GtEnergySumCondition(itCond->second, ptrGtPSB);
0292 
0293           eSumCondition->setVerbosity(m_verbosity);
0294           eSumCondition->evaluateConditionStoreResult();
0295 
0296           cMapResults[itCond->first] = eSumCondition;
0297 
0298           if (m_verbosity && m_isDebugEnabled) {
0299             std::ostringstream myCout;
0300             eSumCondition->print(myCout);
0301 
0302             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0303           }
0304           //                    delete eSumCondition;
0305 
0306         } break;
0307         case CondJetCounts: {
0308           L1GtJetCountsCondition *jcCondition = new L1GtJetCountsCondition(itCond->second, ptrGtPSB, nrL1JetCounts);
0309 
0310           jcCondition->setVerbosity(m_verbosity);
0311           jcCondition->evaluateConditionStoreResult();
0312 
0313           cMapResults[itCond->first] = jcCondition;
0314 
0315           if (m_verbosity && m_isDebugEnabled) {
0316             std::ostringstream myCout;
0317             jcCondition->print(myCout);
0318 
0319             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0320           }
0321 
0322           //                  delete jcCondition;
0323 
0324         } break;
0325         case CondHfBitCounts: {
0326           L1GtHfBitCountsCondition *bcCondition = new L1GtHfBitCountsCondition(itCond->second, ptrGtPSB);
0327 
0328           bcCondition->setVerbosity(m_verbosity);
0329           bcCondition->evaluateConditionStoreResult();
0330 
0331           cMapResults[itCond->first] = bcCondition;
0332 
0333           if (m_isDebugEnabled) {
0334             std::ostringstream myCout;
0335             bcCondition->print(myCout);
0336 
0337             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0338           }
0339 
0340           //                  delete bcCondition;
0341 
0342         } break;
0343         case CondHfRingEtSums: {
0344           L1GtHfRingEtSumsCondition *etCondition = new L1GtHfRingEtSumsCondition(itCond->second, ptrGtPSB);
0345 
0346           etCondition->setVerbosity(m_verbosity);
0347           etCondition->evaluateConditionStoreResult();
0348 
0349           cMapResults[itCond->first] = etCondition;
0350 
0351           if (m_verbosity && m_isDebugEnabled) {
0352             std::ostringstream myCout;
0353             etCondition->print(myCout);
0354 
0355             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0356           }
0357 
0358           //                  delete etCondition;
0359 
0360         } break;
0361         case CondCastor: {
0362           bool castorCondResult = false;
0363 
0364           // FIXME need a solution to read CASTOR
0365           // if (castorConditionFlag) {
0366           //    castorCondResult = castorData->conditionResult(itCond->first);
0367           //}
0368 
0369           L1GtCastorCondition *castorCondition = new L1GtCastorCondition(itCond->second, castorCondResult);
0370 
0371           castorCondition->setVerbosity(m_verbosity);
0372           castorCondition->evaluateConditionStoreResult();
0373 
0374           cMapResults[itCond->first] = castorCondition;
0375 
0376           if (m_verbosity && m_isDebugEnabled) {
0377             std::ostringstream myCout;
0378             castorCondition->print(myCout);
0379 
0380             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0381           }
0382 
0383           //                  delete castorCondition;
0384 
0385         } break;
0386         case CondBptx: {
0387           bool bptxCondResult = true;
0388 
0389           // FIXME need a solution to read BPTX with real value
0390 
0391           L1GtBptxCondition *bptxCondition = new L1GtBptxCondition(itCond->second, bptxCondResult);
0392 
0393           bptxCondition->setVerbosity(m_verbosity);
0394           bptxCondition->evaluateConditionStoreResult();
0395 
0396           cMapResults[itCond->first] = bptxCondition;
0397 
0398           if (m_verbosity && m_isDebugEnabled) {
0399             std::ostringstream myCout;
0400             bptxCondition->print(myCout);
0401 
0402             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0403           }
0404 
0405           //                  delete bptxCondition;
0406 
0407         } break;
0408         case CondExternal: {
0409           bool externalCondResult = true;
0410 
0411           // FIXME need a solution to read External with real value
0412 
0413           L1GtExternalCondition *externalCondition = new L1GtExternalCondition(itCond->second, externalCondResult);
0414 
0415           externalCondition->setVerbosity(m_verbosity);
0416           externalCondition->evaluateConditionStoreResult();
0417 
0418           cMapResults[itCond->first] = externalCondition;
0419 
0420           if (m_verbosity && m_isDebugEnabled) {
0421             std::ostringstream myCout;
0422             externalCondition->print(myCout);
0423 
0424             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0425           }
0426 
0427           //                  delete externalCondition;
0428 
0429         } break;
0430         case CondCorrelation: {
0431           // get first the sub-conditions
0432           const L1GtCorrelationTemplate *corrTemplate = static_cast<const L1GtCorrelationTemplate *>(itCond->second);
0433           const L1GtConditionCategory cond0Categ = corrTemplate->cond0Category();
0434           const L1GtConditionCategory cond1Categ = corrTemplate->cond1Category();
0435           const int cond0Ind = corrTemplate->cond0Index();
0436           const int cond1Ind = corrTemplate->cond1Index();
0437 
0438           const L1GtCondition *cond0Condition = nullptr;
0439           const L1GtCondition *cond1Condition = nullptr;
0440 
0441           // maximum number of objects received for evaluation of Type1s condition
0442           int cond0NrL1Objects = 0;
0443           int cond1NrL1Objects = 0;
0444 
0445           int cond0EtaBits = 0;
0446           int cond1EtaBits = 0;
0447 
0448           switch (cond0Categ) {
0449             case CondMuon: {
0450               cond0Condition = &((corrMuon[iChip])[cond0Ind]);
0451               cond0NrL1Objects = nrL1Mu;
0452               cond0EtaBits = ifMuEtaNumberBits;
0453             } break;
0454             case CondCalo: {
0455               cond0Condition = &((corrCalo[iChip])[cond0Ind]);
0456 
0457               switch ((cond0Condition->objectType())[0]) {
0458                 case NoIsoEG:
0459                   cond0NrL1Objects = nrL1NoIsoEG;
0460                   break;
0461                 case IsoEG:
0462                   cond0NrL1Objects = nrL1IsoEG;
0463                   break;
0464                 case CenJet:
0465                   cond0NrL1Objects = nrL1CenJet;
0466                   break;
0467                 case ForJet:
0468                   cond0NrL1Objects = nrL1ForJet;
0469                   break;
0470                 case TauJet:
0471                   cond0NrL1Objects = nrL1TauJet;
0472                   break;
0473                 default:
0474                   cond0NrL1Objects = 0;
0475                   break;
0476               }
0477 
0478               cond0EtaBits = ifCaloEtaNumberBits;
0479             } break;
0480             case CondEnergySum: {
0481               cond0Condition = &((corrEnergySum[iChip])[cond0Ind]);
0482               cond0NrL1Objects = 1;
0483             } break;
0484             default: {
0485               // do nothing, should not arrive here
0486             } break;
0487           }
0488 
0489           switch (cond1Categ) {
0490             case CondMuon: {
0491               cond1Condition = &((corrMuon[iChip])[cond1Ind]);
0492               cond1NrL1Objects = nrL1Mu;
0493               cond1EtaBits = ifMuEtaNumberBits;
0494             } break;
0495             case CondCalo: {
0496               cond1Condition = &((corrCalo[iChip])[cond1Ind]);
0497 
0498               switch ((cond1Condition->objectType())[0]) {
0499                 case NoIsoEG:
0500                   cond1NrL1Objects = nrL1NoIsoEG;
0501                   break;
0502                 case IsoEG:
0503                   cond1NrL1Objects = nrL1IsoEG;
0504                   break;
0505                 case CenJet:
0506                   cond1NrL1Objects = nrL1CenJet;
0507                   break;
0508                 case ForJet:
0509                   cond1NrL1Objects = nrL1ForJet;
0510                   break;
0511                 case TauJet:
0512                   cond1NrL1Objects = nrL1TauJet;
0513                   break;
0514                 default:
0515                   cond1NrL1Objects = 0;
0516                   break;
0517               }
0518 
0519               cond1EtaBits = ifCaloEtaNumberBits;
0520             } break;
0521             case CondEnergySum: {
0522               cond1Condition = &((corrEnergySum[iChip])[cond1Ind]);
0523               cond1NrL1Objects = 1;
0524             } break;
0525             default: {
0526               // do nothing, should not arrive here
0527             } break;
0528           }
0529 
0530           L1GtCorrelationCondition *correlationCond = new L1GtCorrelationCondition(itCond->second,
0531                                                                                    cond0Condition,
0532                                                                                    cond1Condition,
0533                                                                                    cond0NrL1Objects,
0534                                                                                    cond1NrL1Objects,
0535                                                                                    cond0EtaBits,
0536                                                                                    cond1EtaBits,
0537                                                                                    this,
0538                                                                                    ptrGtPSB,
0539                                                                                    m_gtEtaPhiConversions);
0540 
0541           correlationCond->setVerbosity(m_verbosity);
0542           correlationCond->evaluateConditionStoreResult();
0543 
0544           cMapResults[itCond->first] = correlationCond;
0545 
0546           if (m_verbosity && m_isDebugEnabled) {
0547             std::ostringstream myCout;
0548             correlationCond->print(myCout);
0549 
0550             LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0551           }
0552 
0553           //                  delete correlationCond;
0554 
0555         } break;
0556         case CondNull: {
0557           // do nothing
0558 
0559         } break;
0560         default: {
0561           // do nothing
0562 
0563         } break;
0564       }
0565     }
0566   }
0567 
0568   // loop over algorithm map
0569 
0570   // empty vector for object maps - filled during loop
0571   std::vector<L1GlobalTriggerObjectMap> objMapVec;
0572   if (produceL1GtObjectMapRecord && (iBxInEvent == 0))
0573     objMapVec.reserve(numberPhysTriggers);
0574 
0575   for (CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
0576     L1GtAlgorithmEvaluation gtAlg(itAlgo->second);
0577     gtAlg.evaluateAlgorithm((itAlgo->second).algoChipNumber(), m_conditionResultMaps);
0578 
0579     int algBitNumber = (itAlgo->second).algoBitNumber();
0580     bool algResult = gtAlg.gtAlgoResult();
0581 
0582     if (algResult) {
0583       m_gtlAlgorithmOR.set(algBitNumber);
0584     }
0585 
0586     if (m_verbosity && m_isDebugEnabled) {
0587       std::ostringstream myCout;
0588       (itAlgo->second).print(myCout);
0589       gtAlg.print(myCout);
0590 
0591       LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
0592     }
0593 
0594     // object maps only for BxInEvent = 0
0595     if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
0596       // set object map
0597       L1GlobalTriggerObjectMap objMap;
0598 
0599       objMap.setAlgoName(itAlgo->first);
0600       objMap.setAlgoBitNumber(algBitNumber);
0601       objMap.setAlgoGtlResult(algResult);
0602       objMap.swapOperandTokenVector(gtAlg.operandTokenVector());
0603       objMap.swapCombinationVector(gtAlg.gtAlgoCombinationVector());
0604       // gtAlg is empty now...
0605 
0606       if (m_verbosity && m_isDebugEnabled) {
0607         std::ostringstream myCout1;
0608         objMap.print(myCout1);
0609 
0610         LogTrace("L1GlobalTrigger") << myCout1.str() << std::endl;
0611       }
0612 
0613       objMapVec.push_back(objMap);
0614     }
0615   }
0616 
0617   // object maps only for BxInEvent = 0
0618   if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
0619     gtObjectMapRecord->swapGtObjectMap(objMapVec);
0620   }
0621 
0622   // loop over condition maps (one map per condition chip)
0623   // then loop over conditions in the map
0624   // delete the conditions created with new, zero pointer, do not clear map,
0625   // keep the vector as is...
0626   for (std::vector<L1GtAlgorithmEvaluation::ConditionEvaluationMap>::iterator itCondOnChip =
0627            m_conditionResultMaps.begin();
0628        itCondOnChip != m_conditionResultMaps.end();
0629        itCondOnChip++) {
0630     for (L1GtAlgorithmEvaluation::ItEvalMap itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
0631       delete itCond->second;
0632       itCond->second = nullptr;
0633     }
0634   }
0635 }
0636 
0637 // clear GTL
0638 void L1GlobalTriggerGTL::reset() {
0639   m_candL1Mu->clear();
0640 
0641   m_gtlDecisionWord.reset();
0642   m_gtlAlgorithmOR.reset();
0643 }
0644 
0645 // print Global Muon Trigger data received by GTL
0646 void L1GlobalTriggerGTL::printGmtData(const int iBxInEvent) const {
0647   LogTrace("L1GlobalTrigger") << "\nL1GlobalTrigger: GMT data received for BxInEvent = " << iBxInEvent << std::endl;
0648 
0649   int nrL1Mu = m_candL1Mu->size();
0650   LogTrace("L1GlobalTrigger") << "Number of GMT muons = " << nrL1Mu << "\n" << std::endl;
0651 
0652   for (std::vector<const L1MuGMTCand *>::const_iterator iter = m_candL1Mu->begin(); iter != m_candL1Mu->end(); iter++) {
0653     LogTrace("L1GlobalTrigger") << *(*iter) << std::endl;
0654   }
0655 
0656   LogTrace("L1GlobalTrigger") << std::endl;
0657 }