CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TriggerEvent.h
Go to the documentation of this file.
1 #ifndef HLTReco_TriggerEvent_h
2 #define HLTReco_TriggerEvent_h
3 
20 #include <string>
21 #include <vector>
22 
23 namespace trigger
24 {
25 
28 
29  public:
30 
33  public:
35  std::string filterTag_;
43  }
45  TriggerFilterObject(const edm::InputTag& filterTag, const Vids& filterIds, const Keys& filterKeys): filterTag_(filterTag.encode()), filterIds_(filterIds), filterKeys_(filterKeys) { }
46  };
47 
49  private:
51  std::string usedProcessName_;
53  std::vector<std::string> collectionTags_;
59  std::vector<TriggerFilterObject> triggerFilters_;
60 
62  public:
66  usedProcessName_(usedProcessName),
69  triggerObjects_(),
71  {
72  collectionTags_.reserve(nc); collectionKeys_.reserve(nc);
73  triggerObjects_.reserve(no); triggerFilters_.reserve(nf);
74  }
75 
77  void addObjects(const TriggerObjectCollection& triggerObjects) {triggerObjects_.insert(triggerObjects_.end(), triggerObjects.begin(), triggerObjects.end());}
78 
79  void addCollections(const std::vector<edm::InputTag>& collectionTags, const Keys& collectionKeys) {
80  assert(collectionTags.size()==collectionKeys.size());
81  const trigger::size_type n(collectionTags.size());
82  for (trigger::size_type i=0; i!=n; ++i) {
83  collectionTags_.push_back(collectionTags[i].encode());
84  }
85  collectionKeys_.insert(collectionKeys_.end(), collectionKeys.begin(), collectionKeys.end());
86  }
87 
88  void addCollections(const std::vector<std::string>& collectionTags, const Keys& collectionKeys) {
89  assert(collectionTags.size()==collectionKeys.size());
90  collectionTags_.insert(collectionTags_.end(), collectionTags.begin(), collectionTags.end());
91  collectionKeys_.insert(collectionKeys_.end(), collectionKeys.begin(), collectionKeys.end());
92  }
93 
94  void addFilter(const edm::InputTag& filterTag, const Vids& filterIds, const Keys& filterKeys) {triggerFilters_.push_back(TriggerFilterObject(filterTag, filterIds, filterKeys));}
95 
97  const std::string& usedProcessName() const {return usedProcessName_;}
98  const std::vector<std::string>& collectionTags() const {return collectionTags_;}
99  const Keys& collectionKeys() const {return collectionKeys_;}
101 
104  const edm::InputTag filterTag(trigger::size_type index) const {return edm::InputTag(triggerFilters_.at(index).filterTag_);}
105  const Vids& filterIds(trigger::size_type index) const {return triggerFilters_.at(index).filterIds_;}
106  const Keys& filterKeys(trigger::size_type index) const {return triggerFilters_.at(index).filterKeys_;}
107 
110  const std::string encodedCollectionTag(collectionTag.encode());
111  const trigger::size_type n(collectionTags_.size());
112  for (trigger::size_type i=0; i!=n; ++i) {
113  if (encodedCollectionTag==collectionTags_[i]) {return i;}
114  }
115  return n;
116  }
119  const std::string encodedFilterTag(filterTag.encode());
120  const trigger::size_type n(triggerFilters_.size());
121  for (trigger::size_type i=0; i!=n; ++i) {
122  if (encodedFilterTag==triggerFilters_[i].filterTag_) {return i;}
123  }
124  return n;
125  }
126 
131 
132  };
133 
134 }
135 
136 #endif
int i
Definition: DBlmapReader.cc:9
const std::vector< std::string > & collectionTags() const
Definition: TriggerEvent.h:98
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:27
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:130
trigger::size_type collectionKey(trigger::size_type index) const
Definition: TriggerEvent.h:103
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:106
TriggerFilterObject(const edm::InputTag &filterTag)
Definition: TriggerEvent.h:44
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:118
std::vector< std::string > collectionTags_
Input tags of packed up collections.
Definition: TriggerEvent.h:53
void addCollections(const std::vector< edm::InputTag > &collectionTags, const Keys &collectionKeys)
Definition: TriggerEvent.h:79
void addCollections(const std::vector< std::string > &collectionTags, const Keys &collectionKeys)
Definition: TriggerEvent.h:88
uint16_t size_type
std::string encode() const
Definition: InputTag.cc:72
TriggerObjectCollection triggerObjects_
collection of all unique physics objects (linearised vector)
Definition: TriggerEvent.h:57
const Keys & collectionKeys() const
Definition: TriggerEvent.h:99
const Vids & filterIds(trigger::size_type index) const
Definition: TriggerEvent.h:105
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:100
const std::string & usedProcessName() const
getters
Definition: TriggerEvent.h:97
void addFilter(const edm::InputTag &filterTag, const Vids &filterIds, const Keys &filterKeys)
Definition: TriggerEvent.h:94
TriggerFilterObject(const edm::InputTag &filterTag, const Vids &filterIds, const Keys &filterKeys)
Definition: TriggerEvent.h:45
const edm::InputTag collectionTag(trigger::size_type index) const
Definition: TriggerEvent.h:102
std::string filterTag_
encoded InputTag of filter product
Definition: TriggerEvent.h:35
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:83
Keys collectionKeys_
1-past-end indices into linearised vector
Definition: TriggerEvent.h:55
const edm::InputTag filterTag(trigger::size_type index) const
Definition: TriggerEvent.h:104
std::string usedProcessName_
data members
Definition: TriggerEvent.h:51
trigger::size_type collectionIndex(const edm::InputTag &collectionTag) const
find index of collection from collection tag
Definition: TriggerEvent.h:109
std::vector< TriggerFilterObject > triggerFilters_
collection of all TriggerFilterObjects
Definition: TriggerEvent.h:59
trigger::size_type sizeObjects() const
Definition: TriggerEvent.h:129
std::vector< size_type > Keys
Vids filterIds_
physics object type as per filter
Definition: TriggerEvent.h:37
trigger::size_type sizeCollections() const
other
Definition: TriggerEvent.h:128
Keys filterKeys_
indices pointing into collection of unique TriggerObjects
Definition: TriggerEvent.h:39
void addObjects(const TriggerObjectCollection &triggerObjects)
setters
Definition: TriggerEvent.h:77
Helper class: recording trigger objects firing a single filter.
Definition: TriggerEvent.h:32
TriggerEvent(const std::string &usedProcessName, trigger::size_type nc, trigger::size_type no, trigger::size_type nf)
Definition: TriggerEvent.h:65
std::vector< int > Vids