CMS 3D CMS Logo

TriggerSummaryProducerAOD.h
Go to the documentation of this file.
1 #ifndef HLTcore_TriggerSummaryProducerAOD_h
2 #define HLTcore_TriggerSummaryProducerAOD_h
3 
21 
25 
31 
48 
49 #include <map>
50 #include <set>
51 #include <string>
52 #include <vector>
53 
54 #include <functional>
55 #include "tbb/concurrent_unordered_set.h"
56 #include <regex>
57 
58 namespace edm {
59  class EventSetup;
60 }
61 
62 namespace edm {
64 }
65 
66 //
67 // class declaration
68 //
69 
71 struct InputTagHash {
72  std::size_t operator()(const edm::InputTag& inputTag) const {
73  std::hash<std::string> Hash;
74  // bit-wise xor
75  return Hash(inputTag.label()) ^ Hash(inputTag.instance()) ^ Hash(inputTag.process());
76  }
77 };
79  GlobalInputTags() : filterTagsGlobal_(), collectionTagsGlobal_() {}
80  mutable tbb::concurrent_unordered_set<edm::InputTag, InputTagHash> filterTagsGlobal_;
81  mutable tbb::concurrent_unordered_set<edm::InputTag, InputTagHash> collectionTagsGlobal_;
82 };
83 
84 class TriggerSummaryProducerAOD : public edm::stream::EDProducer<edm::GlobalCache<GlobalInputTags>> {
85 public:
87  ~TriggerSummaryProducerAOD() override;
88  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
89  void produce(edm::Event&, const edm::EventSetup&) override;
90  void endStream() override;
91  static void globalEndJob(const GlobalInputTags*);
92 
93  // additional
94  static std::unique_ptr<GlobalInputTags> initializeGlobalCache(edm::ParameterSet const&) {
95  return std::unique_ptr<GlobalInputTags>(new GlobalInputTags());
96  };
97 
98  template <typename C>
99  void fillTriggerObjectCollections(const edm::Event&, edm::GetterOfProducts<C>&);
100 
101  template <typename T>
102  void fillTriggerObject(const T&);
103  void fillTriggerObject(const l1extra::L1HFRings&);
104  void fillTriggerObject(const l1extra::L1EtMissParticle&);
105  void fillTriggerObject(const reco::PFMET&);
106  void fillTriggerObject(const reco::CaloMET&);
107  void fillTriggerObject(const reco::MET&);
108 
109  template <typename C>
110  void fillFilterObjectMembers(const edm::Event&,
111  const edm::InputTag& tag,
112  const trigger::Vids&,
113  const std::vector<edm::Ref<C>>&);
114 
115  template <typename C>
116  void fillFilterObjectMember(const int&, const int&, const edm::Ref<C>&);
117  void fillFilterObjectMember(const int&, const int&, const edm::Ref<l1extra::L1HFRingsCollection>&);
118  void fillFilterObjectMember(const int&, const int&, const edm::Ref<l1extra::L1EtMissParticleCollection>&);
119  void fillFilterObjectMember(const int&, const int&, const edm::Ref<reco::PFMETCollection>&);
120  void fillFilterObjectMember(const int&, const int&, const edm::Ref<reco::CaloMETCollection>&);
121  void fillFilterObjectMember(const int&, const int&, const edm::Ref<reco::METCollection>&);
122 
123 private:
125  bool throw_;
129  std::vector<std::regex> moduleLabelPatternsToMatch_;
130  std::vector<std::regex> moduleLabelPatternsToSkip_;
131 
133  struct OrderInputTag {
135  OrderInputTag(bool ignoreProcess) : ignoreProcess_(ignoreProcess){};
136  inline bool operator()(const edm::InputTag& l, const edm::InputTag& r) const {
137  int c = l.label().compare(r.label());
138  if (0 == c) {
139  if (ignoreProcess_) {
140  return l.instance() < r.instance();
141  }
142  c = l.instance().compare(r.instance());
143  if (0 == c) {
144  return l.process() < r.process();
145  }
146  }
147  return c < 0;
148  };
149  };
150  typedef std::set<edm::InputTag, OrderInputTag> InputTagSet;
151 
153  InputTagSet filterTagsEvent_;
154  InputTagSet filterTagsStream_;
155 
157  InputTagSet collectionTagsEvent_;
159 
162  std::vector<std::string> tags_;
164  std::map<edm::ProductID, unsigned int> offset_;
165 
170 
172  std::vector<bool> maskFilters_;
173 
196 };
197 #endif
edm::GetterOfProducts< l1t::TauBxCollection > getL1TTauParticleCollection_
std::vector< std::regex > moduleLabelPatternsToSkip_
edm::GetterOfProducts< l1extra::L1JetParticleCollection > getL1JetParticleCollection_
edm::GetterOfProducts< reco::IsolatedPixelTrackCandidateCollection > getIsolatedPixelTrackCandidateCollection_
edm::GetterOfProducts< reco::RecoEcalCandidateCollection > getRecoEcalCandidateCollection_
edm::GetterOfProducts< l1extra::L1MuonParticleCollection > getL1MuonParticleCollection_
trigger::TriggerObjectCollection toc_
trigger object collection
edm::GetterOfProducts< reco::PFTauCollection > getPFTauCollection_
std::vector< bool > maskFilters_
packing decision
edm::GetterOfProducts< reco::METCollection > getMETCollection_
tbb::concurrent_unordered_set< edm::InputTag, InputTagHash > filterTagsGlobal_
edm::GetterOfProducts< l1t::JetBxCollection > getL1TJetParticleCollection_
std::map< edm::ProductID, unsigned int > offset_
global map for indices into toc_: offset per input L3 collection
edm::GetterOfProducts< reco::CaloJetCollection > getCaloJetCollection_
edm::GetterOfProducts< l1extra::L1EtMissParticleCollection > getL1EtMissParticleCollection_
std::vector< std::string > tags_
edm::GetterOfProducts< reco::PFJetCollection > getPFJetCollection_
edm::GetterOfProducts< reco::RecoChargedCandidateCollection > getRecoChargedCandidateCollection_
Definition: MET.h:41
edm::GetterOfProducts< l1extra::L1HFRingsCollection > getL1HFRingsCollection_
bool operator()(const edm::InputTag &l, const edm::InputTag &r) const
std::vector< std::regex > moduleLabelPatternsToMatch_
module labels which should be avoided
std::string Hash
Definition: Types.h:43
std::set< edm::InputTag, OrderInputTag > InputTagSet
edm::GetterOfProducts< l1t::MuonBxCollection > getL1TMuonParticleCollection_
std::size_t operator()(const edm::InputTag &inputTag) const
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< size_type > Keys
edm::GetterOfProducts< reco::CaloMETCollection > getCaloMETCollection_
std::string const & label() const
Definition: InputTag.h:36
std::string const & process() const
Definition: InputTag.h:40
edm::GetterOfProducts< reco::ElectronCollection > getElectronCollection_
HLT enums.
tbb::concurrent_unordered_set< edm::InputTag, InputTagHash > collectionTagsGlobal_
InputTagSet collectionTagsEvent_
list of L3 collection tags
edm::GetterOfProducts< reco::CompositeCandidateCollection > getCompositeCandidateCollection_
edm::GetterOfProducts< trigger::TriggerFilterObjectWithRefs > getTriggerFilterObjectWithRefs_
edm::GetterOfProducts< reco::PFMETCollection > getPFMETCollection_
static std::unique_ptr< GlobalInputTags > initializeGlobalCache(edm::ParameterSet const &)
InputTagSet filterTagsEvent_
list of L3 filter tags
long double T
std::string const & instance() const
Definition: InputTag.h:37
edm::GetterOfProducts< l1t::EtSumBxCollection > getL1TEtSumParticleCollection_
std::vector< int > Vids
edm::GetterOfProducts< l1extra::L1EmParticleCollection > getL1EmParticleCollection_
edm::GetterOfProducts< l1t::EGammaBxCollection > getL1TEGammaParticleCollection_