Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-09 02:06:40

0001 #include <string>
0002 #include <list>
0003 #include <vector>
0004 #include <algorithm>
0005 #include <iostream>
0006 #include <sstream>
0007 #include <cassert>
0008 
0009 #include "DataFormats/Common/interface/Handle.h"
0010 #include "DataFormats/Common/interface/Ref.h"
0011 #include "DataFormats/L1TGlobal/interface/GlobalObjectMapFwd.h"
0012 #include "DataFormats/L1TGlobal/interface/GlobalObjectMap.h"
0013 #include "DataFormats/L1TGlobal/interface/GlobalObjectMapRecord.h"
0014 #include "DataFormats/L1TGlobal/interface/GlobalObject.h"
0015 #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
0016 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0018 #include "FWCore/Utilities/interface/InputTag.h"
0019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0020 #include "FWCore/MessageLogger/interface/MessageDrop.h"
0021 #include "FWCore/Utilities/interface/Exception.h"
0022 #include "FWCore/Framework/interface/EventSetup.h"
0023 #include "FWCore/Framework/interface/ESHandle.h"
0024 
0025 #include "DataFormats/L1TGlobal/interface/GlobalAlgBlk.h"
0026 
0027 #include "HLTL1TSeed.h"
0028 
0029 using namespace std;
0030 
0031 // constructors
0032 HLTL1TSeed::HLTL1TSeed(const edm::ParameterSet& parSet)
0033     : HLTStreamFilter(parSet),
0034       //useObjectMaps_(parSet.getParameter<bool>("L1UseL1TriggerObjectMaps")),
0035       m_l1SeedsLogicalExpression(parSet.getParameter<string>("L1SeedsLogicalExpression")),
0036       m_l1GtObjectMapTag(parSet.getParameter<edm::InputTag>("L1ObjectMapInputTag")),
0037       m_l1GtObjectMapToken(consumes<GlobalObjectMapRecord>(m_l1GtObjectMapTag)),
0038       m_l1GlobalTag(parSet.getParameter<edm::InputTag>("L1GlobalInputTag")),
0039       m_l1GlobalToken(consumes<GlobalAlgBlkBxCollection>(m_l1GlobalTag)),
0040       m_l1MuonCollectionsTag(parSet.getParameter<edm::InputTag>("L1MuonInputTag")),  // FIX WHEN UNPACKERS ADDED
0041       m_l1MuonTag(m_l1MuonCollectionsTag),
0042       m_l1MuonToken(consumes<l1t::MuonBxCollection>(m_l1MuonTag)),
0043       m_l1MuonShowerCollectionsTag(
0044           parSet.getParameter<edm::InputTag>("L1MuonShowerInputTag")),  // FIX WHEN UNPACKERS ADDED
0045       m_l1MuonShowerTag(m_l1MuonShowerCollectionsTag),
0046       m_l1MuonShowerToken(consumes<l1t::MuonShowerBxCollection>(m_l1MuonShowerTag)),
0047       m_l1EGammaCollectionsTag(parSet.getParameter<edm::InputTag>("L1EGammaInputTag")),  // FIX WHEN UNPACKERS ADDED
0048       m_l1EGammaTag(m_l1EGammaCollectionsTag),
0049       m_l1EGammaToken(consumes<l1t::EGammaBxCollection>(m_l1EGammaTag)),
0050       m_l1JetCollectionsTag(parSet.getParameter<edm::InputTag>("L1JetInputTag")),  // FIX WHEN UNPACKERS ADDED
0051       m_l1JetTag(m_l1JetCollectionsTag),
0052       m_l1JetToken(consumes<l1t::JetBxCollection>(m_l1JetTag)),
0053       m_l1TauCollectionsTag(parSet.getParameter<edm::InputTag>("L1TauInputTag")),  // FIX WHEN UNPACKERS ADDED
0054       m_l1TauTag(m_l1TauCollectionsTag),
0055       m_l1TauToken(consumes<l1t::TauBxCollection>(m_l1TauTag)),
0056       m_l1EtSumCollectionsTag(parSet.getParameter<edm::InputTag>("L1EtSumInputTag")),  // FIX WHEN UNPACKERS ADDED
0057       m_l1EtSumTag(m_l1EtSumCollectionsTag),
0058       m_l1EtSumToken(consumes<l1t::EtSumBxCollection>(m_l1EtSumTag)),
0059       m_l1GlobalDecision(false),
0060       m_isDebugEnabled(edm::isDebugEnabled()) {
0061   if (m_l1SeedsLogicalExpression.empty()) {
0062     throw cms::Exception("FailModule") << "\nTrying to seed with an empty L1SeedsLogicalExpression.\n" << std::endl;
0063 
0064   } else if (m_l1SeedsLogicalExpression != "L1GlobalDecision") {
0065     // check also the logical expression - add/remove spaces if needed
0066     m_l1AlgoLogicParser = GlobalLogicParser(m_l1SeedsLogicalExpression);
0067 
0068     // list of required algorithms for seeding
0069     // dummy values for tokenNumber and tokenResult
0070     m_l1AlgoSeeds.reserve((m_l1AlgoLogicParser.operandTokenVector()).size());
0071     m_l1AlgoSeeds = m_l1AlgoLogicParser.expressionSeedsOperandList();
0072     size_t l1AlgoSeedsSize = m_l1AlgoSeeds.size();
0073 
0074     m_l1AlgoSeedsRpn.reserve(l1AlgoSeedsSize);
0075     m_l1AlgoSeedsObjType.reserve(l1AlgoSeedsSize);
0076 
0077   } else {
0078     m_l1GlobalDecision = true;
0079   }
0080 }
0081 
0082 // destructor
0083 HLTL1TSeed::~HLTL1TSeed() {
0084   // empty now
0085 }
0086 
0087 // member functions
0088 
0089 void HLTL1TSeed::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0090   edm::ParameterSetDescription desc;
0091   makeHLTFilterDescription(desc);
0092 
0093   // # logical expression for the required L1 algorithms;
0094   // # the algorithms are specified by name
0095   // # allowed operators: "AND", "OR", "NOT", "(", ")"
0096   // #
0097   // # by convention, "L1GlobalDecision" logical expression means global decision
0098   desc.add<string>("L1SeedsLogicalExpression", "");
0099   desc.add<edm::InputTag>("L1ObjectMapInputTag", edm::InputTag("hltGtStage2ObjectMap"));
0100   desc.add<edm::InputTag>("L1GlobalInputTag", edm::InputTag("hltGtStage2Digis"));
0101   desc.add<edm::InputTag>("L1MuonInputTag", edm::InputTag("hltGtStage2Digis:Muon"));
0102   desc.add<edm::InputTag>("L1MuonShowerInputTag", edm::InputTag("hltGtStage2Digis:MuonShower"));
0103   desc.add<edm::InputTag>("L1EGammaInputTag", edm::InputTag("hltGtStage2Digis:EGamma"));
0104   desc.add<edm::InputTag>("L1JetInputTag", edm::InputTag("hltGtStage2Digis:Jet"));
0105   desc.add<edm::InputTag>("L1TauInputTag", edm::InputTag("hltGtStage2Digis:Tau"));
0106   desc.add<edm::InputTag>("L1EtSumInputTag", edm::InputTag("hltGtStage2Digis:EtSum"));
0107   descriptions.add("hltL1TSeed", desc);
0108 }
0109 
0110 bool HLTL1TSeed::hltFilter(edm::Event& iEvent,
0111                            const edm::EventSetup& evSetup,
0112                            trigger::TriggerFilterObjectWithRefs& filterproduct) {
0113   bool rc = false;
0114 
0115   // the filter object
0116   if (saveTags()) {
0117     // muons
0118     filterproduct.addCollectionTag(m_l1MuonTag);
0119 
0120     // muon showers
0121     filterproduct.addCollectionTag(m_l1MuonShowerTag);
0122 
0123     // egamma
0124     filterproduct.addCollectionTag(m_l1EGammaTag);
0125 
0126     // jet
0127     filterproduct.addCollectionTag(m_l1JetTag);
0128 
0129     // tau
0130     filterproduct.addCollectionTag(m_l1TauTag);
0131 
0132     // etsum
0133     filterproduct.addCollectionTag(m_l1EtSumTag);
0134   }
0135 
0136   // Get all the seeding from iEvent (i.e. L1TriggerObjectMapRecord)
0137   //
0138   rc = seedsL1TriggerObjectMaps(iEvent, filterproduct);
0139 
0140   if (m_isDebugEnabled) {
0141     dumpTriggerFilterObjectWithRefs(filterproduct);
0142   }
0143 
0144   return rc;
0145 }
0146 
0147 // detailed print of filter content
0148 void HLTL1TSeed::dumpTriggerFilterObjectWithRefs(trigger::TriggerFilterObjectWithRefs& filterproduct) const {
0149   LogTrace("HLTL1TSeed") << "\nHLTL1TSeed::hltFilter "
0150                          << "\n  Dump TriggerFilterObjectWithRefs\n"
0151                          << endl;
0152 
0153   vector<l1t::MuonRef> seedsL1Mu;
0154   filterproduct.getObjects(trigger::TriggerL1Mu, seedsL1Mu);
0155   const size_t sizeSeedsL1Mu = seedsL1Mu.size();
0156 
0157   LogTrace("HLTL1TSeed") << "\n  HLTL1TSeed: seed logical expression = " << m_l1SeedsLogicalExpression << endl;
0158 
0159   LogTrace("HLTL1TSeed") << "\n  L1Mu seeds:      " << sizeSeedsL1Mu << endl << endl;
0160 
0161   for (size_t i = 0; i != sizeSeedsL1Mu; i++) {
0162     l1t::MuonRef obj = l1t::MuonRef(seedsL1Mu[i]);
0163 
0164     LogTrace("HLTL1TSeed") << "\tL1Mu     "
0165                            << "\t"
0166                            << "q = "
0167                            << obj->hwCharge()  // TEMP get hwCharge insead of charge which is not yet set NEED FIX.
0168                            << "\t"
0169                            << "pt = " << obj->pt() << "\t"
0170                            << "eta =  " << obj->eta() << "\t"
0171                            << "phi =  " << obj->phi();  //<< "\t" << "BX = " << obj->bx();
0172   }
0173 
0174   vector<l1t::MuonShowerRef> seedsL1MuShower;
0175   filterproduct.getObjects(trigger::TriggerL1MuShower, seedsL1MuShower);
0176   const size_t sizeSeedsL1MuShower = seedsL1MuShower.size();
0177 
0178   LogTrace("HLTL1TSeed") << "\n  HLTL1TSeed: seed logical expression = " << m_l1SeedsLogicalExpression << endl;
0179 
0180   LogTrace("HLTL1TSeed") << "\n  L1MuShower seeds:      " << sizeSeedsL1MuShower << endl << endl;
0181 
0182   for (size_t i = 0; i != sizeSeedsL1MuShower; i++) {
0183     l1t::MuonShowerRef obj = l1t::MuonShowerRef(seedsL1MuShower[i]);
0184 
0185     LogTrace("HLTL1TSeed") << "\tL1MuShower     "
0186                            << "\t"
0187                            << "pt = " << obj->pt() << "\t"
0188                            << "eta =  " << obj->eta() << "\t"
0189                            << "phi =  " << obj->phi();  //<< "\t" << "BX = " << obj->bx();
0190   }
0191 
0192   vector<l1t::EGammaRef> seedsL1EG;
0193   filterproduct.getObjects(trigger::TriggerL1EG, seedsL1EG);
0194   const size_t sizeSeedsL1EG = seedsL1EG.size();
0195 
0196   LogTrace("HLTL1TSeed") << "\n  L1EG seeds:      " << sizeSeedsL1EG << endl << endl;
0197 
0198   for (size_t i = 0; i != sizeSeedsL1EG; i++) {
0199     l1t::EGammaRef obj = l1t::EGammaRef(seedsL1EG[i]);
0200 
0201     LogTrace("HLTL1TSeed") << "\tL1EG     "
0202                            << "\t"
0203                            << "pt = " << obj->pt() << "\t"
0204                            << "eta =  " << obj->eta() << "\t"
0205                            << "phi =  " << obj->phi();  //<< "\t" << "BX = " << obj->bx();
0206   }
0207 
0208   vector<l1t::JetRef> seedsL1Jet;
0209   filterproduct.getObjects(trigger::TriggerL1Jet, seedsL1Jet);
0210   const size_t sizeSeedsL1Jet = seedsL1Jet.size();
0211 
0212   LogTrace("HLTL1TSeed") << "\n  L1Jet seeds:      " << sizeSeedsL1Jet << endl << endl;
0213 
0214   for (size_t i = 0; i != sizeSeedsL1Jet; i++) {
0215     l1t::JetRef obj = l1t::JetRef(seedsL1Jet[i]);
0216 
0217     LogTrace("HLTL1TSeed") << "\tL1Jet     "
0218                            << "\t"
0219                            << "pt = " << obj->pt() << "\t"
0220                            << "eta =  " << obj->eta() << "\t"
0221                            << "phi =  " << obj->phi();  //<< "\t" << "BX = " << obj->bx();
0222   }
0223 
0224   vector<l1t::TauRef> seedsL1Tau;
0225   filterproduct.getObjects(trigger::TriggerL1Tau, seedsL1Tau);
0226   const size_t sizeSeedsL1Tau = seedsL1Tau.size();
0227 
0228   LogTrace("HLTL1TSeed") << "\n  L1Tau seeds:      " << sizeSeedsL1Tau << endl << endl;
0229 
0230   for (size_t i = 0; i != sizeSeedsL1Tau; i++) {
0231     l1t::TauRef obj = l1t::TauRef(seedsL1Tau[i]);
0232 
0233     LogTrace("HLTL1TSeed") << "\tL1Tau     "
0234                            << "\t"
0235                            << "pt = " << obj->pt() << "\t"
0236                            << "eta =  " << obj->eta() << "\t"
0237                            << "phi =  " << obj->phi();  //<< "\t" << "BX = " << obj->bx();
0238   }
0239 
0240   vector<l1t::EtSumRef> seedsL1EtSumETT;
0241   filterproduct.getObjects(trigger::TriggerL1ETT, seedsL1EtSumETT);
0242   const size_t sizeSeedsL1EtSumETT = seedsL1EtSumETT.size();
0243   LogTrace("HLTL1TSeed") << "\n  L1EtSum ETT seeds:      " << sizeSeedsL1EtSumETT << endl << endl;
0244 
0245   for (size_t i = 0; i != sizeSeedsL1EtSumETT; i++) {
0246     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumETT[i]);
0247 
0248     LogTrace("HLTL1TSeed") << "\tL1EtSum  ETT"
0249                            << "\t"
0250                            << "pt = " << obj->pt() << "\t"
0251                            << "eta =  " << obj->eta() << "\t"
0252                            << "phi =  " << obj->phi();  //<< "\t" << "BX = " << obj->bx();
0253   }
0254 
0255   vector<l1t::EtSumRef> seedsL1EtSumHTT;
0256   filterproduct.getObjects(trigger::TriggerL1HTT, seedsL1EtSumHTT);
0257   const size_t sizeSeedsL1EtSumHTT = seedsL1EtSumHTT.size();
0258   LogTrace("HLTL1TSeed") << "\n  L1EtSum HTT seeds:      " << sizeSeedsL1EtSumHTT << endl << endl;
0259 
0260   for (size_t i = 0; i != sizeSeedsL1EtSumHTT; i++) {
0261     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumHTT[i]);
0262 
0263     LogTrace("HLTL1TSeed") << "\tL1EtSum  HTT"
0264                            << "\t"
0265                            << "pt = " << obj->pt() << "\t"
0266                            << "eta =  " << obj->eta() << "\t"
0267                            << "phi =  " << obj->phi();  //<< "\t" << "BX = " << obj->bx();
0268   }
0269 
0270   vector<l1t::EtSumRef> seedsL1EtSumETM;
0271   filterproduct.getObjects(trigger::TriggerL1ETM, seedsL1EtSumETM);
0272   const size_t sizeSeedsL1EtSumETM = seedsL1EtSumETM.size();
0273   LogTrace("HLTL1TSeed") << "\n  L1EtSum ETM seeds:      " << sizeSeedsL1EtSumETM << endl << endl;
0274 
0275   for (size_t i = 0; i != sizeSeedsL1EtSumETM; i++) {
0276     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumETM[i]);
0277 
0278     LogTrace("HLTL1TSeed") << "\tL1EtSum  ETM"
0279                            << "\t"
0280                            << "pt = " << obj->pt() << "\t"
0281                            << "eta =  " << obj->eta() << "\t"
0282                            << "phi =  " << obj->phi();  //<< "\t" << "BX = " << obj->bx();
0283   }
0284 
0285   vector<l1t::EtSumRef> seedsL1EtSumETMHF;
0286   filterproduct.getObjects(trigger::TriggerL1ETMHF, seedsL1EtSumETMHF);
0287   const size_t sizeSeedsL1EtSumETMHF = seedsL1EtSumETMHF.size();
0288   LogTrace("HLTL1TSeed") << "\n  L1EtSum ETMHF seeds:      " << sizeSeedsL1EtSumETMHF << endl << endl;
0289 
0290   for (size_t i = 0; i != sizeSeedsL1EtSumETMHF; i++) {
0291     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumETMHF[i]);
0292 
0293     LogTrace("HLTL1TSeed") << "\tL1EtSum  ETMHF"
0294                            << "\t"
0295                            << "pt = " << obj->pt() << "\t"
0296                            << "eta =  " << obj->eta() << "\t"
0297                            << "phi =  " << obj->phi();  //<< "\t" << "BX = " << obj->bx();
0298   }
0299 
0300   vector<l1t::EtSumRef> seedsL1EtSumHTM;
0301   filterproduct.getObjects(trigger::TriggerL1HTM, seedsL1EtSumHTM);
0302   const size_t sizeSeedsL1EtSumHTM = seedsL1EtSumHTM.size();
0303   LogTrace("HLTL1TSeed") << "\n  L1EtSum HTM seeds:      " << sizeSeedsL1EtSumHTM << endl << endl;
0304 
0305   for (size_t i = 0; i != sizeSeedsL1EtSumHTM; i++) {
0306     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumHTM[i]);
0307 
0308     LogTrace("HLTL1TSeed") << "\tL1EtSum  HTM"
0309                            << "\t"
0310                            << "pt = " << obj->pt() << "\t"
0311                            << "eta =  " << obj->eta() << "\t"
0312                            << "phi =  " << obj->phi();  //<< "\t" << "BX = " << obj->bx();
0313   }
0314 
0315   vector<l1t::EtSumRef> seedsL1EtSumCentrality;
0316   filterproduct.getObjects(trigger::TriggerL1Centrality, seedsL1EtSumCentrality);
0317   const size_t sizeSeedsL1EtSumCentrality = seedsL1EtSumCentrality.size();
0318   LogTrace("HLTL1TSeed") << "\n  L1EtSum Centrality seeds:      " << sizeSeedsL1EtSumCentrality << endl << endl;
0319 
0320   for (size_t i = 0; i != sizeSeedsL1EtSumCentrality; i++) {
0321     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumCentrality[i]);
0322 
0323     LogTrace("HLTL1TSeed") << "\tL1EtSum  Centrality Bits: " << std::bitset<8>(obj->hwPt())
0324                            << " (hwPt = " << obj->hwPt() << ")";
0325   }
0326 
0327   vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFP0;
0328   filterproduct.getObjects(trigger::TriggerL1MinBiasHFP0, seedsL1EtSumMinBiasHFP0);
0329   const size_t sizeSeedsL1EtSumMinBiasHFP0 = seedsL1EtSumMinBiasHFP0.size();
0330   LogTrace("HLTL1TSeed") << "\n  L1EtSum MinBiasHFP0 seeds:      " << sizeSeedsL1EtSumMinBiasHFP0 << endl << endl;
0331 
0332   for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFP0; i++) {
0333     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFP0[i]);
0334 
0335     LogTrace("HLTL1TSeed") << "\tL1EtSum  MinBiasHFP0: hwPt = " << obj->hwPt();
0336   }
0337 
0338   vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFM0;
0339   filterproduct.getObjects(trigger::TriggerL1MinBiasHFM0, seedsL1EtSumMinBiasHFM0);
0340   const size_t sizeSeedsL1EtSumMinBiasHFM0 = seedsL1EtSumMinBiasHFM0.size();
0341   LogTrace("HLTL1TSeed") << "\n  L1EtSum MinBiasHFM0 seeds:      " << sizeSeedsL1EtSumMinBiasHFM0 << endl << endl;
0342 
0343   for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFM0; i++) {
0344     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFM0[i]);
0345 
0346     LogTrace("HLTL1TSeed") << "\tL1EtSum  MinBiasHFM0: hwPt = " << obj->hwPt();
0347   }
0348 
0349   vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFP1;
0350   filterproduct.getObjects(trigger::TriggerL1MinBiasHFP1, seedsL1EtSumMinBiasHFP1);
0351   const size_t sizeSeedsL1EtSumMinBiasHFP1 = seedsL1EtSumMinBiasHFP1.size();
0352   LogTrace("HLTL1TSeed") << "\n  L1EtSum MinBiasHFP1 seeds:      " << sizeSeedsL1EtSumMinBiasHFP1 << endl << endl;
0353 
0354   for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFP1; i++) {
0355     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFP1[i]);
0356 
0357     LogTrace("HLTL1TSeed") << "\tL1EtSum  MinBiasHFP1: hwPt = " << obj->hwPt();
0358   }
0359 
0360   vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFM1;
0361   filterproduct.getObjects(trigger::TriggerL1MinBiasHFM1, seedsL1EtSumMinBiasHFM1);
0362   const size_t sizeSeedsL1EtSumMinBiasHFM1 = seedsL1EtSumMinBiasHFM1.size();
0363   LogTrace("HLTL1TSeed") << "\n  L1EtSum MinBiasHFM1 seeds:      " << sizeSeedsL1EtSumMinBiasHFM1 << endl << endl;
0364 
0365   for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFM1; i++) {
0366     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFM1[i]);
0367 
0368     LogTrace("HLTL1TSeed") << "\tL1EtSum  MinBiasHFM1: hwPt = " << obj->hwPt();
0369   }
0370 
0371   vector<l1t::EtSumRef> seedsL1EtSumTowerCount;
0372   filterproduct.getObjects(trigger::TriggerL1TowerCount, seedsL1EtSumTowerCount);
0373   const size_t sizeSeedsL1EtSumTowerCount = seedsL1EtSumTowerCount.size();
0374   LogTrace("HLTL1TSeed") << "\n  L1EtSum TowerCount seeds:      " << sizeSeedsL1EtSumTowerCount << endl << endl;
0375 
0376   for (size_t i = 0; i != sizeSeedsL1EtSumTowerCount; i++) {
0377     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumTowerCount[i]);
0378 
0379     LogTrace("HLTL1TSeed") << "\tL1EtSum  TowerCount: hwPt = " << obj->hwPt();
0380   }
0381 
0382   vector<l1t::EtSumRef> seedsL1EtSumAsymEt;
0383   filterproduct.getObjects(trigger::TriggerL1AsymEt, seedsL1EtSumAsymEt);
0384   const size_t sizeSeedsL1EtSumAsymEt = seedsL1EtSumAsymEt.size();
0385   LogTrace("HLTL1TSeed") << "\n  L1EtSum AsymEt seeds:      " << sizeSeedsL1EtSumAsymEt << endl << endl;
0386 
0387   for (size_t i = 0; i != sizeSeedsL1EtSumAsymEt; i++) {
0388     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymEt[i]);
0389 
0390     LogTrace("HLTL1TSeed") << "\tL1EtSum  AsymEt: hwPt = " << obj->hwPt();
0391   }
0392 
0393   vector<l1t::EtSumRef> seedsL1EtSumAsymHt;
0394   filterproduct.getObjects(trigger::TriggerL1AsymHt, seedsL1EtSumAsymHt);
0395   const size_t sizeSeedsL1EtSumAsymHt = seedsL1EtSumAsymHt.size();
0396   LogTrace("HLTL1TSeed") << "\n  L1EtSum AsymHt seeds:      " << sizeSeedsL1EtSumAsymHt << endl << endl;
0397 
0398   for (size_t i = 0; i != sizeSeedsL1EtSumAsymHt; i++) {
0399     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymHt[i]);
0400 
0401     LogTrace("HLTL1TSeed") << "\tL1EtSum  AsymHt: hwPt = " << obj->hwPt();
0402   }
0403 
0404   vector<l1t::EtSumRef> seedsL1EtSumAsymEtHF;
0405   filterproduct.getObjects(trigger::TriggerL1AsymEtHF, seedsL1EtSumAsymEtHF);
0406   const size_t sizeSeedsL1EtSumAsymEtHF = seedsL1EtSumAsymEtHF.size();
0407   LogTrace("HLTL1TSeed") << "\n  L1EtSum AsymEtHF seeds:      " << sizeSeedsL1EtSumAsymEtHF << endl << endl;
0408 
0409   for (size_t i = 0; i != sizeSeedsL1EtSumAsymEtHF; i++) {
0410     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymEtHF[i]);
0411 
0412     LogTrace("HLTL1TSeed") << "\tL1EtSum  AsymEtHF: hwPt = " << obj->hwPt();
0413   }
0414 
0415   vector<l1t::EtSumRef> seedsL1EtSumAsymHtHF;
0416   filterproduct.getObjects(trigger::TriggerL1AsymHtHF, seedsL1EtSumAsymHtHF);
0417   const size_t sizeSeedsL1EtSumAsymHtHF = seedsL1EtSumAsymHtHF.size();
0418   LogTrace("HLTL1TSeed") << "\n  L1EtSum AsymHtHF seeds:      " << sizeSeedsL1EtSumAsymHtHF << endl << endl;
0419 
0420   for (size_t i = 0; i != sizeSeedsL1EtSumAsymHtHF; i++) {
0421     l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymHtHF[i]);
0422 
0423     LogTrace("HLTL1TSeed") << "\tL1EtSum  AsymHtHF: hwPt = " << obj->hwPt();
0424   }
0425 
0426   LogTrace("HLTL1TSeed") << " \n\n" << endl;
0427 }
0428 
0429 // seeding is done via L1 trigger object maps, considering the objects which fired in L1
0430 bool HLTL1TSeed::seedsL1TriggerObjectMaps(edm::Event& iEvent, trigger::TriggerFilterObjectWithRefs& filterproduct) {
0431   // Two GT objects are obtained from the Event: (1) the unpacked GT and (2) the emulated GT.
0432   // Return value of the function is the score of seeding logical expression, evaluated using (1).
0433   // Seeding is performed (per l1_algo) if ACCEPT both in (1) and (2). Seed objects are identified
0434   // and only available from ObjectMaps created in (2).
0435 
0436   // define index lists for all particle types
0437 
0438   std::list<int> listMuon;
0439   std::list<int> listMuonShower;
0440 
0441   std::list<int> listEG;
0442 
0443   std::list<int> listJet;
0444   std::list<int> listTau;
0445 
0446   std::list<int> listETM;
0447   std::list<int> listETT;
0448   std::list<int> listHTT;
0449   std::list<int> listHTM;
0450   std::list<int> listETMHF;
0451 
0452   std::list<int> listJetCounts;
0453 
0454   std::list<int> listCentrality;
0455   std::list<int> listMinBiasHFP0;
0456   std::list<int> listMinBiasHFM0;
0457   std::list<int> listMinBiasHFP1;
0458   std::list<int> listMinBiasHFM1;
0459   std::list<int> listTotalEtEm;
0460   std::list<int> listMissingEtHF;
0461   std::list<int> listTowerCount;
0462   std::list<int> listAsymEt;
0463   std::list<int> listAsymHt;
0464   std::list<int> listAsymEtHF;
0465   std::list<int> listAsymHtHF;
0466 
0467   // get handle to unpacked GT
0468   edm::Handle<GlobalAlgBlkBxCollection> uGtAlgoBlocks;
0469   iEvent.getByToken(m_l1GlobalToken, uGtAlgoBlocks);
0470 
0471   if (!uGtAlgoBlocks.isValid()) {
0472     edm::LogWarning("HLTL1TSeed") << " Warning: GlobalAlgBlkBxCollection with input tag " << m_l1GlobalTag
0473                                   << " requested in configuration, but not found in the event." << std::endl;
0474 
0475     return false;
0476   }
0477 
0478   // check size
0479   if (uGtAlgoBlocks->size() == 0) {
0480     edm::LogWarning("HLTL1TSeed") << " Warning: GlobalAlgBlkBxCollection with input tag " << m_l1GlobalTag
0481                                   << " is empty." << std::endl;
0482 
0483     return false;
0484   }
0485 
0486   // get handle to object maps from emulator (one object map per algorithm)
0487   edm::Handle<GlobalObjectMapRecord> gtObjectMapRecord;
0488   iEvent.getByToken(m_l1GtObjectMapToken, gtObjectMapRecord);
0489 
0490   if (!gtObjectMapRecord.isValid()) {
0491     edm::LogWarning("HLTL1TSeed") << " Warning: GlobalObjectMapRecord with input tag " << m_l1GtObjectMapTag
0492                                   << " requested in configuration, but not found in the event." << std::endl;
0493 
0494     return false;
0495   }
0496 
0497   if (m_isDebugEnabled) {
0498     const std::vector<GlobalObjectMap>& objMaps = gtObjectMapRecord->gtObjectMap();
0499 
0500     LogTrace("HLTL1TSeed") << "\nHLTL1Seed"
0501                            << "\n--------------------------------------------------------------------------------------"
0502                               "-------------------------------";
0503 
0504     LogTrace("HLTL1TSeed")
0505         << "\n\tAlgorithms in L1TriggerObjectMapRecord and GT results ( emulated | initial | prescaled | final ) "
0506         << endl;
0507 
0508     LogTrace("HLTL1TSeed") << "\n\tmap"
0509                            << "\tAlgoBit" << std::setw(40) << "algoName"
0510                            << "\t (emul|ini|pre|fin)" << endl;
0511 
0512     LogTrace("HLTL1TSeed") << "----------------------------------------------------------------------------------------"
0513                               "-----------------------------";
0514 
0515     for (size_t imap = 0; imap < objMaps.size(); imap++) {
0516       int bit = objMaps[imap].algoBitNumber();  //  same as bit from L1T Menu
0517 
0518       int emulDecision = objMaps[imap].algoGtlResult();
0519 
0520       // For bx=0 , get 0th AlgoBlock, so in BXvector at(bx=0,i=0)
0521       int initDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionInitial(bit);
0522       int presDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionInterm(bit);
0523       int finlDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionFinal(bit);
0524 
0525       if (emulDecision != initDecision) {
0526         LogTrace("HLTL1TSeed") << "L1T decision (emulated vs. unpacked initial) is not the same:"
0527                                << "\n\tbit = " << std::setw(3) << bit << std::setw(40) << objMaps[imap].algoName()
0528                                << "\t emulated decision = " << emulDecision
0529                                << "\t unpacked initial decision = " << initDecision
0530                                << "\nThis should not happen. Include the L1TGtEmulCompare module in the sequence."
0531                                << endl;
0532       }
0533 
0534       LogTrace("HLTL1TSeed") << "\t" << std::setw(3) << imap << "\tbit = " << std::setw(3) << bit << std::setw(40)
0535                              << objMaps[imap].algoName() << "\t (  " << emulDecision << " | " << initDecision << " | "
0536                              << presDecision << " | " << finlDecision << " ) ";
0537     }
0538     LogTrace("HLTL1TSeed") << endl;
0539   }
0540 
0541   // Filter decision in case of "L1GlobalDecision" logical expression.
0542   // By convention, it means global decision.
0543   // /////////////////////////////////////////////////////////////////
0544   if (m_l1GlobalDecision) {
0545     // For bx=0 , get 0th AlgoBlock, so in BXvector at(bx=0,i=0)
0546     return (uGtAlgoBlocks->at(0, 0)).getFinalOR();
0547   }
0548 
0549   // Update/Reset m_l1AlgoLogicParser by reseting token result
0550   // /////////////////////////////////////////////////////////
0551   std::vector<GlobalLogicParser::OperandToken>& algOpTokenVector = m_l1AlgoLogicParser.operandTokenVector();
0552 
0553   for (auto& i : algOpTokenVector) {
0554     // rest token result
0555     //
0556     i.tokenResult = false;
0557   }
0558 
0559   // Update m_l1AlgoLogicParser and store emulator results for algOpTokens
0560   // /////////////////////////////////////////////////////////////////////
0561   for (auto& i : algOpTokenVector) {
0562     std::string algoName = i.tokenName;
0563 
0564     const GlobalObjectMap* objMap = gtObjectMapRecord->getObjectMap(algoName);
0565 
0566     if (objMap == nullptr) {
0567       throw cms::Exception("FailModule")
0568           << "\nAlgorithm " << algoName
0569           << ", requested as seed by a HLT path, cannot be matched to a L1 algo name in any GlobalObjectMap\n"
0570           << "Please check if algorithm " << algoName << " is present in the L1 menu\n"
0571           << std::endl;
0572 
0573     } else {
0574       //(algOpTokenVector[i]).tokenResult = objMap->algoGtlResult();
0575 
0576       int bit = objMap->algoBitNumber();
0577       bool finalAlgoDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionFinal(bit);
0578       i.tokenResult = finalAlgoDecision;
0579     }
0580   }
0581 
0582   // Filter decision
0583   // ///////////////
0584   bool seedsResult = m_l1AlgoLogicParser.expressionResult();
0585 
0586   if (m_isDebugEnabled) {
0587     LogTrace("HLTL1TSeed") << "\nHLTL1TSeed: l1SeedsLogicalExpression (names) = '" << m_l1SeedsLogicalExpression << "'"
0588                            << "\n  Result for logical expression after update of algOpTokens: " << seedsResult << "\n"
0589                            << std::endl;
0590   }
0591 
0592   /// Loop over the list of required algorithms for seeding
0593   /// /////////////////////////////////////////////////////
0594 
0595   for (std::vector<GlobalLogicParser::OperandToken>::const_iterator itSeed = m_l1AlgoSeeds.begin();
0596        itSeed != m_l1AlgoSeeds.end();
0597        ++itSeed) {
0598     std::string algoSeedName = (*itSeed).tokenName;
0599 
0600     LogTrace("HLTL1TSeed") << "\n ----------------  algo seed name = " << algoSeedName << endl;
0601 
0602     const GlobalObjectMap* objMap = gtObjectMapRecord->getObjectMap(algoSeedName);
0603 
0604     if (objMap == nullptr) {
0605       // Should not get here
0606       //
0607       throw cms::Exception("FailModule")
0608           << "\nAlgorithm " << algoSeedName
0609           << ", requested as seed by a HLT path, cannot be matched to a L1 algo name in any GlobalObjectMap\n"
0610           << "Please check if algorithm " << algoSeedName << " is present in the L1 menu\n"
0611           << std::endl;
0612     }
0613 
0614     int algoSeedBitNumber = objMap->algoBitNumber();
0615     bool algoSeedResult = objMap->algoGtlResult();
0616 
0617     // unpacked GT results: uGtAlgoBlock has decisions initial, prescaled, and final after masks
0618     bool algoSeedResultMaskAndPresc = uGtAlgoBlocks->at(0, 0).getAlgoDecisionFinal(algoSeedBitNumber);
0619 
0620     LogTrace("HLTL1TSeed") << "\n\tAlgo seed " << algoSeedName << " result emulated | final = " << algoSeedResult
0621                            << " | " << algoSeedResultMaskAndPresc << endl;
0622 
0623     /// Unpacked GT result of algorithm is false after masks and prescales  - no seeds
0624     /// ////////////////////////////////////////////////////////////////////////////////
0625     if (!algoSeedResultMaskAndPresc)
0626       continue;
0627 
0628     /// Emulated GT result of algorithm is false - no seeds - but still save the event
0629     //  This should not happen if the emulated and unpacked GT are consistent
0630     /// ////////////////////////////////////////////////////////////////////////////////
0631     if (!algoSeedResult)
0632       continue;
0633 
0634     const std::vector<GlobalLogicParser::OperandToken>& opTokenVecObjMap = objMap->operandTokenVector();
0635     const std::vector<L1TObjectTypeInCond>& condObjTypeVec = objMap->objectTypeVector();
0636     const std::vector<CombinationsInCond>& condCombinations = objMap->combinationVector();
0637 
0638     LogTrace("HLTL1TSeed") << "\n\talgoName =" << objMap->algoName() << "\talgoBitNumber = " << algoSeedBitNumber
0639                            << "\talgoGtlResult = " << algoSeedResult << endl
0640                            << endl;
0641 
0642     if (opTokenVecObjMap.size() != condObjTypeVec.size()) {
0643       edm::LogWarning("HLTL1TSeed")
0644           << "\nWarning: GlobalObjectMapRecord with input tag " << m_l1GtObjectMapTag
0645           << "\nhas object map for bit number " << algoSeedBitNumber
0646           << " which contains different size vectors of operand tokens and of condition object types!" << std::endl;
0647 
0648       assert(opTokenVecObjMap.size() == condObjTypeVec.size());
0649     }
0650 
0651     if (opTokenVecObjMap.size() != condCombinations.size()) {
0652       edm::LogWarning("HLTL1TSeed")
0653           << "\nWarning: GlobalObjectMapRecord with input tag " << m_l1GtObjectMapTag
0654           << "\nhas object map for bit number " << algoSeedBitNumber
0655           << " which contains different size vectors of operand tokens and of condition object combinations!"
0656           << std::endl;
0657 
0658       assert(opTokenVecObjMap.size() == condCombinations.size());
0659     }
0660 
0661     // operands are conditions of L1 algo
0662     //
0663     for (size_t condNumber = 0; condNumber < opTokenVecObjMap.size(); condNumber++) {
0664       std::vector<l1t::GlobalObject> condObjType = condObjTypeVec[condNumber];
0665 
0666       for (auto& jOb : condObjType) {
0667         LogTrace("HLTL1TSeed") << setw(15) << "\tcondObjType = " << jOb << endl;
0668       }
0669 
0670       const std::string condName = opTokenVecObjMap[condNumber].tokenName;
0671       bool condResult = opTokenVecObjMap[condNumber].tokenResult;
0672 
0673       // only procede for conditions that passed
0674       //
0675       if (!condResult) {
0676         continue;
0677       }
0678 
0679       // loop over combinations for a given condition
0680       //
0681       const CombinationsInCond* condComb = objMap->getCombinationsInCond(condNumber);
0682 
0683       LogTrace("HLTL1TSeed") << setw(15) << "\tcondCombinations = " << condComb->size() << endl;
0684 
0685       for (auto const& itComb : (*condComb)) {
0686         LogTrace("HLTL1TSeed") << setw(15) << "\tnew combination" << endl;
0687 
0688         // loop over objects in a combination for a given condition
0689         //
0690         for (auto itObject = itComb.begin(); itObject != itComb.end(); itObject++) {
0691           // in case of object-less triggers (e.g. L1_ZeroBias) condObjType vector is empty, so don't seed!
0692           //
0693           if (condObjType.empty()) {
0694             LogTrace("HLTL1TSeed")
0695                 << "\talgoName = " << objMap->algoName()
0696                 << " is object-less L1 algorithm, so do not attempt to store any objects to the list of seeds.\n"
0697                 << std::endl;
0698             continue;
0699           }
0700 
0701           // the index of the object type is the same as the index of the object
0702           size_t iType = std::distance(itComb.begin(), itObject);
0703 
0704           // get object type and push indices on the list
0705           //
0706           const l1t::GlobalObject objTypeVal = condObjType.at(iType);
0707 
0708           LogTrace("HLTL1TSeed") << "\tAdd object of type " << objTypeVal << " and index " << (*itObject)
0709                                  << " to the seed list." << std::endl;
0710 
0711           // THESE OBJECT CASES ARE CURRENTLY MISSING:
0712           //gtMinBias,
0713           //gtExternal,
0714           //ObjNull
0715 
0716           switch (objTypeVal) {
0717             case l1t::gtMu: {
0718               listMuon.push_back(*itObject);
0719             } break;
0720             case l1t::gtMuShower: {
0721               listMuonShower.push_back(*itObject);
0722             } break;
0723             case l1t::gtEG: {
0724               listEG.push_back(*itObject);
0725             } break;
0726             case l1t::gtJet: {
0727               listJet.push_back(*itObject);
0728             } break;
0729             case l1t::gtTau: {
0730               listTau.push_back(*itObject);
0731             } break;
0732             case l1t::gtETM: {
0733               listETM.push_back(*itObject);
0734             } break;
0735             case l1t::gtETT: {
0736               listETT.push_back(*itObject);
0737             } break;
0738             case l1t::gtHTT: {
0739               listHTT.push_back(*itObject);
0740             } break;
0741             case l1t::gtHTM: {
0742               listHTM.push_back(*itObject);
0743             } break;
0744             case l1t::gtETMHF: {
0745               listETMHF.push_back(*itObject);
0746             } break;
0747             case l1t::gtTowerCount: {
0748               listTowerCount.push_back(*itObject);
0749             } break;
0750             case l1t::gtMinBiasHFP0: {
0751               listMinBiasHFP0.push_back(*itObject);
0752             } break;
0753             case l1t::gtMinBiasHFM0: {
0754               listMinBiasHFM0.push_back(*itObject);
0755             } break;
0756             case l1t::gtMinBiasHFP1: {
0757               listMinBiasHFP1.push_back(*itObject);
0758             } break;
0759             case l1t::gtMinBiasHFM1: {
0760               listMinBiasHFM1.push_back(*itObject);
0761             } break;
0762             case l1t::gtETTem: {
0763               listTotalEtEm.push_back(*itObject);
0764             } break;
0765             case l1t::gtAsymmetryEt: {
0766               listAsymEt.push_back(*itObject);
0767             } break;
0768             case l1t::gtAsymmetryHt: {
0769               listAsymHt.push_back(*itObject);
0770             } break;
0771             case l1t::gtAsymmetryEtHF: {
0772               listAsymEtHF.push_back(*itObject);
0773             } break;
0774             case l1t::gtAsymmetryHtHF: {
0775               listAsymHtHF.push_back(*itObject);
0776             } break;
0777             case l1t::gtCentrality0:
0778             case l1t::gtCentrality1:
0779             case l1t::gtCentrality2:
0780             case l1t::gtCentrality3:
0781             case l1t::gtCentrality4:
0782             case l1t::gtCentrality5:
0783             case l1t::gtCentrality6:
0784             case l1t::gtCentrality7: {
0785               listCentrality.push_back(*itObject);
0786             } break;
0787 
0788               //case JetCounts: {
0789               //    listJetCounts.push_back(*itObject);
0790               //}
0791 
0792               break;
0793             default: {
0794               // should not arrive here
0795 
0796               LogTrace("HLTL1TSeed") << "\n    HLTL1TSeed::hltFilter "
0797                                      << "\n      Unknown object of type " << objTypeVal << " and index " << (*itObject)
0798                                      << " in the seed list." << std::endl;
0799             } break;
0800 
0801           }  // end switch objTypeVal
0802 
0803         }  // end for itObj
0804 
0805       }  // end for itComb
0806 
0807     }  // end for condition
0808 
0809   }  // end for itSeed
0810 
0811   // eliminate duplicates
0812 
0813   listMuon.sort();
0814   listMuon.unique();
0815 
0816   listMuonShower.sort();
0817   listMuonShower.unique();
0818 
0819   listEG.sort();
0820   listEG.unique();
0821 
0822   listJet.sort();
0823   listJet.unique();
0824 
0825   listTau.sort();
0826   listTau.unique();
0827 
0828   listETM.sort();
0829   listETM.unique();
0830 
0831   listETT.sort();
0832   listETT.unique();
0833 
0834   listHTT.sort();
0835   listHTT.unique();
0836 
0837   listHTM.sort();
0838   listHTM.unique();
0839 
0840   listETMHF.sort();
0841   listETMHF.unique();
0842 
0843   listJetCounts.sort();
0844   listJetCounts.unique();
0845 
0846   listCentrality.sort();
0847   listCentrality.unique();
0848 
0849   listMinBiasHFP0.sort();
0850   listMinBiasHFP0.unique();
0851 
0852   listMinBiasHFM0.sort();
0853   listMinBiasHFM0.unique();
0854 
0855   listMinBiasHFP1.sort();
0856   listMinBiasHFP1.unique();
0857 
0858   listMinBiasHFM1.sort();
0859   listMinBiasHFM1.unique();
0860 
0861   listTotalEtEm.sort();
0862   listTotalEtEm.unique();
0863 
0864   listMissingEtHF.sort();
0865   listMissingEtHF.unique();
0866 
0867   listTowerCount.sort();
0868   listTowerCount.unique();
0869 
0870   listAsymEt.sort();
0871   listAsymEt.unique();
0872 
0873   listAsymHt.sort();
0874   listAsymHt.unique();
0875 
0876   listAsymEtHF.sort();
0877   listAsymEtHF.unique();
0878 
0879   listAsymHtHF.sort();
0880   listAsymHtHF.unique();
0881 
0882   // record the L1 physics objects in the HLT filterproduct
0883   // //////////////////////////////////////////////////////
0884 
0885   // Muon
0886   if (!listMuon.empty()) {
0887     edm::Handle<l1t::MuonBxCollection> muons;
0888     iEvent.getByToken(m_l1MuonToken, muons);
0889 
0890     if (!muons.isValid()) {
0891       edm::LogWarning("HLTL1TSeed") << "\nWarning: L1MuonBxCollection with input tag " << m_l1MuonTag
0892                                     << "\nrequested in configuration, but not found in the event."
0893                                     << "\nNo muons added to filterproduct." << endl;
0894     } else {
0895       for (std::list<int>::const_iterator itObj = listMuon.begin(); itObj != listMuon.end(); ++itObj) {
0896         // Transform to index for Bx = 0 to begin of BxVector
0897         unsigned int index = muons->begin(0) - muons->begin() + *itObj;
0898 
0899         l1t::MuonRef myref(muons, index);
0900         filterproduct.addObject(trigger::TriggerL1Mu, myref);
0901       }
0902     }
0903   }
0904 
0905   // Muon Shower
0906   if (!listMuonShower.empty()) {
0907     edm::Handle<l1t::MuonShowerBxCollection> muonShowers;
0908     iEvent.getByToken(m_l1MuonShowerToken, muonShowers);
0909 
0910     if (!muonShowers.isValid()) {
0911       edm::LogWarning("HLTL1TSeed") << "\nWarning: L1MuonShowerBxCollection with input tag " << m_l1MuonShowerTag
0912                                     << "\nrequested in configuration, but not found in the event."
0913                                     << "\nNo muon showers added to filterproduct." << endl;
0914     } else {
0915       for (std::list<int>::const_iterator itObj = listMuonShower.begin(); itObj != listMuonShower.end(); ++itObj) {
0916         // Transform to index for Bx = 0 to begin of BxVector
0917         unsigned int index = muonShowers->begin(0) - muonShowers->begin() + *itObj;
0918 
0919         l1t::MuonShowerRef myref(muonShowers, index);
0920         filterproduct.addObject(trigger::TriggerL1MuShower, myref);
0921       }
0922     }
0923   }
0924 
0925   // EG (isolated)
0926   if (!listEG.empty()) {
0927     edm::Handle<l1t::EGammaBxCollection> egammas;
0928     iEvent.getByToken(m_l1EGammaToken, egammas);
0929     if (!egammas.isValid()) {
0930       edm::LogWarning("HLTL1TSeed") << "\nWarning: L1EGammaBxCollection with input tag " << m_l1EGammaTag
0931                                     << "\nrequested in configuration, but not found in the event."
0932                                     << "\nNo egammas added to filterproduct." << endl;
0933     } else {
0934       for (std::list<int>::const_iterator itObj = listEG.begin(); itObj != listEG.end(); ++itObj) {
0935         // Transform to begin of BxVector
0936         unsigned int index = egammas->begin(0) - egammas->begin() + *itObj;
0937 
0938         l1t::EGammaRef myref(egammas, index);
0939         filterproduct.addObject(trigger::TriggerL1EG, myref);
0940       }
0941     }
0942   }
0943 
0944   // Jet
0945   if (!listJet.empty()) {
0946     edm::Handle<l1t::JetBxCollection> jets;
0947     iEvent.getByToken(m_l1JetToken, jets);
0948 
0949     if (!jets.isValid()) {
0950       edm::LogWarning("HLTL1TSeed") << "\nWarning: L1JetBxCollection with input tag " << m_l1JetTag
0951                                     << "\nrequested in configuration, but not found in the event."
0952                                     << "\nNo jets added to filterproduct." << endl;
0953     } else {
0954       for (std::list<int>::const_iterator itObj = listJet.begin(); itObj != listJet.end(); ++itObj) {
0955         // Transform to begin of BxVector
0956         unsigned int index = jets->begin(0) - jets->begin() + *itObj;
0957 
0958         l1t::JetRef myref(jets, index);
0959         filterproduct.addObject(trigger::TriggerL1Jet, myref);
0960       }
0961     }
0962   }
0963 
0964   // Tau
0965   if (!listTau.empty()) {
0966     edm::Handle<l1t::TauBxCollection> taus;
0967     iEvent.getByToken(m_l1TauToken, taus);
0968 
0969     if (!taus.isValid()) {
0970       edm::LogWarning("HLTL1TSeed") << "\nWarning: L1TauBxCollection with input tag " << m_l1TauTag
0971                                     << "\nrequested in configuration, but not found in the event."
0972                                     << "\nNo taus added to filterproduct." << endl;
0973     } else {
0974       for (std::list<int>::const_iterator itObj = listTau.begin(); itObj != listTau.end(); ++itObj) {
0975         // Transform to begin of BxVector
0976         unsigned int index = taus->begin(0) - taus->begin() + *itObj;
0977 
0978         l1t::TauRef myref(taus, index);
0979         filterproduct.addObject(trigger::TriggerL1Tau, myref);
0980       }
0981     }
0982   }
0983 
0984   // ETT, HTT, ETM, HTM
0985   edm::Handle<l1t::EtSumBxCollection> etsums;
0986   iEvent.getByToken(m_l1EtSumToken, etsums);
0987   if (!etsums.isValid()) {
0988     edm::LogWarning("HLTL1TSeed") << "\nWarning: L1EtSumBxCollection with input tag " << m_l1EtSumTag
0989                                   << "\nrequested in configuration, but not found in the event."
0990                                   << "\nNo etsums added to filterproduct." << endl;
0991   } else {
0992     l1t::EtSumBxCollection::const_iterator iter;
0993 
0994     for (iter = etsums->begin(0); iter != etsums->end(0); ++iter) {
0995       l1t::EtSumRef myref(etsums, etsums->key(iter));
0996 
0997       switch (iter->getType()) {
0998         case l1t::EtSum::kTotalEt:
0999           if (!listETT.empty())
1000             filterproduct.addObject(trigger::TriggerL1ETT, myref);
1001           break;
1002         case l1t::EtSum::kTotalHt:
1003           if (!listHTT.empty())
1004             filterproduct.addObject(trigger::TriggerL1HTT, myref);
1005           break;
1006         case l1t::EtSum::kMissingEt:
1007           if (!listETM.empty())
1008             filterproduct.addObject(trigger::TriggerL1ETM, myref);
1009           break;
1010         case l1t::EtSum::kMissingHt:
1011           if (!listHTM.empty())
1012             filterproduct.addObject(trigger::TriggerL1HTM, myref);
1013           break;
1014         case l1t::EtSum::kMissingEtHF:
1015           if (!listETMHF.empty())
1016             filterproduct.addObject(trigger::TriggerL1ETMHF, myref);
1017           break;
1018         case l1t::EtSum::kCentrality:
1019           if (!listCentrality.empty())
1020             filterproduct.addObject(trigger::TriggerL1Centrality, myref);
1021           break;
1022         case l1t::EtSum::kMinBiasHFP0:
1023           if (!listMinBiasHFP0.empty())
1024             filterproduct.addObject(trigger::TriggerL1MinBiasHFP0, myref);
1025           break;
1026         case l1t::EtSum::kMinBiasHFM0:
1027           if (!listMinBiasHFM0.empty())
1028             filterproduct.addObject(trigger::TriggerL1MinBiasHFM0, myref);
1029           break;
1030         case l1t::EtSum::kMinBiasHFP1:
1031           if (!listMinBiasHFP1.empty())
1032             filterproduct.addObject(trigger::TriggerL1MinBiasHFP1, myref);
1033           break;
1034         case l1t::EtSum::kMinBiasHFM1:
1035           if (!listMinBiasHFM1.empty())
1036             filterproduct.addObject(trigger::TriggerL1MinBiasHFM1, myref);
1037           break;
1038         case l1t::EtSum::kTotalEtEm:
1039           if (!listTotalEtEm.empty())
1040             filterproduct.addObject(trigger::TriggerL1TotalEtEm, myref);
1041           break;
1042         case l1t::EtSum::kTowerCount:
1043           if (!listTowerCount.empty())
1044             filterproduct.addObject(trigger::TriggerL1TowerCount, myref);
1045           break;
1046         case l1t::EtSum::kAsymEt:
1047           if (!listAsymEt.empty())
1048             filterproduct.addObject(trigger::TriggerL1AsymEt, myref);
1049           break;
1050         case l1t::EtSum::kAsymHt:
1051           if (!listAsymHt.empty())
1052             filterproduct.addObject(trigger::TriggerL1AsymHt, myref);
1053           break;
1054         case l1t::EtSum::kAsymEtHF:
1055           if (!listAsymEtHF.empty())
1056             filterproduct.addObject(trigger::TriggerL1AsymEtHF, myref);
1057           break;
1058         case l1t::EtSum::kAsymHtHF:
1059           if (!listAsymHtHF.empty())
1060             filterproduct.addObject(trigger::TriggerL1AsymHtHF, myref);
1061           break;
1062         default:
1063           LogTrace("HLTL1TSeed") << "  L1EtSum seed of currently unsuported HLT TriggerType. l1t::EtSum type:      "
1064                                  << iter->getType() << "\n";
1065 
1066       }  // end switch
1067 
1068     }  // end for
1069 
1070   }  // end else
1071 
1072   // TODO FIXME uncomment if block when JetCounts implemented
1073 
1074   //    // jet counts
1075   //    if (!listJetCounts.empty()) {
1076   //        edm::Handle<l1extra::L1JetCounts> l1JetCounts;
1077   //        iEvent.getByToken(m_l1CollectionsToken.label(), l1JetCounts);
1078   //
1079   //        for (std::list<int>::const_iterator itObj = listJetCounts.begin();
1080   //                itObj != listJetCounts.end(); ++itObj) {
1081   //
1082   //            filterproduct.addObject(trigger::TriggerL1JetCounts,l1extra::L1JetCountsRefProd(l1JetCounts));
1083   //                  // FIXME: RefProd!
1084   //
1085   //        }
1086   //
1087   //    }
1088 
1089   LogTrace("HLTL1TSeed") << "\nHLTL1Seed:seedsL1TriggerObjectMaps returning " << seedsResult << endl << endl;
1090 
1091   return seedsResult;
1092 }
1093 
1094 // register as framework plugin
1095 #include "FWCore/Framework/interface/MakerMacros.h"
1096 DEFINE_FWK_MODULE(HLTL1TSeed);