CMS 3D CMS Logo

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