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 
26 
27 #include "HLTL1TSeed.h"
28 
29 using namespace std;
30 
31 // constructors
33  : HLTStreamFilter(parSet),
34  //useObjectMaps_(parSet.getParameter<bool>("L1UseL1TriggerObjectMaps")),
35  m_l1SeedsLogicalExpression(parSet.getParameter<string>("L1SeedsLogicalExpression")),
36  m_l1GtObjectMapTag(parSet.getParameter<edm::InputTag>("L1ObjectMapInputTag")),
37  m_l1GtObjectMapToken(consumes<GlobalObjectMapRecord>(m_l1GtObjectMapTag)),
38  m_l1GlobalTag(parSet.getParameter<edm::InputTag>("L1GlobalInputTag")),
39  m_l1GlobalToken(consumes<GlobalAlgBlkBxCollection>(m_l1GlobalTag)),
40  m_l1MuonCollectionsTag(parSet.getParameter<edm::InputTag>("L1MuonInputTag")), // FIX WHEN UNPACKERS ADDED
41  m_l1MuonTag(m_l1MuonCollectionsTag),
42  m_l1MuonToken(consumes<l1t::MuonBxCollection>(m_l1MuonTag)),
43  m_l1MuonShowerCollectionsTag(
44  parSet.getParameter<edm::InputTag>("L1MuonShowerInputTag")), // FIX WHEN UNPACKERS ADDED
45  m_l1MuonShowerTag(m_l1MuonShowerCollectionsTag),
46  m_l1MuonShowerToken(consumes<l1t::MuonShowerBxCollection>(m_l1MuonShowerTag)),
47  m_l1EGammaCollectionsTag(parSet.getParameter<edm::InputTag>("L1EGammaInputTag")), // FIX WHEN UNPACKERS ADDED
48  m_l1EGammaTag(m_l1EGammaCollectionsTag),
49  m_l1EGammaToken(consumes<l1t::EGammaBxCollection>(m_l1EGammaTag)),
50  m_l1JetCollectionsTag(parSet.getParameter<edm::InputTag>("L1JetInputTag")), // FIX WHEN UNPACKERS ADDED
51  m_l1JetTag(m_l1JetCollectionsTag),
52  m_l1JetToken(consumes<l1t::JetBxCollection>(m_l1JetTag)),
53  m_l1TauCollectionsTag(parSet.getParameter<edm::InputTag>("L1TauInputTag")), // FIX WHEN UNPACKERS ADDED
54  m_l1TauTag(m_l1TauCollectionsTag),
55  m_l1TauToken(consumes<l1t::TauBxCollection>(m_l1TauTag)),
56  m_l1EtSumCollectionsTag(parSet.getParameter<edm::InputTag>("L1EtSumInputTag")), // FIX WHEN UNPACKERS ADDED
57  m_l1EtSumTag(m_l1EtSumCollectionsTag),
58  m_l1EtSumToken(consumes<l1t::EtSumBxCollection>(m_l1EtSumTag)),
59  m_l1EtSumZdcCollectionsTag(parSet.getParameter<edm::InputTag>("L1EtSumZdcInputTag")), // FIX WHEN UNPACKERS ADDED
60  m_l1EtSumZdcTag(m_l1EtSumZdcCollectionsTag),
61  m_l1EtSumZdcToken(consumes<l1t::EtSumBxCollection>(m_l1EtSumZdcTag)),
62  m_l1GlobalDecision(false),
63  m_isDebugEnabled(edm::isDebugEnabled()) {
64  if (m_l1SeedsLogicalExpression.empty()) {
65  throw cms::Exception("FailModule") << "\nTrying to seed with an empty L1SeedsLogicalExpression.\n" << std::endl;
66 
67  } else if (m_l1SeedsLogicalExpression != "L1GlobalDecision") {
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  } else {
81  m_l1GlobalDecision = true;
82  }
83 }
84 
85 // destructor
87  // empty now
88 }
89 
90 // member functions
91 
95 
96  // # logical expression for the required L1 algorithms;
97  // # the algorithms are specified by name
98  // # allowed operators: "AND", "OR", "NOT", "(", ")"
99  // #
100  // # by convention, "L1GlobalDecision" logical expression means global decision
101  desc.add<string>("L1SeedsLogicalExpression", "");
102  desc.add<edm::InputTag>("L1ObjectMapInputTag", edm::InputTag("hltGtStage2ObjectMap"));
103  desc.add<edm::InputTag>("L1GlobalInputTag", edm::InputTag("hltGtStage2Digis"));
104  desc.add<edm::InputTag>("L1MuonInputTag", edm::InputTag("hltGtStage2Digis:Muon"));
105  desc.add<edm::InputTag>("L1MuonShowerInputTag", edm::InputTag("hltGtStage2Digis:MuonShower"));
106  desc.add<edm::InputTag>("L1EGammaInputTag", edm::InputTag("hltGtStage2Digis:EGamma"));
107  desc.add<edm::InputTag>("L1JetInputTag", edm::InputTag("hltGtStage2Digis:Jet"));
108  desc.add<edm::InputTag>("L1TauInputTag", edm::InputTag("hltGtStage2Digis:Tau"));
109  desc.add<edm::InputTag>("L1EtSumInputTag", edm::InputTag("hltGtStage2Digis:EtSum"));
110  desc.add<edm::InputTag>("L1EtSumZdcInputTag", edm::InputTag("hltGtStage2Digis:EtSumZDC"));
111  descriptions.add("hltL1TSeed", desc);
112 }
113 
115  const edm::EventSetup& evSetup,
116  trigger::TriggerFilterObjectWithRefs& filterproduct) {
117  bool rc = false;
118 
119  // the filter object
120  if (saveTags()) {
121  // muons
122  filterproduct.addCollectionTag(m_l1MuonTag);
123 
124  // muon showers
125  filterproduct.addCollectionTag(m_l1MuonShowerTag);
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  // etsum (ZDC)
140  filterproduct.addCollectionTag(m_l1EtSumZdcTag);
141  }
142 
143  // Get all the seeding from iEvent (i.e. L1TriggerObjectMapRecord)
144  //
145  rc = seedsL1TriggerObjectMaps(iEvent, filterproduct);
146 
147  if (m_isDebugEnabled) {
148  dumpTriggerFilterObjectWithRefs(filterproduct);
149  }
150 
151  return rc;
152 }
153 
154 // detailed print of filter content
156  LogTrace("HLTL1TSeed") << "\nHLTL1TSeed::hltFilter "
157  << "\n Dump TriggerFilterObjectWithRefs\n"
158  << endl;
159 
160  vector<l1t::MuonRef> seedsL1Mu;
161  filterproduct.getObjects(trigger::TriggerL1Mu, seedsL1Mu);
162  const size_t sizeSeedsL1Mu = seedsL1Mu.size();
163 
164  LogTrace("HLTL1TSeed") << "\n HLTL1TSeed: seed logical expression = " << m_l1SeedsLogicalExpression << endl;
165 
166  LogTrace("HLTL1TSeed") << "\n L1Mu seeds: " << sizeSeedsL1Mu << endl << endl;
167 
168  for (size_t i = 0; i != sizeSeedsL1Mu; i++) {
169  l1t::MuonRef obj = l1t::MuonRef(seedsL1Mu[i]);
170 
171  LogTrace("HLTL1TSeed") << "\tL1Mu "
172  << "\t"
173  << "q = "
174  << obj->hwCharge() // TEMP get hwCharge insead of charge which is not yet set NEED FIX.
175  << "\t"
176  << "pt = " << obj->pt() << "\t"
177  << "eta = " << obj->eta() << "\t"
178  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
179  }
180 
181  vector<l1t::MuonShowerRef> seedsL1MuShower;
182  filterproduct.getObjects(trigger::TriggerL1MuShower, seedsL1MuShower);
183  const size_t sizeSeedsL1MuShower = seedsL1MuShower.size();
184 
185  LogTrace("HLTL1TSeed") << "\n HLTL1TSeed: seed logical expression = " << m_l1SeedsLogicalExpression << endl;
186 
187  LogTrace("HLTL1TSeed") << "\n L1MuShower seeds: " << sizeSeedsL1MuShower << endl << endl;
188 
189  for (size_t i = 0; i != sizeSeedsL1MuShower; i++) {
190  l1t::MuonShowerRef obj = l1t::MuonShowerRef(seedsL1MuShower[i]);
191 
192  LogTrace("HLTL1TSeed") << "\tL1MuShower "
193  << "\t"
194  << "pt = " << obj->pt() << "\t"
195  << "eta = " << obj->eta() << "\t"
196  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
197  }
198 
199  vector<l1t::EGammaRef> seedsL1EG;
200  filterproduct.getObjects(trigger::TriggerL1EG, seedsL1EG);
201  const size_t sizeSeedsL1EG = seedsL1EG.size();
202 
203  LogTrace("HLTL1TSeed") << "\n L1EG seeds: " << sizeSeedsL1EG << endl << endl;
204 
205  for (size_t i = 0; i != sizeSeedsL1EG; i++) {
206  l1t::EGammaRef obj = l1t::EGammaRef(seedsL1EG[i]);
207 
208  LogTrace("HLTL1TSeed") << "\tL1EG "
209  << "\t"
210  << "pt = " << obj->pt() << "\t"
211  << "eta = " << obj->eta() << "\t"
212  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
213  }
214 
215  vector<l1t::JetRef> seedsL1Jet;
216  filterproduct.getObjects(trigger::TriggerL1Jet, seedsL1Jet);
217  const size_t sizeSeedsL1Jet = seedsL1Jet.size();
218 
219  LogTrace("HLTL1TSeed") << "\n L1Jet seeds: " << sizeSeedsL1Jet << endl << endl;
220 
221  for (size_t i = 0; i != sizeSeedsL1Jet; i++) {
222  l1t::JetRef obj = l1t::JetRef(seedsL1Jet[i]);
223 
224  LogTrace("HLTL1TSeed") << "\tL1Jet "
225  << "\t"
226  << "pt = " << obj->pt() << "\t"
227  << "eta = " << obj->eta() << "\t"
228  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
229  }
230 
231  vector<l1t::TauRef> seedsL1Tau;
232  filterproduct.getObjects(trigger::TriggerL1Tau, seedsL1Tau);
233  const size_t sizeSeedsL1Tau = seedsL1Tau.size();
234 
235  LogTrace("HLTL1TSeed") << "\n L1Tau seeds: " << sizeSeedsL1Tau << endl << endl;
236 
237  for (size_t i = 0; i != sizeSeedsL1Tau; i++) {
238  l1t::TauRef obj = l1t::TauRef(seedsL1Tau[i]);
239 
240  LogTrace("HLTL1TSeed") << "\tL1Tau "
241  << "\t"
242  << "pt = " << obj->pt() << "\t"
243  << "eta = " << obj->eta() << "\t"
244  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
245  }
246 
247  vector<l1t::EtSumRef> seedsL1EtSumETT;
248  filterproduct.getObjects(trigger::TriggerL1ETT, seedsL1EtSumETT);
249  const size_t sizeSeedsL1EtSumETT = seedsL1EtSumETT.size();
250  LogTrace("HLTL1TSeed") << "\n L1EtSum ETT seeds: " << sizeSeedsL1EtSumETT << endl << endl;
251 
252  for (size_t i = 0; i != sizeSeedsL1EtSumETT; i++) {
253  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumETT[i]);
254 
255  LogTrace("HLTL1TSeed") << "\tL1EtSum ETT"
256  << "\t"
257  << "pt = " << obj->pt() << "\t"
258  << "eta = " << obj->eta() << "\t"
259  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
260  }
261 
262  vector<l1t::EtSumRef> seedsL1EtSumHTT;
263  filterproduct.getObjects(trigger::TriggerL1HTT, seedsL1EtSumHTT);
264  const size_t sizeSeedsL1EtSumHTT = seedsL1EtSumHTT.size();
265  LogTrace("HLTL1TSeed") << "\n L1EtSum HTT seeds: " << sizeSeedsL1EtSumHTT << endl << endl;
266 
267  for (size_t i = 0; i != sizeSeedsL1EtSumHTT; i++) {
268  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumHTT[i]);
269 
270  LogTrace("HLTL1TSeed") << "\tL1EtSum HTT"
271  << "\t"
272  << "pt = " << obj->pt() << "\t"
273  << "eta = " << obj->eta() << "\t"
274  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
275  }
276 
277  vector<l1t::EtSumRef> seedsL1EtSumETM;
278  filterproduct.getObjects(trigger::TriggerL1ETM, seedsL1EtSumETM);
279  const size_t sizeSeedsL1EtSumETM = seedsL1EtSumETM.size();
280  LogTrace("HLTL1TSeed") << "\n L1EtSum ETM seeds: " << sizeSeedsL1EtSumETM << endl << endl;
281 
282  for (size_t i = 0; i != sizeSeedsL1EtSumETM; i++) {
283  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumETM[i]);
284 
285  LogTrace("HLTL1TSeed") << "\tL1EtSum ETM"
286  << "\t"
287  << "pt = " << obj->pt() << "\t"
288  << "eta = " << obj->eta() << "\t"
289  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
290  }
291 
292  vector<l1t::EtSumRef> seedsL1EtSumETMHF;
293  filterproduct.getObjects(trigger::TriggerL1ETMHF, seedsL1EtSumETMHF);
294  const size_t sizeSeedsL1EtSumETMHF = seedsL1EtSumETMHF.size();
295  LogTrace("HLTL1TSeed") << "\n L1EtSum ETMHF seeds: " << sizeSeedsL1EtSumETMHF << endl << endl;
296 
297  for (size_t i = 0; i != sizeSeedsL1EtSumETMHF; i++) {
298  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumETMHF[i]);
299 
300  LogTrace("HLTL1TSeed") << "\tL1EtSum ETMHF"
301  << "\t"
302  << "pt = " << obj->pt() << "\t"
303  << "eta = " << obj->eta() << "\t"
304  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
305  }
306 
307  vector<l1t::EtSumRef> seedsL1EtSumHTMHF;
308  filterproduct.getObjects(trigger::TriggerL1HTMHF, seedsL1EtSumHTMHF);
309  const size_t sizeSeedsL1EtSumHTMHF = seedsL1EtSumHTMHF.size();
310  LogTrace("HLTL1TSeed") << "\n L1EtSum HTMHF seeds: " << sizeSeedsL1EtSumHTMHF << endl << endl;
311 
312  for (size_t i = 0; i != sizeSeedsL1EtSumHTMHF; i++) {
313  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumHTMHF[i]);
314 
315  LogTrace("HLTL1TSeed") << "\tL1EtSum HTMHF"
316  << "\t"
317  << "pt = " << obj->pt() << "\t"
318  << "eta = " << obj->eta() << "\t"
319  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
320  }
321 
322  vector<l1t::EtSumRef> seedsL1EtSumHTM;
323  filterproduct.getObjects(trigger::TriggerL1HTM, seedsL1EtSumHTM);
324  const size_t sizeSeedsL1EtSumHTM = seedsL1EtSumHTM.size();
325  LogTrace("HLTL1TSeed") << "\n L1EtSum HTM seeds: " << sizeSeedsL1EtSumHTM << endl << endl;
326 
327  for (size_t i = 0; i != sizeSeedsL1EtSumHTM; i++) {
328  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumHTM[i]);
329 
330  LogTrace("HLTL1TSeed") << "\tL1EtSum HTM"
331  << "\t"
332  << "pt = " << obj->pt() << "\t"
333  << "eta = " << obj->eta() << "\t"
334  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
335  }
336 
337  vector<l1t::EtSumRef> seedsL1EtSumCentrality;
338  filterproduct.getObjects(trigger::TriggerL1Centrality, seedsL1EtSumCentrality);
339  const size_t sizeSeedsL1EtSumCentrality = seedsL1EtSumCentrality.size();
340  LogTrace("HLTL1TSeed") << "\n L1EtSum Centrality seeds: " << sizeSeedsL1EtSumCentrality << endl << endl;
341 
342  for (size_t i = 0; i != sizeSeedsL1EtSumCentrality; i++) {
343  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumCentrality[i]);
344 
345  LogTrace("HLTL1TSeed") << "\tL1EtSum Centrality Bits: " << std::bitset<8>(obj->hwPt())
346  << " (hwPt = " << obj->hwPt() << ")";
347  }
348 
349  vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFP0;
350  filterproduct.getObjects(trigger::TriggerL1MinBiasHFP0, seedsL1EtSumMinBiasHFP0);
351  const size_t sizeSeedsL1EtSumMinBiasHFP0 = seedsL1EtSumMinBiasHFP0.size();
352  LogTrace("HLTL1TSeed") << "\n L1EtSum MinBiasHFP0 seeds: " << sizeSeedsL1EtSumMinBiasHFP0 << endl << endl;
353 
354  for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFP0; i++) {
355  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFP0[i]);
356 
357  LogTrace("HLTL1TSeed") << "\tL1EtSum MinBiasHFP0: hwPt = " << obj->hwPt();
358  }
359 
360  vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFM0;
361  filterproduct.getObjects(trigger::TriggerL1MinBiasHFM0, seedsL1EtSumMinBiasHFM0);
362  const size_t sizeSeedsL1EtSumMinBiasHFM0 = seedsL1EtSumMinBiasHFM0.size();
363  LogTrace("HLTL1TSeed") << "\n L1EtSum MinBiasHFM0 seeds: " << sizeSeedsL1EtSumMinBiasHFM0 << endl << endl;
364 
365  for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFM0; i++) {
366  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFM0[i]);
367 
368  LogTrace("HLTL1TSeed") << "\tL1EtSum MinBiasHFM0: hwPt = " << obj->hwPt();
369  }
370 
371  vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFP1;
372  filterproduct.getObjects(trigger::TriggerL1MinBiasHFP1, seedsL1EtSumMinBiasHFP1);
373  const size_t sizeSeedsL1EtSumMinBiasHFP1 = seedsL1EtSumMinBiasHFP1.size();
374  LogTrace("HLTL1TSeed") << "\n L1EtSum MinBiasHFP1 seeds: " << sizeSeedsL1EtSumMinBiasHFP1 << endl << endl;
375 
376  for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFP1; i++) {
377  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFP1[i]);
378 
379  LogTrace("HLTL1TSeed") << "\tL1EtSum MinBiasHFP1: hwPt = " << obj->hwPt();
380  }
381 
382  vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFM1;
383  filterproduct.getObjects(trigger::TriggerL1MinBiasHFM1, seedsL1EtSumMinBiasHFM1);
384  const size_t sizeSeedsL1EtSumMinBiasHFM1 = seedsL1EtSumMinBiasHFM1.size();
385  LogTrace("HLTL1TSeed") << "\n L1EtSum MinBiasHFM1 seeds: " << sizeSeedsL1EtSumMinBiasHFM1 << endl << endl;
386 
387  for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFM1; i++) {
388  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFM1[i]);
389 
390  LogTrace("HLTL1TSeed") << "\tL1EtSum MinBiasHFM1: hwPt = " << obj->hwPt();
391  }
392 
393  vector<l1t::EtSumRef> seedsL1EtSumTowerCount;
394  filterproduct.getObjects(trigger::TriggerL1TowerCount, seedsL1EtSumTowerCount);
395  const size_t sizeSeedsL1EtSumTowerCount = seedsL1EtSumTowerCount.size();
396  LogTrace("HLTL1TSeed") << "\n L1EtSum TowerCount seeds: " << sizeSeedsL1EtSumTowerCount << endl << endl;
397 
398  for (size_t i = 0; i != sizeSeedsL1EtSumTowerCount; i++) {
399  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumTowerCount[i]);
400 
401  LogTrace("HLTL1TSeed") << "\tL1EtSum TowerCount: hwPt = " << obj->hwPt();
402  }
403 
404  vector<l1t::EtSumRef> seedsL1EtSumAsymEt;
405  filterproduct.getObjects(trigger::TriggerL1AsymEt, seedsL1EtSumAsymEt);
406  const size_t sizeSeedsL1EtSumAsymEt = seedsL1EtSumAsymEt.size();
407  LogTrace("HLTL1TSeed") << "\n L1EtSum AsymEt seeds: " << sizeSeedsL1EtSumAsymEt << endl << endl;
408 
409  for (size_t i = 0; i != sizeSeedsL1EtSumAsymEt; i++) {
410  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymEt[i]);
411 
412  LogTrace("HLTL1TSeed") << "\tL1EtSum AsymEt: hwPt = " << obj->hwPt();
413  }
414 
415  vector<l1t::EtSumRef> seedsL1EtSumAsymHt;
416  filterproduct.getObjects(trigger::TriggerL1AsymHt, seedsL1EtSumAsymHt);
417  const size_t sizeSeedsL1EtSumAsymHt = seedsL1EtSumAsymHt.size();
418  LogTrace("HLTL1TSeed") << "\n L1EtSum AsymHt seeds: " << sizeSeedsL1EtSumAsymHt << endl << endl;
419 
420  for (size_t i = 0; i != sizeSeedsL1EtSumAsymHt; i++) {
421  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymHt[i]);
422 
423  LogTrace("HLTL1TSeed") << "\tL1EtSum AsymHt: hwPt = " << obj->hwPt();
424  }
425 
426  vector<l1t::EtSumRef> seedsL1EtSumAsymEtHF;
427  filterproduct.getObjects(trigger::TriggerL1AsymEtHF, seedsL1EtSumAsymEtHF);
428  const size_t sizeSeedsL1EtSumAsymEtHF = seedsL1EtSumAsymEtHF.size();
429  LogTrace("HLTL1TSeed") << "\n L1EtSum AsymEtHF seeds: " << sizeSeedsL1EtSumAsymEtHF << endl << endl;
430 
431  for (size_t i = 0; i != sizeSeedsL1EtSumAsymEtHF; i++) {
432  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymEtHF[i]);
433 
434  LogTrace("HLTL1TSeed") << "\tL1EtSum AsymEtHF: hwPt = " << obj->hwPt();
435  }
436 
437  vector<l1t::EtSumRef> seedsL1EtSumAsymHtHF;
438  filterproduct.getObjects(trigger::TriggerL1AsymHtHF, seedsL1EtSumAsymHtHF);
439  const size_t sizeSeedsL1EtSumAsymHtHF = seedsL1EtSumAsymHtHF.size();
440  LogTrace("HLTL1TSeed") << "\n L1EtSum AsymHtHF seeds: " << sizeSeedsL1EtSumAsymHtHF << endl << endl;
441 
442  for (size_t i = 0; i != sizeSeedsL1EtSumAsymHtHF; i++) {
443  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymHtHF[i]);
444 
445  LogTrace("HLTL1TSeed") << "\tL1EtSum AsymHtHF: hwPt = " << obj->hwPt();
446  }
447 
448  vector<l1t::EtSumRef> seedsL1EtSumZDCP;
449  filterproduct.getObjects(trigger::TriggerL1ZDCP, seedsL1EtSumZDCP);
450  const size_t sizeSeedsL1EtSumZDCP = seedsL1EtSumZDCP.size();
451  LogTrace("HLTL1TSeed") << "\n L1EtSum ZDCP seeds: " << sizeSeedsL1EtSumZDCP << endl << endl;
452 
453  for (size_t i = 0; i != sizeSeedsL1EtSumZDCP; i++) {
454  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumZDCP[i]);
455 
456  LogTrace("HLTL1TSeed") << "\tL1EtSum ZDCP"
457  << "\t"
458  << "pt = " << obj->pt() << "\t"
459  << "eta = " << obj->eta() << "\t"
460  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
461  }
462 
463  vector<l1t::EtSumRef> seedsL1EtSumZDCM;
464  filterproduct.getObjects(trigger::TriggerL1ZDCM, seedsL1EtSumZDCM);
465  const size_t sizeSeedsL1EtSumZDCM = seedsL1EtSumZDCM.size();
466  LogTrace("HLTL1TSeed") << "\n L1EtSum ZDCM seeds: " << sizeSeedsL1EtSumZDCM << endl << endl;
467 
468  for (size_t i = 0; i != sizeSeedsL1EtSumZDCM; i++) {
469  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumZDCM[i]);
470 
471  LogTrace("HLTL1TSeed") << "\tL1EtSum ZDCM"
472  << "\t"
473  << "pt = " << obj->pt() << "\t"
474  << "eta = " << obj->eta() << "\t"
475  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
476  }
477 
478  LogTrace("HLTL1TSeed") << " \n\n" << endl;
479 }
480 
481 // seeding is done via L1 trigger object maps, considering the objects which fired in L1
483  // Two GT objects are obtained from the Event: (1) the unpacked GT and (2) the emulated GT.
484  // Return value of the function is the score of seeding logical expression, evaluated using (1).
485  // Seeding is performed (per l1_algo) if ACCEPT both in (1) and (2). Seed objects are identified
486  // and only available from ObjectMaps created in (2).
487 
488  // define index lists for all particle types
489 
490  std::list<int> listMuon;
491  std::list<int> listMuonShower;
492 
493  std::list<int> listEG;
494 
495  std::list<int> listJet;
496  std::list<int> listTau;
497 
498  std::list<int> listETM;
499  std::list<int> listETT;
500  std::list<int> listHTT;
501  std::list<int> listHTM;
502  std::list<int> listETMHF;
503  std::list<int> listHTMHF;
504 
505  std::list<int> listJetCounts;
506 
507  std::list<int> listCentrality;
508  std::list<int> listMinBiasHFP0;
509  std::list<int> listMinBiasHFM0;
510  std::list<int> listMinBiasHFP1;
511  std::list<int> listMinBiasHFM1;
512  std::list<int> listTotalEtEm;
513  std::list<int> listMissingEtHF;
514  std::list<int> listTowerCount;
515  std::list<int> listAsymEt;
516  std::list<int> listAsymHt;
517  std::list<int> listAsymEtHF;
518  std::list<int> listAsymHtHF;
519  std::list<int> listZDCP;
520  std::list<int> listZDCM;
521 
522  // get handle to unpacked GT
524  iEvent.getByToken(m_l1GlobalToken, uGtAlgoBlocks);
525 
526  if (!uGtAlgoBlocks.isValid()) {
527  edm::LogWarning("HLTL1TSeed") << " Warning: GlobalAlgBlkBxCollection with input tag " << m_l1GlobalTag
528  << " requested in configuration, but not found in the event." << std::endl;
529 
530  return false;
531  }
532 
533  // check size (all BXs)
534  if (uGtAlgoBlocks->size() == 0) {
535  edm::LogWarning("HLTL1TSeed") << " Warning: GlobalAlgBlkBxCollection with input tag " << m_l1GlobalTag
536  << " is empty for all BXs.";
537  return false;
538  }
539 
540  // check size (BX 0)
541  if (uGtAlgoBlocks->isEmpty(0)) {
542  edm::LogWarning("HLTL1TSeed") << " Warning: GlobalAlgBlkBxCollection with input tag " << m_l1GlobalTag
543  << " is empty for BX=0.";
544  return false;
545  }
546 
547  // get handle to object maps from emulator (one object map per algorithm)
548  edm::Handle<GlobalObjectMapRecord> gtObjectMapRecord;
549  iEvent.getByToken(m_l1GtObjectMapToken, gtObjectMapRecord);
550 
551  if (!gtObjectMapRecord.isValid()) {
552  edm::LogWarning("HLTL1TSeed") << " Warning: GlobalObjectMapRecord with input tag " << m_l1GtObjectMapTag
553  << " requested in configuration, but not found in the event." << std::endl;
554 
555  return false;
556  }
557 
558  if (m_isDebugEnabled) {
559  const std::vector<GlobalObjectMap>& objMaps = gtObjectMapRecord->gtObjectMap();
560 
561  LogTrace("HLTL1TSeed") << "\nHLTL1Seed"
562  << "\n--------------------------------------------------------------------------------------"
563  "-------------------------------";
564 
565  LogTrace("HLTL1TSeed")
566  << "\n\tAlgorithms in L1TriggerObjectMapRecord and GT results ( emulated | initial | prescaled | final ) "
567  << endl;
568 
569  LogTrace("HLTL1TSeed") << "\n\tmap"
570  << "\tAlgoBit" << std::setw(40) << "algoName"
571  << "\t (emul|ini|pre|fin)" << endl;
572 
573  LogTrace("HLTL1TSeed") << "----------------------------------------------------------------------------------------"
574  "-----------------------------";
575 
576  for (size_t imap = 0; imap < objMaps.size(); imap++) {
577  int bit = objMaps[imap].algoBitNumber(); // same as bit from L1T Menu
578 
579  int emulDecision = objMaps[imap].algoGtlResult();
580 
581  // For bx=0 , get 0th AlgoBlock, so in BXvector at(bx=0,i=0)
582  int initDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionInitial(bit);
583  int presDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionInterm(bit);
584  int finlDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionFinal(bit);
585 
586  if (emulDecision != initDecision) {
587  LogTrace("HLTL1TSeed") << "L1T decision (emulated vs. unpacked initial) is not the same:"
588  << "\n\tbit = " << std::setw(3) << bit << std::setw(40) << objMaps[imap].algoName()
589  << "\t emulated decision = " << emulDecision
590  << "\t unpacked initial decision = " << initDecision
591  << "\nThis should not happen. Include the L1TGtEmulCompare module in the sequence."
592  << endl;
593  }
594 
595  LogTrace("HLTL1TSeed") << "\t" << std::setw(3) << imap << "\tbit = " << std::setw(3) << bit << std::setw(40)
596  << objMaps[imap].algoName() << "\t ( " << emulDecision << " | " << initDecision << " | "
597  << presDecision << " | " << finlDecision << " ) ";
598  }
599  LogTrace("HLTL1TSeed") << endl;
600  }
601 
602  // Filter decision in case of "L1GlobalDecision" logical expression.
603  // By convention, it means global decision.
604  // /////////////////////////////////////////////////////////////////
605  if (m_l1GlobalDecision) {
606  // For bx=0 , get 0th AlgoBlock, so in BXvector at(bx=0,i=0)
607  return (uGtAlgoBlocks->at(0, 0)).getFinalOR();
608  }
609 
610  // Update/Reset m_l1AlgoLogicParser by reseting token result
611  // /////////////////////////////////////////////////////////
612  std::vector<GlobalLogicParser::OperandToken>& algOpTokenVector = m_l1AlgoLogicParser.operandTokenVector();
613 
614  for (auto& i : algOpTokenVector) {
615  // rest token result
616  //
617  i.tokenResult = false;
618  }
619 
620  // Update m_l1AlgoLogicParser and store emulator results for algOpTokens
621  // /////////////////////////////////////////////////////////////////////
622  for (auto& i : algOpTokenVector) {
623  std::string algoName = i.tokenName;
624 
625  const GlobalObjectMap* objMap = gtObjectMapRecord->getObjectMap(algoName);
626 
627  if (objMap == nullptr) {
628  throw cms::Exception("FailModule")
629  << "\nAlgorithm " << algoName
630  << ", requested as seed by a HLT path, cannot be matched to a L1 algo name in any GlobalObjectMap\n"
631  << "Please check if algorithm " << algoName << " is present in the L1 menu\n"
632  << std::endl;
633 
634  } else {
635  //(algOpTokenVector[i]).tokenResult = objMap->algoGtlResult();
636 
637  int bit = objMap->algoBitNumber();
638  bool finalAlgoDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionFinal(bit);
639  i.tokenResult = finalAlgoDecision;
640  }
641  }
642 
643  // Filter decision
644  // ///////////////
645  bool seedsResult = m_l1AlgoLogicParser.expressionResult();
646 
647  if (m_isDebugEnabled) {
648  LogTrace("HLTL1TSeed") << "\nHLTL1TSeed: l1SeedsLogicalExpression (names) = '" << m_l1SeedsLogicalExpression << "'"
649  << "\n Result for logical expression after update of algOpTokens: " << seedsResult << "\n"
650  << std::endl;
651  }
652 
655 
656  for (std::vector<GlobalLogicParser::OperandToken>::const_iterator itSeed = m_l1AlgoSeeds.begin();
657  itSeed != m_l1AlgoSeeds.end();
658  ++itSeed) {
659  std::string algoSeedName = (*itSeed).tokenName;
660 
661  LogTrace("HLTL1TSeed") << "\n ---------------- algo seed name = " << algoSeedName << endl;
662 
663  const GlobalObjectMap* objMap = gtObjectMapRecord->getObjectMap(algoSeedName);
664 
665  if (objMap == nullptr) {
666  // Should not get here
667  //
668  throw cms::Exception("FailModule")
669  << "\nAlgorithm " << algoSeedName
670  << ", requested as seed by a HLT path, cannot be matched to a L1 algo name in any GlobalObjectMap\n"
671  << "Please check if algorithm " << algoSeedName << " is present in the L1 menu\n"
672  << std::endl;
673  }
674 
675  int algoSeedBitNumber = objMap->algoBitNumber();
676  bool algoSeedResult = objMap->algoGtlResult();
677 
678  // unpacked GT results: uGtAlgoBlock has decisions initial, prescaled, and final after masks
679  bool algoSeedResultMaskAndPresc = uGtAlgoBlocks->at(0, 0).getAlgoDecisionFinal(algoSeedBitNumber);
680 
681  LogTrace("HLTL1TSeed") << "\n\tAlgo seed " << algoSeedName << " result emulated | final = " << algoSeedResult
682  << " | " << algoSeedResultMaskAndPresc << endl;
683 
686  if (!algoSeedResultMaskAndPresc)
687  continue;
688 
690  // This should not happen if the emulated and unpacked GT are consistent
692  if (!algoSeedResult)
693  continue;
694 
695  const std::vector<GlobalLogicParser::OperandToken>& opTokenVecObjMap = objMap->operandTokenVector();
696  const std::vector<L1TObjectTypeInCond>& condObjTypeVec = objMap->objectTypeVector();
697  const std::vector<CombinationsInCond>& condCombinations = objMap->combinationVector();
698 
699  LogTrace("HLTL1TSeed") << "\n\talgoName =" << objMap->algoName() << "\talgoBitNumber = " << algoSeedBitNumber
700  << "\talgoGtlResult = " << algoSeedResult << endl
701  << endl;
702 
703  if (opTokenVecObjMap.size() != condObjTypeVec.size()) {
704  edm::LogWarning("HLTL1TSeed")
705  << "\nWarning: GlobalObjectMapRecord with input tag " << m_l1GtObjectMapTag
706  << "\nhas object map for bit number " << algoSeedBitNumber
707  << " which contains different size vectors of operand tokens and of condition object types!" << std::endl;
708 
709  assert(opTokenVecObjMap.size() == condObjTypeVec.size());
710  }
711 
712  if (opTokenVecObjMap.size() != condCombinations.size()) {
713  edm::LogWarning("HLTL1TSeed")
714  << "\nWarning: GlobalObjectMapRecord with input tag " << m_l1GtObjectMapTag
715  << "\nhas object map for bit number " << algoSeedBitNumber
716  << " which contains different size vectors of operand tokens and of condition object combinations!"
717  << std::endl;
718 
719  assert(opTokenVecObjMap.size() == condCombinations.size());
720  }
721 
722  // operands are conditions of L1 algo
723  //
724  for (size_t condNumber = 0; condNumber < opTokenVecObjMap.size(); condNumber++) {
725  std::vector<l1t::GlobalObject> condObjType = condObjTypeVec[condNumber];
726 
727  for (auto& jOb : condObjType) {
728  LogTrace("HLTL1TSeed") << setw(15) << "\tcondObjType = " << jOb << endl;
729  }
730 
731  const std::string condName = opTokenVecObjMap[condNumber].tokenName;
732  bool condResult = opTokenVecObjMap[condNumber].tokenResult;
733 
734  // only procede for conditions that passed
735  //
736  if (!condResult) {
737  continue;
738  }
739 
740  // loop over combinations for a given condition
741  //
742  const CombinationsInCond* condComb = objMap->getCombinationsInCond(condNumber);
743 
744  LogTrace("HLTL1TSeed") << setw(15) << "\tcondCombinations = " << condComb->size() << endl;
745 
746  for (auto const& itComb : (*condComb)) {
747  LogTrace("HLTL1TSeed") << setw(15) << "\tnew combination" << endl;
748 
749  // loop over objects in a combination for a given condition
750  //
751  for (auto itObject = itComb.begin(); itObject != itComb.end(); itObject++) {
752  // in case of object-less triggers (e.g. L1_ZeroBias) condObjType vector is empty, so don't seed!
753  //
754  if (condObjType.empty()) {
755  LogTrace("HLTL1TSeed")
756  << "\talgoName = " << objMap->algoName()
757  << " is object-less L1 algorithm, so do not attempt to store any objects to the list of seeds.\n"
758  << std::endl;
759  continue;
760  }
761 
762  // the index of the object type is the same as the index of the object
763  size_t iType = std::distance(itComb.begin(), itObject);
764 
765  // get object type and push indices on the list
766  //
767  const l1t::GlobalObject objTypeVal = condObjType.at(iType);
768 
769  LogTrace("HLTL1TSeed") << "\tAdd object of type " << objTypeVal << " and index " << (*itObject)
770  << " to the seed list." << std::endl;
771 
772  // THESE OBJECT CASES ARE CURRENTLY MISSING:
773  //gtMinBias,
774  //gtExternal,
775  //ObjNull
776 
777  switch (objTypeVal) {
778  case l1t::gtMu: {
779  listMuon.push_back(*itObject);
780  } break;
781  case l1t::gtMuShower: {
782  listMuonShower.push_back(*itObject);
783  } break;
784  case l1t::gtEG: {
785  listEG.push_back(*itObject);
786  } break;
787  case l1t::gtJet: {
788  listJet.push_back(*itObject);
789  } break;
790  case l1t::gtTau: {
791  listTau.push_back(*itObject);
792  } break;
793  case l1t::gtETM: {
794  listETM.push_back(*itObject);
795  } break;
796  case l1t::gtETT: {
797  listETT.push_back(*itObject);
798  } break;
799  case l1t::gtHTT: {
800  listHTT.push_back(*itObject);
801  } break;
802  case l1t::gtHTM: {
803  listHTM.push_back(*itObject);
804  } break;
805  case l1t::gtETMHF: {
806  listETMHF.push_back(*itObject);
807  } break;
808  case l1t::gtHTMHF: {
809  listHTMHF.push_back(*itObject);
810  } break;
811  case l1t::gtTowerCount: {
812  listTowerCount.push_back(*itObject);
813  } break;
814  case l1t::gtMinBiasHFP0: {
815  listMinBiasHFP0.push_back(*itObject);
816  } break;
817  case l1t::gtMinBiasHFM0: {
818  listMinBiasHFM0.push_back(*itObject);
819  } break;
820  case l1t::gtMinBiasHFP1: {
821  listMinBiasHFP1.push_back(*itObject);
822  } break;
823  case l1t::gtMinBiasHFM1: {
824  listMinBiasHFM1.push_back(*itObject);
825  } break;
826  case l1t::gtETTem: {
827  listTotalEtEm.push_back(*itObject);
828  } break;
829  case l1t::gtAsymmetryEt: {
830  listAsymEt.push_back(*itObject);
831  } break;
832  case l1t::gtAsymmetryHt: {
833  listAsymHt.push_back(*itObject);
834  } break;
835  case l1t::gtAsymmetryEtHF: {
836  listAsymEtHF.push_back(*itObject);
837  } break;
838  case l1t::gtAsymmetryHtHF: {
839  listAsymHtHF.push_back(*itObject);
840  } break;
841  case l1t::gtZDCP: {
842  listZDCP.push_back(*itObject);
843  } break;
844  case l1t::gtZDCM: {
845  listZDCM.push_back(*itObject);
846  } break;
847  case l1t::gtCentrality0:
848  case l1t::gtCentrality1:
849  case l1t::gtCentrality2:
850  case l1t::gtCentrality3:
851  case l1t::gtCentrality4:
852  case l1t::gtCentrality5:
853  case l1t::gtCentrality6:
854  case l1t::gtCentrality7: {
855  listCentrality.push_back(*itObject);
856  } break;
857 
858  //case JetCounts: {
859  // listJetCounts.push_back(*itObject);
860  //}
861 
862  break;
863  default: {
864  // should not arrive here
865 
866  LogTrace("HLTL1TSeed") << "\n HLTL1TSeed::hltFilter "
867  << "\n Unknown object of type " << objTypeVal << " and index " << (*itObject)
868  << " in the seed list." << std::endl;
869  } break;
870 
871  } // end switch objTypeVal
872 
873  } // end for itObj
874 
875  } // end for itComb
876 
877  } // end for condition
878 
879  } // end for itSeed
880 
881  // eliminate duplicates
882 
883  listMuon.sort();
884  listMuon.unique();
885 
886  listMuonShower.sort();
887  listMuonShower.unique();
888 
889  listEG.sort();
890  listEG.unique();
891 
892  listJet.sort();
893  listJet.unique();
894 
895  listTau.sort();
896  listTau.unique();
897 
898  listETM.sort();
899  listETM.unique();
900 
901  listETT.sort();
902  listETT.unique();
903 
904  listHTT.sort();
905  listHTT.unique();
906 
907  listHTM.sort();
908  listHTM.unique();
909 
910  listETMHF.sort();
911  listETMHF.unique();
912 
913  listHTMHF.sort();
914  listHTMHF.unique();
915 
916  listJetCounts.sort();
917  listJetCounts.unique();
918 
919  listCentrality.sort();
920  listCentrality.unique();
921 
922  listMinBiasHFP0.sort();
923  listMinBiasHFP0.unique();
924 
925  listMinBiasHFM0.sort();
926  listMinBiasHFM0.unique();
927 
928  listMinBiasHFP1.sort();
929  listMinBiasHFP1.unique();
930 
931  listMinBiasHFM1.sort();
932  listMinBiasHFM1.unique();
933 
934  listTotalEtEm.sort();
935  listTotalEtEm.unique();
936 
937  listMissingEtHF.sort();
938  listMissingEtHF.unique();
939 
940  listTowerCount.sort();
941  listTowerCount.unique();
942 
943  listAsymEt.sort();
944  listAsymEt.unique();
945 
946  listAsymHt.sort();
947  listAsymHt.unique();
948 
949  listAsymEtHF.sort();
950  listAsymEtHF.unique();
951 
952  listAsymHtHF.sort();
953  listAsymHtHF.unique();
954 
955  listZDCP.sort();
956  listZDCP.unique();
957 
958  listZDCM.sort();
959  listZDCM.unique();
960 
961  // record the L1 physics objects in the HLT filterproduct
962  // //////////////////////////////////////////////////////
963 
964  // Muon
965  if (!listMuon.empty()) {
967  iEvent.getByToken(m_l1MuonToken, muons);
968 
969  if (!muons.isValid()) {
970  edm::LogWarning("HLTL1TSeed") << "\nWarning: L1MuonBxCollection with input tag " << m_l1MuonTag
971  << "\nrequested in configuration, but not found in the event."
972  << "\nNo muons added to filterproduct." << endl;
973  } else {
974  for (std::list<int>::const_iterator itObj = listMuon.begin(); itObj != listMuon.end(); ++itObj) {
975  // skip invalid indices
976  if (*itObj < 0 or unsigned(*itObj) >= muons->size(0)) {
977  edm::LogWarning("HLTL1TSeed")
978  << "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::MuonBxCollection):"
979  << " index=" << *itObj << " (size of unpacked L1T objects in BX0 = " << muons->size(0) << ")";
980  continue;
981  }
982 
983  // Transform to index for Bx = 0 to begin of BxVector
984  unsigned int index = muons->begin(0) - muons->begin() + *itObj;
985 
986  l1t::MuonRef myref(muons, index);
987  filterproduct.addObject(trigger::TriggerL1Mu, myref);
988  }
989  }
990  }
991 
992  // Muon Shower
993  if (!listMuonShower.empty()) {
995  iEvent.getByToken(m_l1MuonShowerToken, muonShowers);
996 
997  if (!muonShowers.isValid()) {
998  edm::LogWarning("HLTL1TSeed") << "\nWarning: L1MuonShowerBxCollection with input tag " << m_l1MuonShowerTag
999  << "\nrequested in configuration, but not found in the event."
1000  << "\nNo muon showers added to filterproduct." << endl;
1001  } else {
1002  for (std::list<int>::const_iterator itObj = listMuonShower.begin(); itObj != listMuonShower.end(); ++itObj) {
1003  // skip invalid indices
1004  if (*itObj < 0 or unsigned(*itObj) >= muonShowers->size(0)) {
1005  edm::LogWarning("HLTL1TSeed")
1006  << "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::MuonShowerBxCollection):"
1007  << " index=" << *itObj << " (size of unpacked L1T objects in BX0 = " << muonShowers->size(0) << ")";
1008  continue;
1009  }
1010 
1011  // Transform to index for Bx = 0 to begin of BxVector
1012  unsigned int index = muonShowers->begin(0) - muonShowers->begin() + *itObj;
1013 
1014  l1t::MuonShowerRef myref(muonShowers, index);
1015  filterproduct.addObject(trigger::TriggerL1MuShower, myref);
1016  }
1017  }
1018  }
1019 
1020  // EG (isolated)
1021  if (!listEG.empty()) {
1023  iEvent.getByToken(m_l1EGammaToken, egammas);
1024  if (!egammas.isValid()) {
1025  edm::LogWarning("HLTL1TSeed") << "\nWarning: L1EGammaBxCollection with input tag " << m_l1EGammaTag
1026  << "\nrequested in configuration, but not found in the event."
1027  << "\nNo egammas added to filterproduct." << endl;
1028  } else {
1029  for (std::list<int>::const_iterator itObj = listEG.begin(); itObj != listEG.end(); ++itObj) {
1030  // skip invalid indices
1031  if (*itObj < 0 or unsigned(*itObj) >= egammas->size(0)) {
1032  edm::LogWarning("HLTL1TSeed")
1033  << "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::EGammaBxCollection):"
1034  << " index=" << *itObj << " (size of unpacked L1T objects in BX0 = " << egammas->size(0) << ")";
1035  continue;
1036  }
1037 
1038  // Transform to begin of BxVector
1039  unsigned int index = egammas->begin(0) - egammas->begin() + *itObj;
1040 
1041  l1t::EGammaRef myref(egammas, index);
1042  filterproduct.addObject(trigger::TriggerL1EG, myref);
1043  }
1044  }
1045  }
1046 
1047  // Jet
1048  if (!listJet.empty()) {
1050  iEvent.getByToken(m_l1JetToken, jets);
1051 
1052  if (!jets.isValid()) {
1053  edm::LogWarning("HLTL1TSeed") << "\nWarning: L1JetBxCollection with input tag " << m_l1JetTag
1054  << "\nrequested in configuration, but not found in the event."
1055  << "\nNo jets added to filterproduct." << endl;
1056  } else {
1057  for (std::list<int>::const_iterator itObj = listJet.begin(); itObj != listJet.end(); ++itObj) {
1058  // skip invalid indices
1059  if (*itObj < 0 or unsigned(*itObj) >= jets->size(0)) {
1060  edm::LogWarning("HLTL1TSeed")
1061  << "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::JetBxCollection):"
1062  << " index=" << *itObj << " (size of unpacked L1T objects in BX0 = " << jets->size(0) << ")";
1063  continue;
1064  }
1065 
1066  // Transform to begin of BxVector
1067  unsigned int index = jets->begin(0) - jets->begin() + *itObj;
1068 
1069  l1t::JetRef myref(jets, index);
1070  filterproduct.addObject(trigger::TriggerL1Jet, myref);
1071  }
1072  }
1073  }
1074 
1075  // Tau
1076  if (!listTau.empty()) {
1078  iEvent.getByToken(m_l1TauToken, taus);
1079 
1080  if (!taus.isValid()) {
1081  edm::LogWarning("HLTL1TSeed") << "\nWarning: L1TauBxCollection with input tag " << m_l1TauTag
1082  << "\nrequested in configuration, but not found in the event."
1083  << "\nNo taus added to filterproduct." << endl;
1084  } else {
1085  for (std::list<int>::const_iterator itObj = listTau.begin(); itObj != listTau.end(); ++itObj) {
1086  // skip invalid indices
1087  if (*itObj < 0 or unsigned(*itObj) >= taus->size(0)) {
1088  edm::LogWarning("HLTL1TSeed")
1089  << "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::TauBxCollection):"
1090  << " index=" << *itObj << " (size of unpacked L1T objects in BX0 = " << taus->size(0) << ")";
1091  continue;
1092  }
1093 
1094  // Transform to begin of BxVector
1095  unsigned int index = taus->begin(0) - taus->begin() + *itObj;
1096 
1097  l1t::TauRef myref(taus, index);
1098  filterproduct.addObject(trigger::TriggerL1Tau, myref);
1099  }
1100  }
1101  }
1102 
1103  // ETT, HTT, ETM, HTM
1105  iEvent.getByToken(m_l1EtSumToken, etsums);
1106  if (!etsums.isValid()) {
1107  edm::LogWarning("HLTL1TSeed") << "\nWarning: L1EtSumBxCollection with input tag " << m_l1EtSumTag
1108  << "\nrequested in configuration, but not found in the event."
1109  << "\nNo etsums added to filterproduct." << endl;
1110  } else {
1112 
1113  for (iter = etsums->begin(0); iter != etsums->end(0); ++iter) {
1114  l1t::EtSumRef myref(etsums, etsums->key(iter));
1115 
1116  switch (iter->getType()) {
1117  case l1t::EtSum::kTotalEt:
1118  if (!listETT.empty())
1119  filterproduct.addObject(trigger::TriggerL1ETT, myref);
1120  break;
1121  case l1t::EtSum::kTotalHt:
1122  if (!listHTT.empty())
1123  filterproduct.addObject(trigger::TriggerL1HTT, myref);
1124  break;
1126  if (!listETM.empty())
1127  filterproduct.addObject(trigger::TriggerL1ETM, myref);
1128  break;
1130  if (!listHTM.empty())
1131  filterproduct.addObject(trigger::TriggerL1HTM, myref);
1132  break;
1134  if (!listETMHF.empty())
1135  filterproduct.addObject(trigger::TriggerL1ETMHF, myref);
1136  break;
1138  if (!listHTMHF.empty())
1139  filterproduct.addObject(trigger::TriggerL1HTMHF, myref);
1140  break;
1142  if (!listCentrality.empty())
1143  filterproduct.addObject(trigger::TriggerL1Centrality, myref);
1144  break;
1146  if (!listMinBiasHFP0.empty())
1147  filterproduct.addObject(trigger::TriggerL1MinBiasHFP0, myref);
1148  break;
1150  if (!listMinBiasHFM0.empty())
1151  filterproduct.addObject(trigger::TriggerL1MinBiasHFM0, myref);
1152  break;
1154  if (!listMinBiasHFP1.empty())
1155  filterproduct.addObject(trigger::TriggerL1MinBiasHFP1, myref);
1156  break;
1158  if (!listMinBiasHFM1.empty())
1159  filterproduct.addObject(trigger::TriggerL1MinBiasHFM1, myref);
1160  break;
1162  if (!listTotalEtEm.empty())
1163  filterproduct.addObject(trigger::TriggerL1TotalEtEm, myref);
1164  break;
1166  if (!listTowerCount.empty())
1167  filterproduct.addObject(trigger::TriggerL1TowerCount, myref);
1168  break;
1169  case l1t::EtSum::kAsymEt:
1170  if (!listAsymEt.empty())
1171  filterproduct.addObject(trigger::TriggerL1AsymEt, myref);
1172  break;
1173  case l1t::EtSum::kAsymHt:
1174  if (!listAsymHt.empty())
1175  filterproduct.addObject(trigger::TriggerL1AsymHt, myref);
1176  break;
1177  case l1t::EtSum::kAsymEtHF:
1178  if (!listAsymEtHF.empty())
1179  filterproduct.addObject(trigger::TriggerL1AsymEtHF, myref);
1180  break;
1181  case l1t::EtSum::kAsymHtHF:
1182  if (!listAsymHtHF.empty())
1183  filterproduct.addObject(trigger::TriggerL1AsymHtHF, myref);
1184  break;
1185  default:
1186  LogTrace("HLTL1TSeed") << " L1EtSum seed of currently unsuported HLT TriggerType. l1t::EtSum type: "
1187  << iter->getType() << "\n";
1188 
1189  } // end switch
1190 
1191  } // end for
1192 
1193  } // end else
1194 
1195  // ZDCP, ZDCM
1197  iEvent.getByToken(m_l1EtSumZdcToken, etsumzdcs);
1198  if (!etsumzdcs.isValid()) {
1202  LogDebug("HLTL1TSeed") << "\nWarning: L1EtSumBxCollection with input tag " << m_l1EtSumZdcTag
1203  << "\nrequested in configuration, but not found in the event."
1204  << "\nNo etsums (ZDC) added to filterproduct.";
1205  } else {
1207 
1208  for (iter = etsumzdcs->begin(0); iter != etsumzdcs->end(0); ++iter) {
1209  l1t::EtSumRef myref(etsumzdcs, etsumzdcs->key(iter));
1210 
1211  switch (iter->getType()) {
1212  case l1t::EtSum::kZDCP:
1213  if (!listZDCP.empty())
1214  filterproduct.addObject(trigger::TriggerL1ZDCP, myref);
1215  break;
1216  case l1t::EtSum::kZDCM:
1217  if (!listZDCM.empty())
1218  filterproduct.addObject(trigger::TriggerL1ZDCM, myref);
1219  break;
1220  default:
1221  LogTrace("HLTL1TSeed")
1222  << " L1EtSum (ZDC) seed of currently unsuported HLT TriggerType. l1t::EtSum type: "
1223  << iter->getType() << "\n";
1224 
1225  } // end switch
1226 
1227  } // end for
1228 
1229  } // end else
1230 
1231  // TODO FIXME uncomment if block when JetCounts implemented
1232 
1233  // // jet counts
1234  // if (!listJetCounts.empty()) {
1235  // edm::Handle<l1extra::L1JetCounts> l1JetCounts;
1236  // iEvent.getByToken(m_l1CollectionsToken.label(), l1JetCounts);
1237  //
1238  // for (std::list<int>::const_iterator itObj = listJetCounts.begin();
1239  // itObj != listJetCounts.end(); ++itObj) {
1240  //
1241  // filterproduct.addObject(trigger::TriggerL1JetCounts,l1extra::L1JetCountsRefProd(l1JetCounts));
1242  // // FIXME: RefProd!
1243  //
1244  // }
1245  //
1246  // }
1247 
1248  LogTrace("HLTL1TSeed") << "\nHLTL1Seed:seedsL1TriggerObjectMaps returning " << seedsResult << endl << endl;
1249 
1250  return seedsResult;
1251 }
1252 
1253 // register as framework plugin
size
Write out results.
const std::vector< L1TObjectTypeInCond > & objectTypeVector() const
BXVector< EGamma > EGammaBxCollection
Definition: EGamma.h:10
bool saveTags() const
std::string m_l1SeedsLogicalExpression
Definition: HLTL1TSeed.h:97
bool isDebugEnabled()
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
edm::EDGetTokenT< l1t::EtSumBxCollection > m_l1EtSumToken
Definition: HLTL1TSeed.h:136
edm::Ref< EGammaBxCollection > EGammaRef
Definition: TkEGTau.h:35
std::vector< const std::vector< GlobalLogicParser::TokenRPN > * > m_l1AlgoSeedsRpn
vector of Rpn vectors for the required algorithms for seeding
Definition: HLTL1TSeed.h:85
unsigned int key(const_iterator &iter) const
Definition: BXVector.h:101
edm::InputTag m_l1MuonTag
Definition: HLTL1TSeed.h:110
edm::InputTag m_l1MuonShowerTag
Definition: HLTL1TSeed.h:115
HLTL1TSeed(const edm::ParameterSet &)
constructor
Definition: HLTL1TSeed.cc:32
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:482
void dumpTriggerFilterObjectWithRefs(trigger::TriggerFilterObjectWithRefs &) const
detailed print of filter content
Definition: HLTL1TSeed.cc:155
GlobalObject
Definition: GlobalObject.h:30
const std::vector< CombinationsInCond > & combinationVector() const
edm::Ref< JetBxCollection > JetRef
Definition: Jet.h:12
edm::Ref< EtSumBxCollection > EtSumRef
Definition: EtSum.h:12
delete x;
Definition: CaloConfig.h:22
bool isEmpty(int bx) const
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:214
assert(be >=bs)
BXVector< Tau > TauBxCollection
Definition: Tau.h:10
std::vector< GlobalLogicParser::OperandToken > expressionSeedsOperandList()
#define LogTrace(id)
const CombinationsInCond * getCombinationsInCond(const std::string &condNameVal) const
return all the combinations passing the requirements imposed in condition condNameVal ...
const_iterator begin(int bx) const
unsigned size(int bx) const
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref<C>)
std::vector< T >::const_iterator const_iterator
Definition: BXVector.h:18
BXVector< EtSum > EtSumBxCollection
Definition: EtSum.h:10
bool algoGtlResult() const
int iEvent
Definition: GenABIO.cc:224
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:100
~HLTL1TSeed() override
destructor
Definition: HLTL1TSeed.cc:86
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
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:79
edm::EDGetTokenT< l1t::EGammaBxCollection > m_l1EGammaToken
Definition: HLTL1TSeed.h:121
edm::InputTag m_l1EtSumTag
Definition: HLTL1TSeed.h:135
edm::InputTag m_l1TauTag
Definition: HLTL1TSeed.h:130
edm::Ref< TauBxCollection > TauRef
Definition: Tau.h:12
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< l1t::EtSumBxCollection > m_l1EtSumZdcToken
Definition: HLTL1TSeed.h:141
BXVector< MuonShower > MuonShowerBxCollection
Definition: MuonShower.h:18
const T & at(int bx, unsigned i) const
const std::vector< GlobalLogicParser::OperandToken > & operandTokenVector() const
edm::Ref< MuonShowerBxCollection > MuonShowerRef
Definition: MuonShower.h:20
const std::vector< GlobalObjectMap > & gtObjectMap() const
get / set the vector of object maps
BXVector< Muon > MuonBxCollection
Definition: Muon.h:11
bool m_isDebugEnabled
cache edm::isDebugEnabled()
Definition: HLTL1TSeed.h:147
std::vector< GlobalLogicParser::OperandToken > m_l1AlgoSeeds
list of required algorithms for seeding
Definition: HLTL1TSeed.h:82
BXVector< Jet > JetBxCollection
Definition: Jet.h:10
const GlobalObjectMap * getObjectMap(const std::string &algoNameVal) const
return the object map for the algorithm algoNameVal
edm::InputTag m_l1EGammaTag
Definition: HLTL1TSeed.h:120
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool isValid() const
Definition: HandleBase.h:70
const std::string & algoName() const
destructor
int algoBitNumber() const
get / set bit number for algorithm in the object map
edm::InputTag m_l1GlobalTag
InputTag for L1 Global Trigger.
Definition: HLTL1TSeed.h:104
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1GlobalToken
Definition: HLTL1TSeed.h:105
const_iterator end(int bx) const
HLT enums.
edm::Ref< MuonBxCollection > MuonRef
Definition: Muon.h:13
bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) override
filter the event
Definition: HLTL1TSeed.cc:114
bool m_l1GlobalDecision
flag to pass if L1TGlobal accept
Definition: HLTL1TSeed.h:144
Log< level::Warning, false > LogWarning
virtual const bool expressionResult() const
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:92
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
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:88
edm::EDGetTokenT< l1t::MuonBxCollection > m_l1MuonToken
Definition: HLTL1TSeed.h:111
edm::InputTag m_l1EtSumZdcTag
Definition: HLTL1TSeed.h:140
edm::EDGetTokenT< l1t::TauBxCollection > m_l1TauToken
Definition: HLTL1TSeed.h:131
#define LogDebug(id)
edm::EDGetTokenT< l1t::MuonShowerBxCollection > m_l1MuonShowerToken
Definition: HLTL1TSeed.h:116
edm::EDGetTokenT< GlobalObjectMapRecord > m_l1GtObjectMapToken
Definition: HLTL1TSeed.h:101