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