Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:18:28

0001 /**
0002  * \class HLTLevel1GTSeed
0003  *
0004  *
0005  * Description: filter L1 bits and extract seed objects from L1 GT for HLT algorithms.
0006  *
0007  * Implementation:
0008  *    This class is an HLTStreamFilter (-> stream::EDFilter). It implements:
0009  *      - filtering on Level-1 bits, given via a logical expression of algorithm names
0010  *      - extraction of the seed objects from L1 GT object map record
0011  *
0012  * \author: Vasile Mihai Ghete - HEPHY Vienna
0013  *
0014  *
0015  */
0016 
0017 // this class header
0018 #include "HLTLevel1GTSeed.h"
0019 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0020 
0021 // system include files
0022 #include <string>
0023 #include <list>
0024 #include <vector>
0025 #include <algorithm>
0026 
0027 #include <iostream>
0028 #include <sstream>
0029 
0030 // user include files
0031 #include "DataFormats/Common/interface/Handle.h"
0032 #include "DataFormats/Common/interface/Ref.h"
0033 
0034 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
0035 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
0036 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h"
0037 
0038 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h"
0039 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h"
0040 
0041 #include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h"
0042 
0043 #include "DataFormats/L1Trigger/interface/L1EmParticleFwd.h"
0044 #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
0045 #include "DataFormats/L1Trigger/interface/L1MuonParticleFwd.h"
0046 #include "DataFormats/L1Trigger/interface/L1EtMissParticleFwd.h"
0047 
0048 #include "DataFormats/L1Trigger/interface/L1EmParticle.h"
0049 #include "DataFormats/L1Trigger/interface/L1JetParticle.h"
0050 #include "DataFormats/L1Trigger/interface/L1MuonParticle.h"
0051 #include "DataFormats/L1Trigger/interface/L1EtMissParticle.h"
0052 
0053 #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
0054 
0055 #include "CondFormats/L1TObjects/interface/L1GtCondition.h"
0056 
0057 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0058 #include "FWCore/Utilities/interface/InputTag.h"
0059 
0060 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0061 #include "FWCore/MessageLogger/interface/MessageDrop.h"
0062 
0063 #include "FWCore/Utilities/interface/Exception.h"
0064 
0065 #include "FWCore/Framework/interface/EventSetup.h"
0066 
0067 // constructors
0068 HLTLevel1GTSeed::HLTLevel1GTSeed(const edm::ParameterSet& parSet)
0069     : HLTStreamFilter(parSet),
0070       // initialize the cache
0071       m_l1GtMenu(nullptr),
0072       m_l1GtMenuCacheID(0ULL),
0073 
0074       // trigger records
0075       m_l1GtTriggerMenuToken(esConsumes()),
0076       m_l1GtTriggerMaskAlgoTrigRcdToken(esConsumes()),
0077       m_l1GtTriggerMaskTechTrigRcdToken(esConsumes()),
0078 
0079       // seeding done via L1 trigger object maps, with objects that fired
0080       m_l1UseL1TriggerObjectMaps(parSet.getParameter<bool>("L1UseL1TriggerObjectMaps")),
0081 
0082       // option used forL1UseL1TriggerObjectMaps = False only
0083       m_l1NrBxInEvent(parSet.getParameter<int>("L1NrBxInEvent")),
0084 
0085       // seeding done via technical trigger bits, if value is "true"
0086       m_l1TechTriggerSeeding(parSet.getParameter<bool>("L1TechTriggerSeeding")),
0087 
0088       // seeding uses algorithm aliases instead of algorithm names, if value is "true";
0089       m_l1UseAliasesForSeeding(parSet.getParameter<bool>("L1UseAliasesForSeeding")),
0090 
0091       // logical expression for the required L1 algorithms
0092       m_l1SeedsLogicalExpression(parSet.getParameter<std::string>("L1SeedsLogicalExpression")),
0093 
0094       // InputTag for the L1 Global Trigger DAQ readout record
0095       m_l1GtReadoutRecordTag(parSet.getParameter<edm::InputTag>("L1GtReadoutRecordTag")),
0096       m_l1GtReadoutRecordToken(consumes<L1GlobalTriggerReadoutRecord>(m_l1GtReadoutRecordTag)),
0097 
0098       // InputTag for L1 Global Trigger object maps
0099       m_l1GtObjectMapTag(parSet.getParameter<edm::InputTag>("L1GtObjectMapTag")),
0100       m_l1GtObjectMapToken(consumes<L1GlobalTriggerObjectMapRecord>(m_l1GtObjectMapTag)),
0101 
0102       // InputTag for L1 particle collections (except muon)
0103       m_l1CollectionsTag(parSet.getParameter<edm::InputTag>("L1CollectionsTag")),
0104 
0105       // InputTag for L1 muon collection
0106       m_l1MuonCollectionTag(parSet.getParameter<edm::InputTag>("L1MuonCollectionTag")),
0107 
0108       /// cached InputTags
0109       m_l1ExtraTag(edm::InputTag(m_l1CollectionsTag.label())),
0110       m_l1MuonTag(edm::InputTag(m_l1MuonCollectionTag.label())),
0111       m_l1MuonToken(consumes<l1extra::L1MuonParticleCollection>(m_l1MuonTag)),
0112       m_l1IsoEGTag(edm::InputTag(m_l1CollectionsTag.label(), "Isolated")),
0113       m_l1IsoEGToken(consumes<l1extra::L1EmParticleCollection>(m_l1IsoEGTag)),
0114       m_l1NoIsoEGTag(edm::InputTag(m_l1CollectionsTag.label(), "NonIsolated")),
0115       m_l1NoIsoEGToken(consumes<l1extra::L1EmParticleCollection>(m_l1NoIsoEGTag)),
0116       m_l1CenJetTag(edm::InputTag(m_l1CollectionsTag.label(), "Central")),
0117       m_l1CenJetToken(consumes<l1extra::L1JetParticleCollection>(m_l1CenJetTag)),
0118       m_l1ForJetTag(edm::InputTag(m_l1CollectionsTag.label(), "Forward")),
0119       m_l1ForJetToken(consumes<l1extra::L1JetParticleCollection>(m_l1ForJetTag)),
0120       m_l1TauJetTag(edm::InputTag(m_l1CollectionsTag.label(), "Tau")),
0121       m_l1TauJetToken(consumes<l1extra::L1JetParticleCollection>(m_l1TauJetTag)),
0122       m_l1IsoTauJetTag(edm::InputTag(m_l1CollectionsTag.label(), "IsoTau")),
0123       m_l1IsoTauJetToken(consumes<l1extra::L1JetParticleCollection>(m_l1IsoTauJetTag)),
0124       m_l1EtMissMETTag(edm::InputTag(m_l1CollectionsTag.label(), "MET")),
0125       m_l1EtMissMETToken(consumes<l1extra::L1EtMissParticleCollection>(m_l1EtMissMETTag)),
0126       m_l1EtMissMHTTag(edm::InputTag(m_l1CollectionsTag.label(), "MHT")),
0127       m_l1EtMissMHTToken(consumes<l1extra::L1EtMissParticleCollection>(m_l1EtMissMHTTag)),
0128       m_l1GlobalDecision(false),
0129       m_isDebugEnabled(edm::isDebugEnabled()) {
0130   if (m_l1SeedsLogicalExpression != "L1GlobalDecision") {
0131     // check also the logical expression - add/remove spaces if needed
0132     m_l1AlgoLogicParser = L1GtLogicParser(m_l1SeedsLogicalExpression);
0133 
0134     // list of required algorithms for seeding
0135     // dummy values for tokenNumber and tokenResult
0136     m_l1AlgoSeeds.reserve((m_l1AlgoLogicParser.operandTokenVector()).size());
0137     m_l1AlgoSeeds = m_l1AlgoLogicParser.expressionSeedsOperandList();
0138     size_t l1AlgoSeedsSize = m_l1AlgoSeeds.size();
0139 
0140     //
0141     m_l1AlgoSeedsRpn.reserve(l1AlgoSeedsSize);
0142     m_l1AlgoSeedsObjType.reserve(l1AlgoSeedsSize);
0143   } else {
0144     m_l1GlobalDecision = true;
0145   }
0146 
0147   // for seeding via technical triggers, convert the "name" to tokenNumber
0148   // (seeding via bit numbers)
0149   if (m_l1TechTriggerSeeding) {
0150     convertStringToBitNumber();
0151   }
0152 
0153   LogDebug("HLTLevel1GTSeed") << "\n"
0154                               << "L1 Seeding using L1 trigger object maps:       " << m_l1UseL1TriggerObjectMaps << "\n"
0155                               << "  if false: seeding with L1Extra\n"
0156                               << "Number of BxInEvent when seeding with L1Extra: " << m_l1NrBxInEvent << "\n"
0157                               << "  aka w/o object maps\n "
0158                               << "\n"
0159                               << "L1 Seeding via Technical Triggers:             " << m_l1TechTriggerSeeding << "\n"
0160                               << "L1 Seeding uses algorithm aliases:             " << m_l1UseAliasesForSeeding << "\n"
0161                               << "L1 Seeds Logical Expression:                   "
0162                               << "\n      " << m_l1SeedsLogicalExpression << "\n"
0163                               << "Input tag for L1 GT DAQ record:                " << m_l1GtReadoutRecordTag << " \n"
0164                               << "Input tag for L1 GT object map record:         " << m_l1GtObjectMapTag << " \n"
0165                               << "Input tag for L1 extra collections:            " << m_l1CollectionsTag << " \n"
0166                               << "Input tag for L1 muon  collections:            " << m_l1MuonCollectionTag << " \n"
0167                               << std::endl;
0168 }
0169 
0170 // destructor
0171 HLTLevel1GTSeed::~HLTLevel1GTSeed() {
0172   // empty now
0173 }
0174 
0175 // member functions
0176 
0177 void HLTLevel1GTSeed::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0178   edm::ParameterSetDescription desc;
0179   makeHLTFilterDescription(desc);
0180 
0181   // # default: true
0182   // #    seeding done via L1 trigger object maps, with objects that fired
0183   // #    only objects from the central BxInEvent (L1A) are used
0184   // # if false:
0185   // #    seeding is done ignoring if a L1 object fired or not,
0186   // #    adding all L1EXtra objects corresponding to the object types
0187   // #    used in all conditions from the algorithms in logical expression
0188   // #    for a given number of BxInEvent
0189   desc.add<bool>("L1UseL1TriggerObjectMaps", true);
0190 
0191   // # option used forL1UseL1TriggerObjectMaps = False only
0192   // # number of BxInEvent: 1: L1A=0; 3: -1, L1A=0, 1; 5: -2, -1, L1A=0, 1, 2
0193   desc.add<int>("L1NrBxInEvent", 3);
0194 
0195   // # seeding done via technical trigger bits, if value is "true";
0196   // # default: false (seeding via physics algorithms)
0197   desc.add<bool>("L1TechTriggerSeeding", false);
0198 
0199   // # seeding done with aliases for physics algorithms
0200   desc.add<bool>("L1UseAliasesForSeeding", true);
0201 
0202   // # logical expression for the required L1 algorithms;
0203   // # the algorithms are specified by name
0204   // # allowed operators: "AND", "OR", "NOT", "(", ")"
0205   // #
0206   // # by convention, "L1GlobalDecision" logical expression means global decision
0207   desc.add<std::string>("L1SeedsLogicalExpression", "");
0208 
0209   // # InputTag for the L1 Global Trigger DAQ readout record
0210   // #   GT Emulator = gtDigis
0211   // #   GT Unpacker = l1GtUnpack
0212   // #
0213   // #   cloned GT unpacker in HLT = gtDigis
0214   desc.add<edm::InputTag>("L1GtReadoutRecordTag", edm::InputTag("gtDigis"));
0215 
0216   // # InputTag for L1 Global Trigger object maps
0217   // #   only the emulator produces the object maps
0218   // #   GT Emulator = gtDigis
0219   // #
0220   // #   cloned GT emulator in HLT = l1GtObjectMap
0221   desc.add<edm::InputTag>("L1GtObjectMapTag", edm::InputTag("l1GtObjectMap"));
0222 
0223   // # InputTag for L1 particle collections (except muon)
0224   // #   L1 Extra = l1extraParticles
0225   desc.add<edm::InputTag>("L1CollectionsTag", edm::InputTag("l1extraParticles"));
0226 
0227   // # InputTag for L1 muon collection
0228   // #   L1 Extra = l1extraParticles
0229   desc.add<edm::InputTag>("L1MuonCollectionTag", edm::InputTag("l1extraParticles"));
0230 
0231   descriptions.add("hltLevel1GTSeed", desc);
0232 }
0233 
0234 bool HLTLevel1GTSeed::hltFilter(edm::Event& iEvent,
0235                                 const edm::EventSetup& evSetup,
0236                                 trigger::TriggerFilterObjectWithRefs& filterproduct) {
0237   // all HLT filters must create and fill a HLT filter object,
0238   // recording any reconstructed physics objects satisfying
0239   // this HLT filter, and place it in the event.
0240 
0241   // the filter object
0242   if (saveTags()) {
0243     filterproduct.addCollectionTag(m_l1MuonTag);
0244     filterproduct.addCollectionTag(m_l1ExtraTag);
0245     filterproduct.addCollectionTag(m_l1IsoEGTag);
0246     filterproduct.addCollectionTag(m_l1NoIsoEGTag);
0247     filterproduct.addCollectionTag(m_l1CenJetTag);
0248     filterproduct.addCollectionTag(m_l1ForJetTag);
0249     filterproduct.addCollectionTag(m_l1TauJetTag);
0250     filterproduct.addCollectionTag(m_l1IsoTauJetTag);
0251     filterproduct.addCollectionTag(m_l1EtMissMETTag);
0252     filterproduct.addCollectionTag(m_l1EtMissMHTTag);
0253   }
0254 
0255   // get the trigger mask from the EventSetup
0256   auto const& l1GtTmAlgo = evSetup.getHandle(m_l1GtTriggerMaskAlgoTrigRcdToken);
0257 
0258   // get L1GlobalTriggerReadoutRecord and GT decision
0259   edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecord;
0260   iEvent.getByToken(m_l1GtReadoutRecordToken, gtReadoutRecord);
0261   const L1GlobalTriggerReadoutRecord* gtReadoutRecordPtr = gtReadoutRecord.product();
0262 
0263   if (!gtReadoutRecord.isValid()) {
0264     edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1GlobalTriggerReadoutRecord with input tag "
0265                                        << m_l1GtReadoutRecordTag
0266                                        << "\nrequested in configuration, but not found in the event." << std::endl;
0267     return false;
0268   }
0269 
0270   //
0271   uint16_t gtFinalOR = gtReadoutRecord->finalOR();
0272   int physicsDaqPartition = 0;
0273   bool gtDecision = static_cast<bool>(gtFinalOR & (1 << physicsDaqPartition));
0274 
0275   // GT global decision "false" possible only when running on MC or on random triggers
0276   if (!gtDecision) {
0277     return false;
0278 
0279   } else {
0280     // by convention, "L1GlobalDecision" logical expression means global decision
0281     if (m_l1GlobalDecision) {
0282       // return the full L1GlobalTriggerObjectMapRecord in filter format FIXME
0283       return true;
0284     }
0285   }
0286 
0287   // seeding done via technical trigger bits
0288   if (m_l1TechTriggerSeeding) {
0289     // get the technical trigger mask from the EventSetup
0290     auto const& l1GtTmTech = evSetup.getHandle(m_l1GtTriggerMaskTechTrigRcdToken);
0291 
0292     // get Global Trigger technical trigger word, update the tokenResult members
0293     // from m_l1AlgoLogicParser and get the result for the logical expression
0294     const std::vector<bool>& gtTechTrigWord = gtReadoutRecord->technicalTriggerWord();
0295     updateAlgoLogicParser(gtTechTrigWord, l1GtTmTech->gtTriggerMask(), physicsDaqPartition);
0296 
0297     // always empty filter - GT not aware of objects for technical triggers
0298     bool seedsResult = m_l1AlgoLogicParser.expressionResult();
0299 
0300     if (seedsResult) {
0301       return true;
0302     } else {
0303       return false;
0304     }
0305   }
0306 
0307   // seeding via physics algorithms
0308 
0309   // get / update the trigger menu from the EventSetup
0310   // local cache & check on cacheIdentifier
0311 
0312   unsigned long long l1GtMenuCacheID = evSetup.get<L1GtTriggerMenuRcd>().cacheIdentifier();
0313 
0314   if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
0315     auto const& l1GtMenu = evSetup.getHandle(m_l1GtTriggerMenuToken);
0316     m_l1GtMenu = l1GtMenu.product();
0317     m_l1GtMenuCacheID = l1GtMenuCacheID;
0318 
0319     const AlgorithmMap& algorithmMap = l1GtMenu->gtAlgorithmMap();
0320     const AlgorithmMap& algorithmAliasMap = l1GtMenu->gtAlgorithmAliasMap();
0321 
0322     LogTrace("HLTLevel1GTSeed") << "\n L1 trigger menu " << l1GtMenu->gtTriggerMenuInterface()
0323                                 << "\n    Number of algorithm names:   " << (algorithmMap.size())
0324                                 << "\n    Number of algorithm aliases: " << (algorithmAliasMap.size()) << "\n"
0325                                 << std::endl;
0326 
0327     // update also the tokenNumber members (holding the bit numbers) from m_l1AlgoLogicParser
0328     if (m_l1UseAliasesForSeeding) {
0329       updateAlgoLogicParser(m_l1GtMenu, algorithmAliasMap);
0330     } else {
0331       updateAlgoLogicParser(m_l1GtMenu, algorithmMap);
0332     }
0333   }
0334 
0335   // FinalOR is true, it was tested before
0336   if (m_l1UseL1TriggerObjectMaps) {
0337     if (not seedsL1TriggerObjectMaps(
0338             iEvent, filterproduct, l1GtTmAlgo.product(), gtReadoutRecordPtr, physicsDaqPartition))
0339       return false;
0340   } else {
0341     if (not seedsL1Extra(iEvent, filterproduct))
0342       return false;
0343   }
0344 
0345   if (m_isDebugEnabled) {
0346     dumpTriggerFilterObjectWithRefs(filterproduct);
0347   }
0348 
0349   return true;
0350 }
0351 
0352 const std::vector<L1GtObject>* HLTLevel1GTSeed::objectTypeVec(const int chipNr, const std::string& cndName) const {
0353   const ConditionMap& conditionMap = (m_l1GtMenu->gtConditionMap()).at(chipNr);
0354 
0355   auto itCond = conditionMap.find(cndName);
0356   if (itCond != conditionMap.end())
0357     return (&((itCond->second)->objectType()));
0358 
0359   // this should never be happen, all conditions are in the maps
0360   throw cms::Exception("FailModule") << "\nCondition " << cndName << " not found in the condition map"
0361                                      << " for chip number " << chipNr;
0362 }
0363 
0364 // for a new L1 Trigger menu, update the tokenNumber (holding the bit numbers)
0365 // from m_l1AlgoLogicParser and from m_l1AlgoSeeds, and fill the m_l1AlgoSeedsRpn vector
0366 void HLTLevel1GTSeed::updateAlgoLogicParser(const L1GtTriggerMenu* l1GtMenu, const AlgorithmMap& algorithmMap) {
0367   std::vector<L1GtLogicParser::OperandToken>& algOpTokenVector = m_l1AlgoLogicParser.operandTokenVector();
0368 
0369   size_t jSeed = 0;
0370   size_t l1AlgoSeedsSize = m_l1AlgoSeeds.size();
0371 
0372   // clear the content from the previous menu for the vector of RPN vectors m_l1AlgoSeedsRpn
0373   // and for the the vector of object-type vectors m_l1AlgoSeedsObjType
0374   m_l1AlgoSeedsRpn.clear();
0375   m_l1AlgoSeedsObjType.clear();
0376 
0377   //
0378 
0379   for (auto& i : algOpTokenVector) {
0380     auto itAlgo = algorithmMap.find(i.tokenName);
0381     if (itAlgo != algorithmMap.end()) {
0382       int bitNr = (itAlgo->second).algoBitNumber();
0383       int chipNr = (itAlgo->second).algoChipNumber();
0384 
0385       i.tokenNumber = bitNr;
0386 
0387       // algOpTokenVector and m_l1AlgoSeeds must have the same ordering
0388       // of the algorithms
0389       if (jSeed < l1AlgoSeedsSize) {
0390         //LogTrace("HLTLevel1GTSeed") << "(m_l1AlgoSeeds[jSeed]).tokenName: "
0391         //    << (m_l1AlgoSeeds[jSeed]).tokenName
0392         //    << std::endl;
0393 
0394         if ((m_l1AlgoSeeds[jSeed]).tokenName == i.tokenName) {
0395           (m_l1AlgoSeeds[jSeed]).tokenNumber = bitNr;
0396 
0397           const std::vector<L1GtLogicParser::TokenRPN>& aRpnVector = (itAlgo->second).algoRpnVector();
0398           size_t aRpnVectorSize = aRpnVector.size();
0399 
0400           m_l1AlgoSeedsRpn.push_back(&aRpnVector);
0401 
0402           // loop over RpnVector to fill for each condition the object type
0403           std::vector<const std::vector<L1GtObject>*> tmpObjTypeVec;
0404           tmpObjTypeVec.reserve(aRpnVectorSize);
0405 
0406           for (size_t opI = 0; opI < aRpnVectorSize; ++opI) {
0407             std::string cName = (aRpnVector[opI]).operand;
0408 
0409             if (!cName.empty()) {
0410               tmpObjTypeVec.push_back(objectTypeVec(chipNr, cName));
0411 
0412               //LogTrace("HLTLevel1GTSeed")
0413               //    << "    Push object vector for condition: " << cName
0414               //    << std::endl;
0415             }
0416           }
0417 
0418           m_l1AlgoSeedsObjType.push_back(tmpObjTypeVec);
0419 
0420           jSeed++;
0421         }
0422       }
0423     } else {
0424       throw cms::Exception("FailModule") << "\nAlgorithm  " << i.tokenName
0425                                          << ", requested as seed by a HLT path, not found in the L1 trigger menu\n   "
0426                                          << l1GtMenu->gtTriggerMenuName() << "\nIncompatible L1 and HLT menus.\n"
0427                                          << std::endl;
0428     }
0429   }
0430 
0431   //
0432   if (m_isDebugEnabled) {
0433     bool newMenu = true;
0434     debugPrint(newMenu);
0435   }
0436 }
0437 
0438 // update the tokenResult members from m_l1AlgoLogicParser
0439 // for a new event
0440 void HLTLevel1GTSeed::updateAlgoLogicParser(const std::vector<bool>& gtWord,
0441                                             const std::vector<unsigned int>& triggerMask,
0442                                             const int physicsDaqPartition) {
0443   std::vector<L1GtLogicParser::OperandToken>& algOpTokenVector = m_l1AlgoLogicParser.operandTokenVector();
0444 
0445   for (auto& i : algOpTokenVector) {
0446     int iBit = i.tokenNumber;
0447     bool iResult = gtWord.at(iBit);
0448 
0449     int triggerMaskBit = triggerMask[iBit] & (1 << physicsDaqPartition);
0450     //LogTrace("HLTLevel1GTSeed")
0451     //<< "\nTrigger bit: " << iBit
0452     //<< " mask = " << triggerMaskBit
0453     //<< " DAQ partition " << physicsDaqPartition
0454     //<< std::endl;
0455 
0456     if (triggerMaskBit) {
0457       iResult = false;
0458 
0459       //LogTrace("HLTLevel1GTSeed")
0460       //<< "\nMasked trigger: " << iBit << ". Result set to false\n"
0461       //<< std::endl;
0462     }
0463 
0464     i.tokenResult = iResult;
0465   }
0466 
0467   for (auto& m_l1AlgoSeed : m_l1AlgoSeeds) {
0468     int iBit = m_l1AlgoSeed.tokenNumber;
0469     bool iResult = gtWord.at(iBit);
0470 
0471     int triggerMaskBit = triggerMask[iBit] & (1 << physicsDaqPartition);
0472     //LogTrace("HLTLevel1GTSeed")
0473     //<< "\nTrigger bit: " << iBit
0474     //<< " mask = " << triggerMaskBit
0475     //<< " DAQ partition " << physicsDaqPartition
0476     //<< std::endl;
0477 
0478     if (triggerMaskBit) {
0479       iResult = false;
0480 
0481       //LogTrace("HLTLevel1GTSeed")
0482       //<< "\nMasked trigger: " << iBit << ". Result set to false\n"
0483       //<< std::endl;
0484     }
0485 
0486     m_l1AlgoSeed.tokenResult = iResult;
0487   }
0488 
0489   if (m_isDebugEnabled) {
0490     bool newMenu = false;
0491     debugPrint(newMenu);
0492   }
0493 }
0494 
0495 // for seeding via technical triggers, convert the "name" to tokenNumber
0496 // (seeding via bit numbers) - done once in constructor
0497 void HLTLevel1GTSeed::convertStringToBitNumber() {
0498   std::vector<L1GtLogicParser::OperandToken>& algOpTokenVector = m_l1AlgoLogicParser.operandTokenVector();
0499 
0500   for (auto& i : algOpTokenVector) {
0501     std::string bitString = i.tokenName;
0502     std::istringstream bitStream(bitString);
0503     int bitInt;
0504 
0505     if ((bitStream >> bitInt).fail()) {
0506       throw cms::Exception("FailModule") << "\nL1 Seeds Logical Expression: = '" << m_l1SeedsLogicalExpression << "'"
0507                                          << "\n  Conversion to integer failed for " << bitString << std::endl;
0508     }
0509 
0510     i.tokenNumber = bitInt;
0511   }
0512 
0513   for (auto& m_l1AlgoSeed : m_l1AlgoSeeds) {
0514     std::string bitString = m_l1AlgoSeed.tokenName;
0515     std::istringstream bitStream(bitString);
0516     int bitInt;
0517 
0518     if ((bitStream >> bitInt).fail()) {
0519       throw cms::Exception("FailModule") << "\nL1 Seeds Logical Expression: = '" << m_l1SeedsLogicalExpression << "'"
0520                                          << "\n  Conversion to integer failed for " << bitString << std::endl;
0521     }
0522 
0523     m_l1AlgoSeed.tokenNumber = bitInt;
0524   }
0525 }
0526 
0527 // debug print grouped in a single function
0528 // can be called for a new menu (bool "true") or for a new event
0529 void HLTLevel1GTSeed::debugPrint(bool newMenu) const {
0530   if (m_l1TechTriggerSeeding) {
0531     LogDebug("HLTLevel1GTSeed") << "\n\nupdateAlgoLogicParser: seeding via technical trigger"
0532                                 << "\n   update event quantities." << std::endl;
0533 
0534   } else {
0535     if (newMenu) {
0536       LogDebug("HLTLevel1GTSeed") << "\n\nupdateAlgoLogicParser: L1 trigger menu changed to "
0537                                   << m_l1GtMenu->gtTriggerMenuName() << std::endl;
0538     } else {
0539       LogDebug("HLTLevel1GTSeed") << "\n\nupdateAlgoLogicParser: L1 trigger menu unchanged ("
0540                                   << m_l1GtMenu->gtTriggerMenuName() << ")\n   update event quantities." << std::endl;
0541     }
0542   }
0543 
0544   std::vector<L1GtLogicParser::OperandToken> const& algOpTokenVector = m_l1AlgoLogicParser.operandTokenVector();
0545 
0546   LogTrace("HLTLevel1GTSeed") << "\n\nupdateAlgoLogicParser: algOpTokenVector.size() = " << algOpTokenVector.size()
0547                               << std::endl;
0548 
0549   for (auto const& i : algOpTokenVector) {
0550     LogTrace("HLTLevel1GTSeed") << "      " << std::setw(5) << i.tokenNumber << "\t" << std::setw(25) << i.tokenName
0551                                 << "\t" << i.tokenResult << std::endl;
0552   }
0553 
0554   LogTrace("HLTLevel1GTSeed") << std::endl;
0555 
0556   LogTrace("HLTLevel1GTSeed") << "\nupdateAlgoLogicParser: m_l1AlgoSeeds.size() = " << m_l1AlgoSeeds.size()
0557                               << std::endl;
0558 
0559   for (auto const& m_l1AlgoSeed : m_l1AlgoSeeds) {
0560     LogTrace("HLTLevel1GTSeed") << "      " << std::setw(5) << m_l1AlgoSeed.tokenNumber << "\t" << std::setw(25)
0561                                 << m_l1AlgoSeed.tokenName << "\t" << m_l1AlgoSeed.tokenResult << std::endl;
0562   }
0563 
0564   LogTrace("HLTLevel1GTSeed") << std::endl;
0565 
0566   if (!newMenu) {
0567     return;
0568   }
0569 
0570   LogTrace("HLTLevel1GTSeed") << "\nupdateAlgoLogicParser: m_l1AlgoSeedsRpn.size() = " << m_l1AlgoSeedsRpn.size()
0571                               << std::endl;
0572 
0573   for (auto i : m_l1AlgoSeedsRpn) {
0574     LogTrace("HLTLevel1GTSeed") << "  Rpn vector size: " << i->size() << std::endl;
0575 
0576     for (size_t j = 0; j < i->size(); ++j) {
0577       LogTrace("HLTLevel1GTSeed") << "      ( " << (*i)[j].operation << ", " << (*i)[j].operand << " )" << std::endl;
0578     }
0579   }
0580 
0581   LogTrace("HLTLevel1GTSeed") << std::endl;
0582 
0583   LogTrace("HLTLevel1GTSeed") << "\nupdateAlgoLogicParser: "
0584                               << "algorithms in seed expression: m_l1AlgoSeedsObjType.size() = "
0585                               << m_l1AlgoSeedsObjType.size() << std::endl;
0586 
0587   for (auto const& i : m_l1AlgoSeedsObjType) {
0588     LogTrace("HLTLevel1GTSeed") << "  Conditions for an algorithm: vector size: " << i.size() << std::endl;
0589 
0590     for (size_t j = 0; j < i.size(); ++j) {
0591       LogTrace("HLTLevel1GTSeed") << "    Condition object type vector: size: " << (i[j])->size() << std::endl;
0592 
0593       for (size_t k = 0; k < (i[j])->size(); ++k) {
0594         L1GtObject obj = (*(i[j]))[k];
0595         LogTrace("HLTLevel1GTSeed") << "      " << obj << " ";
0596       }
0597 
0598       LogTrace("HLTLevel1GTSeed") << std::endl;
0599     }
0600   }
0601 
0602   LogTrace("HLTLevel1GTSeed") << std::endl;
0603 }
0604 
0605 // seeding is done via L1 trigger object maps, considering the objects which fired in L1
0606 bool HLTLevel1GTSeed::seedsL1TriggerObjectMaps(edm::Event& iEvent,
0607                                                trigger::TriggerFilterObjectWithRefs& filterproduct,
0608                                                const L1GtTriggerMask* l1GtTmAlgo,
0609                                                const L1GlobalTriggerReadoutRecord* gtReadoutRecordPtr,
0610                                                const int physicsDaqPartition) {
0611   // get Global Trigger decision word, update the tokenResult members
0612   // from m_l1AlgoLogicParser and get the result for the logical expression
0613   const std::vector<bool>& gtDecisionWord = gtReadoutRecordPtr->decisionWord();
0614   updateAlgoLogicParser(gtDecisionWord, l1GtTmAlgo->gtTriggerMask(), physicsDaqPartition);
0615 
0616   bool seedsResult = m_l1AlgoLogicParser.expressionResult();
0617 
0618   if (m_isDebugEnabled) {
0619     // define an output stream to print into
0620     // it can then be directed to whatever log level is desired
0621     std::ostringstream myCoutStream;
0622     gtReadoutRecordPtr->printGtDecision(myCoutStream);
0623 
0624     LogTrace("HLTLevel1GTSeed") << myCoutStream.str() << "\nHLTLevel1GTSeed::hltFilter "
0625                                 << "\nLogical expression (names) = '" << m_l1SeedsLogicalExpression << "'"
0626                                 << "\n  Result for logical expression: " << seedsResult << "\n"
0627                                 << std::endl;
0628   }
0629 
0630   // the evaluation of the logical expression is false - skip event
0631   if (!seedsResult) {
0632     return false;
0633   }
0634 
0635   // define index lists for all particle types
0636 
0637   std::list<int> listMuon;
0638 
0639   std::list<int> listIsoEG;
0640   std::list<int> listNoIsoEG;
0641 
0642   std::list<int> listCenJet;
0643   std::list<int> listForJet;
0644   std::list<int> listTauJet;
0645   std::list<int> listIsoTauJet;
0646 
0647   std::list<int> listETM;
0648   std::list<int> listETT;
0649   std::list<int> listHTT;
0650   std::list<int> listHTM;
0651 
0652   std::list<int> listJetCounts;
0653 
0654   // get handle to object maps (one object map per algorithm)
0655   edm::Handle<L1GlobalTriggerObjectMapRecord> gtObjectMapRecord;
0656   iEvent.getByToken(m_l1GtObjectMapToken, gtObjectMapRecord);
0657 
0658   if (!gtObjectMapRecord.isValid()) {
0659     edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1GlobalTriggerObjectMapRecord with input tag "
0660                                        << m_l1GtReadoutRecordTag
0661                                        << "\nrequested in configuration, but not found in the event." << std::endl;
0662 
0663     return false;
0664   }
0665 
0666   // TODO check that the L1GlobalTriggerObjectMapRecord corresponds to the same menu as
0667   // the menu run by HLTLevel1GTSeed
0668   //     true normally online (they are run in the same job)
0669   //     can be false offline, when re-running HLT without re-running the object map producer
0670 
0671   // loop over the list of required algorithms for seeding
0672   int iAlgo = -1;
0673 
0674   for (std::vector<L1GtLogicParser::OperandToken>::const_iterator itSeed = m_l1AlgoSeeds.begin();
0675        itSeed != m_l1AlgoSeeds.end();
0676        ++itSeed) {
0677     //
0678     iAlgo++;
0679     //
0680     int algBit = (*itSeed).tokenNumber;
0681     std::string algName = (*itSeed).tokenName;
0682     bool algResult = (*itSeed).tokenResult;
0683 
0684     LogTrace("HLTLevel1GTSeed") << "\nHLTLevel1GTSeed::hltFilter "
0685                                 << "\n  Algorithm " << algName << " with bit number " << algBit
0686                                 << " in the object map seed list"
0687                                 << "\n  Algorithm result = " << algResult << "\n"
0688                                 << std::endl;
0689 
0690     // algorithm result is false - no seeds
0691     if (!algResult) {
0692       continue;
0693     }
0694 
0695     // algorithm result is true - get object map, loop over conditions in the algorithm
0696     const L1GlobalTriggerObjectMap* objMap = gtObjectMapRecord->getObjectMap(algBit);
0697 
0698     if (objMap == nullptr) {
0699       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1GlobalTriggerObjectMap for algorithm  " << algName
0700                                          << " (bit number " << algBit << ") does not exist.\nReturn false.\n"
0701                                          << std::endl;
0702       return false;
0703     }
0704 
0705     const std::vector<L1GtLogicParser::OperandToken>& opTokenVecObjMap = objMap->operandTokenVector();
0706 
0707     const std::vector<L1GtLogicParser::TokenRPN>& algoSeedsRpn = *(m_l1AlgoSeedsRpn.at(iAlgo));
0708 
0709     const std::vector<const std::vector<L1GtObject>*>& algoSeedsObjTypeVec = m_l1AlgoSeedsObjType[iAlgo];
0710 
0711     //
0712     L1GtLogicParser logicParserConditions(algoSeedsRpn, opTokenVecObjMap);
0713 
0714     // get list of required conditions for seeding - loop over
0715     std::vector<L1GtLogicParser::OperandToken> condSeeds = logicParserConditions.expressionSeedsOperandList();
0716 
0717     if (m_isDebugEnabled) {
0718       LogTrace("HLTLevel1GTSeed") << "\n  HLTLevel1GTSeed::hltFilter "
0719                                   << "\n    condSeeds.size() = " << condSeeds.size() << std::endl;
0720 
0721       for (auto& condSeed : condSeeds) {
0722         LogTrace("HLTLevel1GTSeed") << "      " << std::setw(5) << condSeed.tokenNumber << "\t" << std::setw(25)
0723                                     << condSeed.tokenName << "\t" << condSeed.tokenResult << std::endl;
0724       }
0725 
0726       LogTrace("HLTLevel1GTSeed") << std::endl;
0727     }
0728 
0729     for (std::vector<L1GtLogicParser::OperandToken>::const_iterator itCond = condSeeds.begin();
0730          itCond != condSeeds.end();
0731          itCond++) {
0732       std::string cndName = (*itCond).tokenName;
0733       int cndNumber = (*itCond).tokenNumber;
0734       bool cndResult = (*itCond).tokenResult;
0735 
0736       const std::vector<L1GtObject>* cndObjTypeVec = algoSeedsObjTypeVec.at(cndNumber);
0737 
0738       //LogTrace("HLTLevel1GTSeed")
0739       //    << "\n  HLTLevel1GTSeed::hltFilter "
0740       //    << "\n    Condition " << cndName << " with number " << cndNumber
0741       //    << " in the seed list"
0742       //    << "\n    Condition result = " << cndResult << "\n"
0743       //    << std::endl;
0744 
0745       if (!cndResult) {
0746         continue;
0747       }
0748 
0749       // loop over combinations for a given condition
0750 
0751       const CombinationsInCond* cndComb = objMap->getCombinationsInCond(cndNumber);
0752 
0753       for (auto const& itComb : (*cndComb)) {
0754         // loop over objects in a combination for a given condition
0755         int iObj = 0;
0756         for (auto itObject = itComb.begin(); itObject != itComb.end(); itObject++) {
0757           // get object type and push indices on the list
0758           const L1GtObject objTypeVal = (*cndObjTypeVec).at(iObj);
0759 
0760           //LogTrace("HLTLevel1GTSeed")
0761           //    << "\n    HLTLevel1GTSeed::hltFilter "
0762           //    << "\n      Add object of type " << objTypeVal
0763           //    << " and index " << (*itObject) << " to the seed list."
0764           //    << std::endl;
0765 
0766           switch (objTypeVal) {
0767             case Mu: {
0768               listMuon.push_back(*itObject);
0769             }
0770 
0771             break;
0772             case NoIsoEG: {
0773               listNoIsoEG.push_back(*itObject);
0774             }
0775 
0776             break;
0777             case IsoEG: {
0778               listIsoEG.push_back(*itObject);
0779             }
0780 
0781             break;
0782             case CenJet: {
0783               listCenJet.push_back(*itObject);
0784             }
0785 
0786             break;
0787             case ForJet: {
0788               listForJet.push_back(*itObject);
0789             }
0790 
0791             break;
0792             case TauJet: {
0793               listTauJet.push_back(*itObject);
0794             }
0795 
0796             break;
0797             case HfRingEtSums: {
0798               // Special treatment needed to match HFRingEtSums index (Ind) with corresponding l1extra item
0799               // Same ranking (Et) is assumed for both HFRingEtSums indexes and items in l1extra IsoTau collection
0800               // Each HFRingEtSums_IndN corresponds with one object (with (*itObject)=0);
0801               // its index (hfInd) encodded by parsing algorithm name
0802               int hfInd = (*itObject);
0803               if (cndName.find("Ind0") != std::string::npos)
0804                 hfInd = 0;
0805               else if (cndName.find("Ind1") != std::string::npos)
0806                 hfInd = 1;
0807               else if (cndName.find("Ind2") != std::string::npos)
0808                 hfInd = 2;
0809               else if (cndName.find("Ind3") != std::string::npos)
0810                 hfInd = 3;
0811               listIsoTauJet.push_back(hfInd);
0812             }
0813 
0814             break;
0815             case ETM: {
0816               listETM.push_back(*itObject);
0817 
0818             }
0819 
0820             break;
0821             case ETT: {
0822               listETT.push_back(*itObject);
0823 
0824             }
0825 
0826             break;
0827             case HTT: {
0828               listHTT.push_back(*itObject);
0829 
0830             }
0831 
0832             break;
0833             case HTM: {
0834               listHTM.push_back(*itObject);
0835 
0836             }
0837 
0838             break;
0839             case JetCounts: {
0840               listJetCounts.push_back(*itObject);
0841             }
0842 
0843             break;
0844             default: {
0845               // should not arrive here
0846 
0847               LogDebug("HLTLevel1GTSeed") << "\n    HLTLevel1GTSeed::hltFilter "
0848                                           << "\n      Unknown object of type " << objTypeVal << " and index "
0849                                           << (*itObject) << " in the seed list." << std::endl;
0850             } break;
0851           }
0852 
0853           iObj++;
0854         }
0855       }
0856     }
0857   }
0858 
0859   // eliminate duplicates
0860 
0861   listMuon.sort();
0862   listMuon.unique();
0863 
0864   listIsoEG.sort();
0865   listIsoEG.unique();
0866 
0867   listNoIsoEG.sort();
0868   listNoIsoEG.unique();
0869 
0870   listCenJet.sort();
0871   listCenJet.unique();
0872 
0873   listForJet.sort();
0874   listForJet.unique();
0875 
0876   listTauJet.sort();
0877   listTauJet.unique();
0878 
0879   listIsoTauJet.sort();
0880   listIsoTauJet.unique();
0881 
0882   listETM.sort();
0883   listETM.unique();
0884 
0885   listETT.sort();
0886   listETT.unique();
0887 
0888   listHTT.sort();
0889   listHTT.unique();
0890 
0891   listHTM.sort();
0892   listHTM.unique();
0893 
0894   listJetCounts.sort();
0895   listJetCounts.unique();
0896 
0897   //
0898   // record the L1 physics objects in the HLT filterproduct
0899   //
0900 
0901   // muon
0902   if (!listMuon.empty()) {
0903     edm::Handle<l1extra::L1MuonParticleCollection> l1Muon;
0904     iEvent.getByToken(m_l1MuonToken, l1Muon);
0905 
0906     if (!l1Muon.isValid()) {
0907       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1MuonParticleCollection with input tag " << m_l1MuonTag
0908                                          << "\nrequested in configuration, but not found in the event."
0909                                          << "\nNo muon added to filterproduct." << std::endl;
0910 
0911     } else {
0912       for (std::list<int>::const_iterator itObj = listMuon.begin(); itObj != listMuon.end(); ++itObj) {
0913         filterproduct.addObject(trigger::TriggerL1Mu, l1extra::L1MuonParticleRef(l1Muon, *itObj));
0914       }
0915     }
0916   }
0917 
0918   // EG (isolated)
0919   if (!listIsoEG.empty()) {
0920     edm::Handle<l1extra::L1EmParticleCollection> l1IsoEG;
0921     iEvent.getByToken(m_l1IsoEGToken, l1IsoEG);
0922 
0923     if (!l1IsoEG.isValid()) {
0924       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1EmParticleCollection with input tag " << m_l1IsoEGTag
0925                                          << "\nrequested in configuration, but not found in the event."
0926                                          << "\nNo IsoEG added to filterproduct." << std::endl;
0927 
0928     } else {
0929       for (std::list<int>::const_iterator itObj = listIsoEG.begin(); itObj != listIsoEG.end(); ++itObj) {
0930         filterproduct.addObject(trigger::TriggerL1IsoEG, l1extra::L1EmParticleRef(l1IsoEG, *itObj));
0931       }
0932     }
0933   }
0934 
0935   // EG (no isolation)
0936   if (!listNoIsoEG.empty()) {
0937     edm::Handle<l1extra::L1EmParticleCollection> l1NoIsoEG;
0938     iEvent.getByToken(m_l1NoIsoEGToken, l1NoIsoEG);
0939 
0940     if (!l1NoIsoEG.isValid()) {
0941       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1EmParticleCollection with input tag " << m_l1NoIsoEGTag
0942                                          << "\nrequested in configuration, but not found in the event."
0943                                          << "\nNo NoIsoEG added to filterproduct." << std::endl;
0944 
0945     } else {
0946       for (std::list<int>::const_iterator itObj = listNoIsoEG.begin(); itObj != listNoIsoEG.end(); ++itObj) {
0947         filterproduct.addObject(trigger::TriggerL1NoIsoEG, l1extra::L1EmParticleRef(l1NoIsoEG, *itObj));
0948       }
0949     }
0950   }
0951 
0952   // central jets
0953   if (!listCenJet.empty()) {
0954     edm::Handle<l1extra::L1JetParticleCollection> l1CenJet;
0955     iEvent.getByToken(m_l1CenJetToken, l1CenJet);
0956 
0957     if (!l1CenJet.isValid()) {
0958       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1JetParticleCollection with input tag " << m_l1CenJetTag
0959                                          << "\nrequested in configuration, but not found in the event."
0960                                          << "\nNo CenJet added to filterproduct." << std::endl;
0961 
0962     } else {
0963       for (std::list<int>::const_iterator itObj = listCenJet.begin(); itObj != listCenJet.end(); ++itObj) {
0964         filterproduct.addObject(trigger::TriggerL1CenJet, l1extra::L1JetParticleRef(l1CenJet, *itObj));
0965       }
0966     }
0967   }
0968 
0969   // forward jets
0970   if (!listForJet.empty()) {
0971     edm::Handle<l1extra::L1JetParticleCollection> l1ForJet;
0972     iEvent.getByToken(m_l1ForJetToken, l1ForJet);
0973 
0974     if (!l1ForJet.isValid()) {
0975       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1JetParticleCollection with input tag " << m_l1ForJetTag
0976                                          << "\nrequested in configuration, but not found in the event."
0977                                          << "\nNo ForJet added to filterproduct." << std::endl;
0978 
0979     } else {
0980       for (std::list<int>::const_iterator itObj = listForJet.begin(); itObj != listForJet.end(); ++itObj) {
0981         filterproduct.addObject(trigger::TriggerL1ForJet, l1extra::L1JetParticleRef(l1ForJet, *itObj));
0982       }
0983     }
0984   }
0985 
0986   // tau jets
0987   if (!listTauJet.empty()) {
0988     edm::Handle<l1extra::L1JetParticleCollection> l1TauJet;
0989     iEvent.getByToken(m_l1TauJetToken, l1TauJet);
0990 
0991     if (!l1TauJet.isValid()) {
0992       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1JetParticleCollection with input tag " << m_l1TauJetTag
0993                                          << "\nrequested in configuration, but not found in the event."
0994                                          << "\nNo TauJet added to filterproduct." << std::endl;
0995 
0996     } else {
0997       for (std::list<int>::const_iterator itObj = listTauJet.begin(); itObj != listTauJet.end(); ++itObj) {
0998         filterproduct.addObject(trigger::TriggerL1TauJet, l1extra::L1JetParticleRef(l1TauJet, *itObj));
0999       }
1000     }
1001   }
1002 
1003   // isotau jets
1004   if (!listIsoTauJet.empty()) {
1005     edm::Handle<l1extra::L1JetParticleCollection> l1IsoTauJet;
1006     iEvent.getByToken(m_l1IsoTauJetToken, l1IsoTauJet);
1007 
1008     if (!l1IsoTauJet.isValid()) {
1009       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1JetParticleCollection with input tag " << m_l1IsoTauJetTag
1010                                          << "\nrequested in configuration, but not found in the event."
1011                                          << "\nNo IsoTauJet added to filterproduct." << std::endl;
1012 
1013     } else {
1014       for (std::list<int>::const_iterator itObj = listIsoTauJet.begin(); itObj != listIsoTauJet.end(); ++itObj) {
1015         filterproduct.addObject(trigger::TriggerL1TauJet, l1extra::L1JetParticleRef(l1IsoTauJet, *itObj));
1016       }
1017     }
1018   }
1019 
1020   // energy sums
1021   if (!listETM.empty()) {
1022     edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
1023     iEvent.getByToken(m_l1EtMissMETToken, l1EnergySums);
1024 
1025     if (!l1EnergySums.isValid()) {
1026       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMETTag
1027                                          << "\nrequested in configuration, but not found in the event."
1028                                          << "\nNo ETM added to filterproduct." << std::endl;
1029     } else if (l1EnergySums->empty()) {
1030       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMETTag
1031                                          << "\nfound in the event but with 0 size."
1032                                          << "\nNo ETM added to filterproduct." << std::endl;
1033 
1034     } else {
1035       for (std::list<int>::const_iterator itObj = listETM.begin(); itObj != listETM.end(); ++itObj) {
1036         filterproduct.addObject(trigger::TriggerL1ETM, l1extra::L1EtMissParticleRef(l1EnergySums, *itObj));
1037       }
1038     }
1039   }
1040 
1041   if (!listETT.empty()) {
1042     edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
1043     iEvent.getByToken(m_l1EtMissMETToken, l1EnergySums);
1044 
1045     if (!l1EnergySums.isValid()) {
1046       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMETTag
1047                                          << "\nrequested in configuration, but not found in the event."
1048                                          << "\nNo ETT added to filterproduct." << std::endl;
1049     } else if (l1EnergySums->empty()) {
1050       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMETTag
1051                                          << "\nfound in the event but with 0 size."
1052                                          << "\nNo ETT added to filterproduct." << std::endl;
1053 
1054     } else {
1055       for (std::list<int>::const_iterator itObj = listETT.begin(); itObj != listETT.end(); ++itObj) {
1056         filterproduct.addObject(trigger::TriggerL1ETT, l1extra::L1EtMissParticleRef(l1EnergySums, *itObj));
1057       }
1058     }
1059   }
1060 
1061   if (!listHTT.empty()) {
1062     edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
1063     iEvent.getByToken(m_l1EtMissMHTToken, l1EnergySums);
1064 
1065     if (!l1EnergySums.isValid()) {
1066       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMHTTag
1067                                          << "\nrequested in configuration, but not found in the event."
1068                                          << "\nNo HTT added to filterproduct." << std::endl;
1069 
1070     } else if (l1EnergySums->empty()) {
1071       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMHTTag
1072                                          << "\nfound in the event but with 0 size."
1073                                          << "\nNo HTT added to filterproduct." << std::endl;
1074 
1075     } else {
1076       for (std::list<int>::const_iterator itObj = listHTT.begin(); itObj != listHTT.end(); ++itObj) {
1077         filterproduct.addObject(trigger::TriggerL1HTT, l1extra::L1EtMissParticleRef(l1EnergySums, *itObj));
1078       }
1079     }
1080   }
1081 
1082   if (!listHTM.empty()) {
1083     edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
1084     iEvent.getByToken(m_l1EtMissMHTToken, l1EnergySums);
1085 
1086     if (!l1EnergySums.isValid()) {
1087       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMHTTag
1088                                          << "\nrequested in configuration, but not found in the event."
1089                                          << "\nNo HTM added to filterproduct." << std::endl;
1090 
1091     } else if (l1EnergySums->empty()) {
1092       edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMHTTag
1093                                          << "\nfound in the event but with 0 size."
1094                                          << "\nNo HTM added to filterproduct." << std::endl;
1095 
1096     } else {
1097       for (std::list<int>::const_iterator itObj = listHTM.begin(); itObj != listHTM.end(); ++itObj) {
1098         filterproduct.addObject(trigger::TriggerL1HTM, l1extra::L1EtMissParticleRef(l1EnergySums, *itObj));
1099       }
1100     }
1101   }
1102 
1103   // TODO FIXME uncomment if block when JetCounts implemented
1104 
1105   //    // jet counts
1106   //    if (!listJetCounts.empty()) {
1107   //        edm::Handle<l1extra::L1JetCounts> l1JetCounts;
1108   //        iEvent.getByToken(m_l1CollectionsToken.label(), l1JetCounts);
1109   //
1110   //        for (std::list<int>::const_iterator itObj = listJetCounts.begin();
1111   //                itObj != listJetCounts.end(); ++itObj) {
1112   //
1113   //            filterproduct.addObject(trigger::TriggerL1JetCounts,l1extra::L1JetCountsRefProd(l1JetCounts));
1114   //                  // FIXME: RefProd!
1115   //
1116   //        }
1117   //
1118   //    }
1119 
1120   return seedsResult;
1121 }
1122 
1123 // seeding is done ignoring if a L1 object fired or not
1124 // if the event is selected at L1, fill all the L1 objects of types corresponding to the
1125 // L1 conditions from the seeding logical expression for bunch crosses F, 0, 1
1126 // directly from L1Extra and use them as seeds at HLT
1127 // method and filter return true if at least an object is filled
1128 bool HLTLevel1GTSeed::seedsL1Extra(edm::Event& iEvent, trigger::TriggerFilterObjectWithRefs& filterproduct) const {
1129   //    if (m_isDebugEnabled) {
1130   //
1131   //        LogTrace("HLTLevel1GTSeed") << "\n Printing muons from gtDigis\n " << std::endl;
1132   //
1133   //        edm::Handle<std::vector<L1MuGMTCand> > muonData;
1134   //        iEvent.getByToken("gtDigis", muonData);
1135   //
1136   //        if (!muonData.isValid()) {
1137   //            edm::LogWarning("HLTLevel1GTSeed")
1138   //                    << "\nWarning: std::vector<L1MuGMTCand> with input tag "
1139   //                    << "gtDigis"
1140   //                    << "\nrequested in configuration, but not found in the event.\n"
1141   //                    << std::endl;
1142   //        } else {
1143   //
1144   //            std::vector<L1MuGMTCand>::const_iterator itMuon;
1145   //            for (itMuon = muonData->begin(); itMuon != muonData->end(); itMuon++) {
1146   //
1147   //                LogTrace("HLTLevel1GTSeed") << (*itMuon) << std::endl;
1148   //
1149   //            }
1150   //
1151   //        }
1152   //    }
1153 
1154   // define bools to prevent entering more copies of the objects
1155   bool includeMuon = true;
1156 
1157   bool includeIsoEG = true;
1158   bool includeNoIsoEG = true;
1159 
1160   bool includeCenJet = true;
1161   bool includeForJet = true;
1162   bool includeTauJet = true;
1163   bool includeIsoTauJet = true;
1164 
1165   bool includeETM = true;
1166   bool includeETT = true;
1167   bool includeHTT = true;
1168   bool includeHTM = true;
1169 
1170   bool includeJetCounts = true;
1171 
1172   //
1173   bool objectsInFilter = false;
1174 
1175   // loop over the list of required algorithms for seeding
1176   int iAlgo = -1;
1177 
1178   for (auto const& m_l1AlgoSeed : m_l1AlgoSeeds) {
1179     //
1180     iAlgo++;
1181     //
1182     int algBit = m_l1AlgoSeed.tokenNumber;
1183     std::string algName = m_l1AlgoSeed.tokenName;
1184     bool algResult = m_l1AlgoSeed.tokenResult;
1185 
1186     LogTrace("HLTLevel1GTSeed") << "\nHLTLevel1GTSeed::hltFilter "
1187                                 << "\n  Algorithm " << algName << " with bit number " << algBit
1188                                 << " in the object map seed list"
1189                                 << "\n  Algorithm result = " << algResult << std::endl;
1190 
1191     const std::vector<const std::vector<L1GtObject>*>& algoSeedsObjTypeVec = m_l1AlgoSeedsObjType[iAlgo];
1192 
1193     int minBxInEvent = (m_l1NrBxInEvent + 1) / 2 - m_l1NrBxInEvent;
1194     int maxBxInEvent = (m_l1NrBxInEvent + 1) / 2 - 1;
1195 
1196     // loop over all object types found for an algorithm and fill the lists
1197     //
1198     for (auto condObj : algoSeedsObjTypeVec) {
1199       for (auto itObj : (*condObj)) {
1200         LogTrace("HLTLevel1GTSeed") << "  Object type in conditions from this algorithm = " << itObj << std::endl;
1201 
1202         switch (itObj) {
1203           case Mu: {
1204             if (includeMuon) {
1205               edm::Handle<l1extra::L1MuonParticleCollection> l1Muon;
1206               iEvent.getByToken(m_l1MuonToken, l1Muon);
1207 
1208               if (!l1Muon.isValid()) {
1209                 edm::LogWarning("HLTLevel1GTSeed")
1210                     << "\nWarning: L1MuonParticleCollection with input tag " << m_l1MuonTag
1211                     << "\nrequested in configuration, but not found in the event."
1212                     << "\nNo muon added to filterproduct." << std::endl;
1213 
1214               } else {
1215                 int iObj = -1;
1216                 for (auto objIter = l1Muon->begin(); objIter != l1Muon->end(); ++objIter) {
1217                   iObj++;
1218 
1219                   int bxNr = objIter->bx();
1220                   if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
1221                     objectsInFilter = true;
1222                     filterproduct.addObject(trigger::TriggerL1Mu, l1extra::L1MuonParticleRef(l1Muon, iObj));
1223                   }
1224                 }
1225               }
1226               includeMuon = false;
1227             }
1228           }
1229 
1230           break;
1231           case IsoEG: {
1232             if (includeIsoEG) {
1233               edm::Handle<l1extra::L1EmParticleCollection> l1IsoEG;
1234               iEvent.getByToken(m_l1IsoEGToken, l1IsoEG);
1235 
1236               if (!l1IsoEG.isValid()) {
1237                 edm::LogWarning("HLTLevel1GTSeed")
1238                     << "\nWarning: L1EmParticleCollection with input tag " << m_l1IsoEGTag
1239                     << "\nrequested in configuration, but not found in the event."
1240                     << "\nNo IsoEG added to filterproduct." << std::endl;
1241 
1242               } else {
1243                 int iObj = -1;
1244                 for (auto objIter = l1IsoEG->begin(); objIter != l1IsoEG->end(); ++objIter) {
1245                   iObj++;
1246 
1247                   int bxNr = objIter->bx();
1248                   if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
1249                     objectsInFilter = true;
1250                     filterproduct.addObject(trigger::TriggerL1IsoEG, l1extra::L1EmParticleRef(l1IsoEG, iObj));
1251                   }
1252                 }
1253               }
1254               includeIsoEG = false;
1255             }
1256 
1257           } break;
1258           case NoIsoEG: {
1259             if (includeNoIsoEG) {
1260               edm::Handle<l1extra::L1EmParticleCollection> l1NoIsoEG;
1261               iEvent.getByToken(m_l1NoIsoEGToken, l1NoIsoEG);
1262 
1263               if (!l1NoIsoEG.isValid()) {
1264                 edm::LogWarning("HLTLevel1GTSeed")
1265                     << "\nWarning: L1EmParticleCollection with input tag " << m_l1NoIsoEGTag
1266                     << "\nrequested in configuration, but not found in the event."
1267                     << "\nNo NoIsoEG added to filterproduct." << std::endl;
1268 
1269               } else {
1270                 int iObj = -1;
1271                 for (auto objIter = l1NoIsoEG->begin(); objIter != l1NoIsoEG->end(); ++objIter) {
1272                   iObj++;
1273 
1274                   int bxNr = objIter->bx();
1275                   if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
1276                     objectsInFilter = true;
1277                     filterproduct.addObject(trigger::TriggerL1NoIsoEG, l1extra::L1EmParticleRef(l1NoIsoEG, iObj));
1278                   }
1279                 }
1280               }
1281               includeNoIsoEG = false;
1282             }
1283 
1284           } break;
1285           case CenJet: {
1286             if (includeCenJet) {
1287               edm::Handle<l1extra::L1JetParticleCollection> l1CenJet;
1288               iEvent.getByToken(m_l1CenJetToken, l1CenJet);
1289 
1290               if (!l1CenJet.isValid()) {
1291                 edm::LogWarning("HLTLevel1GTSeed")
1292                     << "\nWarning: L1JetParticleCollection with input tag " << m_l1CenJetTag
1293                     << "\nrequested in configuration, but not found in the event."
1294                     << "\nNo CenJet added to filterproduct." << std::endl;
1295 
1296               } else {
1297                 int iObj = -1;
1298                 for (auto objIter = l1CenJet->begin(); objIter != l1CenJet->end(); ++objIter) {
1299                   iObj++;
1300 
1301                   int bxNr = objIter->bx();
1302                   if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
1303                     objectsInFilter = true;
1304                     filterproduct.addObject(trigger::TriggerL1CenJet, l1extra::L1JetParticleRef(l1CenJet, iObj));
1305                   }
1306                 }
1307               }
1308               includeCenJet = false;
1309             }
1310 
1311           }
1312 
1313           break;
1314           case ForJet: {
1315             if (includeForJet) {
1316               edm::Handle<l1extra::L1JetParticleCollection> l1ForJet;
1317               iEvent.getByToken(m_l1ForJetToken, l1ForJet);
1318 
1319               if (!l1ForJet.isValid()) {
1320                 edm::LogWarning("HLTLevel1GTSeed")
1321                     << "\nWarning: L1JetParticleCollection with input tag " << m_l1ForJetTag
1322                     << "\nrequested in configuration, but not found in the event."
1323                     << "\nNo ForJet added to filterproduct." << std::endl;
1324 
1325               } else {
1326                 int iObj = -1;
1327                 for (auto objIter = l1ForJet->begin(); objIter != l1ForJet->end(); ++objIter) {
1328                   iObj++;
1329 
1330                   int bxNr = objIter->bx();
1331                   if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
1332                     objectsInFilter = true;
1333                     filterproduct.addObject(trigger::TriggerL1ForJet, l1extra::L1JetParticleRef(l1ForJet, iObj));
1334                   }
1335                 }
1336               }
1337               includeForJet = false;
1338             }
1339 
1340           }
1341 
1342           break;
1343           case TauJet: {
1344             if (includeTauJet) {
1345               edm::Handle<l1extra::L1JetParticleCollection> l1TauJet;
1346               iEvent.getByToken(m_l1TauJetToken, l1TauJet);
1347 
1348               if (!l1TauJet.isValid()) {
1349                 edm::LogWarning("HLTLevel1GTSeed")
1350                     << "\nWarning: L1JetParticleCollection with input tag " << m_l1TauJetTag
1351                     << "\nrequested in configuration, but not found in the event."
1352                     << "\nNo TauJet added to filterproduct." << std::endl;
1353 
1354               } else {
1355                 int iObj = -1;
1356                 for (auto objIter = l1TauJet->begin(); objIter != l1TauJet->end(); ++objIter) {
1357                   iObj++;
1358 
1359                   int bxNr = objIter->bx();
1360                   if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
1361                     objectsInFilter = true;
1362                     filterproduct.addObject(trigger::TriggerL1TauJet, l1extra::L1JetParticleRef(l1TauJet, iObj));
1363                   }
1364                 }
1365               }
1366               includeTauJet = false;
1367             }
1368           } break;
1369           case HfRingEtSums: {
1370             if (includeIsoTauJet) {
1371               edm::Handle<l1extra::L1JetParticleCollection> l1IsoTauJet;
1372               iEvent.getByToken(m_l1IsoTauJetToken, l1IsoTauJet);
1373 
1374               if (!l1IsoTauJet.isValid()) {
1375                 edm::LogWarning("HLTLevel1GTSeed")
1376                     << "\nWarning: L1JetParticleCollection with input tag " << m_l1IsoTauJetTag
1377                     << "\nrequested in configuration, but not found in the event."
1378                     << "\nNo IsoTauJet added to filterproduct." << std::endl;
1379 
1380               } else {
1381                 int iObj = -1;
1382                 for (auto objIter = l1IsoTauJet->begin(); objIter != l1IsoTauJet->end(); ++objIter) {
1383                   iObj++;
1384 
1385                   int bxNr = objIter->bx();
1386                   if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
1387                     objectsInFilter = true;
1388                     filterproduct.addObject(trigger::TriggerL1TauJet, l1extra::L1JetParticleRef(l1IsoTauJet, iObj));
1389                   }
1390                 }
1391               }
1392               includeIsoTauJet = false;
1393             }
1394 
1395           }
1396 
1397           break;
1398           case ETM: {
1399             if (includeETM) {
1400               edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
1401               iEvent.getByToken(m_l1EtMissMETToken, l1EnergySums);
1402 
1403               if (!l1EnergySums.isValid()) {
1404                 edm::LogWarning("HLTLevel1GTSeed")
1405                     << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMETTag
1406                     << "\nrequested in configuration, but not found in the event."
1407                     << "\nNo ETM added to filterproduct." << std::endl;
1408 
1409               } else if (l1EnergySums->empty()) {
1410                 edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1EtMissParticleCollection with input tag "
1411                                                    << m_l1EtMissMETTag << "\nfound in the event but with 0 size."
1412                                                    << "\nNo ETM added to filterproduct." << std::endl;
1413 
1414               } else {
1415                 int iObj = -1;
1416                 for (auto objIter = l1EnergySums->begin(); objIter != l1EnergySums->end(); ++objIter) {
1417                   iObj++;
1418 
1419                   int bxNr = objIter->bx();
1420                   if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
1421                     objectsInFilter = true;
1422                     filterproduct.addObject(trigger::TriggerL1ETM, l1extra::L1EtMissParticleRef(l1EnergySums, iObj));
1423                   }
1424                 }
1425               }
1426               includeETM = false;
1427             }
1428 
1429           }
1430 
1431           break;
1432           case ETT: {
1433             if (includeETT) {
1434               edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
1435               iEvent.getByToken(m_l1EtMissMETToken, l1EnergySums);
1436 
1437               if (!l1EnergySums.isValid()) {
1438                 edm::LogWarning("HLTLevel1GTSeed")
1439                     << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMETTag
1440                     << "\nrequested in configuration, but not found in the event."
1441                     << "\nNo ETT added to filterproduct." << std::endl;
1442 
1443               } else if (l1EnergySums->empty()) {
1444                 edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1EtMissParticleCollection with input tag "
1445                                                    << m_l1EtMissMETTag << "\nfound in the event but with 0 size."
1446                                                    << "\nNo ETT added to filterproduct." << std::endl;
1447 
1448               } else {
1449                 int iObj = -1;
1450                 for (auto objIter = l1EnergySums->begin(); objIter != l1EnergySums->end(); ++objIter) {
1451                   iObj++;
1452 
1453                   int bxNr = objIter->bx();
1454                   if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
1455                     objectsInFilter = true;
1456                     filterproduct.addObject(trigger::TriggerL1ETT, l1extra::L1EtMissParticleRef(l1EnergySums, iObj));
1457                   }
1458                 }
1459               }
1460               includeETT = false;
1461             }
1462 
1463           }
1464 
1465           break;
1466           case HTT: {
1467             if (includeHTT) {
1468               edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
1469               iEvent.getByToken(m_l1EtMissMHTToken, l1EnergySums);
1470 
1471               if (!l1EnergySums.isValid()) {
1472                 edm::LogWarning("HLTLevel1GTSeed")
1473                     << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMHTTag
1474                     << "\nrequested in configuration, but not found in the event."
1475                     << "\nNo HTT added to filterproduct." << std::endl;
1476 
1477               } else if (l1EnergySums->empty()) {
1478                 edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1EtMissParticleCollection with input tag "
1479                                                    << m_l1EtMissMHTTag << "\nfound in the event but with 0 size."
1480                                                    << "\nNo HTT added to filterproduct." << std::endl;
1481 
1482               } else {
1483                 int iObj = -1;
1484                 for (auto objIter = l1EnergySums->begin(); objIter != l1EnergySums->end(); ++objIter) {
1485                   iObj++;
1486 
1487                   int bxNr = objIter->bx();
1488                   if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
1489                     objectsInFilter = true;
1490                     filterproduct.addObject(trigger::TriggerL1HTT, l1extra::L1EtMissParticleRef(l1EnergySums, iObj));
1491                   }
1492                 }
1493               }
1494               includeHTT = false;
1495             }
1496           }
1497 
1498           break;
1499           case HTM: {
1500             if (includeHTM) {
1501               edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
1502               iEvent.getByToken(m_l1EtMissMHTToken, l1EnergySums);
1503 
1504               if (!l1EnergySums.isValid()) {
1505                 edm::LogWarning("HLTLevel1GTSeed")
1506                     << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMHTTag
1507                     << "\nrequested in configuration, but not found in the event."
1508                     << "\nNo HTM added to filterproduct." << std::endl;
1509 
1510               } else if (l1EnergySums->empty()) {
1511                 edm::LogWarning("HLTLevel1GTSeed") << "\nWarning: L1EtMissParticleCollection with input tag "
1512                                                    << m_l1EtMissMHTTag << "\nfound in the event but with 0 size."
1513                                                    << "\nNo HTM added to filterproduct." << std::endl;
1514 
1515               } else {
1516                 int iObj = -1;
1517                 for (auto objIter = l1EnergySums->begin(); objIter != l1EnergySums->end(); ++objIter) {
1518                   iObj++;
1519 
1520                   int bxNr = objIter->bx();
1521                   if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
1522                     objectsInFilter = true;
1523                     filterproduct.addObject(trigger::TriggerL1HTM, l1extra::L1EtMissParticleRef(l1EnergySums, iObj));
1524                   }
1525                 }
1526               }
1527               includeHTM = false;
1528             }
1529           }
1530 
1531           break;
1532           case JetCounts: {
1533             if (includeJetCounts) {
1534               // do nothing, JetCounts do not exist now
1535             }
1536           }
1537 
1538           break;
1539           default: {
1540             // should not arrive here
1541 
1542             LogDebug("HLTLevel1GTSeed") << "\n    HLTLevel1GTSeed::hltFilter "
1543                                         << "\n      Unknown object of type " << itObj << " in the seed list."
1544                                         << std::endl;
1545           } break;
1546         }
1547       }
1548     }
1549 
1550     LogTrace("HLTLevel1GTSeed") << std::endl;
1551   }
1552 
1553   return objectsInFilter;
1554 }
1555 
1556 // detailed print of filter content
1557 void HLTLevel1GTSeed::dumpTriggerFilterObjectWithRefs(trigger::TriggerFilterObjectWithRefs& filterproduct) const {
1558   LogDebug("HLTLevel1GTSeed") << "\nHLTLevel1GTSeed::hltFilter "
1559                               << "\n  Dump TriggerFilterObjectWithRefs\n"
1560                               << std::endl;
1561 
1562   std::vector<l1extra::L1MuonParticleRef> seedsL1Mu;
1563 
1564   std::vector<l1extra::L1EmParticleRef> seedsL1IsoEG;
1565   std::vector<l1extra::L1EmParticleRef> seedsL1NoIsoEG;
1566 
1567   std::vector<l1extra::L1JetParticleRef> seedsL1CenJet;
1568   std::vector<l1extra::L1JetParticleRef> seedsL1ForJet;
1569   std::vector<l1extra::L1JetParticleRef> seedsL1TauJet;
1570   std::vector<l1extra::L1JetParticleRef> seedsL1IsoTauJet;
1571 
1572   std::vector<l1extra::L1EtMissParticleRef> seedsL1ETM;
1573   std::vector<l1extra::L1EtMissParticleRef> seedsL1ETT;
1574   std::vector<l1extra::L1EtMissParticleRef> seedsL1HTT;
1575   std::vector<l1extra::L1EtMissParticleRef> seedsL1HTM;
1576 
1577   filterproduct.getObjects(trigger::TriggerL1Mu, seedsL1Mu);
1578   const size_t sizeSeedsL1Mu = seedsL1Mu.size();
1579 
1580   filterproduct.getObjects(trigger::TriggerL1IsoEG, seedsL1IsoEG);
1581   const size_t sizeSeedsL1IsoEG = seedsL1IsoEG.size();
1582 
1583   filterproduct.getObjects(trigger::TriggerL1NoIsoEG, seedsL1NoIsoEG);
1584   const size_t sizeSeedsL1NoIsoEG = seedsL1NoIsoEG.size();
1585 
1586   filterproduct.getObjects(trigger::TriggerL1CenJet, seedsL1CenJet);
1587   const size_t sizeSeedsL1CenJet = seedsL1CenJet.size();
1588 
1589   filterproduct.getObjects(trigger::TriggerL1ForJet, seedsL1ForJet);
1590   const size_t sizeSeedsL1ForJet = seedsL1ForJet.size();
1591 
1592   filterproduct.getObjects(trigger::TriggerL1TauJet, seedsL1TauJet);
1593   const size_t sizeSeedsL1TauJet = seedsL1TauJet.size();
1594 
1595   filterproduct.getObjects(trigger::TriggerL1TauJet, seedsL1IsoTauJet);
1596   const size_t sizeSeedsL1IsoTauJet = seedsL1IsoTauJet.size();
1597 
1598   filterproduct.getObjects(trigger::TriggerL1ETM, seedsL1ETM);
1599   const size_t sizeSeedsL1ETM = seedsL1ETM.size();
1600 
1601   filterproduct.getObjects(trigger::TriggerL1ETT, seedsL1ETT);
1602   const size_t sizeSeedsL1ETT = seedsL1ETT.size();
1603 
1604   filterproduct.getObjects(trigger::TriggerL1HTT, seedsL1HTT);
1605   const size_t sizeSeedsL1HTT = seedsL1HTT.size();
1606 
1607   filterproduct.getObjects(trigger::TriggerL1HTM, seedsL1HTM);
1608   const size_t sizeSeedsL1HTM = seedsL1HTM.size();
1609 
1610   LogTrace("HLTLevel1GTSeed") << "  L1Mu seeds:      " << sizeSeedsL1Mu << "\n"
1611                               << "  L1IsoEG seeds:   " << sizeSeedsL1IsoEG << "\n"
1612                               << "  L1NoIsoEG seeds: " << sizeSeedsL1NoIsoEG << "\n"
1613                               << "  L1CenJet seeds:  " << sizeSeedsL1CenJet << "\n"
1614                               << "  L1ForJet seeds:  " << sizeSeedsL1ForJet << "\n"
1615                               << "  L1TauJet seeds:  " << sizeSeedsL1TauJet << "\n"
1616                               << "  L1IsoTauJet seeds:  " << sizeSeedsL1IsoTauJet << "\n"
1617                               << "  L1ETM seeds:     " << sizeSeedsL1ETM << "\n"
1618                               << "  L1ETT seeds:     " << sizeSeedsL1ETT << "\n"
1619                               << "  L1HTT seeds:     " << sizeSeedsL1HTT << "\n"
1620                               << "  L1HTM seeds:     " << sizeSeedsL1HTM << "\n"
1621                               << std::endl;
1622 
1623   for (size_t i = 0; i != sizeSeedsL1Mu; i++) {
1624     l1extra::L1MuonParticleRef obj = l1extra::L1MuonParticleRef(seedsL1Mu[i]);
1625 
1626     LogTrace("HLTLevel1GTSeed") << "L1Mu     "
1627                                 << "\t"
1628                                 << "q*PT = " << obj->charge() * obj->pt() << "\t"
1629                                 << "eta =  " << obj->eta() << "\t"
1630                                 << "phi =  " << obj->phi() << "\t"
1631                                 << "BX = " << obj->bx();
1632   }
1633 
1634   for (size_t i = 0; i != sizeSeedsL1IsoEG; i++) {
1635     l1extra::L1EmParticleRef obj = l1extra::L1EmParticleRef(seedsL1IsoEG[i]);
1636 
1637     LogTrace("HLTLevel1GTSeed") << "L1IsoEG   "
1638                                 << "\t"
1639                                 << "ET =   " << obj->et() << "\t"
1640                                 << "eta =  " << obj->eta() << "\t"
1641                                 << "phi =  " << obj->phi() << "\t"
1642                                 << "BX = " << obj->bx();
1643     ;
1644   }
1645 
1646   for (size_t i = 0; i != sizeSeedsL1NoIsoEG; i++) {
1647     l1extra::L1EmParticleRef obj = l1extra::L1EmParticleRef(seedsL1NoIsoEG[i]);
1648 
1649     LogTrace("HLTLevel1GTSeed") << "L1NoIsoEG"
1650                                 << "\t"
1651                                 << "ET =   " << obj->et() << "\t"
1652                                 << "eta =  " << obj->eta() << "\t"
1653                                 << "phi =  " << obj->phi() << "\t"
1654                                 << "BX = " << obj->bx();
1655   }
1656 
1657   for (size_t i = 0; i != sizeSeedsL1CenJet; i++) {
1658     l1extra::L1JetParticleRef obj = l1extra::L1JetParticleRef(seedsL1CenJet[i]);
1659 
1660     LogTrace("HLTLevel1GTSeed") << "L1CenJet "
1661                                 << "\t"
1662                                 << "ET =   " << obj->et() << "\t"
1663                                 << "eta =  " << obj->eta() << "\t"
1664                                 << "phi =  " << obj->phi() << "\t"
1665                                 << "BX = " << obj->bx();
1666   }
1667 
1668   for (size_t i = 0; i != sizeSeedsL1ForJet; i++) {
1669     l1extra::L1JetParticleRef obj = l1extra::L1JetParticleRef(seedsL1ForJet[i]);
1670 
1671     LogTrace("HLTLevel1GTSeed") << "L1ForJet "
1672                                 << "\t"
1673                                 << "ET =   " << obj->et() << "\t"
1674                                 << "eta =  " << obj->eta() << "\t"
1675                                 << "phi =  " << obj->phi() << "\t"
1676                                 << "BX = " << obj->bx();
1677   }
1678 
1679   for (size_t i = 0; i != sizeSeedsL1TauJet; i++) {
1680     l1extra::L1JetParticleRef obj = l1extra::L1JetParticleRef(seedsL1TauJet[i]);
1681 
1682     LogTrace("HLTLevel1GTSeed") << "L1TauJet "
1683                                 << "\t"
1684                                 << "ET =   " << obj->et() << "\t"
1685                                 << "eta =  " << obj->eta() << "\t"
1686                                 << "phi =  " << obj->phi() << "\t"
1687                                 << "BX = " << obj->bx();
1688   }
1689 
1690   for (size_t i = 0; i != sizeSeedsL1IsoTauJet; i++) {
1691     l1extra::L1JetParticleRef obj = l1extra::L1JetParticleRef(seedsL1IsoTauJet[i]);
1692 
1693     LogTrace("HLTLevel1GTSeed") << "L1IsoTauJet "
1694                                 << "\t"
1695                                 << "ET =   " << obj->et() << "\t"
1696                                 << "eta =  " << obj->eta() << "\t"
1697                                 << "phi =  " << obj->phi() << "\t"
1698                                 << "BX = " << obj->bx();
1699   }
1700 
1701   for (size_t i = 0; i != sizeSeedsL1ETM; i++) {
1702     l1extra::L1EtMissParticleRef obj = l1extra::L1EtMissParticleRef(seedsL1ETM[i]);
1703 
1704     LogTrace("HLTLevel1GTSeed") << "L1ETM    "
1705                                 << "\t"
1706                                 << "ET =   " << obj->etMiss() << "\t"
1707                                 << "phi =  " << obj->phi() << "BX =  " << obj->bx();
1708   }
1709 
1710   for (size_t i = 0; i != sizeSeedsL1ETT; i++) {
1711     l1extra::L1EtMissParticleRef obj = l1extra::L1EtMissParticleRef(seedsL1ETT[i]);
1712 
1713     LogTrace("HLTLevel1GTSeed") << "L1ETT    "
1714                                 << "\t"
1715                                 << "ET =   " << obj->etTotal() << "\t"
1716                                 << "BX = " << obj->bx();
1717   }
1718 
1719   for (size_t i = 0; i != sizeSeedsL1HTT; i++) {
1720     l1extra::L1EtMissParticleRef obj = l1extra::L1EtMissParticleRef(seedsL1HTT[i]);
1721 
1722     LogTrace("HLTLevel1GTSeed") << "L1HTT    "
1723                                 << "\t"
1724                                 << "ET =   " << obj->etTotal() << "\t"
1725                                 << "BX = " << obj->bx();
1726   }
1727 
1728   for (size_t i = 0; i != sizeSeedsL1HTM; i++) {
1729     l1extra::L1EtMissParticleRef obj = l1extra::L1EtMissParticleRef(seedsL1HTM[i]);
1730 
1731     LogTrace("HLTLevel1GTSeed") << "L1HTM    "
1732                                 << "\t"
1733                                 << "ET =   " << obj->etMiss() << "\t"
1734                                 << "phi =  " << obj->phi() << "BX =  " << obj->bx();
1735   }
1736 
1737   LogTrace("HLTLevel1GTSeed") << " \n\n" << std::endl;
1738 }
1739 
1740 // register as framework plugin
1741 #include "FWCore/Framework/interface/MakerMacros.h"
1742 DEFINE_FWK_MODULE(HLTLevel1GTSeed);