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> seedsL1EtSumHTM;
308  filterproduct.getObjects(trigger::TriggerL1HTM, seedsL1EtSumHTM);
309  const size_t sizeSeedsL1EtSumHTM = seedsL1EtSumHTM.size();
310  LogTrace("HLTL1TSeed") << "\n L1EtSum HTM seeds: " << sizeSeedsL1EtSumHTM << endl << endl;
311 
312  for (size_t i = 0; i != sizeSeedsL1EtSumHTM; i++) {
313  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumHTM[i]);
314 
315  LogTrace("HLTL1TSeed") << "\tL1EtSum HTM"
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> seedsL1EtSumCentrality;
323  filterproduct.getObjects(trigger::TriggerL1Centrality, seedsL1EtSumCentrality);
324  const size_t sizeSeedsL1EtSumCentrality = seedsL1EtSumCentrality.size();
325  LogTrace("HLTL1TSeed") << "\n L1EtSum Centrality seeds: " << sizeSeedsL1EtSumCentrality << endl << endl;
326 
327  for (size_t i = 0; i != sizeSeedsL1EtSumCentrality; i++) {
328  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumCentrality[i]);
329 
330  LogTrace("HLTL1TSeed") << "\tL1EtSum Centrality Bits: " << std::bitset<8>(obj->hwPt())
331  << " (hwPt = " << obj->hwPt() << ")";
332  }
333 
334  vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFP0;
335  filterproduct.getObjects(trigger::TriggerL1MinBiasHFP0, seedsL1EtSumMinBiasHFP0);
336  const size_t sizeSeedsL1EtSumMinBiasHFP0 = seedsL1EtSumMinBiasHFP0.size();
337  LogTrace("HLTL1TSeed") << "\n L1EtSum MinBiasHFP0 seeds: " << sizeSeedsL1EtSumMinBiasHFP0 << endl << endl;
338 
339  for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFP0; i++) {
340  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFP0[i]);
341 
342  LogTrace("HLTL1TSeed") << "\tL1EtSum MinBiasHFP0: hwPt = " << obj->hwPt();
343  }
344 
345  vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFM0;
346  filterproduct.getObjects(trigger::TriggerL1MinBiasHFM0, seedsL1EtSumMinBiasHFM0);
347  const size_t sizeSeedsL1EtSumMinBiasHFM0 = seedsL1EtSumMinBiasHFM0.size();
348  LogTrace("HLTL1TSeed") << "\n L1EtSum MinBiasHFM0 seeds: " << sizeSeedsL1EtSumMinBiasHFM0 << endl << endl;
349 
350  for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFM0; i++) {
351  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFM0[i]);
352 
353  LogTrace("HLTL1TSeed") << "\tL1EtSum MinBiasHFM0: hwPt = " << obj->hwPt();
354  }
355 
356  vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFP1;
357  filterproduct.getObjects(trigger::TriggerL1MinBiasHFP1, seedsL1EtSumMinBiasHFP1);
358  const size_t sizeSeedsL1EtSumMinBiasHFP1 = seedsL1EtSumMinBiasHFP1.size();
359  LogTrace("HLTL1TSeed") << "\n L1EtSum MinBiasHFP1 seeds: " << sizeSeedsL1EtSumMinBiasHFP1 << endl << endl;
360 
361  for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFP1; i++) {
362  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFP1[i]);
363 
364  LogTrace("HLTL1TSeed") << "\tL1EtSum MinBiasHFP1: hwPt = " << obj->hwPt();
365  }
366 
367  vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFM1;
368  filterproduct.getObjects(trigger::TriggerL1MinBiasHFM1, seedsL1EtSumMinBiasHFM1);
369  const size_t sizeSeedsL1EtSumMinBiasHFM1 = seedsL1EtSumMinBiasHFM1.size();
370  LogTrace("HLTL1TSeed") << "\n L1EtSum MinBiasHFM1 seeds: " << sizeSeedsL1EtSumMinBiasHFM1 << endl << endl;
371 
372  for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFM1; i++) {
373  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFM1[i]);
374 
375  LogTrace("HLTL1TSeed") << "\tL1EtSum MinBiasHFM1: hwPt = " << obj->hwPt();
376  }
377 
378  vector<l1t::EtSumRef> seedsL1EtSumTowerCount;
379  filterproduct.getObjects(trigger::TriggerL1TowerCount, seedsL1EtSumTowerCount);
380  const size_t sizeSeedsL1EtSumTowerCount = seedsL1EtSumTowerCount.size();
381  LogTrace("HLTL1TSeed") << "\n L1EtSum TowerCount seeds: " << sizeSeedsL1EtSumTowerCount << endl << endl;
382 
383  for (size_t i = 0; i != sizeSeedsL1EtSumTowerCount; i++) {
384  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumTowerCount[i]);
385 
386  LogTrace("HLTL1TSeed") << "\tL1EtSum TowerCount: hwPt = " << obj->hwPt();
387  }
388 
389  vector<l1t::EtSumRef> seedsL1EtSumAsymEt;
390  filterproduct.getObjects(trigger::TriggerL1AsymEt, seedsL1EtSumAsymEt);
391  const size_t sizeSeedsL1EtSumAsymEt = seedsL1EtSumAsymEt.size();
392  LogTrace("HLTL1TSeed") << "\n L1EtSum AsymEt seeds: " << sizeSeedsL1EtSumAsymEt << endl << endl;
393 
394  for (size_t i = 0; i != sizeSeedsL1EtSumAsymEt; i++) {
395  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymEt[i]);
396 
397  LogTrace("HLTL1TSeed") << "\tL1EtSum AsymEt: hwPt = " << obj->hwPt();
398  }
399 
400  vector<l1t::EtSumRef> seedsL1EtSumAsymHt;
401  filterproduct.getObjects(trigger::TriggerL1AsymHt, seedsL1EtSumAsymHt);
402  const size_t sizeSeedsL1EtSumAsymHt = seedsL1EtSumAsymHt.size();
403  LogTrace("HLTL1TSeed") << "\n L1EtSum AsymHt seeds: " << sizeSeedsL1EtSumAsymHt << endl << endl;
404 
405  for (size_t i = 0; i != sizeSeedsL1EtSumAsymHt; i++) {
406  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymHt[i]);
407 
408  LogTrace("HLTL1TSeed") << "\tL1EtSum AsymHt: hwPt = " << obj->hwPt();
409  }
410 
411  vector<l1t::EtSumRef> seedsL1EtSumAsymEtHF;
412  filterproduct.getObjects(trigger::TriggerL1AsymEtHF, seedsL1EtSumAsymEtHF);
413  const size_t sizeSeedsL1EtSumAsymEtHF = seedsL1EtSumAsymEtHF.size();
414  LogTrace("HLTL1TSeed") << "\n L1EtSum AsymEtHF seeds: " << sizeSeedsL1EtSumAsymEtHF << endl << endl;
415 
416  for (size_t i = 0; i != sizeSeedsL1EtSumAsymEtHF; i++) {
417  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymEtHF[i]);
418 
419  LogTrace("HLTL1TSeed") << "\tL1EtSum AsymEtHF: hwPt = " << obj->hwPt();
420  }
421 
422  vector<l1t::EtSumRef> seedsL1EtSumAsymHtHF;
423  filterproduct.getObjects(trigger::TriggerL1AsymHtHF, seedsL1EtSumAsymHtHF);
424  const size_t sizeSeedsL1EtSumAsymHtHF = seedsL1EtSumAsymHtHF.size();
425  LogTrace("HLTL1TSeed") << "\n L1EtSum AsymHtHF seeds: " << sizeSeedsL1EtSumAsymHtHF << endl << endl;
426 
427  for (size_t i = 0; i != sizeSeedsL1EtSumAsymHtHF; i++) {
428  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymHtHF[i]);
429 
430  LogTrace("HLTL1TSeed") << "\tL1EtSum AsymHtHF: hwPt = " << obj->hwPt();
431  }
432 
433  vector<l1t::EtSumRef> seedsL1EtSumZDCP;
434  filterproduct.getObjects(trigger::TriggerL1ZDCP, seedsL1EtSumZDCP);
435  const size_t sizeSeedsL1EtSumZDCP = seedsL1EtSumZDCP.size();
436  LogTrace("HLTL1TSeed") << "\n L1EtSum ZDCP seeds: " << sizeSeedsL1EtSumZDCP << endl << endl;
437 
438  for (size_t i = 0; i != sizeSeedsL1EtSumZDCP; i++) {
439  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumZDCP[i]);
440 
441  LogTrace("HLTL1TSeed") << "\tL1EtSum ZDCP"
442  << "\t"
443  << "pt = " << obj->pt() << "\t"
444  << "eta = " << obj->eta() << "\t"
445  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
446  }
447 
448  vector<l1t::EtSumRef> seedsL1EtSumZDCM;
449  filterproduct.getObjects(trigger::TriggerL1ZDCM, seedsL1EtSumZDCM);
450  const size_t sizeSeedsL1EtSumZDCM = seedsL1EtSumZDCM.size();
451  LogTrace("HLTL1TSeed") << "\n L1EtSum ZDCM seeds: " << sizeSeedsL1EtSumZDCM << endl << endl;
452 
453  for (size_t i = 0; i != sizeSeedsL1EtSumZDCM; i++) {
454  l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumZDCM[i]);
455 
456  LogTrace("HLTL1TSeed") << "\tL1EtSum ZDCM"
457  << "\t"
458  << "pt = " << obj->pt() << "\t"
459  << "eta = " << obj->eta() << "\t"
460  << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
461  }
462 
463  LogTrace("HLTL1TSeed") << " \n\n" << endl;
464 }
465 
466 // seeding is done via L1 trigger object maps, considering the objects which fired in L1
468  // Two GT objects are obtained from the Event: (1) the unpacked GT and (2) the emulated GT.
469  // Return value of the function is the score of seeding logical expression, evaluated using (1).
470  // Seeding is performed (per l1_algo) if ACCEPT both in (1) and (2). Seed objects are identified
471  // and only available from ObjectMaps created in (2).
472 
473  // define index lists for all particle types
474 
475  std::list<int> listMuon;
476  std::list<int> listMuonShower;
477 
478  std::list<int> listEG;
479 
480  std::list<int> listJet;
481  std::list<int> listTau;
482 
483  std::list<int> listETM;
484  std::list<int> listETT;
485  std::list<int> listHTT;
486  std::list<int> listHTM;
487  std::list<int> listETMHF;
488 
489  std::list<int> listJetCounts;
490 
491  std::list<int> listCentrality;
492  std::list<int> listMinBiasHFP0;
493  std::list<int> listMinBiasHFM0;
494  std::list<int> listMinBiasHFP1;
495  std::list<int> listMinBiasHFM1;
496  std::list<int> listTotalEtEm;
497  std::list<int> listMissingEtHF;
498  std::list<int> listTowerCount;
499  std::list<int> listAsymEt;
500  std::list<int> listAsymHt;
501  std::list<int> listAsymEtHF;
502  std::list<int> listAsymHtHF;
503  std::list<int> listZDCP;
504  std::list<int> listZDCM;
505 
506  // get handle to unpacked GT
508  iEvent.getByToken(m_l1GlobalToken, uGtAlgoBlocks);
509 
510  if (!uGtAlgoBlocks.isValid()) {
511  edm::LogWarning("HLTL1TSeed") << " Warning: GlobalAlgBlkBxCollection with input tag " << m_l1GlobalTag
512  << " requested in configuration, but not found in the event." << std::endl;
513 
514  return false;
515  }
516 
517  // check size (all BXs)
518  if (uGtAlgoBlocks->size() == 0) {
519  edm::LogWarning("HLTL1TSeed") << " Warning: GlobalAlgBlkBxCollection with input tag " << m_l1GlobalTag
520  << " is empty for all BXs.";
521  return false;
522  }
523 
524  // check size (BX 0)
525  if (uGtAlgoBlocks->isEmpty(0)) {
526  edm::LogWarning("HLTL1TSeed") << " Warning: GlobalAlgBlkBxCollection with input tag " << m_l1GlobalTag
527  << " is empty for BX=0.";
528  return false;
529  }
530 
531  // get handle to object maps from emulator (one object map per algorithm)
532  edm::Handle<GlobalObjectMapRecord> gtObjectMapRecord;
533  iEvent.getByToken(m_l1GtObjectMapToken, gtObjectMapRecord);
534 
535  if (!gtObjectMapRecord.isValid()) {
536  edm::LogWarning("HLTL1TSeed") << " Warning: GlobalObjectMapRecord with input tag " << m_l1GtObjectMapTag
537  << " requested in configuration, but not found in the event." << std::endl;
538 
539  return false;
540  }
541 
542  if (m_isDebugEnabled) {
543  const std::vector<GlobalObjectMap>& objMaps = gtObjectMapRecord->gtObjectMap();
544 
545  LogTrace("HLTL1TSeed") << "\nHLTL1Seed"
546  << "\n--------------------------------------------------------------------------------------"
547  "-------------------------------";
548 
549  LogTrace("HLTL1TSeed")
550  << "\n\tAlgorithms in L1TriggerObjectMapRecord and GT results ( emulated | initial | prescaled | final ) "
551  << endl;
552 
553  LogTrace("HLTL1TSeed") << "\n\tmap"
554  << "\tAlgoBit" << std::setw(40) << "algoName"
555  << "\t (emul|ini|pre|fin)" << endl;
556 
557  LogTrace("HLTL1TSeed") << "----------------------------------------------------------------------------------------"
558  "-----------------------------";
559 
560  for (size_t imap = 0; imap < objMaps.size(); imap++) {
561  int bit = objMaps[imap].algoBitNumber(); // same as bit from L1T Menu
562 
563  int emulDecision = objMaps[imap].algoGtlResult();
564 
565  // For bx=0 , get 0th AlgoBlock, so in BXvector at(bx=0,i=0)
566  int initDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionInitial(bit);
567  int presDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionInterm(bit);
568  int finlDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionFinal(bit);
569 
570  if (emulDecision != initDecision) {
571  LogTrace("HLTL1TSeed") << "L1T decision (emulated vs. unpacked initial) is not the same:"
572  << "\n\tbit = " << std::setw(3) << bit << std::setw(40) << objMaps[imap].algoName()
573  << "\t emulated decision = " << emulDecision
574  << "\t unpacked initial decision = " << initDecision
575  << "\nThis should not happen. Include the L1TGtEmulCompare module in the sequence."
576  << endl;
577  }
578 
579  LogTrace("HLTL1TSeed") << "\t" << std::setw(3) << imap << "\tbit = " << std::setw(3) << bit << std::setw(40)
580  << objMaps[imap].algoName() << "\t ( " << emulDecision << " | " << initDecision << " | "
581  << presDecision << " | " << finlDecision << " ) ";
582  }
583  LogTrace("HLTL1TSeed") << endl;
584  }
585 
586  // Filter decision in case of "L1GlobalDecision" logical expression.
587  // By convention, it means global decision.
588  // /////////////////////////////////////////////////////////////////
589  if (m_l1GlobalDecision) {
590  // For bx=0 , get 0th AlgoBlock, so in BXvector at(bx=0,i=0)
591  return (uGtAlgoBlocks->at(0, 0)).getFinalOR();
592  }
593 
594  // Update/Reset m_l1AlgoLogicParser by reseting token result
595  // /////////////////////////////////////////////////////////
596  std::vector<GlobalLogicParser::OperandToken>& algOpTokenVector = m_l1AlgoLogicParser.operandTokenVector();
597 
598  for (auto& i : algOpTokenVector) {
599  // rest token result
600  //
601  i.tokenResult = false;
602  }
603 
604  // Update m_l1AlgoLogicParser and store emulator results for algOpTokens
605  // /////////////////////////////////////////////////////////////////////
606  for (auto& i : algOpTokenVector) {
607  std::string algoName = i.tokenName;
608 
609  const GlobalObjectMap* objMap = gtObjectMapRecord->getObjectMap(algoName);
610 
611  if (objMap == nullptr) {
612  throw cms::Exception("FailModule")
613  << "\nAlgorithm " << algoName
614  << ", requested as seed by a HLT path, cannot be matched to a L1 algo name in any GlobalObjectMap\n"
615  << "Please check if algorithm " << algoName << " is present in the L1 menu\n"
616  << std::endl;
617 
618  } else {
619  //(algOpTokenVector[i]).tokenResult = objMap->algoGtlResult();
620 
621  int bit = objMap->algoBitNumber();
622  bool finalAlgoDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionFinal(bit);
623  i.tokenResult = finalAlgoDecision;
624  }
625  }
626 
627  // Filter decision
628  // ///////////////
629  bool seedsResult = m_l1AlgoLogicParser.expressionResult();
630 
631  if (m_isDebugEnabled) {
632  LogTrace("HLTL1TSeed") << "\nHLTL1TSeed: l1SeedsLogicalExpression (names) = '" << m_l1SeedsLogicalExpression << "'"
633  << "\n Result for logical expression after update of algOpTokens: " << seedsResult << "\n"
634  << std::endl;
635  }
636 
639 
640  for (std::vector<GlobalLogicParser::OperandToken>::const_iterator itSeed = m_l1AlgoSeeds.begin();
641  itSeed != m_l1AlgoSeeds.end();
642  ++itSeed) {
643  std::string algoSeedName = (*itSeed).tokenName;
644 
645  LogTrace("HLTL1TSeed") << "\n ---------------- algo seed name = " << algoSeedName << endl;
646 
647  const GlobalObjectMap* objMap = gtObjectMapRecord->getObjectMap(algoSeedName);
648 
649  if (objMap == nullptr) {
650  // Should not get here
651  //
652  throw cms::Exception("FailModule")
653  << "\nAlgorithm " << algoSeedName
654  << ", requested as seed by a HLT path, cannot be matched to a L1 algo name in any GlobalObjectMap\n"
655  << "Please check if algorithm " << algoSeedName << " is present in the L1 menu\n"
656  << std::endl;
657  }
658 
659  int algoSeedBitNumber = objMap->algoBitNumber();
660  bool algoSeedResult = objMap->algoGtlResult();
661 
662  // unpacked GT results: uGtAlgoBlock has decisions initial, prescaled, and final after masks
663  bool algoSeedResultMaskAndPresc = uGtAlgoBlocks->at(0, 0).getAlgoDecisionFinal(algoSeedBitNumber);
664 
665  LogTrace("HLTL1TSeed") << "\n\tAlgo seed " << algoSeedName << " result emulated | final = " << algoSeedResult
666  << " | " << algoSeedResultMaskAndPresc << endl;
667 
670  if (!algoSeedResultMaskAndPresc)
671  continue;
672 
674  // This should not happen if the emulated and unpacked GT are consistent
676  if (!algoSeedResult)
677  continue;
678 
679  const std::vector<GlobalLogicParser::OperandToken>& opTokenVecObjMap = objMap->operandTokenVector();
680  const std::vector<L1TObjectTypeInCond>& condObjTypeVec = objMap->objectTypeVector();
681  const std::vector<CombinationsInCond>& condCombinations = objMap->combinationVector();
682 
683  LogTrace("HLTL1TSeed") << "\n\talgoName =" << objMap->algoName() << "\talgoBitNumber = " << algoSeedBitNumber
684  << "\talgoGtlResult = " << algoSeedResult << endl
685  << endl;
686 
687  if (opTokenVecObjMap.size() != condObjTypeVec.size()) {
688  edm::LogWarning("HLTL1TSeed")
689  << "\nWarning: GlobalObjectMapRecord with input tag " << m_l1GtObjectMapTag
690  << "\nhas object map for bit number " << algoSeedBitNumber
691  << " which contains different size vectors of operand tokens and of condition object types!" << std::endl;
692 
693  assert(opTokenVecObjMap.size() == condObjTypeVec.size());
694  }
695 
696  if (opTokenVecObjMap.size() != condCombinations.size()) {
697  edm::LogWarning("HLTL1TSeed")
698  << "\nWarning: GlobalObjectMapRecord with input tag " << m_l1GtObjectMapTag
699  << "\nhas object map for bit number " << algoSeedBitNumber
700  << " which contains different size vectors of operand tokens and of condition object combinations!"
701  << std::endl;
702 
703  assert(opTokenVecObjMap.size() == condCombinations.size());
704  }
705 
706  // operands are conditions of L1 algo
707  //
708  for (size_t condNumber = 0; condNumber < opTokenVecObjMap.size(); condNumber++) {
709  std::vector<l1t::GlobalObject> condObjType = condObjTypeVec[condNumber];
710 
711  for (auto& jOb : condObjType) {
712  LogTrace("HLTL1TSeed") << setw(15) << "\tcondObjType = " << jOb << endl;
713  }
714 
715  const std::string condName = opTokenVecObjMap[condNumber].tokenName;
716  bool condResult = opTokenVecObjMap[condNumber].tokenResult;
717 
718  // only procede for conditions that passed
719  //
720  if (!condResult) {
721  continue;
722  }
723 
724  // loop over combinations for a given condition
725  //
726  const CombinationsInCond* condComb = objMap->getCombinationsInCond(condNumber);
727 
728  LogTrace("HLTL1TSeed") << setw(15) << "\tcondCombinations = " << condComb->size() << endl;
729 
730  for (auto const& itComb : (*condComb)) {
731  LogTrace("HLTL1TSeed") << setw(15) << "\tnew combination" << endl;
732 
733  // loop over objects in a combination for a given condition
734  //
735  for (auto itObject = itComb.begin(); itObject != itComb.end(); itObject++) {
736  // in case of object-less triggers (e.g. L1_ZeroBias) condObjType vector is empty, so don't seed!
737  //
738  if (condObjType.empty()) {
739  LogTrace("HLTL1TSeed")
740  << "\talgoName = " << objMap->algoName()
741  << " is object-less L1 algorithm, so do not attempt to store any objects to the list of seeds.\n"
742  << std::endl;
743  continue;
744  }
745 
746  // the index of the object type is the same as the index of the object
747  size_t iType = std::distance(itComb.begin(), itObject);
748 
749  // get object type and push indices on the list
750  //
751  const l1t::GlobalObject objTypeVal = condObjType.at(iType);
752 
753  LogTrace("HLTL1TSeed") << "\tAdd object of type " << objTypeVal << " and index " << (*itObject)
754  << " to the seed list." << std::endl;
755 
756  // THESE OBJECT CASES ARE CURRENTLY MISSING:
757  //gtMinBias,
758  //gtExternal,
759  //ObjNull
760 
761  switch (objTypeVal) {
762  case l1t::gtMu: {
763  listMuon.push_back(*itObject);
764  } break;
765  case l1t::gtMuShower: {
766  listMuonShower.push_back(*itObject);
767  } break;
768  case l1t::gtEG: {
769  listEG.push_back(*itObject);
770  } break;
771  case l1t::gtJet: {
772  listJet.push_back(*itObject);
773  } break;
774  case l1t::gtTau: {
775  listTau.push_back(*itObject);
776  } break;
777  case l1t::gtETM: {
778  listETM.push_back(*itObject);
779  } break;
780  case l1t::gtETT: {
781  listETT.push_back(*itObject);
782  } break;
783  case l1t::gtHTT: {
784  listHTT.push_back(*itObject);
785  } break;
786  case l1t::gtHTM: {
787  listHTM.push_back(*itObject);
788  } break;
789  case l1t::gtETMHF: {
790  listETMHF.push_back(*itObject);
791  } break;
792  case l1t::gtTowerCount: {
793  listTowerCount.push_back(*itObject);
794  } break;
795  case l1t::gtMinBiasHFP0: {
796  listMinBiasHFP0.push_back(*itObject);
797  } break;
798  case l1t::gtMinBiasHFM0: {
799  listMinBiasHFM0.push_back(*itObject);
800  } break;
801  case l1t::gtMinBiasHFP1: {
802  listMinBiasHFP1.push_back(*itObject);
803  } break;
804  case l1t::gtMinBiasHFM1: {
805  listMinBiasHFM1.push_back(*itObject);
806  } break;
807  case l1t::gtETTem: {
808  listTotalEtEm.push_back(*itObject);
809  } break;
810  case l1t::gtAsymmetryEt: {
811  listAsymEt.push_back(*itObject);
812  } break;
813  case l1t::gtAsymmetryHt: {
814  listAsymHt.push_back(*itObject);
815  } break;
816  case l1t::gtAsymmetryEtHF: {
817  listAsymEtHF.push_back(*itObject);
818  } break;
819  case l1t::gtAsymmetryHtHF: {
820  listAsymHtHF.push_back(*itObject);
821  } break;
822  case l1t::gtZDCP: {
823  listZDCP.push_back(*itObject);
824  } break;
825  case l1t::gtZDCM: {
826  listZDCM.push_back(*itObject);
827  } break;
828  case l1t::gtCentrality0:
829  case l1t::gtCentrality1:
830  case l1t::gtCentrality2:
831  case l1t::gtCentrality3:
832  case l1t::gtCentrality4:
833  case l1t::gtCentrality5:
834  case l1t::gtCentrality6:
835  case l1t::gtCentrality7: {
836  listCentrality.push_back(*itObject);
837  } break;
838 
839  //case JetCounts: {
840  // listJetCounts.push_back(*itObject);
841  //}
842 
843  break;
844  default: {
845  // should not arrive here
846 
847  LogTrace("HLTL1TSeed") << "\n HLTL1TSeed::hltFilter "
848  << "\n Unknown object of type " << objTypeVal << " and index " << (*itObject)
849  << " in the seed list." << std::endl;
850  } break;
851 
852  } // end switch objTypeVal
853 
854  } // end for itObj
855 
856  } // end for itComb
857 
858  } // end for condition
859 
860  } // end for itSeed
861 
862  // eliminate duplicates
863 
864  listMuon.sort();
865  listMuon.unique();
866 
867  listMuonShower.sort();
868  listMuonShower.unique();
869 
870  listEG.sort();
871  listEG.unique();
872 
873  listJet.sort();
874  listJet.unique();
875 
876  listTau.sort();
877  listTau.unique();
878 
879  listETM.sort();
880  listETM.unique();
881 
882  listETT.sort();
883  listETT.unique();
884 
885  listHTT.sort();
886  listHTT.unique();
887 
888  listHTM.sort();
889  listHTM.unique();
890 
891  listETMHF.sort();
892  listETMHF.unique();
893 
894  listJetCounts.sort();
895  listJetCounts.unique();
896 
897  listCentrality.sort();
898  listCentrality.unique();
899 
900  listMinBiasHFP0.sort();
901  listMinBiasHFP0.unique();
902 
903  listMinBiasHFM0.sort();
904  listMinBiasHFM0.unique();
905 
906  listMinBiasHFP1.sort();
907  listMinBiasHFP1.unique();
908 
909  listMinBiasHFM1.sort();
910  listMinBiasHFM1.unique();
911 
912  listTotalEtEm.sort();
913  listTotalEtEm.unique();
914 
915  listMissingEtHF.sort();
916  listMissingEtHF.unique();
917 
918  listTowerCount.sort();
919  listTowerCount.unique();
920 
921  listAsymEt.sort();
922  listAsymEt.unique();
923 
924  listAsymHt.sort();
925  listAsymHt.unique();
926 
927  listAsymEtHF.sort();
928  listAsymEtHF.unique();
929 
930  listAsymHtHF.sort();
931  listAsymHtHF.unique();
932 
933  listZDCP.sort();
934  listZDCP.unique();
935 
936  listZDCM.sort();
937  listZDCM.unique();
938 
939  // record the L1 physics objects in the HLT filterproduct
940  // //////////////////////////////////////////////////////
941 
942  // Muon
943  if (!listMuon.empty()) {
945  iEvent.getByToken(m_l1MuonToken, muons);
946 
947  if (!muons.isValid()) {
948  edm::LogWarning("HLTL1TSeed") << "\nWarning: L1MuonBxCollection with input tag " << m_l1MuonTag
949  << "\nrequested in configuration, but not found in the event."
950  << "\nNo muons added to filterproduct." << endl;
951  } else {
952  for (std::list<int>::const_iterator itObj = listMuon.begin(); itObj != listMuon.end(); ++itObj) {
953  // skip invalid indices
954  if (*itObj < 0 or unsigned(*itObj) >= muons->size(0)) {
955  edm::LogWarning("HLTL1TSeed")
956  << "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::MuonBxCollection):"
957  << " index=" << *itObj << " (size of unpacked L1T objects in BX0 = " << muons->size(0) << ")";
958  continue;
959  }
960 
961  // Transform to index for Bx = 0 to begin of BxVector
962  unsigned int index = muons->begin(0) - muons->begin() + *itObj;
963 
964  l1t::MuonRef myref(muons, index);
965  filterproduct.addObject(trigger::TriggerL1Mu, myref);
966  }
967  }
968  }
969 
970  // Muon Shower
971  if (!listMuonShower.empty()) {
973  iEvent.getByToken(m_l1MuonShowerToken, muonShowers);
974 
975  if (!muonShowers.isValid()) {
976  edm::LogWarning("HLTL1TSeed") << "\nWarning: L1MuonShowerBxCollection with input tag " << m_l1MuonShowerTag
977  << "\nrequested in configuration, but not found in the event."
978  << "\nNo muon showers added to filterproduct." << endl;
979  } else {
980  for (std::list<int>::const_iterator itObj = listMuonShower.begin(); itObj != listMuonShower.end(); ++itObj) {
981  // skip invalid indices
982  if (*itObj < 0 or unsigned(*itObj) >= muonShowers->size(0)) {
983  edm::LogWarning("HLTL1TSeed")
984  << "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::MuonShowerBxCollection):"
985  << " index=" << *itObj << " (size of unpacked L1T objects in BX0 = " << muonShowers->size(0) << ")";
986  continue;
987  }
988 
989  // Transform to index for Bx = 0 to begin of BxVector
990  unsigned int index = muonShowers->begin(0) - muonShowers->begin() + *itObj;
991 
992  l1t::MuonShowerRef myref(muonShowers, index);
993  filterproduct.addObject(trigger::TriggerL1MuShower, myref);
994  }
995  }
996  }
997 
998  // EG (isolated)
999  if (!listEG.empty()) {
1001  iEvent.getByToken(m_l1EGammaToken, egammas);
1002  if (!egammas.isValid()) {
1003  edm::LogWarning("HLTL1TSeed") << "\nWarning: L1EGammaBxCollection with input tag " << m_l1EGammaTag
1004  << "\nrequested in configuration, but not found in the event."
1005  << "\nNo egammas added to filterproduct." << endl;
1006  } else {
1007  for (std::list<int>::const_iterator itObj = listEG.begin(); itObj != listEG.end(); ++itObj) {
1008  // skip invalid indices
1009  if (*itObj < 0 or unsigned(*itObj) >= egammas->size(0)) {
1010  edm::LogWarning("HLTL1TSeed")
1011  << "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::EGammaBxCollection):"
1012  << " index=" << *itObj << " (size of unpacked L1T objects in BX0 = " << egammas->size(0) << ")";
1013  continue;
1014  }
1015 
1016  // Transform to begin of BxVector
1017  unsigned int index = egammas->begin(0) - egammas->begin() + *itObj;
1018 
1019  l1t::EGammaRef myref(egammas, index);
1020  filterproduct.addObject(trigger::TriggerL1EG, myref);
1021  }
1022  }
1023  }
1024 
1025  // Jet
1026  if (!listJet.empty()) {
1028  iEvent.getByToken(m_l1JetToken, jets);
1029 
1030  if (!jets.isValid()) {
1031  edm::LogWarning("HLTL1TSeed") << "\nWarning: L1JetBxCollection with input tag " << m_l1JetTag
1032  << "\nrequested in configuration, but not found in the event."
1033  << "\nNo jets added to filterproduct." << endl;
1034  } else {
1035  for (std::list<int>::const_iterator itObj = listJet.begin(); itObj != listJet.end(); ++itObj) {
1036  // skip invalid indices
1037  if (*itObj < 0 or unsigned(*itObj) >= jets->size(0)) {
1038  edm::LogWarning("HLTL1TSeed")
1039  << "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::JetBxCollection):"
1040  << " index=" << *itObj << " (size of unpacked L1T objects in BX0 = " << jets->size(0) << ")";
1041  continue;
1042  }
1043 
1044  // Transform to begin of BxVector
1045  unsigned int index = jets->begin(0) - jets->begin() + *itObj;
1046 
1047  l1t::JetRef myref(jets, index);
1048  filterproduct.addObject(trigger::TriggerL1Jet, myref);
1049  }
1050  }
1051  }
1052 
1053  // Tau
1054  if (!listTau.empty()) {
1056  iEvent.getByToken(m_l1TauToken, taus);
1057 
1058  if (!taus.isValid()) {
1059  edm::LogWarning("HLTL1TSeed") << "\nWarning: L1TauBxCollection with input tag " << m_l1TauTag
1060  << "\nrequested in configuration, but not found in the event."
1061  << "\nNo taus added to filterproduct." << endl;
1062  } else {
1063  for (std::list<int>::const_iterator itObj = listTau.begin(); itObj != listTau.end(); ++itObj) {
1064  // skip invalid indices
1065  if (*itObj < 0 or unsigned(*itObj) >= taus->size(0)) {
1066  edm::LogWarning("HLTL1TSeed")
1067  << "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::TauBxCollection):"
1068  << " index=" << *itObj << " (size of unpacked L1T objects in BX0 = " << taus->size(0) << ")";
1069  continue;
1070  }
1071 
1072  // Transform to begin of BxVector
1073  unsigned int index = taus->begin(0) - taus->begin() + *itObj;
1074 
1075  l1t::TauRef myref(taus, index);
1076  filterproduct.addObject(trigger::TriggerL1Tau, myref);
1077  }
1078  }
1079  }
1080 
1081  // ETT, HTT, ETM, HTM
1083  iEvent.getByToken(m_l1EtSumToken, etsums);
1084  if (!etsums.isValid()) {
1085  edm::LogWarning("HLTL1TSeed") << "\nWarning: L1EtSumBxCollection with input tag " << m_l1EtSumTag
1086  << "\nrequested in configuration, but not found in the event."
1087  << "\nNo etsums added to filterproduct." << endl;
1088  } else {
1090 
1091  for (iter = etsums->begin(0); iter != etsums->end(0); ++iter) {
1092  l1t::EtSumRef myref(etsums, etsums->key(iter));
1093 
1094  switch (iter->getType()) {
1095  case l1t::EtSum::kTotalEt:
1096  if (!listETT.empty())
1097  filterproduct.addObject(trigger::TriggerL1ETT, myref);
1098  break;
1099  case l1t::EtSum::kTotalHt:
1100  if (!listHTT.empty())
1101  filterproduct.addObject(trigger::TriggerL1HTT, myref);
1102  break;
1104  if (!listETM.empty())
1105  filterproduct.addObject(trigger::TriggerL1ETM, myref);
1106  break;
1108  if (!listHTM.empty())
1109  filterproduct.addObject(trigger::TriggerL1HTM, myref);
1110  break;
1112  if (!listETMHF.empty())
1113  filterproduct.addObject(trigger::TriggerL1ETMHF, myref);
1114  break;
1116  if (!listCentrality.empty())
1117  filterproduct.addObject(trigger::TriggerL1Centrality, myref);
1118  break;
1120  if (!listMinBiasHFP0.empty())
1121  filterproduct.addObject(trigger::TriggerL1MinBiasHFP0, myref);
1122  break;
1124  if (!listMinBiasHFM0.empty())
1125  filterproduct.addObject(trigger::TriggerL1MinBiasHFM0, myref);
1126  break;
1128  if (!listMinBiasHFP1.empty())
1129  filterproduct.addObject(trigger::TriggerL1MinBiasHFP1, myref);
1130  break;
1132  if (!listMinBiasHFM1.empty())
1133  filterproduct.addObject(trigger::TriggerL1MinBiasHFM1, myref);
1134  break;
1136  if (!listTotalEtEm.empty())
1137  filterproduct.addObject(trigger::TriggerL1TotalEtEm, myref);
1138  break;
1140  if (!listTowerCount.empty())
1141  filterproduct.addObject(trigger::TriggerL1TowerCount, myref);
1142  break;
1143  case l1t::EtSum::kAsymEt:
1144  if (!listAsymEt.empty())
1145  filterproduct.addObject(trigger::TriggerL1AsymEt, myref);
1146  break;
1147  case l1t::EtSum::kAsymHt:
1148  if (!listAsymHt.empty())
1149  filterproduct.addObject(trigger::TriggerL1AsymHt, myref);
1150  break;
1151  case l1t::EtSum::kAsymEtHF:
1152  if (!listAsymEtHF.empty())
1153  filterproduct.addObject(trigger::TriggerL1AsymEtHF, myref);
1154  break;
1155  case l1t::EtSum::kAsymHtHF:
1156  if (!listAsymHtHF.empty())
1157  filterproduct.addObject(trigger::TriggerL1AsymHtHF, myref);
1158  break;
1159  default:
1160  LogTrace("HLTL1TSeed") << " L1EtSum seed of currently unsuported HLT TriggerType. l1t::EtSum type: "
1161  << iter->getType() << "\n";
1162 
1163  } // end switch
1164 
1165  } // end for
1166 
1167  } // end else
1168 
1169  // ZDCP, ZDCM
1171  iEvent.getByToken(m_l1EtSumZdcToken, etsumzdcs);
1172  if (!etsumzdcs.isValid()) {
1176  LogDebug("HLTL1TSeed") << "\nWarning: L1EtSumBxCollection with input tag " << m_l1EtSumZdcTag
1177  << "\nrequested in configuration, but not found in the event."
1178  << "\nNo etsums (ZDC) added to filterproduct.";
1179  } else {
1181 
1182  for (iter = etsumzdcs->begin(0); iter != etsumzdcs->end(0); ++iter) {
1183  l1t::EtSumRef myref(etsumzdcs, etsumzdcs->key(iter));
1184 
1185  switch (iter->getType()) {
1186  case l1t::EtSum::kZDCP:
1187  if (!listZDCP.empty())
1188  filterproduct.addObject(trigger::TriggerL1ZDCP, myref);
1189  break;
1190  case l1t::EtSum::kZDCM:
1191  if (!listZDCM.empty())
1192  filterproduct.addObject(trigger::TriggerL1ZDCM, myref);
1193  break;
1194  default:
1195  LogTrace("HLTL1TSeed")
1196  << " L1EtSum (ZDC) seed of currently unsuported HLT TriggerType. l1t::EtSum type: "
1197  << iter->getType() << "\n";
1198 
1199  } // end switch
1200 
1201  } // end for
1202 
1203  } // end else
1204 
1205  // TODO FIXME uncomment if block when JetCounts implemented
1206 
1207  // // jet counts
1208  // if (!listJetCounts.empty()) {
1209  // edm::Handle<l1extra::L1JetCounts> l1JetCounts;
1210  // iEvent.getByToken(m_l1CollectionsToken.label(), l1JetCounts);
1211  //
1212  // for (std::list<int>::const_iterator itObj = listJetCounts.begin();
1213  // itObj != listJetCounts.end(); ++itObj) {
1214  //
1215  // filterproduct.addObject(trigger::TriggerL1JetCounts,l1extra::L1JetCountsRefProd(l1JetCounts));
1216  // // FIXME: RefProd!
1217  //
1218  // }
1219  //
1220  // }
1221 
1222  LogTrace("HLTL1TSeed") << "\nHLTL1Seed:seedsL1TriggerObjectMaps returning " << seedsResult << endl << endl;
1223 
1224  return seedsResult;
1225 }
1226 
1227 // 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:467
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