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 
103  const std::string & collectionTagEncoded(trigger::size_type index) const {return collectionTags_.at(index);}
105  const edm::InputTag filterTag(trigger::size_type index) const {return edm::InputTag(triggerFilters_.at(index).filterTag_);}
106  const std::string & filterTagEncoded(trigger::size_type index) const {return triggerFilters_.at(index).filterTag_;}
107  std::string filterLabel(trigger::size_type index) const {
108  const std::string & tag = triggerFilters_.at(index).filterTag_;
109  std::string::size_type idx = tag.find(':');
110  return (idx == std::string::npos ? tag : tag.substr(0,idx));
111  }
112  const Vids& filterIds(trigger::size_type index) const {return triggerFilters_.at(index).filterIds_;}
113  const Keys& filterKeys(trigger::size_type index) const {return triggerFilters_.at(index).filterKeys_;}
114 
117  const std::string encodedCollectionTag(collectionTag.encode());
118  const trigger::size_type n(collectionTags_.size());
119  for (trigger::size_type i=0; i!=n; ++i) {
120  if (encodedCollectionTag==collectionTags_[i]) {return i;}
121  }
122  return n;
123  }
126  const std::string encodedFilterTag(filterTag.encode());
127  const trigger::size_type n(triggerFilters_.size());
128  for (trigger::size_type i=0; i!=n; ++i) {
129  if (encodedFilterTag==triggerFilters_[i].filterTag_) {return i;}
130  }
131  return n;
132  }
133 
138 
139  };
140 
141 }
142 
143 #endif
const std::string & collectionTagEncoded(trigger::size_type index) const
Definition: TriggerEvent.h:103
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:137
trigger::size_type collectionKey(trigger::size_type index) const
Definition: TriggerEvent.h:104
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:113
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:125
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:112
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:100
const std::string & usedProcessName() const
getters
Definition: TriggerEvent.h:97
std::string filterLabel(trigger::size_type index) const
Definition: TriggerEvent.h:107
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:105
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:116
std::vector< TriggerFilterObject > triggerFilters_
collection of all TriggerFilterObjects
Definition: TriggerEvent.h:59
trigger::size_type sizeObjects() const
Definition: TriggerEvent.h:136
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:135
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
const std::string & filterTagEncoded(trigger::size_type index) const
Definition: TriggerEvent.h:106
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