CMS 3D CMS Logo

HLTDoubletDZ.cc
Go to the documentation of this file.
2 #include "HLTDoubletDZ.h"
3 
5 
8 
9 //#include "DataFormats/Candidate/interface/Particle.h"
21 
23 
25 
27 #include <cmath>
28 
29 //
30 // constructors and destructor
31 //
32 template <typename T1, typename T2>
34  : HLTFilter(iConfig),
35  originTag1_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag1")),
36  originTag2_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag2")),
37  inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
38  inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
39  inputToken1_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag1_)),
40  inputToken2_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag2_)),
41  //electronToken_ (consumes<reco::ElectronCollection>(iConfig.template getParameter<edm::InputTag>("electronTag"))),
42  triggerType1_(iConfig.template getParameter<int>("triggerType1")),
43  triggerType2_(iConfig.template getParameter<int>("triggerType2")),
44  minDR_(iConfig.template getParameter<double>("MinDR")),
45  maxDZ_(iConfig.template getParameter<double>("MaxDZ")),
46  minPixHitsForDZ_(iConfig.template getParameter<int>("MinPixHitsForDZ")),
47  min_N_(iConfig.template getParameter<int>("MinN")),
48  checkSC_(iConfig.template getParameter<bool>("checkSC")),
49  same_(inputTag1_.encode() == inputTag2_.encode()) // same collections to be compared?
50 {}
51 
52 template <>
54  : HLTFilter(iConfig),
55  originTag1_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag1")),
56  originTag2_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag2")),
57  inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
58  inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
59  inputToken1_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag1_)),
60  inputToken2_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag2_)),
61  electronToken_(consumes<reco::ElectronCollection>(iConfig.template getParameter<edm::InputTag>("electronTag"))),
62  triggerType1_(iConfig.template getParameter<int>("triggerType1")),
63  triggerType2_(iConfig.template getParameter<int>("triggerType2")),
64  minDR_(iConfig.template getParameter<double>("MinDR")),
65  maxDZ_(iConfig.template getParameter<double>("MaxDZ")),
66  minPixHitsForDZ_(iConfig.template getParameter<int>("MinPixHitsForDZ")),
67  min_N_(iConfig.template getParameter<int>("MinN")),
68  checkSC_(iConfig.template getParameter<bool>("checkSC")),
69  same_(inputTag1_.encode() == inputTag2_.encode()) // same collections to be compared?
70 {}
71 
72 template <>
74  : HLTFilter(iConfig),
75  originTag1_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag1")),
76  originTag2_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag2")),
77  inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
78  inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
79  inputToken1_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag1_)),
80  inputToken2_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag2_)),
81  electronToken_(consumes<reco::ElectronCollection>(iConfig.template getParameter<edm::InputTag>("electronTag"))),
82  triggerType1_(iConfig.template getParameter<int>("triggerType1")),
83  triggerType2_(iConfig.template getParameter<int>("triggerType2")),
84  minDR_(iConfig.template getParameter<double>("MinDR")),
85  maxDZ_(iConfig.template getParameter<double>("MaxDZ")),
86  minPixHitsForDZ_(iConfig.template getParameter<int>("MinPixHitsForDZ")),
87  min_N_(iConfig.template getParameter<int>("MinN")),
88  checkSC_(iConfig.template getParameter<bool>("checkSC")),
89  same_(inputTag1_.encode() == inputTag2_.encode()) // same collections to be compared?
90 {}
91 
92 template <>
94  : HLTFilter(iConfig),
95  originTag1_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag1")),
96  originTag2_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag2")),
97  inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
98  inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
99  inputToken1_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag1_)),
100  inputToken2_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag2_)),
101  electronToken_(consumes<reco::ElectronCollection>(iConfig.template getParameter<edm::InputTag>("electronTag"))),
102  triggerType1_(iConfig.template getParameter<int>("triggerType1")),
103  triggerType2_(iConfig.template getParameter<int>("triggerType2")),
104  minDR_(iConfig.template getParameter<double>("MinDR")),
105  maxDZ_(iConfig.template getParameter<double>("MaxDZ")),
106  minPixHitsForDZ_(iConfig.template getParameter<int>("MinPixHitsForDZ")),
107  min_N_(iConfig.template getParameter<int>("MinN")),
108  checkSC_(iConfig.template getParameter<bool>("checkSC")),
109  same_(inputTag1_.encode() == inputTag2_.encode()) // same collections to be compared?
110 {}
111 
112 template <>
114  : HLTFilter(iConfig),
115  originTag1_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag1")),
116  originTag2_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag2")),
117  inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
118  inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
119  inputToken1_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag1_)),
120  inputToken2_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag2_)),
121  //electronToken_ (consumes<reco::ElectronCollection>(iConfig.template getParameter<edm::InputTag>("electronTag"))),
122  triggerType1_(iConfig.template getParameter<int>("triggerType1")),
123  triggerType2_(iConfig.template getParameter<int>("triggerType2")),
124  minDR_(iConfig.template getParameter<double>("MinDR")),
125  maxDZ_(iConfig.template getParameter<double>("MaxDZ")),
126  minPixHitsForDZ_(iConfig.template getParameter<int>("MinPixHitsForDZ")),
127  min_N_(iConfig.template getParameter<int>("MinN")),
128  checkSC_(iConfig.template getParameter<bool>("checkSC")),
129  same_(inputTag1_.encode() == inputTag2_.encode()) // same collections to be compared?
130 {}
131 
132 template <>
134  : HLTFilter(iConfig),
135  originTag1_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag1")),
136  originTag2_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag2")),
137  inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
138  inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
139  inputToken1_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag1_)),
140  inputToken2_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag2_)),
141  triggerType1_(iConfig.template getParameter<int>("triggerType1")),
142  triggerType2_(iConfig.template getParameter<int>("triggerType2")),
143  minDR_(iConfig.template getParameter<double>("MinDR")),
144  maxDZ_(iConfig.template getParameter<double>("MaxDZ")),
145  minPixHitsForDZ_(iConfig.template getParameter<int>("MinPixHitsForDZ")),
146  min_N_(iConfig.template getParameter<int>("MinN")),
147  checkSC_(iConfig.template getParameter<bool>("checkSC")),
148  same_(inputTag1_.encode() == inputTag2_.encode()) // same collections to be compared?
149 {}
150 
151 template <typename T1, typename T2>
153 
154 template <typename T1, typename T2>
157  makeHLTFilterDescription(desc);
158  std::vector<edm::InputTag> originTag1(1, edm::InputTag("hltOriginal1"));
159  std::vector<edm::InputTag> originTag2(1, edm::InputTag("hltOriginal2"));
160  desc.add<std::vector<edm::InputTag>>("originTag1", originTag1);
161  desc.add<std::vector<edm::InputTag>>("originTag2", originTag2);
162  desc.add<edm::InputTag>("inputTag1", edm::InputTag("hltFiltered1"));
163  desc.add<edm::InputTag>("inputTag2", edm::InputTag("hltFiltered2"));
164  desc.add<int>("triggerType1", 0);
165  desc.add<int>("triggerType2", 0);
166  desc.add<double>("MinDR", -1.0);
167  desc.add<double>("MaxDZ", 0.2);
168  desc.add<int>("MinPixHitsForDZ", 0);
169  desc.add<bool>("checkSC", false);
170  desc.add<int>("MinN", 1);
172 }
173 
174 template <>
176  edm::ConfigurationDescriptions& descriptions) {
178  makeHLTFilterDescription(desc);
179  std::vector<edm::InputTag> originTag1(1, edm::InputTag("hltOriginal1"));
180  std::vector<edm::InputTag> originTag2(1, edm::InputTag("hltOriginal2"));
181  desc.add<std::vector<edm::InputTag>>("originTag1", originTag1);
182  desc.add<std::vector<edm::InputTag>>("originTag2", originTag2);
183  desc.add<edm::InputTag>("inputTag1", edm::InputTag("hltFiltered1"));
184  desc.add<edm::InputTag>("inputTag2", edm::InputTag("hltFiltered2"));
185  desc.add<edm::InputTag>("electronTag", edm::InputTag("electronTag"));
186  desc.add<int>("triggerType1", 0);
187  desc.add<int>("triggerType2", 0);
188  desc.add<double>("MinDR", -1.0);
189  desc.add<double>("MaxDZ", 0.2);
190  desc.add<int>("MinPixHitsForDZ", 0);
191  desc.add<bool>("checkSC", false);
192  desc.add<int>("MinN", 1);
194 }
195 
196 template <>
198  edm::ConfigurationDescriptions& descriptions) {
200  makeHLTFilterDescription(desc);
201  std::vector<edm::InputTag> originTag1(1, edm::InputTag("hltOriginal1"));
202  std::vector<edm::InputTag> originTag2(1, edm::InputTag("hltOriginal2"));
203  desc.add<std::vector<edm::InputTag>>("originTag1", originTag1);
204  desc.add<std::vector<edm::InputTag>>("originTag2", originTag2);
205  desc.add<edm::InputTag>("inputTag1", edm::InputTag("hltFiltered1"));
206  desc.add<edm::InputTag>("inputTag2", edm::InputTag("hltFiltered2"));
207  desc.add<edm::InputTag>("electronTag", edm::InputTag("electronTag"));
208  desc.add<int>("triggerType1", 0);
209  desc.add<int>("triggerType2", 0);
210  desc.add<double>("MinDR", -1.0);
211  desc.add<double>("MaxDZ", 0.2);
212  desc.add<int>("MinPixHitsForDZ", 0);
213  desc.add<bool>("checkSC", false);
214  desc.add<int>("MinN", 1);
216 }
217 
218 template <>
220  edm::ConfigurationDescriptions& descriptions) {
222  makeHLTFilterDescription(desc);
223  std::vector<edm::InputTag> originTag1(1, edm::InputTag("hltOriginal1"));
224  std::vector<edm::InputTag> originTag2(1, edm::InputTag("hltOriginal2"));
225  desc.add<std::vector<edm::InputTag>>("originTag1", originTag1);
226  desc.add<std::vector<edm::InputTag>>("originTag2", originTag2);
227  desc.add<edm::InputTag>("inputTag1", edm::InputTag("hltFiltered1"));
228  desc.add<edm::InputTag>("inputTag2", edm::InputTag("hltFiltered2"));
229  desc.add<edm::InputTag>("electronTag", edm::InputTag("electronTag"));
230  desc.add<int>("triggerType1", 0);
231  desc.add<int>("triggerType2", 0);
232  desc.add<double>("MinDR", -1.0);
233  desc.add<double>("MaxDZ", 0.2);
234  desc.add<int>("MinPixHitsForDZ", 0);
235  desc.add<bool>("checkSC", false);
236  desc.add<int>("MinN", 1);
238 }
239 
240 template <>
242  edm::ConfigurationDescriptions& descriptions) {
244  makeHLTFilterDescription(desc);
245  std::vector<edm::InputTag> originTag1(1, edm::InputTag("hltOriginal1"));
246  std::vector<edm::InputTag> originTag2(1, edm::InputTag("hltOriginal2"));
247  desc.add<std::vector<edm::InputTag>>("originTag1", originTag1);
248  desc.add<std::vector<edm::InputTag>>("originTag2", originTag2);
249  desc.add<edm::InputTag>("inputTag1", edm::InputTag("hltFiltered1"));
250  desc.add<edm::InputTag>("inputTag2", edm::InputTag("hltFiltered2"));
251  desc.add<int>("triggerType1", 0);
252  desc.add<int>("triggerType2", 0);
253  desc.add<double>("MinDR", -1.0);
254  desc.add<double>("MaxDZ", 0.2);
255  desc.add<int>("MinPixHitsForDZ", 0);
256  desc.add<bool>("checkSC", false);
257  desc.add<int>("MinN", 1);
259 }
260 
261 template <typename T1, typename T2>
262 bool
263 //HLTDoubletDZ<T1, T2>::getCollections(edm::Event& iEvent, std::vector<T1Ref>& coll1, std::vector<T2Ref>& coll2) const {
265  std::vector<T1Ref>& coll1,
266  std::vector<T2Ref>& coll2,
267  trigger::TriggerFilterObjectWithRefs& filterproduct) const {
269  if (iEvent.getByToken(inputToken1_, handle1) and iEvent.getByToken(inputToken2_, handle2)) {
270  // get hold of pre-filtered object collections
271  handle1->getObjects(triggerType1_, coll1);
272  handle2->getObjects(triggerType2_, coll2);
273  const trigger::size_type n1(coll1.size());
274  const trigger::size_type n2(coll2.size());
275 
276  if (saveTags()) {
277  edm::InputTag tagOld;
278  for (unsigned int i = 0; i < originTag1_.size(); ++i) {
279  filterproduct.addCollectionTag(originTag1_[i]);
280  }
281  tagOld = edm::InputTag();
282  for (trigger::size_type i1 = 0; i1 != n1; ++i1) {
283  const edm::ProductID pid(coll1[i1].id());
284  const auto& prov = iEvent.getStableProvenance(pid);
285  const std::string& label(prov.moduleLabel());
286  const std::string& instance(prov.productInstanceName());
287  const std::string& process(prov.processName());
289  if (tagOld.encode() != tagNew.encode()) {
290  filterproduct.addCollectionTag(tagNew);
291  tagOld = tagNew;
292  }
293  }
294  for (unsigned int i = 0; i < originTag2_.size(); ++i) {
295  filterproduct.addCollectionTag(originTag2_[i]);
296  }
297  tagOld = edm::InputTag();
298  for (trigger::size_type i2 = 0; i2 != n2; ++i2) {
299  const edm::ProductID pid(coll2[i2].id());
300  const auto& prov = iEvent.getStableProvenance(pid);
301  const std::string& label(prov.moduleLabel());
302  const std::string& instance(prov.productInstanceName());
303  const std::string& process(prov.processName());
305  if (tagOld.encode() != tagNew.encode()) {
306  filterproduct.addCollectionTag(tagNew);
307  tagOld = tagNew;
308  }
309  }
310  }
311 
312  return true;
313  } else
314  return false;
315 }
316 
317 template <typename T1, typename T2>
319  const reco::Candidate& candidate1(*r1);
320  const reco::Candidate& candidate2(*r2);
321  if (reco::deltaR(candidate1, candidate2) < minDR_)
322  return false;
323  if (std::abs(candidate1.vz() - candidate2.vz()) > maxDZ_)
324  return false;
325 
326  return true;
327 }
328 
329 template <>
331  T1Ref& r1,
332  T2Ref& r2) const {
334  iEvent.getByToken(electronToken_, electronHandle_);
335  if (!electronHandle_.isValid())
336  edm::LogError("HLTDoubletDZ") << "HLTDoubletDZ: Electron Handle not valid.";
337 
338  if (reco::deltaR(*r1, *r2) < minDR_)
339  return false;
341  for (auto const& eleIt : *electronHandle_) {
342  if (eleIt.superCluster() == r1->superCluster())
343  e1 = eleIt;
344  }
345 
346  const reco::RecoChargedCandidate& candidate2(*r2);
347  bool skipDZ = false;
348  if (minPixHitsForDZ_ > 0 && (e1.gsfTrack()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_ ||
349  candidate2.track()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_))
350  skipDZ = true;
351  if (!skipDZ && std::abs(e1.vz() - candidate2.vz()) > maxDZ_)
352  return false;
353 
354  return true;
355 }
356 
357 template <>
359  T1Ref& r1,
360  T2Ref& r2) const {
362  iEvent.getByToken(electronToken_, electronHandle_);
363  if (!electronHandle_.isValid())
364  edm::LogError("HLTDoubletDZ") << "HLTDoubletDZ: Electron Handle not valid.";
365 
366  if (reco::deltaR(*r1, *r2) < minDR_)
367  return false;
368  reco::Electron e2;
369  for (auto const& eleIt : *electronHandle_) {
370  if (eleIt.superCluster() == r2->superCluster())
371  e2 = eleIt;
372  }
373 
374  const reco::RecoChargedCandidate& candidate1(*r1);
375  bool skipDZ = false;
376  if (minPixHitsForDZ_ > 0 && (candidate1.track()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_ ||
377  e2.gsfTrack()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_))
378  skipDZ = true;
379  if (!skipDZ && std::abs(e2.vz() - candidate1.vz()) > maxDZ_)
380  return false;
381 
382  return true;
383 }
384 
385 template <>
387  T1Ref& r1,
388  T2Ref& r2) const {
390  iEvent.getByToken(electronToken_, electronHandle_);
391  if (!electronHandle_.isValid())
392  edm::LogError("HLTDoubletDZ") << "HLTDoubletDZ: Electron Handle not valid.";
393 
394  if (reco::deltaR(*r1, *r2) < minDR_)
395  return false;
396  reco::Electron e1, e2;
397  for (auto const& eleIt : *electronHandle_) {
398  if (eleIt.superCluster() == r2->superCluster())
399  e2 = eleIt;
400  if (eleIt.superCluster() == r1->superCluster())
401  e1 = eleIt;
402  }
403 
404  bool skipDZ = false;
405  if (minPixHitsForDZ_ > 0 && (e1.gsfTrack()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_ ||
406  e2.gsfTrack()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_))
407  skipDZ = true;
408  if (!skipDZ && std::abs(e2.vz() - e1.vz()) > maxDZ_)
409  return false;
410 
411  return true;
412 }
413 
414 template <>
416  T1Ref& r1,
417  T2Ref& r2) const {
418  const reco::RecoChargedCandidate& candidate1(*r1);
419  const reco::RecoChargedCandidate& candidate2(*r2);
420  if (reco::deltaR(candidate1, candidate2) < minDR_)
421  return false;
422  bool skipDZ = false;
423  if (minPixHitsForDZ_ > 0 && (candidate1.track()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_ ||
424  candidate2.track()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_))
425  skipDZ = true;
426  if (!skipDZ && std::abs(candidate1.vz() - candidate2.vz()) > maxDZ_)
427  return false;
428 
429  return true;
430 }
431 
432 template <>
435  l1t::TrackerMuonRef& r2) const {
436  // We don't care about minPixHitsForDZ_ with the L1TTrackerMuons,
437  // especially because the pixel does not participate in the L1T
438  if (std::abs(r1->phZ0() - r2->phZ0()) > maxDZ_)
439  return false;
440 
441  if (reco::deltaR2(r1->phEta(), r1->phPhi(), r2->phEta(), r2->phPhi()) < minDR_ * minDR_)
442  return false;
443 
444  return true;
445 }
446 
447 template <>
450  l1t::HPSPFTauRef& r2) const {
451  const l1t::HPSPFTau& candidate1(*r1);
452  const l1t::HPSPFTau& candidate2(*r2);
453  if (reco::deltaR(candidate1, candidate2) < minDR_)
454  return false;
455 
456  // We don't care about minPixHitsForDZ_ with the L1HPSPFTaus,
457  // especially because the pixel does not participate in the L1T
458  if (std::abs(candidate1.leadChargedPFCand()->pfTrack()->vertex().z() -
459  candidate2.leadChargedPFCand()->pfTrack()->vertex().z()) > maxDZ_)
460  return false;
461 
462  return true;
463 }
464 
465 // ------------ method called to produce the data ------------
466 template <typename T1, typename T2>
468  const edm::EventSetup& iSetup,
469  trigger::TriggerFilterObjectWithRefs& filterproduct) const {
470  // All HLT filters must create and fill an HLT filter object,
471  // recording any reconstructed physics objects satisfying (or not)
472  // this HLT filter, and place it in the Event.
473  bool accept(false);
474 
475  std::vector<T1Ref> coll1;
476  std::vector<T2Ref> coll2;
477 
478  if (getCollections(iEvent, coll1, coll2, filterproduct)) {
479  int n(0);
480  T1Ref r1;
481  T2Ref r2;
482 
483  for (unsigned int i1 = 0; i1 != coll1.size(); i1++) {
484  r1 = coll1[i1];
485  //const reco::Candidate& candidate1(*r1);
486  unsigned int I(0);
487  if (same_) {
488  I = i1 + 1;
489  }
490  for (unsigned int i2 = I; i2 != coll2.size(); i2++) {
491  r2 = coll2[i2];
492  if (checkSC_) {
493  if (r1->superCluster().isNonnull() && r2->superCluster().isNonnull()) {
494  if (r1->superCluster() == r2->superCluster())
495  continue;
496  }
497  }
498 
499  if (!computeDZ(iEvent, r1, r2))
500  continue;
501 
502  n++;
503  filterproduct.addObject(triggerType1_, r1);
504  filterproduct.addObject(triggerType2_, r2);
505  }
506  }
507 
508  accept = accept || (n >= min_N_);
509  }
510 
511  return accept;
512 }
513 
517 template <>
519  edm::Event& iEvent, const edm::EventSetup& iSetup, trigger::TriggerFilterObjectWithRefs& filterproduct) const {
520  // All HLT filters must create and fill an HLT filter object,
521  // recording any reconstructed physics objects satisfying (or not)
522  // this HLT filter, and place it in the Event.
523  bool accept(false);
524 
525  std::vector<l1t::TrackerMuonRef> coll1;
526  std::vector<l1t::TrackerMuonRef> coll2;
527 
528  if (getCollections(iEvent, coll1, coll2, filterproduct)) {
529  int n(0);
532 
533  for (unsigned int i1 = 0; i1 != coll1.size(); i1++) {
534  r1 = coll1[i1];
535  unsigned int I(0);
536  if (same_) {
537  I = i1 + 1;
538  }
539  for (unsigned int i2 = I; i2 != coll2.size(); i2++) {
540  r2 = coll2[i2];
541 
542  if (!computeDZ(iEvent, r1, r2))
543  continue;
544 
545  n++;
546  filterproduct.addObject(triggerType1_, r1);
547  filterproduct.addObject(triggerType2_, r2);
548  }
549  }
550 
551  accept = accept || (n >= min_N_);
552  }
553 
554  return accept;
555 }
556 
560 template <>
562  const edm::EventSetup& iSetup,
563  trigger::TriggerFilterObjectWithRefs& filterproduct) const {
564  // All HLT filters must create and fill an HLT filter object,
565  // recording any reconstructed physics objects satisfying (or not)
566  // this HLT filter, and place it in the Event.
567  bool accept(false);
568 
569  std::vector<l1t::PFTauRef> coll1;
570  std::vector<l1t::PFTauRef> coll2;
571 
572  if (getCollections(iEvent, coll1, coll2, filterproduct)) {
573  int n(0);
576 
577  for (unsigned int i1 = 0; i1 != coll1.size(); i1++) {
578  r1 = coll1[i1];
579  unsigned int I(0);
580  if (same_) {
581  I = i1 + 1;
582  }
583  for (unsigned int i2 = I; i2 != coll2.size(); i2++) {
584  r2 = coll2[i2];
585 
586  if (!computeDZ(iEvent, r1, r2))
587  continue;
588 
589  n++;
590  filterproduct.addObject(triggerType1_, r1);
591  filterproduct.addObject(triggerType2_, r2);
592  }
593  }
594 
595  accept = accept || (n >= min_N_);
596  }
597 
598  return accept;
599 }
600 
604 template <>
606  const edm::EventSetup& iSetup,
607  trigger::TriggerFilterObjectWithRefs& filterproduct) const {
608  // All HLT filters must create and fill an HLT filter object,
609  // recording any reconstructed physics objects satisfying (or not)
610  // this HLT filter, and place it in the Event.
611  bool accept(false);
612 
613  std::vector<l1t::HPSPFTauRef> coll1;
614  std::vector<l1t::HPSPFTauRef> coll2;
615 
616  if (getCollections(iEvent, coll1, coll2, filterproduct)) {
617  int n(0);
620 
621  for (unsigned int i1 = 0; i1 != coll1.size(); i1++) {
622  r1 = coll1[i1];
623  unsigned int I(0);
624  if (same_) {
625  I = i1 + 1;
626  }
627  for (unsigned int i2 = I; i2 != coll2.size(); i2++) {
628  r2 = coll2[i2];
629 
630  if (!computeDZ(iEvent, r1, r2))
631  continue;
632 
633  n++;
634  filterproduct.addObject(triggerType1_, r1);
635  filterproduct.addObject(triggerType2_, r2);
636  }
637  }
638 
639  accept = accept || (n >= min_N_);
640  }
641 
642  return accept;
643 }
644 
654 
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
HLTDoubletDZ(const edm::ParameterSet &)
Definition: HLTDoubletDZ.cc:33
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool computeDZ(edm::Event &iEvent, T1Ref &c1, T2Ref &c2) const
double vz() const override
z coordinate of vertex position
static PFTauRenderPlugin instance
std::string encode() const
Definition: InputTag.cc:159
~HLTDoubletDZ() override
std::string defaultModuleLabel()
HLTDoubletDZ< l1t::PFTau, l1t::PFTau > HLT2L1PFTauL1PFTauDZ
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
uint16_t size_type
bool getCollections(edm::Event &iEvent, std::vector< T1Ref > &coll1, std::vector< T2Ref > &coll2, trigger::TriggerFilterObjectWithRefs &filterproduct) const
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref<C>)
char const * label
int iEvent
Definition: GenABIO.cc:224
reco::TrackRef track() const override
reference to a track
reco::GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const std::complex< double > I
Definition: I.h:8
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::vector< Electron > ElectronCollection
collectin of Electron objects
Definition: ElectronFwd.h:9
bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
HLTDoubletDZ< reco::RecoChargedCandidate, reco::RecoChargedCandidate > HLT2MuonMuonDZ
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
HLTDoubletDZ< reco::Electron, reco::RecoChargedCandidate > HLT2ElectronMuonDZ
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
void add(std::string const &label, ParameterSetDescription const &psetDescription)
def encode(args, files)
HLTDoubletDZ< reco::RecoChargedCandidate, reco::RecoEcalCandidate > HLT2MuonPhotonDZ
HLTDoubletDZ< reco::Electron, reco::Electron > HLT2ElectronElectronDZ
HLTDoubletDZ< l1t::HPSPFTau, l1t::HPSPFTau > HLT2L1HPSPFTauL1HPSPFTauDZ
bool isValid() const
Definition: HandleBase.h:70
virtual double vz() const =0
z coordinate of vertex position
fixed size matrix
HLT enums.
const l1t::PFCandidateRef & leadChargedPFCand() const
Definition: HPSPFTau.h:28
HLTDoubletDZ< reco::RecoEcalCandidate, reco::RecoEcalCandidate > HLT2PhotonPhotonDZ
HLTDoubletDZ< reco::RecoEcalCandidate, reco::RecoChargedCandidate > HLT2PhotonMuonDZ
HLTDoubletDZ< l1t::TrackerMuon, l1t::TrackerMuon > HLT2L1TkMuonL1TkMuonDZ