CMS 3D CMS Logo

HLTL1TSeed.cc
Go to the documentation of this file.
1 #include <string>
2 #include <list>
3 #include <vector>
4 #include <algorithm>
5 #include <iostream>
6 #include <sstream>
7 #include <cassert>
8 
24 
25 
27 
29 
30 using namespace std;
31 
32 // constructors
34  HLTStreamFilter(parSet),
35  //useObjectMaps_(parSet.getParameter<bool>("L1UseL1TriggerObjectMaps")),
36  m_l1SeedsLogicalExpression(parSet.getParameter<string>("L1SeedsLogicalExpression")),
37  m_l1GtObjectMapTag(parSet.getParameter<edm::InputTag> ("L1ObjectMapInputTag")),
38  m_l1GtObjectMapToken(consumes<GlobalObjectMapRecord>(m_l1GtObjectMapTag)),
39  m_l1GlobalTag(parSet.getParameter<edm::InputTag> ("L1GlobalInputTag")),
40  m_l1GlobalToken(consumes<GlobalAlgBlkBxCollection>(m_l1GlobalTag)),
41  m_l1MuonCollectionsTag(parSet.getParameter<edm::InputTag>("L1MuonInputTag")), // FIX WHEN UNPACKERS ADDED
42  m_l1MuonTag(m_l1MuonCollectionsTag),
43  m_l1MuonToken(consumes<l1t::MuonBxCollection>(m_l1MuonTag)),
44  m_l1EGammaCollectionsTag(parSet.getParameter<edm::InputTag>("L1EGammaInputTag")), // FIX WHEN UNPACKERS ADDED
45  m_l1EGammaTag(m_l1EGammaCollectionsTag),
46  m_l1EGammaToken(consumes<l1t::EGammaBxCollection>(m_l1EGammaTag)),
47  m_l1JetCollectionsTag(parSet.getParameter<edm::InputTag>("L1JetInputTag")), // FIX WHEN UNPACKERS ADDED
48  m_l1JetTag(m_l1JetCollectionsTag),
49  m_l1JetToken(consumes<l1t::JetBxCollection>(m_l1JetTag)),
50  m_l1TauCollectionsTag(parSet.getParameter<edm::InputTag>("L1TauInputTag")), // FIX WHEN UNPACKERS ADDED
51  m_l1TauTag(m_l1TauCollectionsTag),
52  m_l1TauToken(consumes<l1t::TauBxCollection>(m_l1TauTag)),
53  m_l1EtSumCollectionsTag(parSet.getParameter<edm::InputTag>("L1EtSumInputTag")), // FIX WHEN UNPACKERS ADDED
54  m_l1EtSumTag(m_l1EtSumCollectionsTag),
55  m_l1EtSumToken(consumes<l1t::EtSumBxCollection>(m_l1EtSumTag)),
56  m_l1GlobalDecision(false),
57  m_isDebugEnabled(edm::isDebugEnabled())
58 {
59 
60  if (m_l1SeedsLogicalExpression == "") {
61 
62  throw cms::Exception("FailModule") << "\nTrying to seed with an empty L1SeedsLogicalExpression.\n" << std::endl;
63 
64  }
65  else if (m_l1SeedsLogicalExpression != "L1GlobalDecision") {
66 
67  // check also the logical expression - add/remove spaces if needed
69 
70  // list of required algorithms for seeding
71  // dummy values for tokenNumber and tokenResult
74  size_t l1AlgoSeedsSize = m_l1AlgoSeeds.size();
75 
76  m_l1AlgoSeedsRpn.reserve(l1AlgoSeedsSize);
77  m_l1AlgoSeedsObjType.reserve(l1AlgoSeedsSize);
78 
79  }
80  else {
81 
82  m_l1GlobalDecision = true;
83 
84  }
85 
86 }
87 
88 // destructor
90  // empty now
91 }
92 
93 // member functions
94 
95 void
99 
100 
101  // # logical expression for the required L1 algorithms;
102  // # the algorithms are specified by name
103  // # allowed operators: "AND", "OR", "NOT", "(", ")"
104  // #
105  // # by convention, "L1GlobalDecision" logical expression means global decision
106  desc.add<string>("L1SeedsLogicalExpression","");
107  desc.add<edm::InputTag>("L1ObjectMapInputTag",edm::InputTag("hltGtStage2ObjectMap"));
108  desc.add<edm::InputTag>("L1GlobalInputTag",edm::InputTag("hltGtStage2Digis"));
109  desc.add<edm::InputTag>("L1MuonInputTag",edm::InputTag("hltGmtStage2Digis:Muon"));
110  desc.add<edm::InputTag>("L1EGammaInputTag",edm::InputTag("hltCaloStage2Digis:EGamma"));
111  desc.add<edm::InputTag>("L1JetInputTag",edm::InputTag("hltCaloStage2Digis:Jet"));
112  desc.add<edm::InputTag>("L1TauInputTag",edm::InputTag("hltCaloStage2Digis:Tau"));
113  desc.add<edm::InputTag>("L1EtSumInputTag",edm::InputTag("hltCaloStage2Digis:EtSum"));
114  descriptions.add("hltL1TSeed", desc);
115 }
116 
118 
119  bool rc = false;
120 
121  // the filter object
122  if (saveTags()) {
123 
124  // muons
125  filterproduct.addCollectionTag(m_l1MuonTag);
126 
127  // egamma
128  filterproduct.addCollectionTag(m_l1EGammaTag);
129 
130  // jet
131  filterproduct.addCollectionTag(m_l1JetTag);
132 
133  // tau
134  filterproduct.addCollectionTag(m_l1TauTag);
135 
136  // etsum
137  filterproduct.addCollectionTag(m_l1EtSumTag);
138  }
139 
140  // Get all the seeding from iEvent (i.e. L1TriggerObjectMapRecord)
141  //
142  rc = seedsL1TriggerObjectMaps(iEvent, filterproduct);
143 
144  if (m_isDebugEnabled) {
145  dumpTriggerFilterObjectWithRefs(filterproduct);
146  }
147 
148  return rc;
149 
150 }
151 
152 // detailed print of filter content
154 {
155 
156  LogTrace("HLTL1TSeed")
157  << "\nHLTL1TSeed::hltFilter "
158  << "\n Dump TriggerFilterObjectWithRefs\n" << endl;
159 
160  vector<l1t::MuonRef> seedsL1Mu;
161  filterproduct.getObjects(trigger::TriggerL1Mu, seedsL1Mu);
162  const size_t sizeSeedsL1Mu = seedsL1Mu.size();
163 
164  LogTrace("HLTL1TSeed")
165  << "\n HLTL1TSeed: seed logical expression = " << m_l1SeedsLogicalExpression << endl;
166 
167  LogTrace("HLTL1TSeed")
168  << "\n L1Mu seeds: " << sizeSeedsL1Mu << endl << endl;
169 
170  for (size_t i = 0; i != sizeSeedsL1Mu; i++) {
171 
172 
173  l1t::MuonRef obj = l1t::MuonRef( seedsL1Mu[i]);
174 
175  LogTrace("HLTL1TSeed")
176  << "\tL1Mu " << "\t" << "q = " << obj->hwCharge() // TEMP get hwCharge insead of charge which is not yet set NEED FIX.
177  << "\t" << "pt = " << obj->pt() << "\t" << "eta = " << obj->eta()
178  << "\t" << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
179  }
180 
181  vector<l1t::EGammaRef> seedsL1EG;
182  filterproduct.getObjects(trigger::TriggerL1EG, seedsL1EG);
183  const size_t sizeSeedsL1EG = seedsL1EG.size();
184 
185  LogTrace("HLTL1TSeed")
186  << "\n L1EG seeds: " << sizeSeedsL1EG << endl << endl;
187 
188  for (size_t i = 0; i != sizeSeedsL1EG; i++) {
189 
190 
191  l1t::EGammaRef obj = l1t::EGammaRef( seedsL1EG[i]);
192 
193  LogTrace("HLTL1TSeed")
194  << "\tL1EG " << "\t" << "pt = "
195  << obj->pt() << "\t" << "eta = " << obj->eta()
196  << "\t" << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
197  }
198 
199  vector<l1t::JetRef> seedsL1Jet;
200  filterproduct.getObjects(trigger::TriggerL1Jet, seedsL1Jet);
201  const size_t sizeSeedsL1Jet = seedsL1Jet.size();
202 
203  LogTrace("HLTL1TSeed")
204  << "\n L1Jet seeds: " << sizeSeedsL1Jet << endl << endl;
205 
206  for (size_t i = 0; i != sizeSeedsL1Jet; i++) {
207 
208 
209  l1t::JetRef obj = l1t::JetRef( seedsL1Jet[i]);
210 
211  LogTrace("HLTL1TSeed") << "\tL1Jet " << "\t" << "pt = "
212  << obj->pt() << "\t" << "eta = " << obj->eta()
213  << "\t" << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
214  }
215 
216  vector<l1t::TauRef> seedsL1Tau;
217  filterproduct.getObjects(trigger::TriggerL1Tau, seedsL1Tau);
218  const size_t sizeSeedsL1Tau = seedsL1Tau.size();
219 
220  LogTrace("HLTL1TSeed")
221  << "\n L1Tau seeds: " << sizeSeedsL1Tau << endl << endl;
222 
223  for (size_t i = 0; i != sizeSeedsL1Tau; i++) {
224 
225 
226  l1t::TauRef obj = l1t::TauRef( seedsL1Tau[i]);
227 
228  LogTrace("HLTL1TSeed")
229  << "\tL1Tau " << "\t" << "pt = "
230  << obj->pt() << "\t" << "eta = " << obj->eta()
231  << "\t" << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
232  }
233 
234  vector<l1t::EtSumRef> seedsL1EtSumETT;
235  filterproduct.getObjects(trigger::TriggerL1ETT, seedsL1EtSumETT);
236  const size_t sizeSeedsL1EtSumETT = seedsL1EtSumETT.size();
237  LogTrace("HLTL1TSeed")
238  << "\n L1EtSum ETT seeds: " << sizeSeedsL1EtSumETT << endl << endl;
239 
240  for (size_t i = 0; i != sizeSeedsL1EtSumETT; i++) {
241  l1t::EtSumRef obj = l1t::EtSumRef( seedsL1EtSumETT[i]);
242 
243  LogTrace("HLTL1TSeed")
244  << "\tL1EtSum ETT" << "\t" << "pt = "
245  << obj->pt() << "\t" << "eta = " << obj->eta()
246  << "\t" << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
247  }
248 
249  vector<l1t::EtSumRef> seedsL1EtSumHTT;
250  filterproduct.getObjects(trigger::TriggerL1HTT, seedsL1EtSumHTT);
251  const size_t sizeSeedsL1EtSumHTT = seedsL1EtSumHTT.size();
252  LogTrace("HLTL1TSeed")
253  << "\n L1EtSum HTT seeds: " << sizeSeedsL1EtSumHTT << endl << endl;
254 
255  for (size_t i = 0; i != sizeSeedsL1EtSumHTT; i++) {
256  l1t::EtSumRef obj = l1t::EtSumRef( seedsL1EtSumHTT[i]);
257 
258  LogTrace("HLTL1TSeed")
259  << "\tL1EtSum HTT" << "\t" << "pt = "
260  << obj->pt() << "\t" << "eta = " << obj->eta()
261  << "\t" << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
262  }
263 
264  vector<l1t::EtSumRef> seedsL1EtSumETM;
265  filterproduct.getObjects(trigger::TriggerL1ETM, seedsL1EtSumETM);
266  const size_t sizeSeedsL1EtSumETM = seedsL1EtSumETM.size();
267  LogTrace("HLTL1TSeed")
268  << "\n L1EtSum ETM seeds: " << sizeSeedsL1EtSumETM << endl << endl;
269 
270  for (size_t i = 0; i != sizeSeedsL1EtSumETM; i++) {
271  l1t::EtSumRef obj = l1t::EtSumRef( seedsL1EtSumETM[i]);
272 
273  LogTrace("HLTL1TSeed")
274  << "\tL1EtSum ETM" << "\t" << "pt = "
275  << obj->pt() << "\t" << "eta = " << obj->eta()
276  << "\t" << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
277  }
278 
279  vector<l1t::EtSumRef> seedsL1EtSumHTM;
280  filterproduct.getObjects(trigger::TriggerL1HTM, seedsL1EtSumHTM);
281  const size_t sizeSeedsL1EtSumHTM = seedsL1EtSumHTM.size();
282  LogTrace("HLTL1TSeed")
283  << "\n L1EtSum HTM seeds: " << sizeSeedsL1EtSumHTM << endl << endl;
284 
285  for (size_t i = 0; i != sizeSeedsL1EtSumHTM; i++) {
286  l1t::EtSumRef obj = l1t::EtSumRef( seedsL1EtSumHTM[i]);
287 
288  LogTrace("HLTL1TSeed")
289  << "\tL1EtSum HTM" << "\t" << "pt = "
290  << obj->pt() << "\t" << "eta = " << obj->eta()
291  << "\t" << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
292  }
293 
294  LogTrace("HLTL1TSeed") << " \n\n" << endl;
295 
296 }
297 
298 // seeding is done via L1 trigger object maps, considering the objects which fired in L1
301  ) {
302 
303  // Two GT objects are obtained from the Event: (1) the unpacked GT and (2) the emulated GT.
304  // Return value of the function is the score of seeding logical expression, evaluated using (1).
305  // Seeding is performed (per l1_algo) if ACCEPT both in (1) and (2). Seed objects are identified
306  // and only available from ObjectMaps created in (2).
307 
308 
309  // define index lists for all particle types
310 
311  std::list<int> listMuon;
312 
313  std::list<int> listEG;
314 
315  std::list<int> listJet;
316  std::list<int> listTau;
317 
318  std::list<int> listETM;
319  std::list<int> listETT;
320  std::list<int> listHTT;
321  std::list<int> listHTM;
322 
323  std::list<int> listJetCounts;
324 
325  // get handle to unpacked GT
327  iEvent.getByToken(m_l1GlobalToken, uGtAlgoBlocks);
328 
329  if (!uGtAlgoBlocks.isValid()) {
330 
331  edm::LogWarning("HLTL1TSeed")
332  << " Warning: GlobalAlgBlkBxCollection with input tag "
333  << m_l1GlobalTag
334  << " requested in configuration, but not found in the event." << std::endl;
335 
336  return false;
337  }
338 
339  // check size
340  if(uGtAlgoBlocks->size() == 0) {
341 
342  edm::LogWarning("HLTL1TSeed")
343  << " Warning: GlobalAlgBlkBxCollection with input tag "
344  << m_l1GlobalTag
345  << " is empty." << std::endl;
346 
347  return false;
348  }
349 
350  // get handle to object maps from emulator (one object map per algorithm)
351  edm::Handle<GlobalObjectMapRecord> gtObjectMapRecord;
352  iEvent.getByToken(m_l1GtObjectMapToken, gtObjectMapRecord);
353 
354  if (!gtObjectMapRecord.isValid()) {
355 
356  edm::LogWarning("HLTL1TSeed")
357  << " Warning: GlobalObjectMapRecord with input tag "
359  << " requested in configuration, but not found in the event." << std::endl;
360 
361  return false;
362  }
363 
364  if (m_isDebugEnabled) {
365 
366  const std::vector<GlobalObjectMap>& objMaps = gtObjectMapRecord->gtObjectMap();
367 
368  LogTrace("HLTL1TSeed")
369  << "\nHLTL1Seed"
370  << "\n---------------------------------------------------------------------------------------------------------------------";
371 
372  LogTrace("HLTL1TSeed")
373  << "\n\tAlgorithms in L1TriggerObjectMapRecord and GT results ( emulated | initial | prescaled | final ) " << endl;
374 
375  LogTrace("HLTL1TSeed")
376  << "\n\tmap" <<"\tAlgoBit" << std::setw(40) << "algoName" << "\t (emul|ini|pre|fin)" << endl;
377 
378  LogTrace("HLTL1TSeed")
379  << "---------------------------------------------------------------------------------------------------------------------";
380 
381  for (size_t imap =0; imap < objMaps.size(); imap++) {
382 
383  int bit = objMaps[imap].algoBitNumber(); // same as bit from L1T Menu
384 
385  int emulDecision = objMaps[imap].algoGtlResult();
386 
387  // For bx=0 , get 0th AlgoBlock, so in BXvector at(bx=0,i=0)
388  int initDecision = (uGtAlgoBlocks->at(0,0)).getAlgoDecisionInitial(bit);
389  int presDecision = (uGtAlgoBlocks->at(0,0)).getAlgoDecisionInterm(bit);
390  int finlDecision = (uGtAlgoBlocks->at(0,0)).getAlgoDecisionFinal(bit);
391 
392  if(emulDecision != initDecision) {
393 
394  LogTrace("HLTL1TSeed")
395  << "L1T decision (emulated vs. unpacked initial) is not the same:"
396  << "\n\tbit = " << std::setw(3) << bit
397  << std::setw(40) << objMaps[imap].algoName()
398  << "\t emulated decision = " << emulDecision << "\t unpacked initial decision = " << initDecision
399  << "\nThis should not happen. Include the L1TGtEmulCompare module in the sequence."<< endl;
400 
401  }
402 
403 
404  LogTrace("HLTL1TSeed")
405  << "\t" << std::setw(3) << imap
406  << "\tbit = " << std::setw(3) << bit
407  << std::setw(40) << objMaps[imap].algoName()
408  << "\t ( " << emulDecision << " | " << initDecision << " | " << presDecision << " | " << finlDecision << " ) ";
409 
410 
411  }
412  LogTrace("HLTL1TSeed") << endl;
413 
414  }
415 
416  // Filter decision in case of "L1GlobalDecision" logical expression.
417  // By convention, it means global decision.
418  // /////////////////////////////////////////////////////////////////
419  if (m_l1GlobalDecision) {
420 
421  // For bx=0 , get 0th AlgoBlock, so in BXvector at(bx=0,i=0)
422  return (uGtAlgoBlocks->at(0,0)).getFinalOR();
423 
424  }
425 
426 
427  // Update/Reset m_l1AlgoLogicParser by reseting token result
428  // /////////////////////////////////////////////////////////
429  std::vector<GlobalLogicParser::OperandToken>& algOpTokenVector =
431 
432  for (auto & i : algOpTokenVector) {
433 
434  // rest token result
435  //
436  i.tokenResult = false;
437 
438  }
439 
440  // Update m_l1AlgoLogicParser and store emulator results for algOpTokens
441  // /////////////////////////////////////////////////////////////////////
442  for (auto & i : algOpTokenVector) {
443 
444  std::string algoName = i.tokenName;
445 
446  const GlobalObjectMap* objMap = gtObjectMapRecord->getObjectMap(algoName);
447 
448  if(objMap == nullptr) {
449 
450  throw cms::Exception("FailModule") << "\nAlgorithm " << algoName
451  << ", requested as seed by a HLT path, cannot be matched to a L1 algo name in any GlobalObjectMap\n"
452  << "Please check if algorithm " << algoName << " is present in the L1 menu\n" << std::endl;
453 
454  }
455  else {
456 
457  //(algOpTokenVector[i]).tokenResult = objMap->algoGtlResult();
458 
459  int bit = objMap->algoBitNumber();
460  bool finalAlgoDecision = (uGtAlgoBlocks->at(0,0)).getAlgoDecisionFinal(bit);
461  i.tokenResult = finalAlgoDecision;
462 
463  }
464 
465  }
466 
467  // Filter decision
468  // ///////////////
469  bool seedsResult = m_l1AlgoLogicParser.expressionResult();
470 
471  if (m_isDebugEnabled ) {
472 
473  LogTrace("HLTL1TSeed")
474  << "\nHLTL1TSeed: l1SeedsLogicalExpression (names) = '" << m_l1SeedsLogicalExpression << "'"
475  << "\n Result for logical expression after update of algOpTokens: " << seedsResult << "\n"
476  << std::endl;
477  }
478 
481 
482  for (std::vector<GlobalLogicParser::OperandToken>::const_iterator
483  itSeed = m_l1AlgoSeeds.begin(); itSeed != m_l1AlgoSeeds.end(); ++itSeed) {
484 
485  std::string algoSeedName = (*itSeed).tokenName;
486 
487  LogTrace("HLTL1TSeed")
488  << "\n ---------------- algo seed name = " << algoSeedName << endl;
489 
490  const GlobalObjectMap* objMap = gtObjectMapRecord->getObjectMap(algoSeedName);
491 
492  if(objMap == nullptr) {
493 
494  // Should not get here
495  //
496  throw cms::Exception("FailModule") << "\nAlgorithm " << algoSeedName
497  << ", requested as seed by a HLT path, cannot be matched to a L1 algo name in any GlobalObjectMap\n"
498  << "Please check if algorithm " << algoSeedName << " is present in the L1 menu\n" << std::endl;
499 
500  }
501 
502  int algoSeedBitNumber = objMap->algoBitNumber();
503  bool algoSeedResult = objMap->algoGtlResult();
504 
505  // unpacked GT results: uGtAlgoBlock has decisions initial, prescaled, and final after masks
506  bool algoSeedResultMaskAndPresc = uGtAlgoBlocks->at(0,0).getAlgoDecisionFinal(algoSeedBitNumber);
507 
508  LogTrace("HLTL1TSeed")
509  << "\n\tAlgo seed " << algoSeedName << " result emulated | final = " << algoSeedResult << " | " << algoSeedResultMaskAndPresc << endl;
510 
513  if(!algoSeedResultMaskAndPresc) continue;
514 
516  // This should not happen if the emulated and unpacked GT are consistent
518  if(!algoSeedResult) continue;
519 
520  const std::vector<GlobalLogicParser::OperandToken>& opTokenVecObjMap = objMap->operandTokenVector();
521  const std::vector<L1TObjectTypeInCond>& condObjTypeVec = objMap->objectTypeVector();
522  const std::vector<CombinationsInCond>& condCombinations = objMap->combinationVector();
523 
524  LogTrace("HLTL1TSeed")
525  << "\n\talgoName =" << objMap->algoName()
526  << "\talgoBitNumber = " << algoSeedBitNumber
527  << "\talgoGtlResult = " << algoSeedResult << endl << endl;
528 
529 
530  if (opTokenVecObjMap.size() != condObjTypeVec.size() ) {
531  edm::LogWarning("HLTL1TSeed")
532  << "\nWarning: GlobalObjectMapRecord with input tag "
534  << "\nhas object map for bit number " << algoSeedBitNumber << " which contains different size vectors of operand tokens and of condition object types!" << std::endl;
535 
536  assert(opTokenVecObjMap.size() == condObjTypeVec.size());
537  }
538 
539  if (opTokenVecObjMap.size() != condCombinations.size()) {
540  edm::LogWarning("HLTL1TSeed")
541  << "\nWarning: GlobalObjectMapRecord with input tag "
543  << "\nhas object map for bit number " << algoSeedBitNumber << " which contains different size vectors of operand tokens and of condition object combinations!" << std::endl;
544 
545  assert(opTokenVecObjMap.size() == condCombinations.size());
546  }
547 
548  // operands are conditions of L1 algo
549  //
550  for (size_t condNumber = 0; condNumber < opTokenVecObjMap.size(); condNumber++) {
551 
552  std::vector<l1t::GlobalObject> condObjType = condObjTypeVec[condNumber];
553 
554  for (auto & jOb : condObjType) {
555 
556  LogTrace("HLTL1TSeed")
557  << setw(15) << "\tcondObjType = " << jOb << endl;
558 
559  }
560 
561  const std::string condName = opTokenVecObjMap[condNumber].tokenName;
562  bool condResult = opTokenVecObjMap[condNumber].tokenResult;
563 
564  // only procede for conditions that passed
565  //
566  if ( !condResult) {
567  continue;
568  }
569 
570  // loop over combinations for a given condition
571  //
572  const CombinationsInCond* condComb = objMap->getCombinationsInCond(condNumber);
573 
574  LogTrace("HLTL1TSeed")
575  << setw(15) << "\tcondCombinations = " << condComb->size() << endl;
576 
577  for (auto const & itComb : (*condComb)) {
578 
579  LogTrace("HLTL1TSeed")
580  << setw(15) << "\tnew combination" << endl;
581 
582  // loop over objects in a combination for a given condition
583  //
584  for (auto itObject = itComb.begin(); itObject != itComb.end(); itObject++) {
585 
586  // in case of object-less triggers (e.g. L1_ZeroBias) condObjType vector is empty, so don't seed!
587  //
588  if(condObjType.size() == 0) {
589 
590  LogTrace("HLTL1TSeed")
591  << "\talgoName = " << objMap->algoName() << " is object-less L1 algorithm, so do not attempt to store any objects to the list of seeds.\n"
592  << std::endl;
593  continue;
594 
595  }
596 
597  // the index of the object type is the same as the index of the object
598  size_t iType = std::distance(itComb.begin(), itObject);
599 
600  // get object type and push indices on the list
601  //
602  const l1t::GlobalObject objTypeVal = condObjType.at(iType);
603 
604  LogTrace("HLTL1TSeed")
605  << "\tAdd object of type " << objTypeVal << " and index " << (*itObject) << " to the seed list."
606  << std::endl;
607 
608 
609  // THESE OBJECT CASES ARE CURRENTLY MISSING:
610  //gtETM2,
611  //gtMinBias,
612  //gtExternal,
613  //ObjNull
614 
615  switch (objTypeVal) {
616  case l1t::gtMu: {
617  listMuon.push_back(*itObject);
618  }
619 
620  break;
621  case l1t::gtEG: {
622  listEG.push_back(*itObject);
623  }
624  break;
625  case l1t::gtJet: {
626  listJet.push_back(*itObject);
627  }
628  break;
629  case l1t::gtTau: {
630  listTau.push_back(*itObject);
631  }
632  break;
633  case l1t::gtETM: {
634  listETM.push_back(*itObject);
635 
636  }
637  break;
638  case l1t::gtETT: {
639  listETT.push_back(*itObject);
640 
641  }
642 
643  break;
644  case l1t::gtHTT: {
645  listHTT.push_back(*itObject);
646 
647  }
648 
649  break;
650  case l1t::gtHTM: {
651  listHTM.push_back(*itObject);
652 
653  }
654 
655  break;
656  //case JetCounts: {
657  // listJetCounts.push_back(*itObject);
658  //}
659 
660  break;
661  default: {
662  // should not arrive here
663 
664  LogTrace("HLTL1TSeed")
665  << "\n HLTL1TSeed::hltFilter "
666  << "\n Unknown object of type " << objTypeVal
667  << " and index " << (*itObject) << " in the seed list."
668  << std::endl;
669  }
670  break;
671 
672  } // end switch objTypeVal
673 
674  } // end for itObj
675 
676  } // end for itComb
677 
678  } // end for condition
679 
680  } // end for itSeed
681 
682 
683  // eliminate duplicates
684 
685  listMuon.sort();
686  listMuon.unique();
687 
688  listEG.sort();
689  listEG.unique();
690 
691  listJet.sort();
692  listJet.unique();
693 
694  listTau.sort();
695  listTau.unique();
696 
697  listETM.sort();
698  listETM.unique();
699 
700  listETT.sort();
701  listETT.unique();
702 
703  listHTT.sort();
704  listHTT.unique();
705 
706  listHTM.sort();
707  listHTM.unique();
708 
709  listJetCounts.sort();
710  listJetCounts.unique();
711 
712 
713  // record the L1 physics objects in the HLT filterproduct
714  // //////////////////////////////////////////////////////
715 
716  // Muon
717  if (!listMuon.empty()) {
718 
720  iEvent.getByToken(m_l1MuonToken, muons);
721 
722  if (!muons.isValid()){
723  edm::LogWarning("HLTL1TSeed")
724  << "\nWarning: L1MuonBxCollection with input tag "
725  << m_l1MuonTag
726  << "\nrequested in configuration, but not found in the event."
727  << "\nNo muons added to filterproduct."
728  << endl;
729  }
730  else {
731 
732  for (std::list<int>::const_iterator itObj = listMuon.begin(); itObj != listMuon.end(); ++itObj) {
733 
734 
735  // Transform to index for Bx = 0 to begin of BxVector
736  unsigned int index = muons->begin(0) - muons->begin() + *itObj;
737 
738  l1t::MuonRef myref(muons, index);
739  filterproduct.addObject(trigger::TriggerL1Mu, myref);
740 
741  }
742 
743  }
744 
745  }
746 
747  // EG (isolated)
748  if (!listEG.empty()) {
749 
751  iEvent.getByToken(m_l1EGammaToken, egammas);
752  if (!egammas.isValid()){
753  edm::LogWarning("HLTL1TSeed")
754  << "\nWarning: L1EGammaBxCollection with input tag " << m_l1EGammaTag
755  << "\nrequested in configuration, but not found in the event."
756  << "\nNo egammas added to filterproduct."
757  << endl;
758  }
759  else {
760 
761  for (std::list<int>::const_iterator itObj = listEG.begin(); itObj != listEG.end(); ++itObj) {
762 
763  // Transform to begin of BxVector
764  unsigned int index = egammas->begin(0) - egammas->begin() + *itObj;
765 
766  l1t::EGammaRef myref(egammas, index);
767  filterproduct.addObject(trigger::TriggerL1EG, myref);
768 
769  }
770 
771  }
772 
773  }
774 
775  // Jet
776  if (!listJet.empty()) {
777 
779  iEvent.getByToken(m_l1JetToken, jets);
780 
781  if (!jets.isValid()){
782  edm::LogWarning("HLTL1TSeed")
783  << "\nWarning: L1JetBxCollection with input tag " << m_l1JetTag
784  << "\nrequested in configuration, but not found in the event."
785  << "\nNo jets added to filterproduct."
786  << endl;
787  }
788  else {
789 
790  for (std::list<int>::const_iterator itObj = listJet.begin(); itObj != listJet.end(); ++itObj) {
791 
792  // Transform to begin of BxVector
793  unsigned int index = jets->begin(0) - jets->begin() + *itObj;
794 
795  l1t::JetRef myref(jets, index);
796  filterproduct.addObject(trigger::TriggerL1Jet, myref);
797 
798  }
799 
800  }
801 
802  }
803 
804  // Tau
805  if (!listTau.empty()) {
806 
808  iEvent.getByToken(m_l1TauToken, taus);
809 
810  if (!taus.isValid()){
811  edm::LogWarning("HLTL1TSeed")
812  << "\nWarning: L1TauBxCollection with input tag " << m_l1TauTag
813  << "\nrequested in configuration, but not found in the event."
814  << "\nNo taus added to filterproduct."
815  << endl;
816  }
817  else {
818 
819  for (std::list<int>::const_iterator itObj = listTau.begin(); itObj != listTau.end(); ++itObj) {
820 
821  // Transform to begin of BxVector
822  unsigned int index = taus->begin(0) - taus->begin() + *itObj;
823 
824  l1t::TauRef myref(taus, index);
825  filterproduct.addObject(trigger::TriggerL1Tau, myref);
826 
827  }
828 
829  }
830 
831  }
832 
833  // ETT, HTT, ETM, HTM
835  iEvent.getByToken(m_l1EtSumToken, etsums);
836  if (!etsums.isValid()){
837  edm::LogWarning("HLTL1TSeed")
838  << "\nWarning: L1EtSumBxCollection with input tag "
839  << m_l1EtSumTag
840  << "\nrequested in configuration, but not found in the event."
841  << "\nNo etsums added to filterproduct."
842  << endl;
843  } else {
844 
846 
847  for (iter = etsums->begin(0); iter != etsums->end(0); ++iter){
848 
849  l1t::EtSumRef myref(etsums, etsums->key(iter));
850 
851  switch(iter->getType()) {
852 
853  case l1t::EtSum::kTotalEt :
854  if(!listETT.empty())
855  filterproduct.addObject(trigger::TriggerL1ETT, myref);
856  break;
857  case l1t::EtSum::kTotalHt :
858  if(!listHTT.empty())
859  filterproduct.addObject(trigger::TriggerL1HTT, myref);
860  break;
862  if(!listETM.empty())
863  filterproduct.addObject(trigger::TriggerL1ETM, myref);
864  break;
866  if(!listHTM.empty())
867  filterproduct.addObject(trigger::TriggerL1HTM, myref);
868  break;
869  default:
870  LogTrace("HLTL1TSeed") << " L1EtSum seed of currently unsuported HLT TriggerType. l1t::EtSum type: " << iter->getType() << "\n";
871 
872  } // end switch
873 
874  } // end for
875 
876  } // end else
877 
878 
879  // TODO FIXME uncomment if block when JetCounts implemented
880 
881  // // jet counts
882  // if (!listJetCounts.empty()) {
883  // edm::Handle<l1extra::L1JetCounts> l1JetCounts;
884  // iEvent.getByToken(m_l1CollectionsToken.label(), l1JetCounts);
885  //
886  // for (std::list<int>::const_iterator itObj = listJetCounts.begin();
887  // itObj != listJetCounts.end(); ++itObj) {
888  //
889  // filterproduct.addObject(trigger::TriggerL1JetCounts,l1extra::L1JetCountsRefProd(l1JetCounts));
890  // // FIXME: RefProd!
891  //
892  // }
893  //
894  // }
895 
896 
897  LogTrace("HLTL1TSeed")
898  << "\nHLTL1Seed:seedsL1TriggerObjectMaps returning " << seedsResult << endl << endl;
899 
900  return seedsResult;
901 
902 }
903 
904 // register as framework plugin
size
Write out results.
BXVector< EGamma > EGammaBxCollection
Definition: EGamma.h:11
const_iterator end(int bx) const
std::string m_l1SeedsLogicalExpression
Definition: HLTL1TSeed.h:102
bool isDebugEnabled()
virtual const bool expressionResult() const
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
edm::EDGetTokenT< l1t::EtSumBxCollection > m_l1EtSumToken
Definition: HLTL1TSeed.h:136
unsigned size(int bx) const
edm::Ref< TauBxCollection > TauRef
Definition: Tau.h:12
const GlobalObjectMap * getObjectMap(const std::string &algoNameVal) const
return the object map for the algorithm algoNameVal
std::vector< std::vector< const std::vector< l1t::GlobalObject > * > > m_l1AlgoSeedsObjType
vector of object-type vectors for each condition in the required algorithms for seeding ...
Definition: HLTL1TSeed.h:91
edm::Ref< EGammaBxCollection > EGammaRef
Definition: EGamma.h:13
const std::vector< L1TObjectTypeInCond > & objectTypeVector() const
std::vector< bool > const & getAlgoDecisionFinal() const
Definition: GlobalAlgBlk.h:88
edm::InputTag m_l1MuonTag
Definition: HLTL1TSeed.h:115
HLTL1TSeed(const edm::ParameterSet &)
constructor
Definition: HLTL1TSeed.cc:33
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
enum start value shifted to 81 so as to avoid clashes with PDG codes
bool seedsL1TriggerObjectMaps(edm::Event &, trigger::TriggerFilterObjectWithRefs &)
seeding is done via L1 trigger object maps, considering the objects which fired in L1 ...
Definition: HLTL1TSeed.cc:299
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual ~HLTL1TSeed()
destructor
Definition: HLTL1TSeed.cc:89
GlobalObject
Definition: GlobalObject.h:16
unsigned int key(const_iterator &iter) const
Definition: BXVector.h:104
bool algoGtlResult() const
delete x;
Definition: CaloConfig.h:22
const std::vector< GlobalObjectMap > & gtObjectMap() const
get / set the vector of object maps
BXVector< Tau > TauBxCollection
Definition: Tau.h:10
std::vector< GlobalLogicParser::OperandToken > expressionSeedsOperandList()
edm::Ref< MuonBxCollection > MuonRef
Definition: Muon.h:12
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref<C>)
edm::Ref< JetBxCollection > JetRef
Definition: Jet.h:12
BXVector< EtSum > EtSumBxCollection
Definition: EtSum.h:10
int iEvent
Definition: GenABIO.cc:230
edm::InputTag m_l1JetTag
Definition: HLTL1TSeed.h:125
edm::InputTag m_l1GtObjectMapTag
InputTag for L1 Global Trigger object maps. This is done per menu. Should be part of Run...
Definition: HLTL1TSeed.h:105
vector< PseudoJet > jets
edm::EDGetTokenT< l1t::JetBxCollection > m_l1JetToken
Definition: HLTL1TSeed.h:126
std::vector< OperandToken > & operandTokenVector()
return the vector of operand tokens
GlobalLogicParser m_l1AlgoLogicParser
logic parser for m_l1SeedsLogicalExpression
Definition: HLTL1TSeed.h:82
edm::EDGetTokenT< l1t::EGammaBxCollection > m_l1EGammaToken
Definition: HLTL1TSeed.h:121
edm::InputTag m_l1EtSumTag
Definition: HLTL1TSeed.h:135
std::vector< const std::vector< GlobalLogicParser::TokenRPN > * > m_l1AlgoSeedsRpn
vector of Rpn vectors for the required algorithms for seeding
Definition: HLTL1TSeed.h:88
edm::InputTag m_l1TauTag
Definition: HLTL1TSeed.h:130
int algoBitNumber() const
get / set bit number for algorithm in the object map
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:74
const std::vector< CombinationsInCond > & combinationVector() const
#define LogTrace(id)
BXVector< Muon > MuonBxCollection
Definition: Muon.h:10
const std::vector< GlobalLogicParser::OperandToken > & operandTokenVector() const
bool m_isDebugEnabled
cache edm::isDebugEnabled()
Definition: HLTL1TSeed.h:142
std::vector< GlobalLogicParser::OperandToken > m_l1AlgoSeeds
list of required algorithms for seeding
Definition: HLTL1TSeed.h:85
const std::string & algoName() const
destructor
BXVector< Jet > JetBxCollection
Definition: Jet.h:10
edm::InputTag m_l1EGammaTag
Definition: HLTL1TSeed.h:120
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::Ref< EtSumBxCollection > EtSumRef
Definition: EtSum.h:12
edm::InputTag m_l1GlobalTag
InputTag for L1 Global Trigger.
Definition: HLTL1TSeed.h:109
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1GlobalToken
Definition: HLTL1TSeed.h:110
const CombinationsInCond * getCombinationsInCond(const std::string &condNameVal) const
return all the combinations passing the requirements imposed in condition condNameVal ...
HLT enums.
void dumpTriggerFilterObjectWithRefs(trigger::TriggerFilterObjectWithRefs &) const
detailed print of filter content
Definition: HLTL1TSeed.cc:153
virtual bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) override
filter the event
Definition: HLTL1TSeed.cc:117
bool m_l1GlobalDecision
flag to pass if L1TGlobal accept
Definition: HLTL1TSeed.h:139
std::vector< SingleCombInCond > CombinationsInCond
all the object combinations evaluated to true in the condition
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
parameter description
Definition: HLTL1TSeed.cc:96
const_iterator begin(int bx) const
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
edm::EDGetTokenT< l1t::MuonBxCollection > m_l1MuonToken
Definition: HLTL1TSeed.h:116
bool saveTags() const
std::vector< EtSum >::const_iterator const_iterator
Definition: BXVector.h:20
edm::EDGetTokenT< l1t::TauBxCollection > m_l1TauToken
Definition: HLTL1TSeed.h:131
edm::EDGetTokenT< GlobalObjectMapRecord > m_l1GtObjectMapToken
Definition: HLTL1TSeed.h:106
const T & at(int bx, unsigned i) const