CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/HLTrigger/HLTfilters/src/HLTLevel1GTSeed.cc

Go to the documentation of this file.
00001 
00019 // this class header
00020 #include "HLTrigger/HLTfilters/interface/HLTLevel1GTSeed.h"
00021 
00022 // system include files
00023 #include <string>
00024 #include <list>
00025 #include <vector>
00026 #include <algorithm>
00027 
00028 #include <iostream>
00029 #include <sstream>
00030 
00031 // user include files
00032 #include "DataFormats/Common/interface/Handle.h"
00033 #include "DataFormats/Common/interface/Ref.h"
00034 
00035 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
00036 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00037 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h"
00038 
00039 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h"
00040 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h"
00041 
00042 #include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h"
00043 
00044 #include "DataFormats/L1Trigger/interface/L1EmParticleFwd.h"
00045 #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
00046 #include "DataFormats/L1Trigger/interface/L1MuonParticleFwd.h"
00047 #include "DataFormats/L1Trigger/interface/L1EtMissParticleFwd.h"
00048 
00049 #include "DataFormats/L1Trigger/interface/L1EmParticle.h"
00050 #include "DataFormats/L1Trigger/interface/L1JetParticle.h"
00051 #include "DataFormats/L1Trigger/interface/L1MuonParticle.h"
00052 #include "DataFormats/L1Trigger/interface/L1EtMissParticle.h"
00053 
00054 #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
00055 
00056 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
00057 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
00058 
00059 #include "CondFormats/L1TObjects/interface/L1GtTriggerMask.h"
00060 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h"
00061 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskTechTrigRcd.h"
00062 
00063 #include "CondFormats/L1TObjects/interface/L1GtCondition.h"
00064 
00065 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00066 #include "FWCore/Utilities/interface/InputTag.h"
00067 
00068 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00069 #include "FWCore/MessageLogger/interface/MessageDrop.h"
00070 
00071 #include "FWCore/Utilities/interface/Exception.h"
00072 
00073 #include "FWCore/Framework/interface/EventSetup.h"
00074 #include "FWCore/Framework/interface/ESHandle.h"
00075 
00076 // constructors
00077 HLTLevel1GTSeed::HLTLevel1GTSeed(const edm::ParameterSet& parSet) :
00078             //    seeding done via L1 trigger object maps, with objects that fired
00079             m_l1UseL1TriggerObjectMaps(parSet.getParameter<bool> (
00080                     "L1UseL1TriggerObjectMaps")),
00081 
00082             // option used forL1UseL1TriggerObjectMaps = False only
00083             m_l1NrBxInEvent(parSet.getParameter<int> (
00084                     "L1NrBxInEvent")),
00085 
00086             // seeding done via technical trigger bits, if value is "true"
00087             m_l1TechTriggerSeeding(parSet.getParameter<bool> (
00088                     "L1TechTriggerSeeding")),
00089 
00090             // seeding uses algorithm aliases instead of algorithm names, if value is "true";
00091             m_l1UseAliasesForSeeding(parSet.getParameter<bool> (
00092                     "L1UseAliasesForSeeding")),
00093 
00094             // logical expression for the required L1 algorithms
00095             m_l1SeedsLogicalExpression(parSet.getParameter<std::string> (
00096                     "L1SeedsLogicalExpression")),
00097 
00098             // InputTag for the L1 Global Trigger DAQ readout record
00099             m_l1GtReadoutRecordTag(parSet.getParameter<edm::InputTag> (
00100                     "L1GtReadoutRecordTag")),
00101 
00102             // InputTag for L1 Global Trigger object maps
00103             m_l1GtObjectMapTag(parSet.getParameter<edm::InputTag> (
00104                     "L1GtObjectMapTag")),
00105 
00106             // InputTag for L1 particle collections (except muon)
00107             m_l1CollectionsTag(parSet.getParameter<edm::InputTag> (
00108                     "L1CollectionsTag")),
00109 
00110             // InputTag for L1 muon collection
00111             m_l1MuonCollectionTag(parSet.getParameter<edm::InputTag> (
00112                     "L1MuonCollectionTag")),
00113 
00115             m_l1MuonTag(edm::InputTag(m_l1MuonCollectionTag.label())),
00116             m_l1ExtraTag(edm::InputTag(m_l1CollectionsTag.label())),
00117             m_l1IsoEGTag(edm::InputTag(m_l1CollectionsTag.label(), "Isolated")),
00118             m_l1NoIsoEGTag(edm::InputTag(m_l1CollectionsTag.label(),
00119                     "NonIsolated")), m_l1CenJetTag(edm::InputTag(
00120                     m_l1CollectionsTag.label(), "Central")), m_l1ForJetTag(
00121                     edm::InputTag(m_l1CollectionsTag.label(), "Forward")),
00122             m_l1TauJetTag(edm::InputTag(m_l1CollectionsTag.label(), "Tau")),
00123             m_l1EtMissMET(edm::InputTag(m_l1CollectionsTag.label(), "MET")),
00124             m_l1EtMissMHT(edm::InputTag(m_l1CollectionsTag.label(), "MHT")),
00125 
00126             // save tags to TriggerFilterObjectWithRefs
00127             saveTags_(parSet.getUntrackedParameter<bool> ("saveTags", true)),
00128             m_isDebugEnabled(edm::isDebugEnabled()) {
00129     if (m_l1SeedsLogicalExpression != "L1GlobalDecision") {
00130 
00131         // check also the logical expression - add/remove spaces if needed
00132         m_l1AlgoLogicParser = L1GtLogicParser(m_l1SeedsLogicalExpression);
00133 
00134         // list of required algorithms for seeding
00135         // dummy values for tokenNumber and tokenResult
00136         m_l1AlgoSeeds.reserve((m_l1AlgoLogicParser.operandTokenVector()).size());
00137         m_l1AlgoSeeds = m_l1AlgoLogicParser.expressionSeedsOperandList();
00138         size_t l1AlgoSeedsSize = m_l1AlgoSeeds.size();
00139 
00140         //
00141         m_l1AlgoSeedsRpn.reserve(l1AlgoSeedsSize);
00142         m_l1AlgoSeedsObjType.reserve(l1AlgoSeedsSize);
00143     }
00144 
00145     // for seeding via technical triggers, convert the "name" to tokenNumber
00146     // (seeding via bit numbers)
00147     if (m_l1TechTriggerSeeding) {
00148         convertStringToBitNumber();
00149     }
00150 
00151     LogDebug("HLTLevel1GTSeed") << "\n"
00152             << "L1 Seeding using L1 trigger object maps:       "
00153             << m_l1UseL1TriggerObjectMaps << "\n"
00154             << "  if false: seeding with L1Extra\n"
00155             << "Number of BxInEvent when seeding with L1Extra: "
00156             << m_l1NrBxInEvent << "\n"
00157             << "  aka w/o object maps\n " << "\n"
00158             << "L1 Seeding via Technical Triggers:             "
00159             << m_l1TechTriggerSeeding << "\n"
00160             << "L1 Seeding uses algorithm aliases:             "
00161             << m_l1UseAliasesForSeeding << "\n"
00162             << "L1 Seeds Logical Expression:                   " << "\n      "
00163             << m_l1SeedsLogicalExpression << "\n"
00164             << "Input tag for L1 GT DAQ record:                "
00165             << m_l1GtReadoutRecordTag << " \n"
00166             << "Input tag for L1 GT object map record:         "
00167             << m_l1GtObjectMapTag << " \n"
00168             << "Input tag for L1 extra collections:            "
00169             << m_l1CollectionsTag << " \n"
00170             << "Input tag for L1 muon  collections:            "
00171             << m_l1MuonCollectionTag << " \n" << std::endl;
00172 
00173     // register the products
00174     produces<trigger::TriggerFilterObjectWithRefs>();
00175 
00176     // initialize cached IDs
00177     m_l1GtMenuCacheID = 0ULL;
00178 
00179     m_l1GtTmAlgoCacheID = 0ULL;
00180     m_l1GtTmTechCacheID = 0ULL;
00181 
00182 }
00183 
00184 // destructor
00185 HLTLevel1GTSeed::~HLTLevel1GTSeed() {
00186     // empty now
00187 }
00188 
00189 // member functions
00190 
00191 bool HLTLevel1GTSeed::filter(edm::Event& iEvent, const edm::EventSetup& evSetup) {
00192 
00193     // all HLT filters must create and fill a HLT filter object,
00194     // recording any reconstructed physics objects satisfying
00195     // this HLT filter, and place it in the event.
00196 
00197     // the filter object
00198     std::auto_ptr<trigger::TriggerFilterObjectWithRefs> filterObject(
00199             new trigger::TriggerFilterObjectWithRefs(path(), module()));
00200     if (saveTags_) {
00201         filterObject->addCollectionTag(m_l1MuonTag);
00202         filterObject->addCollectionTag(m_l1ExtraTag);
00203         filterObject->addCollectionTag(m_l1IsoEGTag);
00204         filterObject->addCollectionTag(m_l1NoIsoEGTag);
00205         filterObject->addCollectionTag(m_l1CenJetTag);
00206         filterObject->addCollectionTag(m_l1ForJetTag);
00207         filterObject->addCollectionTag(m_l1TauJetTag);
00208         filterObject->addCollectionTag(m_l1EtMissMET);
00209         filterObject->addCollectionTag(m_l1EtMissMHT);
00210     }
00211 
00212     // get L1GlobalTriggerReadoutRecord and GT decision
00213     edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecord;
00214     iEvent.getByLabel(m_l1GtReadoutRecordTag, gtReadoutRecord);
00215     const L1GlobalTriggerReadoutRecord* gtReadoutRecordPtr =
00216             gtReadoutRecord.product();
00217 
00218     if (!gtReadoutRecord.isValid()) {
00219         edm::LogWarning("HLTLevel1GTSeed")
00220                 << "\nWarning: L1GlobalTriggerReadoutRecord with input tag "
00221                 << m_l1GtReadoutRecordTag
00222                 << "\nrequested in configuration, but not found in the event."
00223                 << std::endl;
00224 
00225         iEvent.put(filterObject);
00226         return false;
00227     }
00228 
00229     //
00230     boost::uint16_t gtFinalOR = gtReadoutRecord->finalOR();
00231     int physicsDaqPartition = 0;
00232     bool gtDecision =
00233             static_cast<bool> (gtFinalOR & (1 << physicsDaqPartition));
00234 
00235     // GT global decision "false" possible only when running on MC or on random triggers
00236     if (!gtDecision) {
00237 
00238         iEvent.put(filterObject);
00239         return false;
00240 
00241     } else {
00242 
00243         // by convention, "L1GlobalDecision" logical expression means global decision
00244         if (m_l1SeedsLogicalExpression == "L1GlobalDecision") {
00245 
00246             // return the full L1GlobalTriggerObjectMapRecord in filter format FIXME
00247             iEvent.put(filterObject);
00248 
00249             return true;
00250 
00251         }
00252 
00253     }
00254 
00255     // seeding done via technical trigger bits
00256     if (m_l1TechTriggerSeeding) {
00257 
00258         // get / update the trigger mask from the EventSetup
00259         // local cache & check on cacheIdentifier
00260         unsigned long long l1GtTmTechCacheID = evSetup.get<
00261                 L1GtTriggerMaskTechTrigRcd>().cacheIdentifier();
00262 
00263         if (m_l1GtTmTechCacheID != l1GtTmTechCacheID) {
00264 
00265             edm::ESHandle<L1GtTriggerMask> l1GtTmTech;
00266             evSetup.get<L1GtTriggerMaskTechTrigRcd>().get(l1GtTmTech);
00267             m_l1GtTmTech = l1GtTmTech.product();
00268 
00269             m_triggerMaskTechTrig = m_l1GtTmTech->gtTriggerMask();
00270 
00271             m_l1GtTmTechCacheID = l1GtTmTechCacheID;
00272 
00273         }
00274 
00275         // get Global Trigger technical trigger word, update the tokenResult members
00276         // from m_l1AlgoLogicParser and get the result for the logical expression
00277         const std::vector<bool>& gtTechTrigWord =
00278                 gtReadoutRecord->technicalTriggerWord();
00279         updateAlgoLogicParser(gtTechTrigWord, m_triggerMaskTechTrig,
00280                 physicsDaqPartition);
00281 
00282         // always empty filter - GT not aware of objects for technical triggers
00283         iEvent.put(filterObject);
00284 
00285         bool seedsResult = m_l1AlgoLogicParser.expressionResult();
00286 
00287         if (seedsResult) {
00288             return true;
00289         } else {
00290             return false;
00291         }
00292 
00293     }
00294 
00295     // seeding via physics algorithms
00296 
00297     // get / update the trigger menu from the EventSetup
00298     // local cache & check on cacheIdentifier
00299 
00300     unsigned long long l1GtMenuCacheID =
00301             evSetup.get<L1GtTriggerMenuRcd>().cacheIdentifier();
00302 
00303     if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
00304 
00305         edm::ESHandle<L1GtTriggerMenu> l1GtMenu;
00306         evSetup.get<L1GtTriggerMenuRcd>().get(l1GtMenu);
00307         m_l1GtMenu = l1GtMenu.product();
00308         (const_cast<L1GtTriggerMenu*> (m_l1GtMenu))->buildGtConditionMap(); //...ugly
00309 
00310         m_l1GtMenuCacheID = l1GtMenuCacheID;
00311 
00312         const AlgorithmMap& algorithmMap = l1GtMenu->gtAlgorithmMap();
00313         const AlgorithmMap& algorithmAliasMap = l1GtMenu->gtAlgorithmAliasMap();
00314 
00315         LogTrace("HLTLevel1GTSeed") << "\n L1 trigger menu "
00316                 << l1GtMenu->gtTriggerMenuInterface()
00317                 << "\n    Number of algorithm names:   "
00318                 << (algorithmMap.size())
00319                 << "\n    Number of algorithm aliases: "
00320                 << (algorithmAliasMap.size()) << "\n" << std::endl;
00321 
00322         // update also the tokenNumber members (holding the bit numbers) from m_l1AlgoLogicParser
00323         if (m_l1UseAliasesForSeeding) {
00324             updateAlgoLogicParser(m_l1GtMenu, algorithmAliasMap);
00325         } else {
00326             updateAlgoLogicParser(m_l1GtMenu, algorithmMap);
00327         }
00328     }
00329 
00330     // get / update the trigger mask from the EventSetup
00331     // local cache & check on cacheIdentifier
00332 
00333     unsigned long long l1GtTmAlgoCacheID = evSetup.get<
00334             L1GtTriggerMaskAlgoTrigRcd>().cacheIdentifier();
00335 
00336     if (m_l1GtTmAlgoCacheID != l1GtTmAlgoCacheID) {
00337 
00338         edm::ESHandle<L1GtTriggerMask> l1GtTmAlgo;
00339         evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().get(l1GtTmAlgo);
00340         m_l1GtTmAlgo = l1GtTmAlgo.product();
00341 
00342         m_triggerMaskAlgoTrig = m_l1GtTmAlgo->gtTriggerMask();
00343 
00344         m_l1GtTmAlgoCacheID = l1GtTmAlgoCacheID;
00345 
00346     }
00347 
00348     // FinalOR is true, it was tested before
00349     if (m_l1UseL1TriggerObjectMaps) {
00350         if (!(seedsL1TriggerObjectMaps(iEvent, filterObject,
00351                 gtReadoutRecordPtr, physicsDaqPartition))) {
00352 
00353             iEvent.put(filterObject);
00354             return false;
00355         }
00356     } else {
00357         if (!(seedsL1Extra(iEvent, filterObject))) {
00358 
00359             iEvent.put(filterObject);
00360             return false;
00361         }
00362 
00363     }
00364 
00365     if (m_isDebugEnabled) {
00366         dumpTriggerFilterObjectWithRefs(filterObject);
00367     }
00368 
00369     //
00370 
00371     iEvent.put(filterObject);
00372 
00373     return true;
00374 
00375 }
00376 
00377 const std::vector<L1GtObject>* HLTLevel1GTSeed::objectTypeVec(const int chipNr,
00378         const std::string& cndName) {
00379 
00380     bool foundCond = false;
00381 
00382     const ConditionMap& conditionMap =
00383             (m_l1GtMenu->gtConditionMap()).at(chipNr);
00384 
00385     CItCond itCond = conditionMap.find(cndName);
00386     if (itCond != conditionMap.end()) {
00387         foundCond = true;
00388         return (&((itCond->second)->objectType()));
00389     }
00390 
00391     if (!foundCond) {
00392 
00393         // it should never be happen, all conditions are in the maps
00394         throw cms::Exception("FailModule") << "\nCondition " << cndName
00395                 << " not found in the condition map" << " for chip number "
00396                 << chipNr << std::endl;
00397     }
00398 
00399     // dummy return - prevent compiler warning
00400     return 0;
00401 
00402 }
00403 
00404 // for a new L1 Trigger menu, update the tokenNumber (holding the bit numbers)
00405 // from m_l1AlgoLogicParser and from m_l1AlgoSeeds, and fill the m_l1AlgoSeedsRpn vector
00406 void HLTLevel1GTSeed::updateAlgoLogicParser(const L1GtTriggerMenu* l1GtMenu,
00407         const AlgorithmMap& algorithmMap) {
00408 
00409     std::vector<L1GtLogicParser::OperandToken>& algOpTokenVector =
00410             m_l1AlgoLogicParser.operandTokenVector();
00411 
00412     size_t jSeed = 0;
00413     size_t l1AlgoSeedsSize = m_l1AlgoSeeds.size();
00414 
00415     // clear the content from the previous menu for the vector of RPN vectors m_l1AlgoSeedsRpn
00416     // and for the the vector of object-type vectors m_l1AlgoSeedsObjType
00417     m_l1AlgoSeedsRpn.clear();
00418     m_l1AlgoSeedsObjType.clear();
00419 
00420     //
00421 
00422     for (size_t i = 0; i < algOpTokenVector.size(); ++i) {
00423 
00424         CItAlgo itAlgo = algorithmMap.find((algOpTokenVector[i]).tokenName);
00425         if (itAlgo != algorithmMap.end()) {
00426 
00427             int bitNr = (itAlgo->second).algoBitNumber();
00428             int chipNr = (itAlgo->second).algoChipNumber();
00429 
00430             (algOpTokenVector[i]).tokenNumber = bitNr;
00431 
00432             // algOpTokenVector and m_l1AlgoSeeds must have the same ordering
00433             // of the algorithms
00434             if (jSeed < l1AlgoSeedsSize) {
00435 
00436                 //LogTrace("HLTLevel1GTSeed") << "(m_l1AlgoSeeds[jSeed]).tokenName: "
00437                 //    << (m_l1AlgoSeeds[jSeed]).tokenName
00438                 //    << std::endl;
00439 
00440                 if ((m_l1AlgoSeeds[jSeed]).tokenName
00441                         == (algOpTokenVector[i]).tokenName) {
00442 
00443                     (m_l1AlgoSeeds[jSeed]).tokenNumber = bitNr;
00444 
00445                     const std::vector<L1GtLogicParser::TokenRPN>& aRpnVector =
00446                             (itAlgo->second).algoRpnVector();
00447                     size_t aRpnVectorSize = aRpnVector.size();
00448 
00449                     m_l1AlgoSeedsRpn.push_back(&aRpnVector);
00450 
00451                     // loop over RpnVector to fill for each condition the object type
00452                     std::vector<const std::vector<L1GtObject>*> tmpObjTypeVec;
00453                     tmpObjTypeVec.reserve(aRpnVectorSize);
00454 
00455                     for (size_t opI = 0; opI < aRpnVectorSize; ++opI) {
00456 
00457                         std::string cName = (aRpnVector[opI]).operand;
00458 
00459                         if (!cName.empty()) {
00460 
00461                             tmpObjTypeVec.push_back(
00462                                     objectTypeVec(chipNr, cName));
00463 
00464                             //LogTrace("HLTLevel1GTSeed")
00465                             //    << "    Push object vector for condition: " << cName
00466                             //    << std::endl;
00467                         }
00468                     }
00469 
00470                     m_l1AlgoSeedsObjType.push_back(tmpObjTypeVec);
00471 
00472                     jSeed++;
00473                 }
00474             }
00475         } else {
00476 
00477             throw cms::Exception("FailModule") << "\nAlgorithm  "
00478                     << (algOpTokenVector[i]).tokenName
00479                     << ", requested as seed by a HLT path, not found in the L1 trigger menu\n   "
00480                     << l1GtMenu->gtTriggerMenuName()
00481                     << "\nIncompatible L1 and HLT menus.\n" << std::endl;
00482 
00483         }
00484 
00485     }
00486 
00487     //
00488     if (m_isDebugEnabled) {
00489         bool newMenu = true;
00490         debugPrint(newMenu);
00491     }
00492 
00493 }
00494 
00495 // update the tokenResult members from m_l1AlgoLogicParser
00496 // for a new event
00497 void HLTLevel1GTSeed::updateAlgoLogicParser(const std::vector<bool>& gtWord,
00498         const std::vector<unsigned int>& triggerMask,
00499         const int physicsDaqPartition) {
00500 
00501     std::vector<L1GtLogicParser::OperandToken>& algOpTokenVector =
00502             m_l1AlgoLogicParser.operandTokenVector();
00503 
00504     for (size_t i = 0; i < algOpTokenVector.size(); ++i) {
00505         int iBit = (algOpTokenVector[i]).tokenNumber;
00506         bool iResult = gtWord.at(iBit);
00507 
00508         int triggerMaskBit = triggerMask[iBit] & (1 << physicsDaqPartition);
00509         //LogTrace("HLTLevel1GTSeed")
00510         //<< "\nTrigger bit: " << iBit
00511         //<< " mask = " << triggerMaskBit
00512         //<< " DAQ partition " << physicsDaqPartition
00513         //<< std::endl;
00514 
00515         if (triggerMaskBit) {
00516             iResult = false;
00517 
00518             //LogTrace("HLTLevel1GTSeed")
00519             //<< "\nMasked trigger: " << iBit << ". Result set to false\n"
00520             //<< std::endl;
00521         }
00522 
00523         (algOpTokenVector[i]).tokenResult = iResult;
00524 
00525     }
00526 
00527     for (size_t i = 0; i < m_l1AlgoSeeds.size(); ++i) {
00528         int iBit = (m_l1AlgoSeeds[i]).tokenNumber;
00529         bool iResult = gtWord.at(iBit);
00530 
00531         int triggerMaskBit = triggerMask[iBit] & (1 << physicsDaqPartition);
00532         //LogTrace("HLTLevel1GTSeed")
00533         //<< "\nTrigger bit: " << iBit
00534         //<< " mask = " << triggerMaskBit
00535         //<< " DAQ partition " << physicsDaqPartition
00536         //<< std::endl;
00537 
00538         if (triggerMaskBit) {
00539             iResult = false;
00540 
00541             //LogTrace("HLTLevel1GTSeed")
00542             //<< "\nMasked trigger: " << iBit << ". Result set to false\n"
00543             //<< std::endl;
00544         }
00545 
00546         (m_l1AlgoSeeds[i]).tokenResult = iResult;
00547 
00548     }
00549 
00550     if (m_isDebugEnabled) {
00551         bool newMenu = false;
00552         debugPrint(newMenu);
00553     }
00554 
00555 }
00556 
00557 // for seeding via technical triggers, convert the "name" to tokenNumber
00558 // (seeding via bit numbers) - done once in constructor
00559 void HLTLevel1GTSeed::convertStringToBitNumber() {
00560 
00561     std::vector<L1GtLogicParser::OperandToken>& algOpTokenVector =
00562             m_l1AlgoLogicParser.operandTokenVector();
00563 
00564     for (size_t i = 0; i < algOpTokenVector.size(); ++i) {
00565 
00566         std::string bitString = (algOpTokenVector[i]).tokenName;
00567         std::istringstream bitStream(bitString);
00568         int bitInt;
00569 
00570         if ((bitStream >> bitInt).fail()) {
00571 
00572             throw cms::Exception("FailModule")
00573                     << "\nL1 Seeds Logical Expression: = '"
00574                     << m_l1SeedsLogicalExpression << "'"
00575                     << "\n  Conversion to integer failed for " << bitString
00576                     << std::endl;
00577         }
00578 
00579         (algOpTokenVector[i]).tokenNumber = bitInt;
00580 
00581     }
00582 
00583     for (size_t i = 0; i < m_l1AlgoSeeds.size(); ++i) {
00584 
00585         std::string bitString = (m_l1AlgoSeeds[i]).tokenName;
00586         std::istringstream bitStream(bitString);
00587         int bitInt;
00588 
00589         if ((bitStream >> bitInt).fail()) {
00590 
00591             throw cms::Exception("FailModule")
00592                     << "\nL1 Seeds Logical Expression: = '"
00593                     << m_l1SeedsLogicalExpression << "'"
00594                     << "\n  Conversion to integer failed for " << bitString
00595                     << std::endl;
00596         }
00597 
00598         (m_l1AlgoSeeds[i]).tokenNumber = bitInt;
00599     }
00600 
00601 }
00602 
00603 // debug print grouped in a single function
00604 // can be called for a new menu (bool "true") or for a new event
00605 void HLTLevel1GTSeed::debugPrint(bool newMenu) {
00606 
00607     if (m_l1TechTriggerSeeding) {
00608         LogDebug("HLTLevel1GTSeed")
00609                 << "\n\nupdateAlgoLogicParser: seeding via technical trigger"
00610                 << "\n   update event quantities." << std::endl;
00611 
00612     } else {
00613 
00614         if (newMenu) {
00615             LogDebug("HLTLevel1GTSeed")
00616                     << "\n\nupdateAlgoLogicParser: L1 trigger menu changed to "
00617                     << m_l1GtMenu->gtTriggerMenuName() << std::endl;
00618         } else {
00619             LogDebug("HLTLevel1GTSeed")
00620                     << "\n\nupdateAlgoLogicParser: L1 trigger menu unchanged ("
00621                     << m_l1GtMenu->gtTriggerMenuName()
00622                     << ")\n   update event quantities." << std::endl;
00623         }
00624     }
00625 
00626     std::vector<L1GtLogicParser::OperandToken>& algOpTokenVector =
00627             m_l1AlgoLogicParser.operandTokenVector();
00628 
00629     LogTrace("HLTLevel1GTSeed")
00630             << "\n\nupdateAlgoLogicParser: algOpTokenVector.size() = "
00631             << algOpTokenVector.size() << std::endl;
00632 
00633     for (size_t i = 0; i < algOpTokenVector.size(); ++i) {
00634 
00635         LogTrace("HLTLevel1GTSeed") << "      " << std::setw(5)
00636                 << (algOpTokenVector[i]).tokenNumber << "\t" << std::setw(25)
00637                 << (algOpTokenVector[i]).tokenName << "\t"
00638                 << (algOpTokenVector[i]).tokenResult << std::endl;
00639     }
00640 
00641     LogTrace("HLTLevel1GTSeed") << std::endl;
00642 
00643     LogTrace("HLTLevel1GTSeed")
00644             << "\nupdateAlgoLogicParser: m_l1AlgoSeeds.size() = "
00645             << m_l1AlgoSeeds.size() << std::endl;
00646 
00647     for (size_t i = 0; i < m_l1AlgoSeeds.size(); ++i) {
00648 
00649         LogTrace("HLTLevel1GTSeed") << "      " << std::setw(5)
00650                 << (m_l1AlgoSeeds[i]).tokenNumber << "\t" << std::setw(25)
00651                 << (m_l1AlgoSeeds[i]).tokenName << "\t"
00652                 << (m_l1AlgoSeeds[i]).tokenResult << std::endl;
00653     }
00654 
00655     LogTrace("HLTLevel1GTSeed") << std::endl;
00656 
00657     if (!newMenu) {
00658         return;
00659     }
00660 
00661     LogTrace("HLTLevel1GTSeed")
00662             << "\nupdateAlgoLogicParser: m_l1AlgoSeedsRpn.size() = "
00663             << m_l1AlgoSeedsRpn.size() << std::endl;
00664 
00665     for (size_t i = 0; i < m_l1AlgoSeedsRpn.size(); ++i) {
00666 
00667         LogTrace("HLTLevel1GTSeed") << "  Rpn vector size: "
00668                 << (m_l1AlgoSeedsRpn[i])->size() << std::endl;
00669 
00670         for (size_t j = 0; j < (m_l1AlgoSeedsRpn[i])->size(); ++j) {
00671 
00672             LogTrace("HLTLevel1GTSeed") << "      ( "
00673                     << (*(m_l1AlgoSeedsRpn[i]))[j].operation << ", "
00674                     << (*(m_l1AlgoSeedsRpn[i]))[j].operand << " )" << std::endl;
00675 
00676         }
00677     }
00678 
00679     LogTrace("HLTLevel1GTSeed") << std::endl;
00680 
00681     LogTrace("HLTLevel1GTSeed") << "\nupdateAlgoLogicParser: "
00682             << "algorithms in seed expression: m_l1AlgoSeedsObjType.size() = "
00683             << m_l1AlgoSeedsObjType.size() << std::endl;
00684 
00685     for (size_t i = 0; i < m_l1AlgoSeedsObjType.size(); ++i) {
00686 
00687         LogTrace("HLTLevel1GTSeed")
00688                 << "  Conditions for an algorithm: vector size: "
00689                 << (m_l1AlgoSeedsObjType[i]).size() << std::endl;
00690 
00691         for (size_t j = 0; j < (m_l1AlgoSeedsObjType[i]).size(); ++j) {
00692 
00693             LogTrace("HLTLevel1GTSeed")
00694                     << "    Condition object type vector: size: "
00695                     << ((m_l1AlgoSeedsObjType[i])[j])->size() << std::endl;
00696 
00697             for (size_t k = 0; k < ((m_l1AlgoSeedsObjType[i])[j])->size(); ++k) {
00698 
00699                 L1GtObject obj = (*((m_l1AlgoSeedsObjType[i])[j]))[k];
00700                 LogTrace("HLTLevel1GTSeed") << "      " << obj << " ";
00701 
00702             }
00703 
00704             LogTrace("HLTLevel1GTSeed") << std::endl;
00705 
00706         }
00707     }
00708 
00709     LogTrace("HLTLevel1GTSeed") << std::endl;
00710 
00711 }
00712 
00713 
00714 // seeding is done via L1 trigger object maps, considering the objects which fired in L1
00715 bool HLTLevel1GTSeed::seedsL1TriggerObjectMaps(edm::Event& iEvent,
00716         std::auto_ptr<trigger::TriggerFilterObjectWithRefs>& filterObject,
00717         const L1GlobalTriggerReadoutRecord* gtReadoutRecordPtr,
00718         const int physicsDaqPartition) {
00719 
00720     // get Global Trigger decision word, update the tokenResult members
00721     // from m_l1AlgoLogicParser and get the result for the logical expression
00722     const std::vector<bool>& gtDecisionWord = gtReadoutRecordPtr->decisionWord();
00723     updateAlgoLogicParser(gtDecisionWord, m_triggerMaskAlgoTrig, physicsDaqPartition);
00724 
00725     bool seedsResult = m_l1AlgoLogicParser.expressionResult();
00726 
00727     if (m_isDebugEnabled ) {
00728         // define an output stream to print into
00729         // it can then be directed to whatever log level is desired
00730         std::ostringstream myCoutStream;
00731         gtReadoutRecordPtr->printGtDecision(myCoutStream);
00732 
00733         LogTrace("HLTLevel1GTSeed")
00734         << myCoutStream.str()
00735         << "\nHLTLevel1GTSeed::filter "
00736         << "\nLogical expression (names) = '" << m_l1SeedsLogicalExpression << "'"
00737         << "\n  Result for logical expression: " << seedsResult << "\n"
00738         << std::endl;
00739     }
00740 
00741     // the evaluation of the logical expression is false - skip event
00742     if ( !seedsResult) {
00743 
00744         return false;
00745 
00746     }
00747 
00748     // define index lists for all particle types
00749 
00750     std::list<int> listMuon;
00751 
00752     std::list<int> listIsoEG;
00753     std::list<int> listNoIsoEG;
00754 
00755     std::list<int> listCenJet;
00756     std::list<int> listForJet;
00757     std::list<int> listTauJet;
00758 
00759     std::list<int> listETM;
00760     std::list<int> listETT;
00761     std::list<int> listHTT;
00762     std::list<int> listHTM;
00763 
00764     std::list<int> listJetCounts;
00765 
00766     // get handle to object maps (one object map per algorithm)
00767     edm::Handle<L1GlobalTriggerObjectMapRecord> gtObjectMapRecord;
00768     iEvent.getByLabel(m_l1GtObjectMapTag, gtObjectMapRecord);
00769 
00770     if (!gtObjectMapRecord.isValid()) {
00771         edm::LogWarning("HLTLevel1GTSeed")
00772         << "\nWarning: L1GlobalTriggerObjectMapRecord with input tag "
00773         << m_l1GtReadoutRecordTag
00774         << "\nrequested in configuration, but not found in the event." << std::endl;
00775 
00776         return false;
00777     }
00778 
00779     // TODO check that the L1GlobalTriggerObjectMapRecord corresponds to the same menu as
00780     // the menu run by HLTLevel1GTSeed
00781     //     true normally online (they are run in the same job)
00782     //     can be false offline, when re-running HLT without re-running the object map producer
00783 
00784     // loop over the list of required algorithms for seeding
00785     int iAlgo = -1;
00786 
00787     for (std::vector<L1GtLogicParser::OperandToken>::const_iterator
00788             itSeed = m_l1AlgoSeeds.begin(); itSeed != m_l1AlgoSeeds.end(); ++itSeed) {
00789 
00790         //
00791         iAlgo++;
00792         //
00793         int algBit = (*itSeed).tokenNumber;
00794         std::string algName = (*itSeed).tokenName;
00795         bool algResult = (*itSeed).tokenResult;
00796 
00797         LogTrace("HLTLevel1GTSeed")
00798         << "\nHLTLevel1GTSeed::filter "
00799         << "\n  Algorithm " << algName << " with bit number " << algBit
00800         << " in the object map seed list"
00801         << "\n  Algorithm result = " << algResult << "\n"
00802         << std::endl;
00803 
00804         // algorithm result is false - no seeds
00805         if ( !algResult) {
00806             continue;
00807         }
00808 
00809         // algorithm result is true - get object map, loop over conditions in the algorithm
00810         const L1GlobalTriggerObjectMap* objMap = gtObjectMapRecord->getObjectMap(algBit);
00811 
00812         if (objMap == 0) {
00813             edm::LogWarning("HLTLevel1GTSeed")
00814             << "\nWarning: L1GlobalTriggerObjectMap for algorithm  " << algName
00815             << " (bit number " << algBit << ") does not exist.\nReturn false.\n"
00816             << std::endl;
00817 
00818             iEvent.put(filterObject);
00819             return false;
00820         }
00821 
00822         const std::vector<L1GtLogicParser::OperandToken>& opTokenVecObjMap =
00823         objMap->operandTokenVector();
00824 
00825         const std::vector<L1GtLogicParser::TokenRPN>& algoSeedsRpn =
00826         * ( m_l1AlgoSeedsRpn.at(iAlgo) );
00827 
00828         const std::vector<const std::vector<L1GtObject>*>& algoSeedsObjTypeVec =
00829         m_l1AlgoSeedsObjType[iAlgo];
00830 
00831         //
00832         L1GtLogicParser logicParserConditions(algoSeedsRpn, opTokenVecObjMap);
00833 
00834         // get list of required conditions for seeding - loop over
00835         std::vector<L1GtLogicParser::OperandToken> condSeeds =
00836         logicParserConditions.expressionSeedsOperandList();
00837 
00838         if (m_isDebugEnabled ) {
00839 
00840             LogTrace("HLTLevel1GTSeed")
00841             << "\n  HLTLevel1GTSeed::filter "
00842             << "\n    condSeeds.size() = "
00843             << condSeeds.size()
00844             << std::endl;
00845 
00846             for (size_t i = 0; i < condSeeds.size(); ++i) {
00847 
00848                 LogTrace("HLTLevel1GTSeed")
00849                 << "      " << std::setw(5) << (condSeeds[i]).tokenNumber << "\t"
00850                 << std::setw(25) << (condSeeds[i]).tokenName << "\t"
00851                 << (condSeeds[i]).tokenResult
00852                 << std::endl;
00853             }
00854 
00855             LogTrace("HLTLevel1GTSeed")
00856             << std::endl;
00857         }
00858 
00859         for (std::vector<L1GtLogicParser::OperandToken>::const_iterator
00860                 itCond = condSeeds.begin(); itCond != condSeeds.end(); itCond++) {
00861 
00862             std::string cndName = (*itCond).tokenName;
00863             int cndNumber = (*itCond).tokenNumber;
00864             bool cndResult = (*itCond).tokenResult;
00865 
00866             const std::vector<L1GtObject>* cndObjTypeVec = algoSeedsObjTypeVec.at(cndNumber);
00867 
00868             //LogTrace("HLTLevel1GTSeed")
00869             //    << "\n  HLTLevel1GTSeed::filter "
00870             //    << "\n    Condition " << cndName << " with number " << cndNumber
00871             //    << " in the seed list"
00872             //    << "\n    Condition result = " << cndResult << "\n"
00873             //    << std::endl;
00874 
00875             if ( !cndResult) {
00876                 continue;
00877             }
00878 
00879             // loop over combinations for a given condition
00880 
00881             const CombinationsInCond* cndComb = objMap->getCombinationsInCond(cndNumber);
00882 
00883             for (std::vector<SingleCombInCond>::const_iterator
00884                     itComb = (*cndComb).begin(); itComb != (*cndComb).end(); itComb++) {
00885 
00886                 // loop over objects in a combination for a given condition
00887                 int iObj = 0;
00888                 for (SingleCombInCond::const_iterator
00889                         itObject = (*itComb).begin(); itObject != (*itComb).end(); itObject++) {
00890 
00891                     // get object type and push indices on the list
00892                     const L1GtObject objTypeVal = (*cndObjTypeVec).at(iObj);
00893 
00894                     //LogTrace("HLTLevel1GTSeed")
00895                     //    << "\n    HLTLevel1GTSeed::filter "
00896                     //    << "\n      Add object of type " << objTypeVal
00897                     //    << " and index " << (*itObject) << " to the seed list."
00898                     //    << std::endl;
00899 
00900                     switch (objTypeVal) {
00901                         case Mu: {
00902                             listMuon.push_back(*itObject);
00903                         }
00904 
00905                         break;
00906                         case NoIsoEG: {
00907                             listNoIsoEG.push_back(*itObject);
00908                         }
00909 
00910                         break;
00911                         case IsoEG: {
00912                             listIsoEG.push_back(*itObject);
00913                         }
00914 
00915                         break;
00916                         case CenJet: {
00917                             listCenJet.push_back(*itObject);
00918                         }
00919 
00920                         break;
00921                         case ForJet: {
00922                             listForJet.push_back(*itObject);
00923                         }
00924 
00925                         break;
00926                         case TauJet: {
00927                             listTauJet.push_back(*itObject);
00928                         }
00929 
00930                         break;
00931                         case ETM: {
00932                             listETM.push_back(*itObject);
00933 
00934                         }
00935 
00936                         break;
00937                         case ETT: {
00938                             listETT.push_back(*itObject);
00939 
00940                         }
00941 
00942                         break;
00943                         case HTT: {
00944                             listHTT.push_back(*itObject);
00945 
00946                         }
00947 
00948                         break;
00949                         case HTM: {
00950                             listHTM.push_back(*itObject);
00951 
00952                         }
00953 
00954                         break;
00955                         case JetCounts: {
00956                             listJetCounts.push_back(*itObject);
00957                         }
00958 
00959                         break;
00960                         default: {
00961                             // should not arrive here
00962 
00963                             LogDebug("HLTLevel1GTSeed")
00964                             << "\n    HLTLevel1GTSeed::filter "
00965                             << "\n      Unknown object of type " << objTypeVal
00966                             << " and index " << (*itObject) << " in the seed list."
00967                             << std::endl;
00968                         }
00969                         break;
00970                     }
00971 
00972                     iObj++;
00973 
00974                 }
00975 
00976             }
00977 
00978         }
00979 
00980     }
00981 
00982     // eliminate duplicates
00983 
00984     listMuon.sort();
00985     listMuon.unique();
00986 
00987     listIsoEG.sort();
00988     listIsoEG.unique();
00989 
00990     listNoIsoEG.sort();
00991     listNoIsoEG.unique();
00992 
00993     listCenJet.sort();
00994     listCenJet.unique();
00995 
00996     listForJet.sort();
00997     listForJet.unique();
00998 
00999     listTauJet.sort();
01000     listTauJet.unique();
01001 
01002     listETM.sort();
01003     listETM.unique();
01004 
01005     listETT.sort();
01006     listETT.unique();
01007 
01008     listHTT.sort();
01009     listHTT.unique();
01010 
01011     listHTM.sort();
01012     listHTM.unique();
01013 
01014     listJetCounts.sort();
01015     listJetCounts.unique();
01016 
01017     //
01018     // record the L1 physics objects in the HLT filterObject
01019     //
01020 
01021     // muon
01022     if (listMuon.size()) {
01023 
01024         edm::Handle<l1extra::L1MuonParticleCollection> l1Muon;
01025         iEvent.getByLabel(m_l1MuonTag, l1Muon);
01026 
01027         if (!l1Muon.isValid()) {
01028             edm::LogWarning("HLTLevel1GTSeed")
01029             << "\nWarning: L1MuonParticleCollection with input tag " << m_l1MuonTag
01030             << "\nrequested in configuration, but not found in the event."
01031             << "\nNo muon added to filterObject." << std::endl;
01032 
01033         } else {
01034 
01035             for (std::list<int>::const_iterator itObj = listMuon.begin(); itObj != listMuon.end(); ++itObj) {
01036 
01037                 filterObject->addObject(trigger::TriggerL1Mu, l1extra::L1MuonParticleRef(
01038                                 l1Muon, *itObj));
01039 
01040             }
01041         }
01042 
01043     }
01044 
01045     // EG (isolated)
01046     if (listIsoEG.size()) {
01047         edm::Handle<l1extra::L1EmParticleCollection> l1IsoEG;
01048         iEvent.getByLabel(m_l1IsoEGTag, l1IsoEG);
01049 
01050         if (!l1IsoEG.isValid()) {
01051             edm::LogWarning("HLTLevel1GTSeed")
01052             << "\nWarning: L1EmParticleCollection with input tag " << m_l1IsoEGTag
01053             << "\nrequested in configuration, but not found in the event."
01054             << "\nNo IsoEG added to filterObject." << std::endl;
01055 
01056         } else {
01057             for (std::list<int>::const_iterator itObj = listIsoEG.begin(); itObj != listIsoEG.end(); ++itObj) {
01058 
01059                 filterObject->addObject(trigger::TriggerL1IsoEG, l1extra::L1EmParticleRef(
01060                                 l1IsoEG, *itObj));
01061 
01062             }
01063         }
01064     }
01065 
01066     // EG (no isolation)
01067     if (listNoIsoEG.size()) {
01068         edm::Handle<l1extra::L1EmParticleCollection> l1NoIsoEG;
01069         iEvent.getByLabel(m_l1NoIsoEGTag, l1NoIsoEG);
01070 
01071         if (!l1NoIsoEG.isValid()) {
01072             edm::LogWarning("HLTLevel1GTSeed")
01073             << "\nWarning: L1EmParticleCollection with input tag " << m_l1NoIsoEGTag
01074             << "\nrequested in configuration, but not found in the event."
01075             << "\nNo NoIsoEG added to filterObject." << std::endl;
01076 
01077         } else {
01078             for (std::list<int>::const_iterator itObj = listNoIsoEG.begin(); itObj
01079                     != listNoIsoEG.end(); ++itObj) {
01080 
01081                 filterObject->addObject(trigger::TriggerL1NoIsoEG, l1extra::L1EmParticleRef(
01082                                 l1NoIsoEG, *itObj));
01083 
01084             }
01085         }
01086     }
01087 
01088     // central jets
01089     if (listCenJet.size()) {
01090         edm::Handle<l1extra::L1JetParticleCollection> l1CenJet;
01091         iEvent.getByLabel(m_l1CenJetTag, l1CenJet);
01092 
01093         if (!l1CenJet.isValid()) {
01094             edm::LogWarning("HLTLevel1GTSeed")
01095             << "\nWarning: L1JetParticleCollection with input tag " << m_l1CenJetTag
01096             << "\nrequested in configuration, but not found in the event."
01097             << "\nNo CenJet added to filterObject." << std::endl;
01098 
01099         } else {
01100             for (std::list<int>::const_iterator itObj = listCenJet.begin(); itObj
01101                     != listCenJet.end(); ++itObj) {
01102 
01103                 filterObject->addObject(trigger::TriggerL1CenJet, l1extra::L1JetParticleRef(
01104                                 l1CenJet, *itObj));
01105 
01106             }
01107         }
01108     }
01109 
01110     // forward jets
01111     if (listForJet.size()) {
01112         edm::Handle<l1extra::L1JetParticleCollection> l1ForJet;
01113         iEvent.getByLabel(m_l1ForJetTag, l1ForJet);
01114 
01115         if (!l1ForJet.isValid()) {
01116             edm::LogWarning("HLTLevel1GTSeed")
01117             << "\nWarning: L1JetParticleCollection with input tag " << m_l1ForJetTag
01118             << "\nrequested in configuration, but not found in the event."
01119             << "\nNo ForJet added to filterObject." << std::endl;
01120 
01121         } else {
01122             for (std::list<int>::const_iterator itObj = listForJet.begin(); itObj
01123                     != listForJet.end(); ++itObj) {
01124 
01125                 filterObject->addObject(trigger::TriggerL1ForJet, l1extra::L1JetParticleRef(
01126                                 l1ForJet, *itObj));
01127 
01128             }
01129         }
01130     }
01131 
01132     // tau jets
01133     if (listTauJet.size()) {
01134         edm::Handle<l1extra::L1JetParticleCollection> l1TauJet;
01135         iEvent.getByLabel(m_l1TauJetTag, l1TauJet);
01136 
01137         if (!l1TauJet.isValid()) {
01138             edm::LogWarning("HLTLevel1GTSeed")
01139             << "\nWarning: L1JetParticleCollection with input tag " << m_l1TauJetTag
01140             << "\nrequested in configuration, but not found in the event."
01141             << "\nNo TauJet added to filterObject." << std::endl;
01142 
01143         } else {
01144             for (std::list<int>::const_iterator itObj = listTauJet.begin(); itObj
01145                     != listTauJet.end(); ++itObj) {
01146 
01147                 filterObject->addObject(trigger::TriggerL1TauJet, l1extra::L1JetParticleRef(
01148                                 l1TauJet, *itObj));
01149 
01150             }
01151         }
01152     }
01153 
01154     // energy sums
01155     if (listETM.size()) {
01156         edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
01157         iEvent.getByLabel(m_l1EtMissMET, l1EnergySums);
01158 
01159         if (!l1EnergySums.isValid()) {
01160             edm::LogWarning("HLTLevel1GTSeed")
01161             << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMET
01162             << "\nrequested in configuration, but not found in the event."
01163             << "\nNo ETM added to filterObject." << std::endl;
01164         } else if (l1EnergySums->size() == 0) {
01165             edm::LogWarning("HLTLevel1GTSeed")
01166             << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMET
01167             << "\nfound in the event but with 0 size." << "\nNo ETM added to filterObject."
01168             << std::endl;
01169 
01170         } else {
01171 
01172             for (std::list<int>::const_iterator itObj = listETM.begin(); itObj != listETM.end(); ++itObj) {
01173 
01174                 filterObject->addObject(trigger::TriggerL1ETM, l1extra::L1EtMissParticleRef(
01175                                 l1EnergySums, *itObj));
01176 
01177             }
01178 
01179         }
01180 
01181     }
01182 
01183     if (listETT.size()) {
01184         edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
01185         iEvent.getByLabel(m_l1EtMissMET, l1EnergySums);
01186 
01187         if (!l1EnergySums.isValid()) {
01188             edm::LogWarning("HLTLevel1GTSeed")
01189             << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMET
01190             << "\nrequested in configuration, but not found in the event."
01191             << "\nNo ETT added to filterObject." << std::endl;
01192         } else if (l1EnergySums->size() == 0) {
01193             edm::LogWarning("HLTLevel1GTSeed")
01194             << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMET
01195             << "\nfound in the event but with 0 size." << "\nNo ETT added to filterObject."
01196             << std::endl;
01197 
01198         } else {
01199 
01200             for (std::list<int>::const_iterator itObj = listETT.begin(); itObj != listETT.end(); ++itObj) {
01201 
01202                 filterObject->addObject(trigger::TriggerL1ETT, l1extra::L1EtMissParticleRef(
01203                                 l1EnergySums, *itObj));
01204 
01205             }
01206 
01207         }
01208 
01209     }
01210 
01211     if (listHTT.size()) {
01212         edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
01213         iEvent.getByLabel(m_l1EtMissMHT, l1EnergySums);
01214 
01215         if (!l1EnergySums.isValid()) {
01216             edm::LogWarning("HLTLevel1GTSeed")
01217             << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMHT
01218             << "\nrequested in configuration, but not found in the event."
01219             << "\nNo HTT added to filterObject." << std::endl;
01220 
01221         } else if (l1EnergySums->size() == 0) {
01222             edm::LogWarning("HLTLevel1GTSeed")
01223             << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMHT
01224             << "\nfound in the event but with 0 size." << "\nNo HTT added to filterObject."
01225             << std::endl;
01226 
01227         } else {
01228 
01229             for (std::list<int>::const_iterator itObj = listHTT.begin(); itObj != listHTT.end(); ++itObj) {
01230 
01231                 filterObject->addObject(trigger::TriggerL1HTT, l1extra::L1EtMissParticleRef(
01232                                 l1EnergySums, *itObj));
01233 
01234             }
01235 
01236         }
01237     }
01238 
01239     if (listHTM.size()) {
01240         edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
01241         iEvent.getByLabel(m_l1EtMissMHT, l1EnergySums);
01242 
01243         if (!l1EnergySums.isValid()) {
01244             edm::LogWarning("HLTLevel1GTSeed")
01245             << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMHT
01246             << "\nrequested in configuration, but not found in the event."
01247             << "\nNo HTM added to filterObject." << std::endl;
01248 
01249         } else if (l1EnergySums->size() == 0) {
01250             edm::LogWarning("HLTLevel1GTSeed")
01251             << "\nWarning: L1EtMissParticleCollection with input tag " << m_l1EtMissMHT
01252             << "\nfound in the event but with 0 size." << "\nNo HTM added to filterObject."
01253             << std::endl;
01254 
01255         } else {
01256 
01257             for (std::list<int>::const_iterator itObj = listHTM.begin(); itObj != listHTM.end(); ++itObj) {
01258 
01259                 filterObject->addObject(trigger::TriggerL1HTM, l1extra::L1EtMissParticleRef(
01260                                 l1EnergySums, *itObj));
01261 
01262             }
01263         }
01264     }
01265 
01266     // TODO FIXME uncomment if block when JetCounts implemented
01267 
01268     //    // jet counts
01269     //    if (listJetCounts.size()) {
01270     //        edm::Handle<l1extra::L1JetCounts> l1JetCounts;
01271     //        iEvent.getByLabel(m_l1CollectionsTag.label(), l1JetCounts);
01272     //
01273     //        for (std::list<int>::const_iterator itObj = listJetCounts.begin();
01274     //                itObj != listJetCounts.end(); ++itObj) {
01275     //
01276     //            filterObject->addObject(trigger::TriggerL1JetCounts,l1extra::L1JetCountsRefProd(l1JetCounts));
01277     //                  // FIXME: RefProd!
01278     //
01279     //        }
01280     //
01281     //    }
01282 
01283     return seedsResult;
01284 
01285 }
01286 
01287 // seeding is done ignoring if a L1 object fired or not
01288 // if the event is selected at L1, fill all the L1 objects of types corresponding to the
01289 // L1 conditions from the seeding logical expression for bunch crosses F, 0, 1
01290 // directly from L1Extra and use them as seeds at HLT
01291 // method and filter return true if at least an object is filled
01292 bool HLTLevel1GTSeed::seedsL1Extra(edm::Event& iEvent, std::auto_ptr<
01293         trigger::TriggerFilterObjectWithRefs>& filterObject) {
01294 
01295 
01296 
01297     //    if (m_isDebugEnabled) {
01298     //
01299     //        LogTrace("HLTLevel1GTSeed") << "\n Printing muons from gtDigis\n " << std::endl;
01300     //
01301     //        edm::Handle<std::vector<L1MuGMTCand> > muonData;
01302     //        iEvent.getByLabel("gtDigis", muonData);
01303     //
01304     //        if (!muonData.isValid()) {
01305     //            edm::LogWarning("HLTLevel1GTSeed")
01306     //                    << "\nWarning: std::vector<L1MuGMTCand> with input tag "
01307     //                    << "gtDigis"
01308     //                    << "\nrequested in configuration, but not found in the event.\n"
01309     //                    << std::endl;
01310     //        } else {
01311     //
01312     //            std::vector<L1MuGMTCand>::const_iterator itMuon;
01313     //            for (itMuon = muonData->begin(); itMuon != muonData->end(); itMuon++) {
01314     //
01315     //                LogTrace("HLTLevel1GTSeed") << (*itMuon) << std::endl;
01316     //
01317     //            }
01318     //
01319     //        }
01320     //    }
01321 
01322     // define bools to prevent entering more copies of the objects
01323     bool includeMuon = true;
01324 
01325     bool includeIsoEG = true;
01326     bool includeNoIsoEG = true;
01327 
01328     bool includeCenJet = true;
01329     bool includeForJet = true;
01330     bool includeTauJet = true;
01331 
01332     bool includeETM = true;
01333     bool includeETT = true;
01334     bool includeHTT = true;
01335     bool includeHTM = true;
01336 
01337     bool includeJetCounts = true;
01338 
01339     //
01340     bool objectsInFilter = false;
01341 
01342     // loop over the list of required algorithms for seeding
01343     int iAlgo = -1;
01344 
01345     for (std::vector<L1GtLogicParser::OperandToken>::const_iterator itSeed =
01346             m_l1AlgoSeeds.begin(); itSeed != m_l1AlgoSeeds.end(); ++itSeed) {
01347 
01348         //
01349         iAlgo++;
01350         //
01351         int algBit = (*itSeed).tokenNumber;
01352         std::string algName = (*itSeed).tokenName;
01353         bool algResult = (*itSeed).tokenResult;
01354 
01355         LogTrace("HLTLevel1GTSeed") << "\nHLTLevel1GTSeed::filter "
01356                 << "\n  Algorithm " << algName << " with bit number " << algBit
01357                 << " in the object map seed list" << "\n  Algorithm result = "
01358                 << algResult << std::endl;
01359 
01360         const std::vector<const std::vector<L1GtObject>*>& algoSeedsObjTypeVec =
01361                 m_l1AlgoSeedsObjType[iAlgo];
01362 
01363         int minBxInEvent = (m_l1NrBxInEvent + 1)/2 - m_l1NrBxInEvent;
01364         int maxBxInEvent = (m_l1NrBxInEvent + 1)/2 - 1;
01365 
01366         // loop over all object types found for an algorithm and fill the lists
01367         //
01368         for (std::vector<const std::vector<L1GtObject>*>::const_iterator itVec =
01369                 algoSeedsObjTypeVec.begin(); itVec != algoSeedsObjTypeVec.end(); ++itVec) {
01370 
01371             const std::vector<L1GtObject>* condObj = *itVec;
01372             for (std::vector<L1GtObject>::const_iterator itObj =
01373                     (*condObj).begin(); itObj != (*condObj).end(); ++itObj) {
01374 
01375                 LogTrace("HLTLevel1GTSeed")
01376                         << "  Object type in conditions from this algorithm = "
01377                         << (*itObj) << std::endl;
01378 
01379                 switch (*itObj) {
01380                     case Mu: {
01381                         if (includeMuon) {
01382 
01383                             edm::Handle<l1extra::L1MuonParticleCollection> l1Muon;
01384                             iEvent.getByLabel(m_l1MuonTag, l1Muon);
01385 
01386                             if (!l1Muon.isValid()) {
01387                                 edm::LogWarning("HLTLevel1GTSeed")
01388                                         << "\nWarning: L1MuonParticleCollection with input tag "
01389                                         << m_l1MuonTag
01390                                         << "\nrequested in configuration, but not found in the event."
01391                                         << "\nNo muon added to filterObject."
01392                                         << std::endl;
01393 
01394                             } else {
01395                                 int iObj = -1;
01396                                 for (l1extra::L1MuonParticleCollection::const_iterator
01397                                         objIter = l1Muon->begin(); objIter
01398                                         != l1Muon->end(); ++objIter) {
01399 
01400                                     iObj++;
01401 
01402                                     int bxNr = objIter->bx();
01403                                     if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
01404 
01405                                         objectsInFilter = true;
01406                                         filterObject->addObject(
01407                                                 trigger::TriggerL1Mu,
01408                                                 l1extra::L1MuonParticleRef(
01409                                                         l1Muon, iObj));
01410                                     }
01411 
01412                                 }
01413                             }
01414                             includeMuon = false;
01415                         }
01416                     }
01417 
01418                         break;
01419                     case IsoEG: {
01420                         if (includeIsoEG) {
01421                             edm::Handle<l1extra::L1EmParticleCollection> l1IsoEG;
01422                             iEvent.getByLabel(m_l1IsoEGTag, l1IsoEG);
01423 
01424                             if (!l1IsoEG.isValid()) {
01425                                 edm::LogWarning("HLTLevel1GTSeed")
01426                                         << "\nWarning: L1EmParticleCollection with input tag "
01427                                         << m_l1IsoEGTag
01428                                         << "\nrequested in configuration, but not found in the event."
01429                                         << "\nNo IsoEG added to filterObject."
01430                                         << std::endl;
01431 
01432                             } else {
01433                                 int iObj = -1;
01434                                 for (l1extra::L1EmParticleCollection::const_iterator
01435                                         objIter = l1IsoEG->begin(); objIter
01436                                         != l1IsoEG->end(); ++objIter) {
01437 
01438                                     iObj++;
01439 
01440                                     int bxNr = objIter->bx();
01441                                     if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
01442 
01443                                         objectsInFilter = true;
01444                                         filterObject->addObject(
01445                                                 trigger::TriggerL1IsoEG,
01446                                                 l1extra::L1EmParticleRef(
01447                                                         l1IsoEG, iObj));
01448 
01449                                     }
01450                                 }
01451                             }
01452                             includeIsoEG = false;
01453                         }
01454 
01455                     }
01456                         break;
01457                     case NoIsoEG: {
01458                         if (includeNoIsoEG) {
01459                             edm::Handle<l1extra::L1EmParticleCollection> l1NoIsoEG;
01460                             iEvent.getByLabel(m_l1NoIsoEGTag, l1NoIsoEG);
01461 
01462                             if (!l1NoIsoEG.isValid()) {
01463                                 edm::LogWarning("HLTLevel1GTSeed")
01464                                         << "\nWarning: L1EmParticleCollection with input tag "
01465                                         << m_l1NoIsoEGTag
01466                                         << "\nrequested in configuration, but not found in the event."
01467                                         << "\nNo NoIsoEG added to filterObject."
01468                                         << std::endl;
01469 
01470                             } else {
01471                                 int iObj = -1;
01472                                 for (l1extra::L1EmParticleCollection::const_iterator
01473                                         objIter = l1NoIsoEG->begin(); objIter
01474                                         != l1NoIsoEG->end(); ++objIter) {
01475 
01476                                     iObj++;
01477 
01478                                     int bxNr = objIter->bx();
01479                                     if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
01480 
01481                                         objectsInFilter = true;
01482                                         filterObject->addObject(
01483                                                 trigger::TriggerL1NoIsoEG,
01484                                                 l1extra::L1EmParticleRef(
01485                                                         l1NoIsoEG, iObj));
01486 
01487                                     }
01488                                 }
01489                             }
01490                             includeNoIsoEG = false;
01491                         }
01492 
01493                     }
01494                         break;
01495                     case CenJet: {
01496                         if (includeCenJet) {
01497                             edm::Handle<l1extra::L1JetParticleCollection> l1CenJet;
01498                             iEvent.getByLabel(m_l1CenJetTag, l1CenJet);
01499 
01500                             if (!l1CenJet.isValid()) {
01501                                 edm::LogWarning("HLTLevel1GTSeed")
01502                                         << "\nWarning: L1JetParticleCollection with input tag "
01503                                         << m_l1CenJetTag
01504                                         << "\nrequested in configuration, but not found in the event."
01505                                         << "\nNo CenJet added to filterObject."
01506                                         << std::endl;
01507 
01508                             } else {
01509                                 int iObj = -1;
01510                                 for (l1extra::L1JetParticleCollection::const_iterator
01511                                         objIter = l1CenJet->begin(); objIter
01512                                         != l1CenJet->end(); ++objIter) {
01513 
01514                                     iObj++;
01515 
01516                                     int bxNr = objIter->bx();
01517                                     if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
01518 
01519                                         objectsInFilter = true;
01520                                         filterObject->addObject(
01521                                                 trigger::TriggerL1CenJet,
01522                                                 l1extra::L1JetParticleRef(
01523                                                         l1CenJet, iObj));
01524 
01525                                     }
01526                                 }
01527                             }
01528                             includeCenJet = false;
01529                         }
01530 
01531                     }
01532 
01533                         break;
01534                     case ForJet: {
01535                         if (includeForJet) {
01536                             edm::Handle<l1extra::L1JetParticleCollection> l1ForJet;
01537                             iEvent.getByLabel(m_l1ForJetTag, l1ForJet);
01538 
01539                             if (!l1ForJet.isValid()) {
01540                                 edm::LogWarning("HLTLevel1GTSeed")
01541                                         << "\nWarning: L1JetParticleCollection with input tag "
01542                                         << m_l1ForJetTag
01543                                         << "\nrequested in configuration, but not found in the event."
01544                                         << "\nNo ForJet added to filterObject."
01545                                         << std::endl;
01546 
01547                             } else {
01548                                 int iObj = -1;
01549                                 for (l1extra::L1JetParticleCollection::const_iterator
01550                                         objIter = l1ForJet->begin(); objIter
01551                                         != l1ForJet->end(); ++objIter) {
01552 
01553                                     iObj++;
01554 
01555                                     int bxNr = objIter->bx();
01556                                     if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
01557 
01558                                         objectsInFilter = true;
01559                                         filterObject->addObject(
01560                                                 trigger::TriggerL1ForJet,
01561                                                 l1extra::L1JetParticleRef(
01562                                                         l1ForJet, iObj));
01563 
01564                                     }
01565                                 }
01566                             }
01567                             includeForJet = false;
01568                         }
01569 
01570                     }
01571 
01572                         break;
01573                     case TauJet: {
01574                         if (includeTauJet) {
01575                             edm::Handle<l1extra::L1JetParticleCollection> l1TauJet;
01576                             iEvent.getByLabel(m_l1TauJetTag, l1TauJet);
01577 
01578                             if (!l1TauJet.isValid()) {
01579                                 edm::LogWarning("HLTLevel1GTSeed")
01580                                         << "\nWarning: L1JetParticleCollection with input tag "
01581                                         << m_l1TauJetTag
01582                                         << "\nrequested in configuration, but not found in the event."
01583                                         << "\nNo TauJet added to filterObject."
01584                                         << std::endl;
01585 
01586                             } else {
01587                                 int iObj = -1;
01588                                 for (l1extra::L1JetParticleCollection::const_iterator
01589                                         objIter = l1TauJet->begin(); objIter
01590                                         != l1TauJet->end(); ++objIter) {
01591 
01592                                     iObj++;
01593 
01594                                     int bxNr = objIter->bx();
01595                                     if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
01596 
01597                                         objectsInFilter = true;
01598                                         filterObject->addObject(
01599                                                 trigger::TriggerL1TauJet,
01600                                                 l1extra::L1JetParticleRef(
01601                                                         l1TauJet, iObj));
01602 
01603                                     }
01604                                 }
01605                             }
01606                             includeTauJet = false;
01607                         }
01608 
01609                     }
01610 
01611                         break;
01612                     case ETM: {
01613                         if (includeETM) {
01614                             edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
01615                             iEvent.getByLabel(m_l1EtMissMET, l1EnergySums);
01616 
01617                             if (!l1EnergySums.isValid()) {
01618                                 edm::LogWarning("HLTLevel1GTSeed")
01619                                         << "\nWarning: L1EtMissParticleCollection with input tag "
01620                                         << m_l1EtMissMET
01621                                         << "\nrequested in configuration, but not found in the event."
01622                                         << "\nNo ETM added to filterObject."
01623                                         << std::endl;
01624 
01625                             } else if (l1EnergySums->size() == 0) {
01626                                 edm::LogWarning("HLTLevel1GTSeed")
01627                                         << "\nWarning: L1EtMissParticleCollection with input tag "
01628                                         << m_l1EtMissMET
01629                                         << "\nfound in the event but with 0 size."
01630                                         << "\nNo ETM added to filterObject."
01631                                         << std::endl;
01632 
01633                             } else {
01634                                 int iObj = -1;
01635                                 for (l1extra::L1EtMissParticleCollection::const_iterator
01636                                         objIter = l1EnergySums->begin(); objIter
01637                                         != l1EnergySums->end(); ++objIter) {
01638 
01639                                     iObj++;
01640 
01641                                     int bxNr = objIter->bx();
01642                                     if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
01643 
01644                                         objectsInFilter = true;
01645                                         filterObject->addObject(
01646                                                 trigger::TriggerL1ETM,
01647                                                 l1extra::L1EtMissParticleRef(
01648                                                         l1EnergySums, iObj));
01649 
01650                                     }
01651                                 }
01652                             }
01653                             includeETM = false;
01654                         }
01655 
01656                     }
01657 
01658                         break;
01659                     case ETT: {
01660                         if (includeETT) {
01661                             edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
01662                             iEvent.getByLabel(m_l1EtMissMET, l1EnergySums);
01663 
01664                             if (!l1EnergySums.isValid()) {
01665                                 edm::LogWarning("HLTLevel1GTSeed")
01666                                         << "\nWarning: L1EtMissParticleCollection with input tag "
01667                                         << m_l1EtMissMET
01668                                         << "\nrequested in configuration, but not found in the event."
01669                                         << "\nNo ETT added to filterObject."
01670                                         << std::endl;
01671 
01672                             } else if (l1EnergySums->size() == 0) {
01673                                 edm::LogWarning("HLTLevel1GTSeed")
01674                                         << "\nWarning: L1EtMissParticleCollection with input tag "
01675                                         << m_l1EtMissMET
01676                                         << "\nfound in the event but with 0 size."
01677                                         << "\nNo ETT added to filterObject."
01678                                         << std::endl;
01679 
01680                             } else {
01681                                 int iObj = -1;
01682                                 for (l1extra::L1EtMissParticleCollection::const_iterator
01683                                         objIter = l1EnergySums->begin(); objIter
01684                                         != l1EnergySums->end(); ++objIter) {
01685 
01686                                     iObj++;
01687 
01688                                     int bxNr = objIter->bx();
01689                                     if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
01690 
01691                                         objectsInFilter = true;
01692                                         filterObject->addObject(
01693                                                 trigger::TriggerL1ETT,
01694                                                 l1extra::L1EtMissParticleRef(
01695                                                         l1EnergySums, iObj));
01696 
01697                                     }
01698                                 }
01699                             }
01700                             includeETT = false;
01701                         }
01702 
01703                     }
01704 
01705                         break;
01706                     case HTT: {
01707                         if (includeHTT) {
01708                             edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
01709                             iEvent.getByLabel(m_l1EtMissMHT, l1EnergySums);
01710 
01711                             if (!l1EnergySums.isValid()) {
01712                                 edm::LogWarning("HLTLevel1GTSeed")
01713                                         << "\nWarning: L1EtMissParticleCollection with input tag "
01714                                         << m_l1EtMissMHT
01715                                         << "\nrequested in configuration, but not found in the event."
01716                                         << "\nNo HTT added to filterObject."
01717                                         << std::endl;
01718 
01719                             } else if (l1EnergySums->size() == 0) {
01720                                 edm::LogWarning("HLTLevel1GTSeed")
01721                                         << "\nWarning: L1EtMissParticleCollection with input tag "
01722                                         << m_l1EtMissMHT
01723                                         << "\nfound in the event but with 0 size."
01724                                         << "\nNo HTT added to filterObject."
01725                                         << std::endl;
01726 
01727                             } else {
01728                                 int iObj = -1;
01729                                 for (l1extra::L1EtMissParticleCollection::const_iterator
01730                                         objIter = l1EnergySums->begin(); objIter
01731                                         != l1EnergySums->end(); ++objIter) {
01732 
01733                                     iObj++;
01734 
01735                                     int bxNr = objIter->bx();
01736                                     if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
01737 
01738                                         objectsInFilter = true;
01739                                         filterObject->addObject(
01740                                                 trigger::TriggerL1HTT,
01741                                                 l1extra::L1EtMissParticleRef(
01742                                                         l1EnergySums, iObj));
01743 
01744                                     }
01745                                 }
01746                             }
01747                             includeHTT = false;
01748                         }
01749                     }
01750 
01751                         break;
01752                     case HTM: {
01753                         if (includeHTM) {
01754                             edm::Handle<l1extra::L1EtMissParticleCollection> l1EnergySums;
01755                             iEvent.getByLabel(m_l1EtMissMHT, l1EnergySums);
01756 
01757                             if (!l1EnergySums.isValid()) {
01758                                 edm::LogWarning("HLTLevel1GTSeed")
01759                                         << "\nWarning: L1EtMissParticleCollection with input tag "
01760                                         << m_l1EtMissMHT
01761                                         << "\nrequested in configuration, but not found in the event."
01762                                         << "\nNo HTM added to filterObject."
01763                                         << std::endl;
01764 
01765                             } else if (l1EnergySums->size() == 0) {
01766                                 edm::LogWarning("HLTLevel1GTSeed")
01767                                         << "\nWarning: L1EtMissParticleCollection with input tag "
01768                                         << m_l1EtMissMHT
01769                                         << "\nfound in the event but with 0 size."
01770                                         << "\nNo HTM added to filterObject."
01771                                         << std::endl;
01772 
01773                             } else {
01774                                 int iObj = -1;
01775                                 for (l1extra::L1EtMissParticleCollection::const_iterator
01776                                         objIter = l1EnergySums->begin(); objIter
01777                                         != l1EnergySums->end(); ++objIter) {
01778 
01779                                     iObj++;
01780 
01781                                     int bxNr = objIter->bx();
01782                                     if ((bxNr >= minBxInEvent) && (bxNr <= maxBxInEvent)) {
01783 
01784                                         objectsInFilter = true;
01785                                         filterObject->addObject(
01786                                                 trigger::TriggerL1HTM,
01787                                                 l1extra::L1EtMissParticleRef(
01788                                                         l1EnergySums, iObj));
01789 
01790                                     }
01791                                 }
01792                             }
01793                             includeHTM = false;
01794                         }
01795                     }
01796 
01797                         break;
01798                     case JetCounts: {
01799                         if (includeJetCounts) {
01800                             // do nothing, JetCounts do not exist now
01801                         }
01802                     }
01803 
01804                         break;
01805                     default: {
01806                         // should not arrive here
01807 
01808                         LogDebug("HLTLevel1GTSeed")
01809                                 << "\n    HLTLevel1GTSeed::filter "
01810                                 << "\n      Unknown object of type " << *itObj
01811                                 << " in the seed list." << std::endl;
01812                     }
01813                         break;
01814                 }
01815 
01816             }
01817 
01818         }
01819 
01820         LogTrace("HLTLevel1GTSeed") << std::endl;
01821     }
01822 
01823     return objectsInFilter;
01824 
01825 }
01826 
01827 // detailed print of filter content
01828 void HLTLevel1GTSeed::dumpTriggerFilterObjectWithRefs(std::auto_ptr<
01829         trigger::TriggerFilterObjectWithRefs>& filterObject) {
01830 
01831     LogDebug("HLTLevel1GTSeed") << "\nHLTLevel1GTSeed::filter "
01832             << "\n  Dump TriggerFilterObjectWithRefs\n" << std::endl;
01833 
01834     std::vector<l1extra::L1MuonParticleRef> seedsL1Mu;
01835 
01836     std::vector<l1extra::L1EmParticleRef> seedsL1IsoEG;
01837     std::vector<l1extra::L1EmParticleRef> seedsL1NoIsoEG;
01838 
01839     std::vector<l1extra::L1JetParticleRef> seedsL1CenJet;
01840     std::vector<l1extra::L1JetParticleRef> seedsL1ForJet;
01841     std::vector<l1extra::L1JetParticleRef> seedsL1TauJet;
01842 
01843     std::vector<l1extra::L1EtMissParticleRef> seedsL1ETM;
01844     std::vector<l1extra::L1EtMissParticleRef> seedsL1ETT;
01845     std::vector<l1extra::L1EtMissParticleRef> seedsL1HTT;
01846     std::vector<l1extra::L1EtMissParticleRef> seedsL1HTM;
01847 
01848     filterObject->getObjects(trigger::TriggerL1Mu, seedsL1Mu);
01849     const size_t sizeSeedsL1Mu = seedsL1Mu.size();
01850 
01851     filterObject->getObjects(trigger::TriggerL1IsoEG, seedsL1IsoEG);
01852     const size_t sizeSeedsL1IsoEG = seedsL1IsoEG.size();
01853 
01854     filterObject->getObjects(trigger::TriggerL1NoIsoEG, seedsL1NoIsoEG);
01855     const size_t sizeSeedsL1NoIsoEG = seedsL1NoIsoEG.size();
01856 
01857     filterObject->getObjects(trigger::TriggerL1CenJet, seedsL1CenJet);
01858     const size_t sizeSeedsL1CenJet = seedsL1CenJet.size();
01859 
01860     filterObject->getObjects(trigger::TriggerL1ForJet, seedsL1ForJet);
01861     const size_t sizeSeedsL1ForJet = seedsL1ForJet.size();
01862 
01863     filterObject->getObjects(trigger::TriggerL1TauJet, seedsL1TauJet);
01864     const size_t sizeSeedsL1TauJet = seedsL1TauJet.size();
01865 
01866     filterObject->getObjects(trigger::TriggerL1ETM, seedsL1ETM);
01867     const size_t sizeSeedsL1ETM = seedsL1ETM.size();
01868 
01869     filterObject->getObjects(trigger::TriggerL1ETT, seedsL1ETT);
01870     const size_t sizeSeedsL1ETT = seedsL1ETT.size();
01871 
01872     filterObject->getObjects(trigger::TriggerL1HTT, seedsL1HTT);
01873     const size_t sizeSeedsL1HTT = seedsL1HTT.size();
01874 
01875     filterObject->getObjects(trigger::TriggerL1HTM, seedsL1HTM);
01876     const size_t sizeSeedsL1HTM = seedsL1HTM.size();
01877 
01878     LogTrace("HLTLevel1GTSeed") << "  L1Mu seeds:      " << sizeSeedsL1Mu << "\n"
01879             << "  L1IsoEG seeds:   " << sizeSeedsL1IsoEG << "\n"
01880             << "  L1NoIsoEG seeds: " << sizeSeedsL1NoIsoEG << "\n"
01881             << "  L1CenJet seeds:  " << sizeSeedsL1CenJet << "\n"
01882             << "  L1ForJet seeds:  " << sizeSeedsL1ForJet << "\n"
01883             << "  L1TauJet seeds:  " << sizeSeedsL1TauJet << "\n"
01884             << "  L1ETM seeds:     " << sizeSeedsL1ETM << "\n"
01885             << "  L1ETT seeds:     " << sizeSeedsL1ETT << "\n"
01886             << "  L1HTT seeds:     " << sizeSeedsL1HTT << "\n"
01887             << "  L1HTM seeds:     " << sizeSeedsL1HTM << "\n" << std::endl;
01888 
01889     for (size_t i = 0; i != sizeSeedsL1Mu; i++) {
01890 
01891         l1extra::L1MuonParticleRef obj = l1extra::L1MuonParticleRef(
01892                 seedsL1Mu[i]);
01893 
01894         LogTrace("HLTLevel1GTSeed") << "L1Mu     " << "\t" << "q*PT = "
01895                 << obj->charge() * obj->pt() << "\t" << "eta =  " << obj->eta()
01896                 << "\t" << "phi =  " << obj->phi() << "\t" << "BX = "
01897                 << obj->bx();
01898     }
01899 
01900     for (size_t i = 0; i != sizeSeedsL1IsoEG; i++) {
01901 
01902         l1extra::L1EmParticleRef obj =
01903                 l1extra::L1EmParticleRef(seedsL1IsoEG[i]);
01904 
01905         LogTrace("HLTLevel1GTSeed") << "L1IsoEG   " << "\t" << "ET =   "
01906                 << obj->et() << "\t" << "eta =  " << obj->eta() << "\t"
01907                 << "phi =  " << obj->phi() << "\t" << "BX = " << obj->bx();
01908         ;
01909     }
01910 
01911     for (size_t i = 0; i != sizeSeedsL1NoIsoEG; i++) {
01912 
01913         l1extra::L1EmParticleRef obj = l1extra::L1EmParticleRef(
01914                 seedsL1NoIsoEG[i]);
01915 
01916         LogTrace("HLTLevel1GTSeed") << "L1NoIsoEG" << "\t" << "ET =   "
01917                 << obj->et() << "\t" << "eta =  " << obj->eta() << "\t"
01918                 << "phi =  " << obj->phi() << "\t" << "BX = " << obj->bx();
01919     }
01920 
01921     for (size_t i = 0; i != sizeSeedsL1CenJet; i++) {
01922 
01923         l1extra::L1JetParticleRef obj = l1extra::L1JetParticleRef(
01924                 seedsL1CenJet[i]);
01925 
01926         LogTrace("HLTLevel1GTSeed") << "L1CenJet " << "\t" << "ET =   "
01927                 << obj->et() << "\t" << "eta =  " << obj->eta() << "\t"
01928                 << "phi =  " << obj->phi() << "\t" << "BX = " << obj->bx();
01929     }
01930 
01931     for (size_t i = 0; i != sizeSeedsL1ForJet; i++) {
01932 
01933         l1extra::L1JetParticleRef obj = l1extra::L1JetParticleRef(
01934                 seedsL1ForJet[i]);
01935 
01936         LogTrace("HLTLevel1GTSeed") << "L1ForJet " << "\t" << "ET =   "
01937                 << obj->et() << "\t" << "eta =  " << obj->eta() << "\t"
01938                 << "phi =  " << obj->phi() << "\t" << "BX = " << obj->bx();
01939     }
01940 
01941     for (size_t i = 0; i != sizeSeedsL1TauJet; i++) {
01942 
01943         l1extra::L1JetParticleRef obj = l1extra::L1JetParticleRef(
01944                 seedsL1TauJet[i]);
01945 
01946         LogTrace("HLTLevel1GTSeed") << "L1TauJet " << "\t" << "ET =   "
01947                 << obj->et() << "\t" << "eta =  " << obj->eta() << "\t"
01948                 << "phi =  " << obj->phi() << "\t" << "BX = " << obj->bx();
01949     }
01950 
01951     for (size_t i = 0; i != sizeSeedsL1ETM; i++) {
01952 
01953         l1extra::L1EtMissParticleRef obj = l1extra::L1EtMissParticleRef(
01954                 seedsL1ETM[i]);
01955 
01956         LogTrace("HLTLevel1GTSeed") << "L1ETM    " << "\t" << "ET =   "
01957                 << obj->etMiss() << "\t" << "phi =  " << obj->phi() << "BX =  "
01958                 << obj->bx();
01959     }
01960 
01961     for (size_t i = 0; i != sizeSeedsL1ETT; i++) {
01962 
01963         l1extra::L1EtMissParticleRef obj = l1extra::L1EtMissParticleRef(
01964                 seedsL1ETT[i]);
01965 
01966         LogTrace("HLTLevel1GTSeed") << "L1ETT    " << "\t" << "ET =   "
01967                 << obj->etTotal() << "\t" << "BX = " << obj->bx();
01968     }
01969 
01970     for (size_t i = 0; i != sizeSeedsL1HTT; i++) {
01971 
01972         l1extra::L1EtMissParticleRef obj = l1extra::L1EtMissParticleRef(
01973                 seedsL1HTT[i]);
01974 
01975         LogTrace("HLTLevel1GTSeed") << "L1HTT    " << "\t" << "ET =   "
01976                 << obj->etTotal() << "\t" << "BX = " << obj->bx();
01977     }
01978 
01979     for (size_t i = 0; i != sizeSeedsL1HTM; i++) {
01980 
01981         l1extra::L1EtMissParticleRef obj = l1extra::L1EtMissParticleRef(
01982                 seedsL1HTM[i]);
01983 
01984         LogTrace("HLTLevel1GTSeed") << "L1HTM    " << "\t" << "ET =   "
01985                 << obj->etMiss() << "\t" << "phi =  " << obj->phi() << "BX =  "
01986                 << obj->bx();
01987     }
01988 
01989     LogTrace("HLTLevel1GTSeed") << " \n\n" << std::endl;
01990 
01991 }