CMS 3D CMS Logo

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