CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HLTDoubletDZ.cc
Go to the documentation of this file.
2 #include "HLTDoubletDZ.h"
3 
5 
8 
9 //#include "DataFormats/Candidate/interface/Particle.h"
22 
24 
26 
28 #include <cmath>
29 
30 //
31 // constructors and destructor
32 //
33 template <typename T1, typename T2>
35  : HLTFilter(iConfig),
36  originTag1_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag1")),
37  originTag2_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag2")),
38  inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
39  inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
40  inputToken1_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag1_)),
41  inputToken2_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag2_)),
42  //electronToken_ (consumes<reco::ElectronCollection>(iConfig.template getParameter<edm::InputTag>("electronTag"))),
43  triggerType1_(iConfig.template getParameter<int>("triggerType1")),
44  triggerType2_(iConfig.template getParameter<int>("triggerType2")),
45  minDR_(iConfig.template getParameter<double>("MinDR")),
46  maxDZ_(iConfig.template getParameter<double>("MaxDZ")),
47  minPixHitsForDZ_(iConfig.template getParameter<int>("MinPixHitsForDZ")),
48  min_N_(iConfig.template getParameter<int>("MinN")),
49  checkSC_(iConfig.template getParameter<bool>("checkSC")),
50  same_(inputTag1_.encode() == inputTag2_.encode()) // same collections to be compared?
51 {}
52 
53 template <>
55  : HLTFilter(iConfig),
56  originTag1_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag1")),
57  originTag2_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag2")),
58  inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
59  inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
60  inputToken1_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag1_)),
61  inputToken2_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag2_)),
62  electronToken_(consumes<reco::ElectronCollection>(iConfig.template getParameter<edm::InputTag>("electronTag"))),
63  triggerType1_(iConfig.template getParameter<int>("triggerType1")),
64  triggerType2_(iConfig.template getParameter<int>("triggerType2")),
65  minDR_(iConfig.template getParameter<double>("MinDR")),
66  maxDZ_(iConfig.template getParameter<double>("MaxDZ")),
67  minPixHitsForDZ_(iConfig.template getParameter<int>("MinPixHitsForDZ")),
68  min_N_(iConfig.template getParameter<int>("MinN")),
69  checkSC_(iConfig.template getParameter<bool>("checkSC")),
70  same_(inputTag1_.encode() == inputTag2_.encode()) // same collections to be compared?
71 {}
72 
73 template <>
75  : HLTFilter(iConfig),
76  originTag1_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag1")),
77  originTag2_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag2")),
78  inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
79  inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
80  inputToken1_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag1_)),
81  inputToken2_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag2_)),
82  electronToken_(consumes<reco::ElectronCollection>(iConfig.template getParameter<edm::InputTag>("electronTag"))),
83  triggerType1_(iConfig.template getParameter<int>("triggerType1")),
84  triggerType2_(iConfig.template getParameter<int>("triggerType2")),
85  minDR_(iConfig.template getParameter<double>("MinDR")),
86  maxDZ_(iConfig.template getParameter<double>("MaxDZ")),
87  minPixHitsForDZ_(iConfig.template getParameter<int>("MinPixHitsForDZ")),
88  min_N_(iConfig.template getParameter<int>("MinN")),
89  checkSC_(iConfig.template getParameter<bool>("checkSC")),
90  same_(inputTag1_.encode() == inputTag2_.encode()) // same collections to be compared?
91 {}
92 
93 template <>
95  : HLTFilter(iConfig),
96  originTag1_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag1")),
97  originTag2_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag2")),
98  inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
99  inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
100  inputToken1_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag1_)),
101  inputToken2_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag2_)),
102  electronToken_(consumes<reco::ElectronCollection>(iConfig.template getParameter<edm::InputTag>("electronTag"))),
103  triggerType1_(iConfig.template getParameter<int>("triggerType1")),
104  triggerType2_(iConfig.template getParameter<int>("triggerType2")),
105  minDR_(iConfig.template getParameter<double>("MinDR")),
106  maxDZ_(iConfig.template getParameter<double>("MaxDZ")),
107  minPixHitsForDZ_(iConfig.template getParameter<int>("MinPixHitsForDZ")),
108  min_N_(iConfig.template getParameter<int>("MinN")),
109  checkSC_(iConfig.template getParameter<bool>("checkSC")),
110  same_(inputTag1_.encode() == inputTag2_.encode()) // same collections to be compared?
111 {}
112 
113 template <>
115  : HLTFilter(iConfig),
116  originTag1_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag1")),
117  originTag2_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag2")),
118  inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
119  inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
120  inputToken1_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag1_)),
121  inputToken2_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag2_)),
122  //electronToken_ (consumes<reco::ElectronCollection>(iConfig.template getParameter<edm::InputTag>("electronTag"))),
123  triggerType1_(iConfig.template getParameter<int>("triggerType1")),
124  triggerType2_(iConfig.template getParameter<int>("triggerType2")),
125  minDR_(iConfig.template getParameter<double>("MinDR")),
126  maxDZ_(iConfig.template getParameter<double>("MaxDZ")),
127  minPixHitsForDZ_(iConfig.template getParameter<int>("MinPixHitsForDZ")),
128  min_N_(iConfig.template getParameter<int>("MinN")),
129  checkSC_(iConfig.template getParameter<bool>("checkSC")),
130  same_(inputTag1_.encode() == inputTag2_.encode()) // same collections to be compared?
131 {}
132 
133 template <>
135  : HLTFilter(iConfig),
136  originTag1_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag1")),
137  originTag2_(iConfig.template getParameter<std::vector<edm::InputTag>>("originTag2")),
138  inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
139  inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
140  inputToken1_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag1_)),
141  inputToken2_(consumes<trigger::TriggerFilterObjectWithRefs>(inputTag2_)),
142  triggerType1_(iConfig.template getParameter<int>("triggerType1")),
143  triggerType2_(iConfig.template getParameter<int>("triggerType2")),
144  minDR_(iConfig.template getParameter<double>("MinDR")),
145  maxDZ_(iConfig.template getParameter<double>("MaxDZ")),
146  minPixHitsForDZ_(iConfig.template getParameter<int>("MinPixHitsForDZ")),
147  min_N_(iConfig.template getParameter<int>("MinN")),
148  checkSC_(iConfig.template getParameter<bool>("checkSC")),
149  same_(inputTag1_.encode() == inputTag2_.encode()) // same collections to be compared?
150 {}
151 
152 template <typename T1, typename T2>
154 
155 template <typename T1, typename T2>
158  makeHLTFilterDescription(desc);
159  std::vector<edm::InputTag> originTag1(1, edm::InputTag("hltOriginal1"));
160  std::vector<edm::InputTag> originTag2(1, edm::InputTag("hltOriginal2"));
161  desc.add<std::vector<edm::InputTag>>("originTag1", originTag1);
162  desc.add<std::vector<edm::InputTag>>("originTag2", originTag2);
163  desc.add<edm::InputTag>("inputTag1", edm::InputTag("hltFiltered1"));
164  desc.add<edm::InputTag>("inputTag2", edm::InputTag("hltFiltered2"));
165  desc.add<int>("triggerType1", 0);
166  desc.add<int>("triggerType2", 0);
167  desc.add<double>("MinDR", -1.0);
168  desc.add<double>("MaxDZ", 0.2);
169  desc.add<int>("MinPixHitsForDZ", 0);
170  desc.add<bool>("checkSC", false);
171  desc.add<int>("MinN", 1);
172  descriptions.add(defaultModuleLabel<HLTDoubletDZ<T1, T2>>(), desc);
173 }
174 
175 template <>
177  edm::ConfigurationDescriptions& descriptions) {
179  makeHLTFilterDescription(desc);
180  std::vector<edm::InputTag> originTag1(1, edm::InputTag("hltOriginal1"));
181  std::vector<edm::InputTag> originTag2(1, edm::InputTag("hltOriginal2"));
182  desc.add<std::vector<edm::InputTag>>("originTag1", originTag1);
183  desc.add<std::vector<edm::InputTag>>("originTag2", originTag2);
184  desc.add<edm::InputTag>("inputTag1", edm::InputTag("hltFiltered1"));
185  desc.add<edm::InputTag>("inputTag2", edm::InputTag("hltFiltered2"));
186  desc.add<edm::InputTag>("electronTag", edm::InputTag("electronTag"));
187  desc.add<int>("triggerType1", 0);
188  desc.add<int>("triggerType2", 0);
189  desc.add<double>("MinDR", -1.0);
190  desc.add<double>("MaxDZ", 0.2);
191  desc.add<int>("MinPixHitsForDZ", 0);
192  desc.add<bool>("checkSC", false);
193  desc.add<int>("MinN", 1);
195 }
196 
197 template <>
199  edm::ConfigurationDescriptions& descriptions) {
201  makeHLTFilterDescription(desc);
202  std::vector<edm::InputTag> originTag1(1, edm::InputTag("hltOriginal1"));
203  std::vector<edm::InputTag> originTag2(1, edm::InputTag("hltOriginal2"));
204  desc.add<std::vector<edm::InputTag>>("originTag1", originTag1);
205  desc.add<std::vector<edm::InputTag>>("originTag2", originTag2);
206  desc.add<edm::InputTag>("inputTag1", edm::InputTag("hltFiltered1"));
207  desc.add<edm::InputTag>("inputTag2", edm::InputTag("hltFiltered2"));
208  desc.add<edm::InputTag>("electronTag", edm::InputTag("electronTag"));
209  desc.add<int>("triggerType1", 0);
210  desc.add<int>("triggerType2", 0);
211  desc.add<double>("MinDR", -1.0);
212  desc.add<double>("MaxDZ", 0.2);
213  desc.add<int>("MinPixHitsForDZ", 0);
214  desc.add<bool>("checkSC", false);
215  desc.add<int>("MinN", 1);
217 }
218 
219 template <>
221  edm::ConfigurationDescriptions& descriptions) {
223  makeHLTFilterDescription(desc);
224  std::vector<edm::InputTag> originTag1(1, edm::InputTag("hltOriginal1"));
225  std::vector<edm::InputTag> originTag2(1, edm::InputTag("hltOriginal2"));
226  desc.add<std::vector<edm::InputTag>>("originTag1", originTag1);
227  desc.add<std::vector<edm::InputTag>>("originTag2", originTag2);
228  desc.add<edm::InputTag>("inputTag1", edm::InputTag("hltFiltered1"));
229  desc.add<edm::InputTag>("inputTag2", edm::InputTag("hltFiltered2"));
230  desc.add<edm::InputTag>("electronTag", edm::InputTag("electronTag"));
231  desc.add<int>("triggerType1", 0);
232  desc.add<int>("triggerType2", 0);
233  desc.add<double>("MinDR", -1.0);
234  desc.add<double>("MaxDZ", 0.2);
235  desc.add<int>("MinPixHitsForDZ", 0);
236  desc.add<bool>("checkSC", false);
237  desc.add<int>("MinN", 1);
239 }
240 
241 template <>
243  edm::ConfigurationDescriptions& descriptions) {
245  makeHLTFilterDescription(desc);
246  std::vector<edm::InputTag> originTag1(1, edm::InputTag("hltOriginal1"));
247  std::vector<edm::InputTag> originTag2(1, edm::InputTag("hltOriginal2"));
248  desc.add<std::vector<edm::InputTag>>("originTag1", originTag1);
249  desc.add<std::vector<edm::InputTag>>("originTag2", originTag2);
250  desc.add<edm::InputTag>("inputTag1", edm::InputTag("hltFiltered1"));
251  desc.add<edm::InputTag>("inputTag2", edm::InputTag("hltFiltered2"));
252  desc.add<int>("triggerType1", 0);
253  desc.add<int>("triggerType2", 0);
254  desc.add<double>("MinDR", -1.0);
255  desc.add<double>("MaxDZ", 0.2);
256  desc.add<int>("MinPixHitsForDZ", 0);
257  desc.add<bool>("checkSC", false);
258  desc.add<int>("MinN", 1);
260 }
261 
262 template <typename T1, typename T2>
263 bool
264 //HLTDoubletDZ<T1, T2>::getCollections(edm::Event& iEvent, std::vector<T1Ref>& coll1, std::vector<T2Ref>& coll2) const {
266  std::vector<T1Ref>& coll1,
267  std::vector<T2Ref>& coll2,
268  trigger::TriggerFilterObjectWithRefs& filterproduct) const {
270  if (iEvent.getByToken(inputToken1_, handle1) and iEvent.getByToken(inputToken2_, handle2)) {
271  // get hold of pre-filtered object collections
272  handle1->getObjects(triggerType1_, coll1);
273  handle2->getObjects(triggerType2_, coll2);
274  const trigger::size_type n1(coll1.size());
275  const trigger::size_type n2(coll2.size());
276 
277  if (saveTags()) {
278  edm::InputTag tagOld;
279  for (unsigned int i = 0; i < originTag1_.size(); ++i) {
280  filterproduct.addCollectionTag(originTag1_[i]);
281  }
282  tagOld = edm::InputTag();
283  for (trigger::size_type i1 = 0; i1 != n1; ++i1) {
284  const edm::ProductID pid(coll1[i1].id());
285  const auto& prov = iEvent.getStableProvenance(pid);
286  const std::string& label(prov.moduleLabel());
287  const std::string& instance(prov.productInstanceName());
288  const std::string& process(prov.processName());
290  if (tagOld.encode() != tagNew.encode()) {
291  filterproduct.addCollectionTag(tagNew);
292  tagOld = tagNew;
293  }
294  }
295  for (unsigned int i = 0; i < originTag2_.size(); ++i) {
296  filterproduct.addCollectionTag(originTag2_[i]);
297  }
298  tagOld = edm::InputTag();
299  for (trigger::size_type i2 = 0; i2 != n2; ++i2) {
300  const edm::ProductID pid(coll2[i2].id());
301  const auto& prov = iEvent.getStableProvenance(pid);
302  const std::string& label(prov.moduleLabel());
303  const std::string& instance(prov.productInstanceName());
304  const std::string& process(prov.processName());
306  if (tagOld.encode() != tagNew.encode()) {
307  filterproduct.addCollectionTag(tagNew);
308  tagOld = tagNew;
309  }
310  }
311  }
312 
313  return true;
314  } else
315  return false;
316 }
317 
318 template <typename T1, typename T2>
320  const reco::Candidate& candidate1(*r1);
321  const reco::Candidate& candidate2(*r2);
322  if (reco::deltaR(candidate1, candidate2) < minDR_)
323  return false;
324  if (std::abs(candidate1.vz() - candidate2.vz()) > maxDZ_)
325  return false;
326 
327  return true;
328 }
329 
330 template <>
332  T1Ref& r1,
333  T2Ref& r2) const {
335  iEvent.getByToken(electronToken_, electronHandle_);
336  if (!electronHandle_.isValid())
337  edm::LogError("HLTDoubletDZ") << "HLTDoubletDZ: Electron Handle not valid.";
338 
339  if (reco::deltaR(*r1, *r2) < minDR_)
340  return false;
341  reco::Electron e1;
342  for (auto const& eleIt : *electronHandle_) {
343  if (eleIt.superCluster() == r1->superCluster())
344  e1 = eleIt;
345  }
346 
347  const reco::RecoChargedCandidate& candidate2(*r2);
348  bool skipDZ = false;
349  if (minPixHitsForDZ_ > 0 && (e1.gsfTrack()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_ ||
350  candidate2.track()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_))
351  skipDZ = true;
352  if (!skipDZ && std::abs(e1.vz() - candidate2.vz()) > maxDZ_)
353  return false;
354 
355  return true;
356 }
357 
358 template <>
360  T1Ref& r1,
361  T2Ref& r2) const {
363  iEvent.getByToken(electronToken_, electronHandle_);
364  if (!electronHandle_.isValid())
365  edm::LogError("HLTDoubletDZ") << "HLTDoubletDZ: Electron Handle not valid.";
366 
367  if (reco::deltaR(*r1, *r2) < minDR_)
368  return false;
369  reco::Electron e2;
370  for (auto const& eleIt : *electronHandle_) {
371  if (eleIt.superCluster() == r2->superCluster())
372  e2 = eleIt;
373  }
374 
375  const reco::RecoChargedCandidate& candidate1(*r1);
376  bool skipDZ = false;
377  if (minPixHitsForDZ_ > 0 && (candidate1.track()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_ ||
378  e2.gsfTrack()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_))
379  skipDZ = true;
380  if (!skipDZ && std::abs(e2.vz() - candidate1.vz()) > maxDZ_)
381  return false;
382 
383  return true;
384 }
385 
386 template <>
388  T1Ref& r1,
389  T2Ref& r2) const {
391  iEvent.getByToken(electronToken_, electronHandle_);
392  if (!electronHandle_.isValid())
393  edm::LogError("HLTDoubletDZ") << "HLTDoubletDZ: Electron Handle not valid.";
394 
395  if (reco::deltaR(*r1, *r2) < minDR_)
396  return false;
397  reco::Electron e1, e2;
398  for (auto const& eleIt : *electronHandle_) {
399  if (eleIt.superCluster() == r2->superCluster())
400  e2 = eleIt;
401  if (eleIt.superCluster() == r1->superCluster())
402  e1 = eleIt;
403  }
404 
405  bool skipDZ = false;
406  if (minPixHitsForDZ_ > 0 && (e1.gsfTrack()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_ ||
407  e2.gsfTrack()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_))
408  skipDZ = true;
409  if (!skipDZ && std::abs(e2.vz() - e1.vz()) > maxDZ_)
410  return false;
411 
412  return true;
413 }
414 
415 template <>
417  T1Ref& r1,
418  T2Ref& r2) const {
419  const reco::RecoChargedCandidate& candidate1(*r1);
420  const reco::RecoChargedCandidate& candidate2(*r2);
421  if (reco::deltaR(candidate1, candidate2) < minDR_)
422  return false;
423  bool skipDZ = false;
424  if (minPixHitsForDZ_ > 0 && (candidate1.track()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_ ||
425  candidate2.track()->hitPattern().numberOfValidPixelHits() < minPixHitsForDZ_))
426  skipDZ = true;
427  if (!skipDZ && std::abs(candidate1.vz() - candidate2.vz()) > maxDZ_)
428  return false;
429 
430  return true;
431 }
432 
433 template <>
436  l1t::TkMuonRef& r2) const {
437  const l1t::TkMuon& candidate1(*r1);
438  const l1t::TkMuon& candidate2(*r2);
439  if (reco::deltaR(candidate1, candidate2) < minDR_)
440  return false;
441 
442  // We don't care about minPixHitsForDZ_ with the L1TkMuons,
443  // especially because the pixel does not participate in the L1T
444  if (std::abs(candidate1.trkzVtx() - candidate2.trkzVtx()) > maxDZ_)
445  return false;
446 
447  return true;
448 }
449 
450 template <>
453  l1t::HPSPFTauRef& r2) const {
454  const l1t::HPSPFTau& candidate1(*r1);
455  const l1t::HPSPFTau& candidate2(*r2);
456  if (reco::deltaR(candidate1, candidate2) < minDR_)
457  return false;
458 
459  // We don't care about minPixHitsForDZ_ with the L1HPSPFTaus,
460  // especially because the pixel does not participate in the L1T
461  if (std::abs(candidate1.leadChargedPFCand()->pfTrack()->vertex().z() -
462  candidate2.leadChargedPFCand()->pfTrack()->vertex().z()) > maxDZ_)
463  return false;
464 
465  return true;
466 }
467 
468 // ------------ method called to produce the data ------------
469 template <typename T1, typename T2>
471  const edm::EventSetup& iSetup,
472  trigger::TriggerFilterObjectWithRefs& filterproduct) const {
473  // All HLT filters must create and fill an HLT filter object,
474  // recording any reconstructed physics objects satisfying (or not)
475  // this HLT filter, and place it in the Event.
476  bool accept(false);
477 
478  std::vector<T1Ref> coll1;
479  std::vector<T2Ref> coll2;
480 
481  if (getCollections(iEvent, coll1, coll2, filterproduct)) {
482  int n(0);
483  T1Ref r1;
484  T2Ref r2;
485 
486  for (unsigned int i1 = 0; i1 != coll1.size(); i1++) {
487  r1 = coll1[i1];
488  //const reco::Candidate& candidate1(*r1);
489  unsigned int I(0);
490  if (same_) {
491  I = i1 + 1;
492  }
493  for (unsigned int i2 = I; i2 != coll2.size(); i2++) {
494  r2 = coll2[i2];
495  if (checkSC_) {
496  if (r1->superCluster().isNonnull() && r2->superCluster().isNonnull()) {
497  if (r1->superCluster() == r2->superCluster())
498  continue;
499  }
500  }
501 
502  if (!computeDZ(iEvent, r1, r2))
503  continue;
504 
505  n++;
506  filterproduct.addObject(triggerType1_, r1);
507  filterproduct.addObject(triggerType2_, r2);
508  }
509  }
510 
511  accept = accept || (n >= min_N_);
512  }
513 
514  return accept;
515 }
516 
520 template <>
522  const edm::EventSetup& iSetup,
523  trigger::TriggerFilterObjectWithRefs& filterproduct) const {
524  // All HLT filters must create and fill an HLT filter object,
525  // recording any reconstructed physics objects satisfying (or not)
526  // this HLT filter, and place it in the Event.
527  bool accept(false);
528 
529  std::vector<l1t::TkMuonRef> coll1;
530  std::vector<l1t::TkMuonRef> coll2;
531 
532  if (getCollections(iEvent, coll1, coll2, filterproduct)) {
533  int n(0);
536 
537  for (unsigned int i1 = 0; i1 != coll1.size(); i1++) {
538  r1 = coll1[i1];
539  unsigned int I(0);
540  if (same_) {
541  I = i1 + 1;
542  }
543  for (unsigned int i2 = I; i2 != coll2.size(); i2++) {
544  r2 = coll2[i2];
545 
546  if (!computeDZ(iEvent, r1, r2))
547  continue;
548 
549  n++;
550  filterproduct.addObject(triggerType1_, r1);
551  filterproduct.addObject(triggerType2_, r2);
552  }
553  }
554 
555  accept = accept || (n >= min_N_);
556  }
557 
558  return accept;
559 }
560 
564 template <>
566  const edm::EventSetup& iSetup,
567  trigger::TriggerFilterObjectWithRefs& filterproduct) const {
568  // All HLT filters must create and fill an HLT filter object,
569  // recording any reconstructed physics objects satisfying (or not)
570  // this HLT filter, and place it in the Event.
571  bool accept(false);
572 
573  std::vector<l1t::PFTauRef> coll1;
574  std::vector<l1t::PFTauRef> coll2;
575 
576  if (getCollections(iEvent, coll1, coll2, filterproduct)) {
577  int n(0);
580 
581  for (unsigned int i1 = 0; i1 != coll1.size(); i1++) {
582  r1 = coll1[i1];
583  unsigned int I(0);
584  if (same_) {
585  I = i1 + 1;
586  }
587  for (unsigned int i2 = I; i2 != coll2.size(); i2++) {
588  r2 = coll2[i2];
589 
590  if (!computeDZ(iEvent, r1, r2))
591  continue;
592 
593  n++;
594  filterproduct.addObject(triggerType1_, r1);
595  filterproduct.addObject(triggerType2_, r2);
596  }
597  }
598 
599  accept = accept || (n >= min_N_);
600  }
601 
602  return accept;
603 }
604 
608 template <>
610  const edm::EventSetup& iSetup,
611  trigger::TriggerFilterObjectWithRefs& filterproduct) const {
612  // All HLT filters must create and fill an HLT filter object,
613  // recording any reconstructed physics objects satisfying (or not)
614  // this HLT filter, and place it in the Event.
615  bool accept(false);
616 
617  std::vector<l1t::HPSPFTauRef> coll1;
618  std::vector<l1t::HPSPFTauRef> coll2;
619 
620  if (getCollections(iEvent, coll1, coll2, filterproduct)) {
621  int n(0);
624 
625  for (unsigned int i1 = 0; i1 != coll1.size(); i1++) {
626  r1 = coll1[i1];
627  unsigned int I(0);
628  if (same_) {
629  I = i1 + 1;
630  }
631  for (unsigned int i2 = I; i2 != coll2.size(); i2++) {
632  r2 = coll2[i2];
633 
634  if (!computeDZ(iEvent, r1, r2))
635  continue;
636 
637  n++;
638  filterproduct.addObject(triggerType1_, r1);
639  filterproduct.addObject(triggerType2_, r2);
640  }
641  }
642 
643  accept = accept || (n >= min_N_);
644  }
645 
646  return accept;
647 }
648 
658 
HLTDoubletDZ< l1t::TkMuon, l1t::TkMuon > HLT2L1TkMuonL1TkMuonDZ
HLTDoubletDZ(const edm::ParameterSet &)
Definition: HLTDoubletDZ.cc:34
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const l1t::PFCandidateRef & leadChargedPFCand() const
Definition: HPSPFTau.h:28
double vz() const override
z coordinate of vertex position
static PFTauRenderPlugin instance
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
~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
std::string encode() const
Definition: InputTag.cc:159
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&lt;C&gt;)
char const * label
int iEvent
Definition: GenABIO.cc:224
bool computeDZ(edm::Event &iEvent, T1Ref &c1, T2Ref &c2) const
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
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:70
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
HLTDoubletDZ< reco::Electron, reco::RecoChargedCandidate > HLT2ElectronMuonDZ
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLTDoubletDZ< reco::RecoChargedCandidate, reco::RecoEcalCandidate > HLT2MuonPhotonDZ
HLTDoubletDZ< reco::Electron, reco::Electron > HLT2ElectronElectronDZ
HLTDoubletDZ< l1t::HPSPFTau, l1t::HPSPFTau > HLT2L1HPSPFTauL1HPSPFTauDZ
virtual double vz() const =0
z coordinate of vertex position
tuple process
Definition: LaserDQM_cfg.py:3
StableProvenance const & getStableProvenance(BranchID const &theID) const
Definition: Event.cc:124
float trkzVtx() const
Definition: TkMuon.h:42
HLTDoubletDZ< reco::RecoEcalCandidate, reco::RecoEcalCandidate > HLT2PhotonPhotonDZ
HLTDoubletDZ< reco::RecoEcalCandidate, reco::RecoChargedCandidate > HLT2PhotonMuonDZ
def template
Definition: svgfig.py:521