CMS 3D CMS Logo

TriggerSummaryProducerAOD.cc
Go to the documentation of this file.
1 
10 #include <ostream>
11 #include <algorithm>
12 #include <memory>
13 #include <typeinfo>
14 
17 
24 
37 
43 
49 
58 
61 
64 
65 #include "boost/algorithm/string.hpp"
66 
67 namespace {
68  std::vector<std::regex> convertToRegex(std::vector<std::string> const& iPatterns) {
69  std::vector<std::regex> result;
70 
71  for (auto const& pattern : iPatterns) {
72  auto regexPattern = pattern;
73  boost::replace_all(regexPattern, "*", ".*");
74  boost::replace_all(regexPattern, "?", ".");
75 
76  result.emplace_back(regexPattern);
77  }
78  return result;
79  }
80 } // namespace
81 
82 //
83 // constructors and destructor
84 //
86  : throw_(ps.getParameter<bool>("throw")),
87  pn_(ps.getParameter<std::string>("processName")),
88  moduleLabelPatternsToMatch_(
89  convertToRegex(ps.getParameter<std::vector<std::string>>("moduleLabelPatternsToMatch"))),
90  moduleLabelPatternsToSkip_(
91  convertToRegex(ps.getParameter<std::vector<std::string>>("moduleLabelPatternsToSkip"))) {
92  if (pn_ == "@") {
94  if (tns.isAvailable()) {
95  pn_ = tns->getProcessName();
96  } else {
97  edm::LogError("TriggerSummaryProducerAOD") << "HLT Error: TriggerNamesService not available!";
98  pn_ = "*";
99  }
100  }
101  LogDebug("TriggerSummaryProducerAOD") << "Using process name: '" << pn_ << "'";
102 
103  produces<trigger::TriggerEvent>();
104 
105  auto const* pProcessName = &pn_;
108  auto productMatch = [pProcessName, &moduleLabelPatternsToSkip, &moduleLabelPatternsToMatch](
109  edm::BranchDescription const& iBranch) -> bool {
110  if (iBranch.processName() == *pProcessName || *pProcessName == "*") {
111  auto const& label = iBranch.moduleLabel();
112  for (auto& match : moduleLabelPatternsToMatch) {
113  if (std::regex_match(label, match)) {
114  //make sure this is not in the reject list
115  for (auto& reject : moduleLabelPatternsToSkip) {
116  if (std::regex_match(label, reject)) {
117  return false;
118  }
119  }
120  return true;
121  }
122  }
123  }
124  return false;
125  };
126 
147 
155 
159 
190  });
191 }
192 
194 
195 //
196 // member functions
197 //
198 
199 namespace {
200  inline void tokenizeTag(const std::string& tag, std::string& label, std::string& instance, std::string& process) {
201  using std::string;
202 
203  const char token(':');
204  const string empty;
205 
206  label = tag;
207  const string::size_type i1(label.find(token));
208  if (i1 == string::npos) {
209  instance = empty;
210  process = empty;
211  } else {
212  instance = label.substr(i1 + 1);
213  label.resize(i1);
214  const string::size_type i2(instance.find(token));
215  if (i2 == string::npos) {
216  process = empty;
217  } else {
218  process = instance.substr(i2 + 1);
219  instance.resize(i2);
220  }
221  }
222  }
223 } // namespace
224 
227  desc.add<bool>("throw", false)->setComment("Throw exception or LogError");
228  desc.add<std::string>("processName", "@")
229  ->setComment(
230  "Process name to use when getting data. The value of '@' is used to denote the current process name.");
231  desc.add<std::vector<std::string>>("moduleLabelPatternsToMatch", std::vector<std::string>(1, "hlt*"))
232  ->setComment("glob patterns for module labels to get data.");
233  desc.add<std::vector<std::string>>("moduleLabelPatternsToSkip", std::vector<std::string>())
234  ->setComment("module labels for data products which should not be gotten.");
235  descriptions.add("triggerSummaryProducerAOD", desc);
236 }
237 
238 // ------------ method called to produce the data ------------
240  using namespace std;
241  using namespace edm;
242  using namespace reco;
243  using namespace l1extra;
244  using namespace trigger;
245  using namespace l1t;
246 
247  std::vector<edm::Handle<trigger::TriggerFilterObjectWithRefs>> fobs;
249 
250  const unsigned int nfob(fobs.size());
251  LogTrace("TriggerSummaryProducerAOD") << "Number of filter objects found: " << nfob;
252 
253  string tagLabel, tagInstance, tagProcess;
254 
260  std::vector<bool> maskFilters;
261  maskFilters.resize(nfob);
262  InputTagSet filterTagsEvent(pn_ != "*");
263  InputTagSet collectionTagsEvent(pn_ != "*");
264 
265  unsigned int nf(0);
266  for (unsigned int ifob = 0; ifob != nfob; ++ifob) {
267  maskFilters[ifob] = false;
268  const vector<string>& collectionTags_(fobs[ifob]->getCollectionTagsAsStrings());
269  const unsigned int ncol(collectionTags_.size());
270  if (ncol > 0) {
271  nf++;
272  maskFilters[ifob] = true;
273  const string& label(fobs[ifob].provenance()->moduleLabel());
274  const string& instance(fobs[ifob].provenance()->productInstanceName());
275  const string& process(fobs[ifob].provenance()->processName());
276  filterTagsEvent.insert(InputTag(label, instance, process));
277  for (unsigned int icol = 0; icol != ncol; ++icol) {
278  // overwrite process name (usually not set)
279  tokenizeTag(collectionTags_[icol], tagLabel, tagInstance, tagProcess);
280  collectionTagsEvent.insert(InputTag(tagLabel, tagInstance, pn_));
281  }
282  }
283  }
285  if (filterTagsEvent.size() != nf) {
286  LogError("TriggerSummaryProducerAOD")
287  << "Mismatch in number of filter tags: " << filterTagsEvent.size() << "!=" << nf;
288  }
289 
291  collectionTagsGlobal_.insert(collectionTagsEvent.begin(), collectionTagsEvent.end());
292  filterTagsGlobal_.insert(filterTagsEvent.begin(), filterTagsEvent.end());
293 
295  if (isDebugEnabled()) {
297  const unsigned int nc(collectionTagsEvent.size());
298  LogTrace("TriggerSummaryProducerAOD") << "Number of unique collections requested " << nc;
299  const InputTagSet::const_iterator cb(collectionTagsEvent.begin());
300  const InputTagSet::const_iterator ce(collectionTagsEvent.end());
301  for (InputTagSet::const_iterator ci = cb; ci != ce; ++ci) {
302  LogTrace("TriggerSummaryProducerAOD") << distance(cb, ci) << " " << ci->encode();
303  }
304  const unsigned int nf(filterTagsEvent.size());
305  LogTrace("TriggerSummaryProducerAOD") << "Number of unique filters requested " << nf;
306  const InputTagSet::const_iterator fb(filterTagsEvent.begin());
307  const InputTagSet::const_iterator fe(filterTagsEvent.end());
308  for (InputTagSet::const_iterator fi = fb; fi != fe; ++fi) {
309  LogTrace("TriggerSummaryProducerAOD") << distance(fb, fi) << " " << fi->encode();
310  }
311  }
312 
319  //toc_.clear();
320  std::vector<std::string> tags;
322  std::map<edm::ProductID, unsigned int> offset;
323 
324  fillTriggerObjectCollections<RecoEcalCandidateCollection>(
325  toc, offset, tags, keys, iEvent, getRecoEcalCandidateCollection_, collectionTagsEvent);
326  fillTriggerObjectCollections<ElectronCollection>(
327  toc, offset, tags, keys, iEvent, getElectronCollection_, collectionTagsEvent);
328  fillTriggerObjectCollections<RecoChargedCandidateCollection>(
329  toc, offset, tags, keys, iEvent, getRecoChargedCandidateCollection_, collectionTagsEvent);
330  fillTriggerObjectCollections<CaloJetCollection>(
331  toc, offset, tags, keys, iEvent, getCaloJetCollection_, collectionTagsEvent);
332  fillTriggerObjectCollections<CompositeCandidateCollection>(
333  toc, offset, tags, keys, iEvent, getCompositeCandidateCollection_, collectionTagsEvent);
334  fillTriggerObjectCollections<METCollection>(toc, offset, tags, keys, iEvent, getMETCollection_, collectionTagsEvent);
335  fillTriggerObjectCollections<CaloMETCollection>(
336  toc, offset, tags, keys, iEvent, getCaloMETCollection_, collectionTagsEvent);
337  fillTriggerObjectCollections<IsolatedPixelTrackCandidateCollection>(
338  toc, offset, tags, keys, iEvent, getIsolatedPixelTrackCandidateCollection_, collectionTagsEvent);
340  fillTriggerObjectCollections<L1EmParticleCollection>(
341  toc, offset, tags, keys, iEvent, getL1EmParticleCollection_, collectionTagsEvent);
342  fillTriggerObjectCollections<L1MuonParticleCollection>(
343  toc, offset, tags, keys, iEvent, getL1MuonParticleCollection_, collectionTagsEvent);
344  fillTriggerObjectCollections<L1JetParticleCollection>(
345  toc, offset, tags, keys, iEvent, getL1JetParticleCollection_, collectionTagsEvent);
346  fillTriggerObjectCollections<L1EtMissParticleCollection>(
347  toc, offset, tags, keys, iEvent, getL1EtMissParticleCollection_, collectionTagsEvent);
348  fillTriggerObjectCollections<L1HFRingsCollection>(
349  toc, offset, tags, keys, iEvent, getL1HFRingsCollection_, collectionTagsEvent);
350  fillTriggerObjectCollections<MuonBxCollection>(
351  toc, offset, tags, keys, iEvent, getL1TMuonParticleCollection_, collectionTagsEvent);
352  fillTriggerObjectCollections<EGammaBxCollection>(
353  toc, offset, tags, keys, iEvent, getL1TEGammaParticleCollection_, collectionTagsEvent);
354  fillTriggerObjectCollections<JetBxCollection>(
355  toc, offset, tags, keys, iEvent, getL1TJetParticleCollection_, collectionTagsEvent);
356  fillTriggerObjectCollections<TauBxCollection>(
357  toc, offset, tags, keys, iEvent, getL1TTauParticleCollection_, collectionTagsEvent);
358  fillTriggerObjectCollections<EtSumBxCollection>(
359  toc, offset, tags, keys, iEvent, getL1TEtSumParticleCollection_, collectionTagsEvent);
361  fillTriggerObjectCollections<l1t::TkMuonCollection>(
362  toc, offset, tags, keys, iEvent, getL1TTkMuonCollection_, collectionTagsEvent);
363  fillTriggerObjectCollections<l1t::TkElectronCollection>(
364  toc, offset, tags, keys, iEvent, getL1TTkElectronCollection_, collectionTagsEvent);
365  fillTriggerObjectCollections<l1t::TkEmCollection>(
366  toc, offset, tags, keys, iEvent, getL1TTkEmCollection_, collectionTagsEvent);
367  fillTriggerObjectCollections<l1t::PFJetCollection>(
368  toc, offset, tags, keys, iEvent, getL1TPFJetCollection_, collectionTagsEvent);
369  fillTriggerObjectCollections<l1t::PFTauCollection>(
370  toc, offset, tags, keys, iEvent, getL1TPFTauCollection_, collectionTagsEvent);
371  fillTriggerObjectCollections<l1t::HPSPFTauCollection>(
372  toc, offset, tags, keys, iEvent, getL1THPSPFTauCollection_, collectionTagsEvent);
373  fillTriggerObjectCollections<l1t::PFTrackCollection>(
374  toc, offset, tags, keys, iEvent, getL1TPFTrackCollection_, collectionTagsEvent);
376  fillTriggerObjectCollections<reco::PFJetCollection>(
377  toc, offset, tags, keys, iEvent, getPFJetCollection_, collectionTagsEvent);
378  fillTriggerObjectCollections<reco::PFTauCollection>(
379  toc, offset, tags, keys, iEvent, getPFTauCollection_, collectionTagsEvent);
380  fillTriggerObjectCollections<reco::PFMETCollection>(
381  toc, offset, tags, keys, iEvent, getPFMETCollection_, collectionTagsEvent);
383  const unsigned int nk(tags.size());
384  LogDebug("TriggerSummaryProducerAOD") << "Number of collections found: " << nk;
385  const unsigned int no(toc.size());
386  LogDebug("TriggerSummaryProducerAOD") << "Number of physics objects found: " << no;
387 
390  unique_ptr<TriggerEvent> product(new TriggerEvent(pn_, nk, no, nf));
391 
393  product->addCollections(tags, keys);
394  product->addObjects(toc);
395 
397  trigger::Vids ids;
398  for (unsigned int ifob = 0; ifob != nfob; ++ifob) {
399  if (maskFilters[ifob]) {
400  const string& label(fobs[ifob].provenance()->moduleLabel());
401  const string& instance(fobs[ifob].provenance()->productInstanceName());
402  const string& process(fobs[ifob].provenance()->processName());
403  const edm::InputTag filterTag(label, instance, process);
404  ids.clear();
405  keys.clear();
406  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->photonIds(), fobs[ifob]->photonRefs(), offset, keys, ids);
408  iEvent, filterTag, fobs[ifob]->electronIds(), fobs[ifob]->electronRefs(), offset, keys, ids);
409  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->muonIds(), fobs[ifob]->muonRefs(), offset, keys, ids);
410  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->jetIds(), fobs[ifob]->jetRefs(), offset, keys, ids);
412  iEvent, filterTag, fobs[ifob]->compositeIds(), fobs[ifob]->compositeRefs(), offset, keys, ids);
414  iEvent, filterTag, fobs[ifob]->basemetIds(), fobs[ifob]->basemetRefs(), offset, keys, ids);
416  iEvent, filterTag, fobs[ifob]->calometIds(), fobs[ifob]->calometRefs(), offset, keys, ids);
418  iEvent, filterTag, fobs[ifob]->pixtrackIds(), fobs[ifob]->pixtrackRefs(), offset, keys, ids);
419  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->l1emIds(), fobs[ifob]->l1emRefs(), offset, keys, ids);
420  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->l1muonIds(), fobs[ifob]->l1muonRefs(), offset, keys, ids);
421  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->l1jetIds(), fobs[ifob]->l1jetRefs(), offset, keys, ids);
423  iEvent, filterTag, fobs[ifob]->l1etmissIds(), fobs[ifob]->l1etmissRefs(), offset, keys, ids);
425  iEvent, filterTag, fobs[ifob]->l1hfringsIds(), fobs[ifob]->l1hfringsRefs(), offset, keys, ids);
427  iEvent, filterTag, fobs[ifob]->l1tmuonIds(), fobs[ifob]->l1tmuonRefs(), offset, keys, ids);
429  iEvent, filterTag, fobs[ifob]->l1tegammaIds(), fobs[ifob]->l1tegammaRefs(), offset, keys, ids);
430  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->l1tjetIds(), fobs[ifob]->l1tjetRefs(), offset, keys, ids);
431  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->l1ttauIds(), fobs[ifob]->l1ttauRefs(), offset, keys, ids);
433  iEvent, filterTag, fobs[ifob]->l1tetsumIds(), fobs[ifob]->l1tetsumRefs(), offset, keys, ids);
434 
436  iEvent, filterTag, fobs[ifob]->l1ttkmuonIds(), fobs[ifob]->l1ttkmuonRefs(), offset, keys, ids);
438  iEvent, filterTag, fobs[ifob]->l1ttkeleIds(), fobs[ifob]->l1ttkeleRefs(), offset, keys, ids);
440  iEvent, filterTag, fobs[ifob]->l1ttkemIds(), fobs[ifob]->l1ttkemRefs(), offset, keys, ids);
442  iEvent, filterTag, fobs[ifob]->l1tpfjetIds(), fobs[ifob]->l1tpfjetRefs(), offset, keys, ids);
444  iEvent, filterTag, fobs[ifob]->l1tpftauIds(), fobs[ifob]->l1tpftauRefs(), offset, keys, ids);
446  iEvent, filterTag, fobs[ifob]->l1thpspftauIds(), fobs[ifob]->l1thpspftauRefs(), offset, keys, ids);
448  iEvent, filterTag, fobs[ifob]->l1tpftrackIds(), fobs[ifob]->l1tpftrackRefs(), offset, keys, ids);
449 
450  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->pfjetIds(), fobs[ifob]->pfjetRefs(), offset, keys, ids);
451  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->pftauIds(), fobs[ifob]->pftauRefs(), offset, keys, ids);
452  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->pfmetIds(), fobs[ifob]->pfmetRefs(), offset, keys, ids);
453  product->addFilter(filterTag, ids, keys);
454  }
455  }
456 
457  OrphanHandle<TriggerEvent> ref = iEvent.put(std::move(product));
458  LogTrace("TriggerSummaryProducerAOD") << "Number of physics objects packed: " << ref->sizeObjects();
459  LogTrace("TriggerSummaryProducerAOD") << "Number of filter objects packed: " << ref->sizeFilters();
460 }
461 
462 template <typename C>
465  std::vector<std::string>& tags,
467  const edm::Event& iEvent,
468  const edm::GetterOfProducts<C>& getter,
469  const InputTagSet& collectionTagsEvent) const {
473 
474  using namespace std;
475  using namespace edm;
476  using namespace reco;
477  using namespace l1extra;
478  using namespace trigger;
479  using namespace l1t;
480 
481  vector<Handle<C>> collections;
482  getter.fillHandles(iEvent, collections);
483  const unsigned int nc(collections.size());
484 
485  for (unsigned int ic = 0; ic != nc; ++ic) {
486  const Provenance& provenance(*(collections[ic].provenance()));
487  const string& label(provenance.moduleLabel());
488  const string& instance(provenance.productInstanceName());
489  const string& process(provenance.processName());
490  const InputTag collectionTag(label, instance, process);
491 
492  if (collectionTagsEvent.find(collectionTag) != collectionTagsEvent.end()) {
493  const ProductID pid(collections[ic].provenance()->productID());
494  if (offset.find(pid) != offset.end()) {
495  LogError("TriggerSummaryProducerAOD") << "Duplicate pid: " << pid;
496  }
497  offset[pid] = toc.size();
498  const unsigned int n(collections[ic]->size());
499  for (unsigned int i = 0; i != n; ++i) {
500  fillTriggerObject(toc, (*collections[ic])[i]);
501  }
502  tags.push_back(collectionTag.encode());
503  keys.push_back(toc.size());
504  }
505 
506  }
507 }
508 
509 template <typename T>
511  using namespace trigger;
512  toc.emplace_back(object);
513 
514  return;
515 }
516 
518  const l1extra::L1HFRings& object) const {
519  using namespace l1extra;
520  using namespace trigger;
521 
522  toc.emplace_back(TriggerL1HfRingEtSums,
523  object.hfEtSum(L1HFRings::kRing1PosEta),
524  object.hfEtSum(L1HFRings::kRing1NegEta),
525  object.hfEtSum(L1HFRings::kRing2PosEta),
526  object.hfEtSum(L1HFRings::kRing2NegEta));
527  toc.emplace_back(TriggerL1HfBitCounts,
528  object.hfBitCount(L1HFRings::kRing1PosEta),
529  object.hfBitCount(L1HFRings::kRing1NegEta),
530  object.hfBitCount(L1HFRings::kRing2PosEta),
531  object.hfBitCount(L1HFRings::kRing2NegEta));
532 
533  return;
534 }
535 
537  const l1extra::L1EtMissParticle& object) const {
538  using namespace l1extra;
539  using namespace trigger;
540 
541  toc.emplace_back(object);
542  if (object.type() == L1EtMissParticle::kMET) {
543  toc.emplace_back(TriggerL1ETT, object.etTotal(), 0.0, 0.0, 0.0);
544  } else if (object.type() == L1EtMissParticle::kMHT) {
545  toc.emplace_back(TriggerL1HTT, object.etTotal(), 0.0, 0.0, 0.0);
546  } else {
547  toc.emplace_back(0, object.etTotal(), 0.0, 0.0, 0.0);
548  }
549 
550  return;
551 }
552 
554  const reco::PFMET& object) const {
555  using namespace reco;
556  using namespace trigger;
557 
558  toc.emplace_back(object);
559  toc.emplace_back(TriggerTET, object.sumEt(), 0.0, 0.0, 0.0);
560  toc.emplace_back(TriggerMETSig, object.mEtSig(), 0.0, 0.0, 0.0);
561  toc.emplace_back(TriggerELongit, object.e_longitudinal(), 0.0, 0.0, 0.0);
562 
563  return;
564 }
565 
567  const reco::CaloMET& object) const {
568  using namespace reco;
569  using namespace trigger;
570 
571  toc.emplace_back(object);
572  toc.emplace_back(TriggerTET, object.sumEt(), 0.0, 0.0, 0.0);
573  toc.emplace_back(TriggerMETSig, object.mEtSig(), 0.0, 0.0, 0.0);
574  toc.emplace_back(TriggerELongit, object.e_longitudinal(), 0.0, 0.0, 0.0);
575 
576  return;
577 }
578 
580  const reco::MET& object) const {
581  using namespace reco;
582  using namespace trigger;
583 
584  toc.emplace_back(object);
585  toc.emplace_back(TriggerTHT, object.sumEt(), 0.0, 0.0, 0.0);
586  toc.emplace_back(TriggerMHTSig, object.mEtSig(), 0.0, 0.0, 0.0);
587  toc.emplace_back(TriggerHLongit, object.e_longitudinal(), 0.0, 0.0, 0.0);
588 
589  return;
590 }
591 
592 template <typename C>
594  const edm::InputTag& tag,
595  const trigger::Vids& ids,
596  const std::vector<edm::Ref<C>>& refs,
597  const ProductIDtoIndex& offset,
599  trigger::Vids& oIDs) const {
603 
604  using namespace std;
605  using namespace edm;
606  using namespace reco;
607  using namespace l1extra;
608  using namespace trigger;
609 
610  if (ids.size() != refs.size()) {
611  LogError("TriggerSummaryProducerAOD") << "Vector length is different: " << ids.size() << " " << refs.size();
612  }
613 
614  const unsigned int n(min(ids.size(), refs.size()));
615  for (unsigned int i = 0; i != n; ++i) {
616  const ProductID pid(refs[i].id());
617  if (!(pid.isValid())) {
618  std::ostringstream ost;
619  ost << "Iinvalid pid: " << pid << " FilterTag / Key: " << tag.encode() << " / " << i << "of" << n
620  << " CollectionTag / Key: "
621  << " <Unrecoverable>"
622  << " / " << refs[i].key() << " CollectionType: " << typeid(C).name();
623  if (throw_) {
624  throw cms::Exception("TriggerSummaryProducerAOD") << ost.str();
625  } else {
626  LogError("TriggerSummaryProducerAOD") << ost.str();
627  }
628  } else {
629  auto itOffset = offset.find(pid);
630  if (itOffset == offset.end()) {
631  const string& label(iEvent.getProvenance(pid).moduleLabel());
632  const string& instance(iEvent.getProvenance(pid).productInstanceName());
633  const string& process(iEvent.getProvenance(pid).processName());
634  std::ostringstream ost;
635  ost << "Uunknown pid: " << pid << " FilterTag / Key: " << tag.encode() << " / " << i << "of" << n
636  << " CollectionTag / Key: " << InputTag(label, instance, process).encode() << " / " << refs[i].key()
637  << " CollectionType: " << typeid(C).name();
638  if (throw_) {
639  throw cms::Exception("TriggerSummaryProducerAOD") << ost.str();
640  } else {
641  LogError("TriggerSummaryProducerAOD") << ost.str();
642  }
643  } else {
644  fillFilterObjectMember(keys, oIDs, itOffset->second, ids[i], refs[i]);
645  }
646  }
647  }
648  return;
649 }
650 
651 template <typename C>
653  trigger::Keys& keys, trigger::Vids& ids, const int& offset, const int& id, const edm::Ref<C>& ref) const {
654  keys.push_back(offset + ref.key());
655  ids.push_back(id);
656 
657  return;
658 }
659 
661  trigger::Vids& ids,
662  const int& offset,
663  const int& id,
664  const edm::Ref<l1extra::L1HFRingsCollection>& ref) const {
665  using namespace trigger;
666 
667  if (id == TriggerL1HfBitCounts) {
668  keys.push_back(offset + 2 * ref.key() + 1);
669  } else { // if (ids[i]==TriggerL1HfRingEtSums) {
670  keys.push_back(offset + 2 * ref.key() + 0);
671  }
672  ids.push_back(id);
673 
674  return;
675 }
676 
678  trigger::Vids& ids,
679  const int& offset,
680  const int& id,
682  using namespace trigger;
683 
684  if ((id == TriggerL1ETT) || (id == TriggerL1HTT)) {
685  keys.push_back(offset + 2 * ref.key() + 1);
686  } else {
687  keys.push_back(offset + 2 * ref.key() + 0);
688  }
689  ids.push_back(id);
690 
691  return;
692 }
693 
695  trigger::Vids& ids,
696  const int& offset,
697  const int& id,
698  const edm::Ref<reco::PFMETCollection>& ref) const {
699  using namespace trigger;
700 
701  if ((id == TriggerTHT) || (id == TriggerTET)) {
702  keys.push_back(offset + 4 * ref.key() + 1);
703  } else if ((id == TriggerMETSig) || (id == TriggerMHTSig)) {
704  keys.push_back(offset + 4 * ref.key() + 2);
705  } else if ((id == TriggerELongit) || (id == TriggerHLongit)) {
706  keys.push_back(offset + 4 * ref.key() + 3);
707  } else {
708  keys.push_back(offset + 4 * ref.key() + 0);
709  }
710  ids.push_back(id);
711 
712  return;
713 }
714 
716  trigger::Vids& ids,
717  const int& offset,
718  const int& id,
719  const edm::Ref<reco::CaloMETCollection>& ref) const {
720  using namespace trigger;
721 
722  if ((id == TriggerTHT) || (id == TriggerTET)) {
723  keys.push_back(offset + 4 * ref.key() + 1);
724  } else if ((id == TriggerMETSig) || (id == TriggerMHTSig)) {
725  keys.push_back(offset + 4 * ref.key() + 2);
726  } else if ((id == TriggerELongit) || (id == TriggerHLongit)) {
727  keys.push_back(offset + 4 * ref.key() + 3);
728  } else {
729  keys.push_back(offset + 4 * ref.key() + 0);
730  }
731  ids.push_back(id);
732 
733  return;
734 }
735 
737  trigger::Vids& ids,
738  const int& offset,
739  const int& id,
740  const edm::Ref<reco::METCollection>& ref) const {
741  using namespace trigger;
742 
743  if ((id == TriggerTHT) || (id == TriggerTET)) {
744  keys.push_back(offset + 4 * ref.key() + 1);
745  } else if ((id == TriggerMETSig) || (id == TriggerMHTSig)) {
746  keys.push_back(offset + 4 * ref.key() + 2);
747  } else if ((id == TriggerELongit) || (id == TriggerHLongit)) {
748  keys.push_back(offset + 4 * ref.key() + 3);
749  } else {
750  keys.push_back(offset + 4 * ref.key() + 0);
751  }
752  ids.push_back(id);
753 
754  return;
755 }
756 
758  using namespace std;
759  using namespace edm;
760  using namespace trigger;
761 
762  LogVerbatim("TriggerSummaryProducerAOD") << endl;
763  LogVerbatim("TriggerSummaryProducerAOD") << "TriggerSummaryProducerAOD::globalEndJob - accumulated tags:" << endl;
764 
765  InputTagSet filterTags(false);
767 
768  filterTags.insert(filterTagsGlobal_.begin(), filterTagsGlobal_.end());
770 
771  const unsigned int nc(collectionTags.size());
772  const unsigned int nf(filterTags.size());
773  LogVerbatim("TriggerSummaryProducerAOD") << " Overall number of Collections/Filters: " << nc << "/" << nf << endl;
774 
775  LogVerbatim("TriggerSummaryProducerAOD") << " The collections: " << nc << endl;
776  const InputTagSet::const_iterator cb(collectionTags.begin());
777  const InputTagSet::const_iterator ce(collectionTags.end());
778  for (InputTagSet::const_iterator ci = cb; ci != ce; ++ci) {
779  LogVerbatim("TriggerSummaryProducerAOD") << " " << distance(cb, ci) << " " << ci->encode() << endl;
780  }
781 
782  LogVerbatim("TriggerSummaryProducerAOD") << " The filters:" << nf << endl;
783  const InputTagSet::const_iterator fb(filterTags.begin());
784  const InputTagSet::const_iterator fe(filterTags.end());
785  for (InputTagSet::const_iterator fi = fb; fi != fe; ++fi) {
786  LogVerbatim("TriggerSummaryProducerAOD") << " " << distance(fb, fi) << " " << fi->encode() << endl;
787  }
788 
789  LogVerbatim("TriggerSummaryProducerAOD") << "TriggerSummaryProducerAOD::endJob." << endl;
790  LogVerbatim("TriggerSummaryProducerAOD") << endl;
791 
792  return;
793 }
ConfigurationDescriptions.h
edm::Provenance::moduleLabel
std::string const & moduleLabel() const
Definition: Provenance.h:55
edm::StreamID
Definition: StreamID.h:30
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
Handle.h
trigger::TriggerEvent::sizeFilters
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:146
CaloJet.h
electrons_cff.bool
bool
Definition: electrons_cff.py:372
mps_fire.i
i
Definition: mps_fire.py:355
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
CompositeCandidate.h
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
TriggerSummaryProducerAOD::InputTagSet
std::set< edm::InputTag, OrderInputTag > InputTagSet
Definition: TriggerSummaryProducerAOD.h:116
trigger::Vids
std::vector< int > Vids
Definition: TriggerTypeDefs.h:21
TriggerSummaryProducerAOD::getElectronCollection_
edm::GetterOfProducts< reco::ElectronCollection > getElectronCollection_
Definition: TriggerSummaryProducerAOD.h:192
TriggerSummaryProducerAOD::getL1TTkEmCollection_
edm::GetterOfProducts< l1t::TkEmCollection > getL1TTkEmCollection_
Definition: TriggerSummaryProducerAOD.h:214
TriggerSummaryProducerAOD::getRecoChargedCandidateCollection_
edm::GetterOfProducts< reco::RecoChargedCandidateCollection > getRecoChargedCandidateCollection_
Definition: TriggerSummaryProducerAOD.h:193
trigger::TriggerMHTSig
Definition: TriggerTypeDefs.h:91
PFTau.h
TriggerSummaryProducerAOD::collectionTagsGlobal_
tbb::concurrent_unordered_set< edm::InputTag, InputTagHash > collectionTagsGlobal_
list of L3 collection tags
Definition: TriggerSummaryProducerAOD.h:174
TriggerNamesService.h
min
T min(T a, T b)
Definition: MathUtil.h:58
TriggerEvent.h
TriggerSummaryProducerAOD::getCompositeCandidateCollection_
edm::GetterOfProducts< reco::CompositeCandidateCollection > getCompositeCandidateCollection_
Definition: TriggerSummaryProducerAOD.h:195
edm
HLT enums.
Definition: AlignableModifier.h:19
deep_tau::DeepTauBase::BasicDiscriminator
BasicDiscriminator
Definition: DeepTauBase.h:115
Muon.h
TriggerSummaryProducerAOD::fillFilterObjectMembers
void fillFilterObjectMembers(const edm::Event &, const edm::InputTag &tag, const trigger::Vids &, const std::vector< edm::Ref< C >> &, const ProductIDtoIndex &, trigger::Keys &keys, trigger::Vids &oIds) const
Definition: TriggerSummaryProducerAOD.cc:593
TriggerSummaryProducerAOD::pn_
std::string pn_
process name
Definition: TriggerSummaryProducerAOD.h:165
PFJet.h
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
edm::service::TriggerNamesService::getProcessName
std::string const & getProcessName() const
Definition: TriggerNamesService.h:107
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TriggerSummaryProducerAOD::moduleLabelPatternsToMatch_
std::vector< std::regex > moduleLabelPatternsToMatch_
module labels which should be avoided
Definition: TriggerSummaryProducerAOD.h:167
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
Jet.h
objects.METAnalyzer.sumEt
sumEt
Definition: METAnalyzer.py:97
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
L1HFRings.h
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
IsolatedPixelTrackCandidate.h
trigger::TriggerELongit
Definition: TriggerTypeDefs.h:90
trigger::TriggerTET
Definition: TriggerTypeDefs.h:84
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
TriggerSummaryProducerAOD::getL1THPSPFTauCollection_
edm::GetterOfProducts< l1t::HPSPFTauCollection > getL1THPSPFTauCollection_
Definition: TriggerSummaryProducerAOD.h:217
CaloMETFwd.h
l1extra::L1EtMissParticle
Definition: L1EtMissParticle.h:27
TriggerSummaryProducerAOD::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: TriggerSummaryProducerAOD.cc:239
edm::Ref
Definition: AssociativeIterator.h:58
TkMuon.h
TriggerSummaryProducerAOD::getL1TTkElectronCollection_
edm::GetterOfProducts< l1t::TkElectronCollection > getL1TTkElectronCollection_
Definition: TriggerSummaryProducerAOD.h:213
reco::CaloMET
Definition: CaloMET.h:21
trigger::TriggerTHT
Definition: TriggerTypeDefs.h:85
edm::ProducerBase::callWhenNewProductsRegistered
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: ProducerBase.h:79
TriggerSummaryProducerAOD::getL1TTauParticleCollection_
edm::GetterOfProducts< l1t::TauBxCollection > getL1TTauParticleCollection_
Definition: TriggerSummaryProducerAOD.h:210
reco::MET
Definition: MET.h:41
TriggerSummaryProducerAOD::getIsolatedPixelTrackCandidateCollection_
edm::GetterOfProducts< reco::IsolatedPixelTrackCandidateCollection > getIsolatedPixelTrackCandidateCollection_
Definition: TriggerSummaryProducerAOD.h:199
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
TriggerSummaryProducerAOD::getL1TPFTauCollection_
edm::GetterOfProducts< l1t::PFTauCollection > getL1TPFTauCollection_
Definition: TriggerSummaryProducerAOD.h:216
CaloMET.h
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
EGamma.h
edm::Provenance::processName
std::string const & processName() const
Definition: Provenance.h:57
Service.h
TriggerSummaryProducerAOD::getL1EtMissParticleCollection_
edm::GetterOfProducts< l1extra::L1EtMissParticleCollection > getL1EtMissParticleCollection_
Definition: TriggerSummaryProducerAOD.h:203
OrphanHandle.h
ProcessMatch.h
Provenance.h
TriggerSummaryProducerAOD::getCaloMETCollection_
edm::GetterOfProducts< reco::CaloMETCollection > getCaloMETCollection_
Definition: TriggerSummaryProducerAOD.h:197
TriggerSummaryProducerAOD::getL1EmParticleCollection_
edm::GetterOfProducts< l1extra::L1EmParticleCollection > getL1EmParticleCollection_
Definition: TriggerSummaryProducerAOD.h:200
TriggerSummaryProducerAOD::getL1TEtSumParticleCollection_
edm::GetterOfProducts< l1t::EtSumBxCollection > getL1TEtSumParticleCollection_
Definition: TriggerSummaryProducerAOD.h:211
HLT_2018_cff.moduleLabelPatternsToMatch
moduleLabelPatternsToMatch
Definition: HLT_2018_cff.py:88405
l1extra::L1HFRings
Definition: L1HFRings.h:31
TriggerSummaryProducerAOD::ProductIDtoIndex
std::map< edm::ProductID, unsigned int > ProductIDtoIndex
Definition: TriggerSummaryProducerAOD.h:115
HPSPFTauFwd.h
TriggerSummaryProducerAOD::throw_
const bool throw_
throw on error
Definition: TriggerSummaryProducerAOD.h:163
TriggerSummaryProducerAOD::getL1TJetParticleCollection_
edm::GetterOfProducts< l1t::JetBxCollection > getL1TJetParticleCollection_
Definition: TriggerSummaryProducerAOD.h:209
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::Provenance::productInstanceName
std::string const & productInstanceName() const
Definition: Provenance.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
oniaPATMuonsWithTrigger_cff.collections
collections
Definition: oniaPATMuonsWithTrigger_cff.py:37
TriggerSummaryProducerAOD::fillTriggerObjectCollections
void fillTriggerObjectCollections(trigger::TriggerObjectCollection &, ProductIDtoIndex &, std::vector< std::string > &, trigger::Keys &, const edm::Event &, const edm::GetterOfProducts< C > &, const InputTagSet &) const
Definition: TriggerSummaryProducerAOD.cc:463
TriggerSummaryProducerAOD::getTriggerFilterObjectWithRefs_
edm::GetterOfProducts< trigger::TriggerFilterObjectWithRefs > getTriggerFilterObjectWithRefs_
trigger object collection
Definition: TriggerSummaryProducerAOD.h:190
reco::PFMET
Definition: PFMET.h:18
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
trigger::TriggerMETSig
Definition: TriggerTypeDefs.h:89
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
trigger::TriggerL1HfBitCounts
Definition: TriggerTypeDefs.h:41
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
TriggerSummaryProducerAOD::getRecoEcalCandidateCollection_
edm::GetterOfProducts< reco::RecoEcalCandidateCollection > getRecoEcalCandidateCollection_
Definition: TriggerSummaryProducerAOD.h:191
l1t
delete x;
Definition: CaloConfig.h:22
TriggerSummaryProducerAOD::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TriggerSummaryProducerAOD.cc:225
TriggerSummaryProducerAOD::getL1TPFTrackCollection_
edm::GetterOfProducts< l1t::PFTrackCollection > getL1TPFTrackCollection_
Definition: TriggerSummaryProducerAOD.h:218
TriggerSummaryProducerAOD::TriggerSummaryProducerAOD
TriggerSummaryProducerAOD(const edm::ParameterSet &)
Definition: TriggerSummaryProducerAOD.cc:85
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
TriggerSummaryProducerAOD::getL1TPFJetCollection_
edm::GetterOfProducts< l1t::PFJetCollection > getL1TPFJetCollection_
Definition: TriggerSummaryProducerAOD.h:215
TriggerSummaryProducerAOD::getCaloJetCollection_
edm::GetterOfProducts< reco::CaloJetCollection > getCaloJetCollection_
Definition: TriggerSummaryProducerAOD.h:194
trigger::TriggerObjectCollection
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
TriggerSummaryProducerAOD::getL1MuonParticleCollection_
edm::GetterOfProducts< l1extra::L1MuonParticleCollection > getL1MuonParticleCollection_
Definition: TriggerSummaryProducerAOD.h:201
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
PFMET.h
TriggerSummaryProducerAOD::getL1TTkMuonCollection_
edm::GetterOfProducts< l1t::TkMuonCollection > getL1TTkMuonCollection_
Definition: TriggerSummaryProducerAOD.h:212
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
PFTrack.h
edm::GetterOfProducts< trigger::TriggerFilterObjectWithRefs >
trigger::Keys
std::vector< size_type > Keys
Definition: TriggerTypeDefs.h:19
edm::LogVerbatim
Definition: MessageLogger.h:297
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
EcalCalibMonitorTasks_cfi.collectionTags
collectionTags
Definition: EcalCalibMonitorTasks_cfi.py:21
TkEm.h
HLT_2018_cff.moduleLabelPatternsToSkip
moduleLabelPatternsToSkip
Definition: HLT_2018_cff.py:88402
edm::EventSetup
Definition: EventSetup.h:57
L1EmParticle.h
TriggerSummaryProducerAOD::fillTriggerObject
void fillTriggerObject(trigger::TriggerObjectCollection &, const T &) const
Definition: TriggerSummaryProducerAOD.cc:510
TriggerSummaryProducerAOD::getL1TEGammaParticleCollection_
edm::GetterOfProducts< l1t::EGammaBxCollection > getL1TEGammaParticleCollection_
Definition: TriggerSummaryProducerAOD.h:208
trigger::TriggerEvent::sizeObjects
trigger::size_type sizeObjects() const
Definition: TriggerEvent.h:145
edm::ProductID::isValid
bool isValid() const
Definition: ProductID.h:32
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
TriggerSummaryProducerAOD::getL1JetParticleCollection_
edm::GetterOfProducts< l1extra::L1JetParticleCollection > getL1JetParticleCollection_
Definition: TriggerSummaryProducerAOD.h:202
TkElectron.h
TriggerSummaryProducerAOD::moduleLabelPatternsToSkip_
std::vector< std::regex > moduleLabelPatternsToSkip_
Definition: TriggerSummaryProducerAOD.h:168
PFMETFwd.h
TriggerSummaryProducerAOD::filterTagsGlobal_
tbb::concurrent_unordered_set< edm::InputTag, InputTagHash > filterTagsGlobal_
list of L3 filter tags
Definition: TriggerSummaryProducerAOD.h:171
trigger::TriggerL1HfRingEtSums
Definition: TriggerTypeDefs.h:42
MET.h
TriggerSummaryProducerAOD::getPFMETCollection_
edm::GetterOfProducts< reco::PFMETCollection > getPFMETCollection_
Definition: TriggerSummaryProducerAOD.h:198
HPSPFTau.h
edm::GetterOfProducts::fillHandles
void fillHandles(edm::Event const &event, std::vector< edm::Handle< T >> &handles) const
Definition: GetterOfProducts.h:143
Electron.h
type
type
Definition: HCALResponse.h:21
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::OrphanHandle
Definition: EDProductfwd.h:39
RecoEcalCandidate.h
trigger::TriggerL1HTT
Definition: TriggerTypeDefs.h:38
L1MuonParticle.h
gen::C
C
Definition: PomwigHadronizer.cc:76
RecoChargedCandidate.h
T
long double T
Definition: Basic3DVectorLD.h:48
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
TriggerSummaryProducerAOD::getPFTauCollection_
edm::GetterOfProducts< reco::PFTauCollection > getPFTauCollection_
Definition: TriggerSummaryProducerAOD.h:206
Exception
Definition: hltDiff.cc:246
METFwd.h
trigger::TriggerHLongit
Definition: TriggerTypeDefs.h:92
PFTau.h
TriggerSummaryProducerAOD::endJob
void endJob() override
Definition: TriggerSummaryProducerAOD.cc:757
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
TriggerSummaryProducerAOD::getMETCollection_
edm::GetterOfProducts< reco::METCollection > getMETCollection_
Definition: TriggerSummaryProducerAOD.h:196
triggerMatcherToHLTDebug_cfi.tags
tags
Definition: triggerMatcherToHLTDebug_cfi.py:9
TriggerSummaryProducerAOD.h
trigger
Definition: HLTPrescaleTableCond.h:8
edm::isDebugEnabled
bool isDebugEnabled()
Definition: MessageLogger.cc:71
edm::BranchDescription
Definition: BranchDescription.h:32
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
TriggerSummaryProducerAOD::getPFJetCollection_
edm::GetterOfProducts< reco::PFJetCollection > getPFJetCollection_
Definition: TriggerSummaryProducerAOD.h:205
mps_fire.result
result
Definition: mps_fire.py:303
TriggerSummaryProducerAOD::~TriggerSummaryProducerAOD
~TriggerSummaryProducerAOD() override
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
L1EtMissParticle.h
TriggerSummaryProducerAOD::fillFilterObjectMember
void fillFilterObjectMember(trigger::Keys &keys, trigger::Vids &ids, const int &, const int &, const edm::Ref< C > &) const
Definition: TriggerSummaryProducerAOD.cc:652
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4
EtSum.h
TriggerSummaryProducerAOD::getL1TMuonParticleCollection_
edm::GetterOfProducts< l1t::MuonBxCollection > getL1TMuonParticleCollection_
Definition: TriggerSummaryProducerAOD.h:207
l1extra
Definition: L1EmParticle.h:26
edm::Provenance
Definition: Provenance.h:34
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
edm::Event
Definition: Event.h:73
L1JetParticle.h
trigger::TriggerL1ETT
Definition: TriggerTypeDefs.h:37
edm::InputTag
Definition: InputTag.h:15
TriggerSummaryProducerAOD::getL1HFRingsCollection_
edm::GetterOfProducts< l1extra::L1HFRingsCollection > getL1HFRingsCollection_
Definition: TriggerSummaryProducerAOD.h:204
label
const char * label
Definition: PFTauDecayModeTools.cc:11
benchmark_cfg.fb
fb
Definition: benchmark_cfg.py:14
edm::ProductID
Definition: ProductID.h:27
PFJet.h
ZCounting_cff.TriggerEvent
TriggerEvent
Definition: ZCounting_cff.py:5
Tau.h
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316