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  // loop over objects in a combination for a given condition
581  //
582  for (SingleCombInCond::const_iterator itObject = (*itComb).begin(); itObject != (*itComb).end(); itObject++) {
583 
584  // loop over types for the object in a combination. This object might have more then one type (i.e. mu-eg)
585  //
586  for (size_t iType =0; iType < condObjType.size(); iType++) {
587 
588  // get object type and push indices on the list
589  //
590  const l1t::GlobalObject objTypeVal = condObjType.at(iType);
591 
592  LogTrace("HLTL1TSeed")
593  << "\tAdd object of type " << objTypeVal << " and index " << (*itObject) << " to the seed list."
594  << std::endl;
595 
596 
597  // THESE OBJECT CASES ARE CURRENTLY MISSING:
598  //gtETM2,
599  //gtMinBias,
600  //gtExternal,
601  //ObjNull
602 
603  switch (objTypeVal) {
604  case l1t::gtMu: {
605  listMuon.push_back(*itObject);
606  }
607 
608  break;
609  case l1t::gtEG: {
610  listEG.push_back(*itObject);
611  }
612  break;
613  case l1t::gtJet: {
614  listJet.push_back(*itObject);
615  }
616  break;
617  case l1t::gtTau: {
618  listTau.push_back(*itObject);
619  }
620  break;
621  case l1t::gtETM: {
622  listETM.push_back(*itObject);
623 
624  }
625  break;
626  case l1t::gtETT: {
627  listETT.push_back(*itObject);
628 
629  }
630 
631  break;
632  case l1t::gtHTT: {
633  listHTT.push_back(*itObject);
634 
635  }
636 
637  break;
638  case l1t::gtHTM: {
639  listHTM.push_back(*itObject);
640 
641  }
642 
643  break;
644  //case JetCounts: {
645  // listJetCounts.push_back(*itObject);
646  //}
647 
648  break;
649  default: {
650  // should not arrive here
651 
652  LogTrace("HLTL1TSeed")
653  << "\n HLTL1TSeed::hltFilter "
654  << "\n Unknown object of type " << objTypeVal
655  << " and index " << (*itObject) << " in the seed list."
656  << std::endl;
657  }
658  break;
659 
660  } // end switch objTypeVal
661 
662  } // end for iType
663 
664  } // end for itObj
665 
666  } // end for itComb
667 
668  } // end for condition
669 
670  } // end for itSeed
671 
672 
673  // eliminate duplicates
674 
675  listMuon.sort();
676  listMuon.unique();
677 
678  listEG.sort();
679  listEG.unique();
680 
681  listJet.sort();
682  listJet.unique();
683 
684  listTau.sort();
685  listTau.unique();
686 
687  listETM.sort();
688  listETM.unique();
689 
690  listETT.sort();
691  listETT.unique();
692 
693  listHTT.sort();
694  listHTT.unique();
695 
696  listHTM.sort();
697  listHTM.unique();
698 
699  listJetCounts.sort();
700  listJetCounts.unique();
701 
702 
703  // record the L1 physics objects in the HLT filterproduct
704  // //////////////////////////////////////////////////////
705 
706  // Muon
707  if (!listMuon.empty()) {
708 
710  iEvent.getByToken(m_l1MuonToken, muons);
711 
712  if (!muons.isValid()){
713  edm::LogWarning("HLTL1TSeed")
714  << "\nWarning: L1MuonBxCollection with input tag "
715  << m_l1MuonTag
716  << "\nrequested in configuration, but not found in the event."
717  << "\nNo muons added to filterproduct."
718  << endl;
719  }
720  else {
721 
722  for (std::list<int>::const_iterator itObj = listMuon.begin(); itObj != listMuon.end(); ++itObj) {
723 
724 
725  // Transform to index for Bx = 0 to begin of BxVector
726  unsigned int index = muons->begin(0) - muons->begin() + *itObj;
727 
728  l1t::MuonRef myref(muons, index);
729  filterproduct.addObject(trigger::TriggerL1Mu, myref);
730 
731  }
732 
733  }
734 
735  }
736 
737  // EG (isolated)
738  if (!listEG.empty()) {
739 
741  iEvent.getByToken(m_l1EGammaToken, egammas);
742  if (!egammas.isValid()){
743  edm::LogWarning("HLTL1TSeed")
744  << "\nWarning: L1EGammaBxCollection with input tag " << m_l1EGammaTag
745  << "\nrequested in configuration, but not found in the event."
746  << "\nNo egammas added to filterproduct."
747  << endl;
748  }
749  else {
750 
751  for (std::list<int>::const_iterator itObj = listEG.begin(); itObj != listEG.end(); ++itObj) {
752 
753  // Transform to begin of BxVector
754  unsigned int index = egammas->begin(0) - egammas->begin() + *itObj;
755 
756  l1t::EGammaRef myref(egammas, index);
757  filterproduct.addObject(trigger::TriggerL1EG, myref);
758 
759  }
760 
761  }
762 
763  }
764 
765  // Jet
766  if (!listJet.empty()) {
767 
769  iEvent.getByToken(m_l1JetToken, jets);
770 
771  if (!jets.isValid()){
772  edm::LogWarning("HLTL1TSeed")
773  << "\nWarning: L1JetBxCollection with input tag " << m_l1JetTag
774  << "\nrequested in configuration, but not found in the event."
775  << "\nNo jets added to filterproduct."
776  << endl;
777  }
778  else {
779 
780  for (std::list<int>::const_iterator itObj = listJet.begin(); itObj != listJet.end(); ++itObj) {
781 
782  // Transform to begin of BxVector
783  unsigned int index = jets->begin(0) - jets->begin() + *itObj;
784 
785  l1t::JetRef myref(jets, index);
786  filterproduct.addObject(trigger::TriggerL1Jet, myref);
787 
788  }
789 
790  }
791 
792  }
793 
794  // Tau
795  if (!listTau.empty()) {
796 
798  iEvent.getByToken(m_l1TauToken, taus);
799 
800  if (!taus.isValid()){
801  edm::LogWarning("HLTL1TSeed")
802  << "\nWarning: L1TauBxCollection with input tag " << m_l1TauTag
803  << "\nrequested in configuration, but not found in the event."
804  << "\nNo taus added to filterproduct."
805  << endl;
806  }
807  else {
808 
809  for (std::list<int>::const_iterator itObj = listTau.begin(); itObj != listTau.end(); ++itObj) {
810 
811  // Transform to begin of BxVector
812  unsigned int index = taus->begin(0) - taus->begin() + *itObj;
813 
814  l1t::TauRef myref(taus, index);
815  filterproduct.addObject(trigger::TriggerL1Tau, myref);
816 
817  }
818 
819  }
820 
821  }
822 
823  // ETT, HTT, ETM, HTM
825  iEvent.getByToken(m_l1EtSumToken, etsums);
826  if (!etsums.isValid()){
827  edm::LogWarning("HLTL1TSeed")
828  << "\nWarning: L1EtSumBxCollection with input tag "
829  << m_l1EtSumTag
830  << "\nrequested in configuration, but not found in the event."
831  << "\nNo etsums added to filterproduct."
832  << endl;
833  } else {
834 
836 
837  for (iter = etsums->begin(0); iter != etsums->end(0); ++iter){
838 
839  l1t::EtSumRef myref(etsums, etsums->key(iter));
840 
841  switch(iter->getType()) {
842 
843  case l1t::EtSum::kTotalEt :
844  if(!listETT.empty())
845  filterproduct.addObject(trigger::TriggerL1ETT, myref);
846  break;
847  case l1t::EtSum::kTotalHt :
848  if(!listHTT.empty())
849  filterproduct.addObject(trigger::TriggerL1HTT, myref);
850  break;
852  if(!listETM.empty())
853  filterproduct.addObject(trigger::TriggerL1ETM, myref);
854  break;
856  if(!listHTM.empty())
857  filterproduct.addObject(trigger::TriggerL1HTM, myref);
858  break;
859  default:
860  LogTrace("HLTL1TSeed") << " L1EtSum seed of currently unsuported HLT TriggerType. l1t::EtSum type: " << iter->getType() << "\n";
861 
862  } // end switch
863 
864  } // end for
865 
866  } // end else
867 
868 
869  // TODO FIXME uncomment if block when JetCounts implemented
870 
871  // // jet counts
872  // if (!listJetCounts.empty()) {
873  // edm::Handle<l1extra::L1JetCounts> l1JetCounts;
874  // iEvent.getByToken(m_l1CollectionsToken.label(), l1JetCounts);
875  //
876  // for (std::list<int>::const_iterator itObj = listJetCounts.begin();
877  // itObj != listJetCounts.end(); ++itObj) {
878  //
879  // filterproduct.addObject(trigger::TriggerL1JetCounts,l1extra::L1JetCountsRefProd(l1JetCounts));
880  // // FIXME: RefProd!
881  //
882  // }
883  //
884  // }
885 
886 
887  LogTrace("HLTL1TSeed")
888  << "\nHLTL1Seed:seedsL1TriggerObjectMaps returning " << seedsResult << endl << endl;
889 
890  return seedsResult;
891 
892 }
893 
894 // 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