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 
86  public:
88  ~TriggerSummaryProducerAOD() override;
89  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
90  void produce(edm::Event&, const edm::EventSetup&) override;
91  void endStream() override;
92  static void globalEndJob(const GlobalInputTags *);
93 
94  // additional
95  static std::unique_ptr<GlobalInputTags> initializeGlobalCache(edm::ParameterSet const&) {
96  return std::unique_ptr<GlobalInputTags> (new GlobalInputTags());
97  };
98 
99  template <typename C>
100  void fillTriggerObjectCollections(const edm::Event&, edm::GetterOfProducts<C>& );
101 
102  template <typename T>
103  void fillTriggerObject(const T& );
104  void fillTriggerObject(const l1extra::L1HFRings& );
105  void fillTriggerObject(const l1extra::L1EtMissParticle& );
106  void fillTriggerObject(const reco::PFMET& );
107  void fillTriggerObject(const reco::CaloMET& );
108  void fillTriggerObject(const reco::MET& );
109 
110  template <typename C>
111  void fillFilterObjectMembers(const edm::Event&, const edm::InputTag& tag, const trigger::Vids &, const std::vector<edm::Ref<C> >&);
112 
113  template <typename C>
114  void fillFilterObjectMember(const int&, const int&, const edm::Ref<C>&);
115  void fillFilterObjectMember(const int&, const int&, const edm::Ref<l1extra::L1HFRingsCollection>&);
116  void fillFilterObjectMember(const int&, const int&, const edm::Ref<l1extra::L1EtMissParticleCollection>&);
117  void fillFilterObjectMember(const int&, const int&, const edm::Ref<reco::PFMETCollection>&);
118  void fillFilterObjectMember(const int&, const int&, const edm::Ref<reco::CaloMETCollection>&);
119  void fillFilterObjectMember(const int&, const int&, const edm::Ref<reco::METCollection>&);
120 
121  private:
123  bool throw_;
127  std::vector<std::regex> moduleLabelPatternsToMatch_;
128  std::vector<std::regex> moduleLabelPatternsToSkip_;
129 
131  struct OrderInputTag {
133  OrderInputTag(bool ignoreProcess): ignoreProcess_(ignoreProcess) { };
134  inline bool operator()(const edm::InputTag& l, const edm::InputTag& r) const {
135  int c = l.label().compare(r.label());
136  if(0==c) {
137  if(ignoreProcess_) {
138  return l.instance()<r.instance();
139  }
140  c = l.instance().compare(r.instance());
141  if(0==c) {
142  return l.process()<r.process();
143  }
144  }
145  return c < 0;
146  };
147  };
148  typedef std::set<edm::InputTag,OrderInputTag> InputTagSet;
149 
151  InputTagSet filterTagsEvent_;
152  InputTagSet filterTagsStream_;
153 
155  InputTagSet collectionTagsEvent_;
157 
160  std::vector<std::string> tags_;
162  std::map<edm::ProductID,unsigned int> offset_;
163 
168 
170  std::vector<bool> maskFilters_;
171 
194 };
195 #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_
edm::GetterOfProducts< l1t::JetBxCollection > getL1TJetParticleCollection_
std::set< edm::InputTag, OrderInputTag > InputTagSet
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:42
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::map< edm::ProductID, unsigned int > offset_
global map for indices into toc_: offset per input L3 collection
std::string Hash
Definition: Types.h:45
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:81
tbb::concurrent_unordered_set< edm::InputTag, InputTagHash > filterTagsGlobal_
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.
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
tbb::concurrent_unordered_set< edm::InputTag, InputTagHash > collectionTagsGlobal_
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_