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 
50 
59 
62 
65 
66 #include "boost/algorithm/string.hpp"
67 
68 namespace {
69  std::vector<std::regex> convertToRegex(std::vector<std::string> const& iPatterns) {
70  std::vector<std::regex> result;
71 
72  for (auto const& pattern : iPatterns) {
73  auto regexPattern = pattern;
74  boost::replace_all(regexPattern, "*", ".*");
75  boost::replace_all(regexPattern, "?", ".");
76 
77  result.emplace_back(regexPattern);
78  }
79  return result;
80  }
81 } // namespace
82 
83 //
84 // constructors and destructor
85 //
87  : throw_(ps.getParameter<bool>("throw")),
88  pn_(ps.getParameter<std::string>("processName")),
89  moduleLabelPatternsToMatch_(
90  convertToRegex(ps.getParameter<std::vector<std::string>>("moduleLabelPatternsToMatch"))),
91  moduleLabelPatternsToSkip_(
92  convertToRegex(ps.getParameter<std::vector<std::string>>("moduleLabelPatternsToSkip"))) {
93  if (pn_ == "@") {
95  if (tns.isAvailable()) {
96  pn_ = tns->getProcessName();
97  } else {
98  edm::LogError("TriggerSummaryProducerAOD") << "HLT Error: TriggerNamesService not available!";
99  pn_ = "*";
100  }
101  }
102  LogDebug("TriggerSummaryProducerAOD") << "Using process name: '" << pn_ << "'";
103 
104  produces<trigger::TriggerEvent>();
105 
106  auto const* pProcessName = &pn_;
109  auto productMatch = [pProcessName, &moduleLabelPatternsToSkip, &moduleLabelPatternsToMatch](
110  edm::BranchDescription const& iBranch) -> bool {
111  if (iBranch.processName() == *pProcessName || *pProcessName == "*") {
112  auto const& label = iBranch.moduleLabel();
113  for (auto& match : moduleLabelPatternsToMatch) {
114  if (std::regex_match(label, match)) {
115  //make sure this is not in the reject list
116  for (auto& reject : moduleLabelPatternsToSkip) {
117  if (std::regex_match(label, reject)) {
118  return false;
119  }
120  }
121  return true;
122  }
123  }
124  }
125  return false;
126  };
127 
149 
157 
161 
193  });
194 }
195 
197 
198 //
199 // member functions
200 //
201 
202 namespace {
203  inline void tokenizeTag(const std::string& tag, std::string& label, std::string& instance, std::string& process) {
204  using std::string;
205 
206  const char token(':');
207  const string empty;
208 
209  label = tag;
210  const string::size_type i1(label.find(token));
211  if (i1 == string::npos) {
212  instance = empty;
213  process = empty;
214  } else {
215  instance = label.substr(i1 + 1);
216  label.resize(i1);
217  const string::size_type i2(instance.find(token));
218  if (i2 == string::npos) {
219  process = empty;
220  } else {
221  process = instance.substr(i2 + 1);
222  instance.resize(i2);
223  }
224  }
225  }
226 } // namespace
227 
230  desc.add<bool>("throw", false)->setComment("Throw exception or LogError");
231  desc.add<std::string>("processName", "@")
232  ->setComment(
233  "Process name to use when getting data. The value of '@' is used to denote the current process name.");
234  desc.add<std::vector<std::string>>("moduleLabelPatternsToMatch", std::vector<std::string>(1, "hlt*"))
235  ->setComment("glob patterns for module labels to get data.");
236  desc.add<std::vector<std::string>>("moduleLabelPatternsToSkip", std::vector<std::string>())
237  ->setComment("module labels for data products which should not be gotten.");
238  descriptions.add("triggerSummaryProducerAOD", desc);
239 }
240 
241 // ------------ method called to produce the data ------------
243  using namespace std;
244  using namespace edm;
245  using namespace reco;
246  using namespace l1extra;
247  using namespace trigger;
248  using namespace l1t;
249 
250  std::vector<edm::Handle<trigger::TriggerFilterObjectWithRefs>> fobs;
252 
253  const unsigned int nfob(fobs.size());
254  LogTrace("TriggerSummaryProducerAOD") << "Number of filter objects found: " << nfob;
255 
256  string tagLabel, tagInstance, tagProcess;
257 
263  std::vector<bool> maskFilters;
264  maskFilters.resize(nfob);
265  InputTagSet filterTagsEvent(pn_ == "*");
266  InputTagSet collectionTagsEvent(pn_ == "*");
267 
268  unsigned int nf(0);
269  for (unsigned int ifob = 0; ifob != nfob; ++ifob) {
270  maskFilters[ifob] = false;
271  const vector<string>& collectionTags_(fobs[ifob]->getCollectionTagsAsStrings());
272  const unsigned int ncol(collectionTags_.size());
273  if (ncol > 0) {
274  nf++;
275  maskFilters[ifob] = true;
276  const string& label(fobs[ifob].provenance()->moduleLabel());
277  const string& instance(fobs[ifob].provenance()->productInstanceName());
278  const string& process(fobs[ifob].provenance()->processName());
279  filterTagsEvent.insert(InputTag(label, instance, process));
280  for (unsigned int icol = 0; icol != ncol; ++icol) {
281  // overwrite process name (usually not set)
282  tokenizeTag(collectionTags_[icol], tagLabel, tagInstance, tagProcess);
283  collectionTagsEvent.insert(InputTag(tagLabel, tagInstance, pn_));
284  }
285  }
286  }
288  if (filterTagsEvent.size() != nf) {
289  LogError("TriggerSummaryProducerAOD")
290  << "Mismatch in number of filter tags: " << filterTagsEvent.size() << "!=" << nf;
291  }
292 
294  collectionTagsGlobal_.insert(collectionTagsEvent.begin(), collectionTagsEvent.end());
295  filterTagsGlobal_.insert(filterTagsEvent.begin(), filterTagsEvent.end());
296 
298  if (isDebugEnabled()) {
300  const unsigned int nc(collectionTagsEvent.size());
301  LogTrace("TriggerSummaryProducerAOD") << "Number of unique collections requested " << nc;
302  const InputTagSet::const_iterator cb(collectionTagsEvent.begin());
303  const InputTagSet::const_iterator ce(collectionTagsEvent.end());
304  for (InputTagSet::const_iterator ci = cb; ci != ce; ++ci) {
305  LogTrace("TriggerSummaryProducerAOD") << distance(cb, ci) << " " << ci->encode();
306  }
307  const unsigned int nf(filterTagsEvent.size());
308  LogTrace("TriggerSummaryProducerAOD") << "Number of unique filters requested " << nf;
309  const InputTagSet::const_iterator fb(filterTagsEvent.begin());
310  const InputTagSet::const_iterator fe(filterTagsEvent.end());
311  for (InputTagSet::const_iterator fi = fb; fi != fe; ++fi) {
312  LogTrace("TriggerSummaryProducerAOD") << distance(fb, fi) << " " << fi->encode();
313  }
314  }
315 
322  //toc_.clear();
323  std::vector<std::string> tags;
325  std::map<edm::ProductID, unsigned int> offset;
326 
327  fillTriggerObjectCollections<RecoEcalCandidateCollection>(
328  toc, offset, tags, keys, iEvent, getRecoEcalCandidateCollection_, collectionTagsEvent);
329  fillTriggerObjectCollections<ElectronCollection>(
330  toc, offset, tags, keys, iEvent, getElectronCollection_, collectionTagsEvent);
331  fillTriggerObjectCollections<RecoChargedCandidateCollection>(
332  toc, offset, tags, keys, iEvent, getRecoChargedCandidateCollection_, collectionTagsEvent);
333  fillTriggerObjectCollections<CaloJetCollection>(
334  toc, offset, tags, keys, iEvent, getCaloJetCollection_, collectionTagsEvent);
335  fillTriggerObjectCollections<CompositeCandidateCollection>(
336  toc, offset, tags, keys, iEvent, getCompositeCandidateCollection_, collectionTagsEvent);
337  fillTriggerObjectCollections<METCollection>(toc, offset, tags, keys, iEvent, getMETCollection_, collectionTagsEvent);
338  fillTriggerObjectCollections<CaloMETCollection>(
339  toc, offset, tags, keys, iEvent, getCaloMETCollection_, collectionTagsEvent);
340  fillTriggerObjectCollections<IsolatedPixelTrackCandidateCollection>(
341  toc, offset, tags, keys, iEvent, getIsolatedPixelTrackCandidateCollection_, collectionTagsEvent);
343  fillTriggerObjectCollections<L1EmParticleCollection>(
344  toc, offset, tags, keys, iEvent, getL1EmParticleCollection_, collectionTagsEvent);
345  fillTriggerObjectCollections<L1MuonParticleCollection>(
346  toc, offset, tags, keys, iEvent, getL1MuonParticleCollection_, collectionTagsEvent);
347  fillTriggerObjectCollections<L1JetParticleCollection>(
348  toc, offset, tags, keys, iEvent, getL1JetParticleCollection_, collectionTagsEvent);
349  fillTriggerObjectCollections<L1EtMissParticleCollection>(
350  toc, offset, tags, keys, iEvent, getL1EtMissParticleCollection_, collectionTagsEvent);
351  fillTriggerObjectCollections<L1HFRingsCollection>(
352  toc, offset, tags, keys, iEvent, getL1HFRingsCollection_, collectionTagsEvent);
353  fillTriggerObjectCollections<MuonBxCollection>(
354  toc, offset, tags, keys, iEvent, getL1TMuonParticleCollection_, collectionTagsEvent);
355  fillTriggerObjectCollections<MuonShowerBxCollection>(
356  toc, offset, tags, keys, iEvent, getL1TMuonShowerParticleCollection_, collectionTagsEvent);
357  fillTriggerObjectCollections<EGammaBxCollection>(
358  toc, offset, tags, keys, iEvent, getL1TEGammaParticleCollection_, collectionTagsEvent);
359  fillTriggerObjectCollections<JetBxCollection>(
360  toc, offset, tags, keys, iEvent, getL1TJetParticleCollection_, collectionTagsEvent);
361  fillTriggerObjectCollections<TauBxCollection>(
362  toc, offset, tags, keys, iEvent, getL1TTauParticleCollection_, collectionTagsEvent);
363  fillTriggerObjectCollections<EtSumBxCollection>(
364  toc, offset, tags, keys, iEvent, getL1TEtSumParticleCollection_, collectionTagsEvent);
366  fillTriggerObjectCollections<l1t::TkMuonCollection>(
367  toc, offset, tags, keys, iEvent, getL1TTkMuonCollection_, collectionTagsEvent);
368  fillTriggerObjectCollections<l1t::TkElectronCollection>(
369  toc, offset, tags, keys, iEvent, getL1TTkElectronCollection_, collectionTagsEvent);
370  fillTriggerObjectCollections<l1t::TkEmCollection>(
371  toc, offset, tags, keys, iEvent, getL1TTkEmCollection_, collectionTagsEvent);
372  fillTriggerObjectCollections<l1t::PFJetCollection>(
373  toc, offset, tags, keys, iEvent, getL1TPFJetCollection_, collectionTagsEvent);
374  fillTriggerObjectCollections<l1t::PFTauCollection>(
375  toc, offset, tags, keys, iEvent, getL1TPFTauCollection_, collectionTagsEvent);
376  fillTriggerObjectCollections<l1t::HPSPFTauCollection>(
377  toc, offset, tags, keys, iEvent, getL1THPSPFTauCollection_, collectionTagsEvent);
378  fillTriggerObjectCollections<l1t::PFTrackCollection>(
379  toc, offset, tags, keys, iEvent, getL1TPFTrackCollection_, collectionTagsEvent);
381  fillTriggerObjectCollections<reco::PFJetCollection>(
382  toc, offset, tags, keys, iEvent, getPFJetCollection_, collectionTagsEvent);
383  fillTriggerObjectCollections<reco::PFTauCollection>(
384  toc, offset, tags, keys, iEvent, getPFTauCollection_, collectionTagsEvent);
385  fillTriggerObjectCollections<reco::PFMETCollection>(
386  toc, offset, tags, keys, iEvent, getPFMETCollection_, collectionTagsEvent);
388  const unsigned int nk(tags.size());
389  LogDebug("TriggerSummaryProducerAOD") << "Number of collections found: " << nk;
390  const unsigned int no(toc.size());
391  LogDebug("TriggerSummaryProducerAOD") << "Number of physics objects found: " << no;
392 
395  unique_ptr<TriggerEvent> product(new TriggerEvent(pn_, nk, no, nf));
396 
398  product->addCollections(tags, keys);
399  product->addObjects(toc);
400 
402  trigger::Vids ids;
403  for (unsigned int ifob = 0; ifob != nfob; ++ifob) {
404  if (maskFilters[ifob]) {
405  const string& label(fobs[ifob].provenance()->moduleLabel());
406  const string& instance(fobs[ifob].provenance()->productInstanceName());
407  const string& process(fobs[ifob].provenance()->processName());
408  const edm::InputTag filterTag(label, instance, process);
409  ids.clear();
410  keys.clear();
411  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->photonIds(), fobs[ifob]->photonRefs(), offset, keys, ids);
413  iEvent, filterTag, fobs[ifob]->electronIds(), fobs[ifob]->electronRefs(), offset, keys, ids);
414  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->muonIds(), fobs[ifob]->muonRefs(), offset, keys, ids);
415  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->jetIds(), fobs[ifob]->jetRefs(), offset, keys, ids);
417  iEvent, filterTag, fobs[ifob]->compositeIds(), fobs[ifob]->compositeRefs(), offset, keys, ids);
419  iEvent, filterTag, fobs[ifob]->basemetIds(), fobs[ifob]->basemetRefs(), offset, keys, ids);
421  iEvent, filterTag, fobs[ifob]->calometIds(), fobs[ifob]->calometRefs(), offset, keys, ids);
423  iEvent, filterTag, fobs[ifob]->pixtrackIds(), fobs[ifob]->pixtrackRefs(), offset, keys, ids);
424  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->l1emIds(), fobs[ifob]->l1emRefs(), offset, keys, ids);
425  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->l1muonIds(), fobs[ifob]->l1muonRefs(), offset, keys, ids);
426  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->l1jetIds(), fobs[ifob]->l1jetRefs(), offset, keys, ids);
428  iEvent, filterTag, fobs[ifob]->l1etmissIds(), fobs[ifob]->l1etmissRefs(), offset, keys, ids);
430  iEvent, filterTag, fobs[ifob]->l1hfringsIds(), fobs[ifob]->l1hfringsRefs(), offset, keys, ids);
432  iEvent, filterTag, fobs[ifob]->l1tmuonIds(), fobs[ifob]->l1tmuonRefs(), offset, keys, ids);
434  iEvent, filterTag, fobs[ifob]->l1tmuonShowerIds(), fobs[ifob]->l1tmuonShowerRefs(), offset, keys, ids);
436  iEvent, filterTag, fobs[ifob]->l1tegammaIds(), fobs[ifob]->l1tegammaRefs(), offset, keys, ids);
437  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->l1tjetIds(), fobs[ifob]->l1tjetRefs(), offset, keys, ids);
438  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->l1ttauIds(), fobs[ifob]->l1ttauRefs(), offset, keys, ids);
440  iEvent, filterTag, fobs[ifob]->l1tetsumIds(), fobs[ifob]->l1tetsumRefs(), offset, keys, ids);
441 
443  iEvent, filterTag, fobs[ifob]->l1ttkmuonIds(), fobs[ifob]->l1ttkmuonRefs(), offset, keys, ids);
445  iEvent, filterTag, fobs[ifob]->l1ttkeleIds(), fobs[ifob]->l1ttkeleRefs(), offset, keys, ids);
447  iEvent, filterTag, fobs[ifob]->l1ttkemIds(), fobs[ifob]->l1ttkemRefs(), offset, keys, ids);
449  iEvent, filterTag, fobs[ifob]->l1tpfjetIds(), fobs[ifob]->l1tpfjetRefs(), offset, keys, ids);
451  iEvent, filterTag, fobs[ifob]->l1tpftauIds(), fobs[ifob]->l1tpftauRefs(), offset, keys, ids);
453  iEvent, filterTag, fobs[ifob]->l1thpspftauIds(), fobs[ifob]->l1thpspftauRefs(), offset, keys, ids);
455  iEvent, filterTag, fobs[ifob]->l1tpftrackIds(), fobs[ifob]->l1tpftrackRefs(), offset, keys, ids);
456 
457  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->pfjetIds(), fobs[ifob]->pfjetRefs(), offset, keys, ids);
458  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->pftauIds(), fobs[ifob]->pftauRefs(), offset, keys, ids);
459  fillFilterObjectMembers(iEvent, filterTag, fobs[ifob]->pfmetIds(), fobs[ifob]->pfmetRefs(), offset, keys, ids);
460  product->addFilter(filterTag, ids, keys);
461  }
462  }
463 
464  OrphanHandle<TriggerEvent> ref = iEvent.put(std::move(product));
465  LogTrace("TriggerSummaryProducerAOD") << "Number of physics objects packed: " << ref->sizeObjects();
466  LogTrace("TriggerSummaryProducerAOD") << "Number of filter objects packed: " << ref->sizeFilters();
467 }
468 
469 template <typename C>
472  std::vector<std::string>& tags,
474  const edm::Event& iEvent,
475  const edm::GetterOfProducts<C>& getter,
476  const InputTagSet& collectionTagsEvent) const {
480 
481  using namespace std;
482  using namespace edm;
483  using namespace reco;
484  using namespace l1extra;
485  using namespace trigger;
486  using namespace l1t;
487 
488  vector<Handle<C>> collections;
489  getter.fillHandles(iEvent, collections);
490  const unsigned int nc(collections.size());
491 
492  for (unsigned int ic = 0; ic != nc; ++ic) {
493  const Provenance& provenance(*(collections[ic].provenance()));
494  const string& label(provenance.moduleLabel());
495  const string& instance(provenance.productInstanceName());
496  const string& process(provenance.processName());
497  const InputTag collectionTag(label, instance, process);
498 
499  if (collectionTagsEvent.find(collectionTag) != collectionTagsEvent.end()) {
500  const ProductID pid(collections[ic].provenance()->productID());
501  if (offset.find(pid) != offset.end()) {
502  LogError("TriggerSummaryProducerAOD") << "Duplicate pid: " << pid;
503  }
504  offset[pid] = toc.size();
505  const unsigned int n(collections[ic]->size());
506  for (unsigned int i = 0; i != n; ++i) {
507  fillTriggerObject(toc, (*collections[ic])[i]);
508  }
509  tags.push_back(collectionTag.encode());
510  keys.push_back(toc.size());
511  }
512 
513  }
514 }
515 
516 template <typename T>
518  using namespace trigger;
519  toc.emplace_back(object);
520 
521  return;
522 }
523 
525  const l1extra::L1HFRings& object) const {
526  using namespace l1extra;
527  using namespace trigger;
528 
529  toc.emplace_back(TriggerL1HfRingEtSums,
530  object.hfEtSum(L1HFRings::kRing1PosEta),
531  object.hfEtSum(L1HFRings::kRing1NegEta),
532  object.hfEtSum(L1HFRings::kRing2PosEta),
533  object.hfEtSum(L1HFRings::kRing2NegEta));
534  toc.emplace_back(TriggerL1HfBitCounts,
535  object.hfBitCount(L1HFRings::kRing1PosEta),
536  object.hfBitCount(L1HFRings::kRing1NegEta),
537  object.hfBitCount(L1HFRings::kRing2PosEta),
538  object.hfBitCount(L1HFRings::kRing2NegEta));
539 
540  return;
541 }
542 
544  const l1extra::L1EtMissParticle& object) const {
545  using namespace l1extra;
546  using namespace trigger;
547 
548  toc.emplace_back(object);
549  if (object.type() == L1EtMissParticle::kMET) {
550  toc.emplace_back(TriggerL1ETT, object.etTotal(), 0.0, 0.0, 0.0);
551  } else if (object.type() == L1EtMissParticle::kMHT) {
552  toc.emplace_back(TriggerL1HTT, object.etTotal(), 0.0, 0.0, 0.0);
553  } else {
554  toc.emplace_back(0, object.etTotal(), 0.0, 0.0, 0.0);
555  }
556 
557  return;
558 }
559 
561  const reco::PFMET& object) const {
562  using namespace reco;
563  using namespace trigger;
564 
565  toc.emplace_back(object);
566  toc.emplace_back(TriggerTET, object.sumEt(), 0.0, 0.0, 0.0);
567  toc.emplace_back(TriggerMETSig, object.mEtSig(), 0.0, 0.0, 0.0);
568  toc.emplace_back(TriggerELongit, object.e_longitudinal(), 0.0, 0.0, 0.0);
569 
570  return;
571 }
572 
574  const reco::CaloMET& object) const {
575  using namespace reco;
576  using namespace trigger;
577 
578  toc.emplace_back(object);
579  toc.emplace_back(TriggerTET, object.sumEt(), 0.0, 0.0, 0.0);
580  toc.emplace_back(TriggerMETSig, object.mEtSig(), 0.0, 0.0, 0.0);
581  toc.emplace_back(TriggerELongit, object.e_longitudinal(), 0.0, 0.0, 0.0);
582 
583  return;
584 }
585 
587  const reco::MET& object) const {
588  using namespace reco;
589  using namespace trigger;
590 
591  toc.emplace_back(object);
592  toc.emplace_back(TriggerTHT, object.sumEt(), 0.0, 0.0, 0.0);
593  toc.emplace_back(TriggerMHTSig, object.mEtSig(), 0.0, 0.0, 0.0);
594  toc.emplace_back(TriggerHLongit, object.e_longitudinal(), 0.0, 0.0, 0.0);
595 
596  return;
597 }
598 
599 template <typename C>
601  const edm::InputTag& tag,
602  const trigger::Vids& ids,
603  const std::vector<edm::Ref<C>>& refs,
604  const ProductIDtoIndex& offset,
606  trigger::Vids& oIDs) const {
610 
611  using namespace std;
612  using namespace edm;
613  using namespace reco;
614  using namespace l1extra;
615  using namespace trigger;
616 
617  if (ids.size() != refs.size()) {
618  LogError("TriggerSummaryProducerAOD") << "Vector length is different: " << ids.size() << " " << refs.size();
619  }
620 
621  const unsigned int n(min(ids.size(), refs.size()));
622  for (unsigned int i = 0; i != n; ++i) {
623  const ProductID pid(refs[i].id());
624  if (!(pid.isValid())) {
625  std::ostringstream ost;
626  ost << "Iinvalid pid: " << pid << " FilterTag / Key: " << tag.encode() << " / " << i << "of" << n
627  << " CollectionTag / Key: "
628  << " <Unrecoverable>"
629  << " / " << refs[i].key() << " CollectionType: " << typeid(C).name();
630  if (throw_) {
631  throw cms::Exception("TriggerSummaryProducerAOD") << ost.str();
632  } else {
633  LogError("TriggerSummaryProducerAOD") << ost.str();
634  }
635  } else {
636  auto itOffset = offset.find(pid);
637  if (itOffset == offset.end()) {
638  const auto& prov = iEvent.getStableProvenance(pid);
639  const string& label(prov.moduleLabel());
640  const string& instance(prov.productInstanceName());
641  const string& process(prov.processName());
642  std::ostringstream ost;
643  ost << "Uunknown pid: " << pid << " FilterTag / Key: " << tag.encode() << " / " << i << "of" << n
644  << " CollectionTag / Key: " << InputTag(label, instance, process).encode() << " / " << refs[i].key()
645  << " CollectionType: " << typeid(C).name();
646  if (throw_) {
647  throw cms::Exception("TriggerSummaryProducerAOD") << ost.str();
648  } else {
649  LogError("TriggerSummaryProducerAOD") << ost.str();
650  }
651  } else {
652  fillFilterObjectMember(keys, oIDs, itOffset->second, ids[i], refs[i]);
653  }
654  }
655  }
656  return;
657 }
658 
659 template <typename C>
661  trigger::Keys& keys, trigger::Vids& ids, const int& offset, const int& id, const edm::Ref<C>& ref) const {
662  keys.push_back(offset + ref.key());
663  ids.push_back(id);
664 
665  return;
666 }
667 
669  trigger::Vids& ids,
670  const int& offset,
671  const int& id,
672  const edm::Ref<l1extra::L1HFRingsCollection>& ref) const {
673  using namespace trigger;
674 
675  if (id == TriggerL1HfBitCounts) {
676  keys.push_back(offset + 2 * ref.key() + 1);
677  } else { // if (ids[i]==TriggerL1HfRingEtSums) {
678  keys.push_back(offset + 2 * ref.key() + 0);
679  }
680  ids.push_back(id);
681 
682  return;
683 }
684 
686  trigger::Vids& ids,
687  const int& offset,
688  const int& id,
690  using namespace trigger;
691 
692  if ((id == TriggerL1ETT) || (id == TriggerL1HTT)) {
693  keys.push_back(offset + 2 * ref.key() + 1);
694  } else {
695  keys.push_back(offset + 2 * ref.key() + 0);
696  }
697  ids.push_back(id);
698 
699  return;
700 }
701 
703  trigger::Vids& ids,
704  const int& offset,
705  const int& id,
706  const edm::Ref<reco::PFMETCollection>& ref) const {
707  using namespace trigger;
708 
709  if ((id == TriggerTHT) || (id == TriggerTET)) {
710  keys.push_back(offset + 4 * ref.key() + 1);
711  } else if ((id == TriggerMETSig) || (id == TriggerMHTSig)) {
712  keys.push_back(offset + 4 * ref.key() + 2);
713  } else if ((id == TriggerELongit) || (id == TriggerHLongit)) {
714  keys.push_back(offset + 4 * ref.key() + 3);
715  } else {
716  keys.push_back(offset + 4 * ref.key() + 0);
717  }
718  ids.push_back(id);
719 
720  return;
721 }
722 
724  trigger::Vids& ids,
725  const int& offset,
726  const int& id,
727  const edm::Ref<reco::CaloMETCollection>& ref) const {
728  using namespace trigger;
729 
730  if ((id == TriggerTHT) || (id == TriggerTET)) {
731  keys.push_back(offset + 4 * ref.key() + 1);
732  } else if ((id == TriggerMETSig) || (id == TriggerMHTSig)) {
733  keys.push_back(offset + 4 * ref.key() + 2);
734  } else if ((id == TriggerELongit) || (id == TriggerHLongit)) {
735  keys.push_back(offset + 4 * ref.key() + 3);
736  } else {
737  keys.push_back(offset + 4 * ref.key() + 0);
738  }
739  ids.push_back(id);
740 
741  return;
742 }
743 
745  trigger::Vids& ids,
746  const int& offset,
747  const int& id,
748  const edm::Ref<reco::METCollection>& ref) const {
749  using namespace trigger;
750 
751  if ((id == TriggerTHT) || (id == TriggerTET)) {
752  keys.push_back(offset + 4 * ref.key() + 1);
753  } else if ((id == TriggerMETSig) || (id == TriggerMHTSig)) {
754  keys.push_back(offset + 4 * ref.key() + 2);
755  } else if ((id == TriggerELongit) || (id == TriggerHLongit)) {
756  keys.push_back(offset + 4 * ref.key() + 3);
757  } else {
758  keys.push_back(offset + 4 * ref.key() + 0);
759  }
760  ids.push_back(id);
761 
762  return;
763 }
764 
766  using namespace std;
767  using namespace edm;
768  using namespace trigger;
769 
770  LogVerbatim("TriggerSummaryProducerAOD") << endl;
771  LogVerbatim("TriggerSummaryProducerAOD") << "TriggerSummaryProducerAOD::globalEndJob - accumulated tags:" << endl;
772 
773  InputTagSet filterTags(false);
775 
776  filterTags.insert(filterTagsGlobal_.begin(), filterTagsGlobal_.end());
778 
779  const unsigned int nc(collectionTags.size());
780  const unsigned int nf(filterTags.size());
781  LogVerbatim("TriggerSummaryProducerAOD") << " Overall number of Collections/Filters: " << nc << "/" << nf << endl;
782 
783  LogVerbatim("TriggerSummaryProducerAOD") << " The collections: " << nc << endl;
784  const InputTagSet::const_iterator cb(collectionTags.begin());
785  const InputTagSet::const_iterator ce(collectionTags.end());
786  for (InputTagSet::const_iterator ci = cb; ci != ce; ++ci) {
787  LogVerbatim("TriggerSummaryProducerAOD") << " " << distance(cb, ci) << " " << ci->encode() << endl;
788  }
789 
790  LogVerbatim("TriggerSummaryProducerAOD") << " The filters:" << nf << endl;
791  const InputTagSet::const_iterator fb(filterTags.begin());
792  const InputTagSet::const_iterator fe(filterTags.end());
793  for (InputTagSet::const_iterator fi = fb; fi != fe; ++fi) {
794  LogVerbatim("TriggerSummaryProducerAOD") << " " << distance(fb, fi) << " " << fi->encode() << endl;
795  }
796 
797  LogVerbatim("TriggerSummaryProducerAOD") << "TriggerSummaryProducerAOD::endJob." << endl;
798  LogVerbatim("TriggerSummaryProducerAOD") << endl;
799 
800  return;
801 }
size
Write out results.
~TriggerSummaryProducerAOD() override
Log< level::Info, true > LogVerbatim
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: ProducerBase.h:85
bool isDebugEnabled()
edm::GetterOfProducts< l1t::TauBxCollection > getL1TTauParticleCollection_
std::vector< std::regex > moduleLabelPatternsToSkip_
edm::GetterOfProducts< l1extra::L1JetParticleCollection > getL1JetParticleCollection_
edm::GetterOfProducts< reco::IsolatedPixelTrackCandidateCollection > getIsolatedPixelTrackCandidateCollection_
bool isValid() const
Definition: ProductID.h:32
edm::GetterOfProducts< reco::RecoEcalCandidateCollection > getRecoEcalCandidateCollection_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::GetterOfProducts< l1t::PFTrackCollection > getL1TPFTrackCollection_
edm::GetterOfProducts< l1extra::L1MuonParticleCollection > getL1MuonParticleCollection_
edm::GetterOfProducts< reco::PFTauCollection > getPFTauCollection_
static PFTauRenderPlugin instance
edm::GetterOfProducts< reco::METCollection > getMETCollection_
edm::GetterOfProducts< l1t::JetBxCollection > getL1TJetParticleCollection_
edm::GetterOfProducts< l1t::TkElectronCollection > getL1TTkElectronCollection_
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:146
tbb::concurrent_unordered_set< edm::InputTag, InputTagHash > filterTagsGlobal_
list of L3 filter tags
std::string const & processName() const
Definition: Provenance.h:57
tbb::concurrent_unordered_set< edm::InputTag, InputTagHash > collectionTagsGlobal_
list of L3 collection tags
edm::GetterOfProducts< reco::CaloJetCollection > getCaloJetCollection_
delete x;
Definition: CaloConfig.h:22
edm::GetterOfProducts< l1extra::L1EtMissParticleCollection > getL1EtMissParticleCollection_
Log< level::Error, false > LogError
std::string const & getProcessName() const
uint16_t size_type
key_type key() const
Accessor for product key.
Definition: Ref.h:250
#define LogTrace(id)
void fillTriggerObject(trigger::TriggerObjectCollection &, const T &) const
edm::GetterOfProducts< reco::PFJetCollection > getPFJetCollection_
const bool throw_
throw on error
void fillTriggerObjectCollections(trigger::TriggerObjectCollection &, ProductIDtoIndex &, std::vector< std::string > &, trigger::Keys &, const edm::Event &, const edm::GetterOfProducts< C > &, const InputTagSet &) const
char const * label
void fillFilterObjectMember(trigger::Keys &keys, trigger::Vids &ids, const int &, const int &, const edm::Ref< C > &) const
std::set< edm::InputTag, OrderInputTag > InputTagSet
int iEvent
Definition: GenABIO.cc:224
edm::GetterOfProducts< l1t::TkEmCollection > getL1TTkEmCollection_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
edm::GetterOfProducts< reco::RecoChargedCandidateCollection > getRecoChargedCandidateCollection_
TriggerSummaryProducerAOD(const edm::ParameterSet &)
std::string const & productInstanceName() const
Definition: Provenance.h:58
Definition: MET.h:41
edm::GetterOfProducts< l1extra::L1HFRingsCollection > getL1HFRingsCollection_
edm::GetterOfProducts< l1t::TkMuonCollection > getL1TTkMuonCollection_
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
std::vector< std::regex > moduleLabelPatternsToMatch_
module labels which should be avoided
edm::GetterOfProducts< l1t::PFTauCollection > getL1TPFTauCollection_
trigger::size_type sizeObjects() const
Definition: TriggerEvent.h:145
edm::GetterOfProducts< l1t::MuonBxCollection > getL1TMuonParticleCollection_
edm::GetterOfProducts< l1t::HPSPFTauCollection > getL1THPSPFTauCollection_
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
void fillHandles(edm::Event const &event, std::vector< edm::Handle< T >> &handles) const
std::vector< size_type > Keys
edm::GetterOfProducts< l1t::MuonShowerBxCollection > getL1TMuonShowerParticleCollection_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::GetterOfProducts< reco::CaloMETCollection > getCaloMETCollection_
edm::GetterOfProducts< reco::ElectronCollection > getElectronCollection_
fixed size matrix
HLT enums.
std::map< edm::ProductID, unsigned int > ProductIDtoIndex
edm::GetterOfProducts< reco::CompositeCandidateCollection > getCompositeCandidateCollection_
edm::GetterOfProducts< trigger::TriggerFilterObjectWithRefs > getTriggerFilterObjectWithRefs_
trigger object collection
std::string const & moduleLabel() const
Definition: Provenance.h:55
bool isAvailable() const
Definition: Service.h:40
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
edm::GetterOfProducts< reco::PFMETCollection > getPFMETCollection_
edm::GetterOfProducts< l1t::PFJetCollection > getL1TPFJetCollection_
long double T
edm::GetterOfProducts< l1t::EtSumBxCollection > getL1TEtSumParticleCollection_
std::vector< int > Vids
edm::GetterOfProducts< l1extra::L1EmParticleCollection > getL1EmParticleCollection_
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)
edm::GetterOfProducts< l1t::EGammaBxCollection > getL1TEGammaParticleCollection_