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