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 
18 #include <string>
19 #include <vector>
20 
21 namespace trigger
22 {
23 
26 
27  public:
28 
31  public:
41  }
43  TriggerFilterObject(const edm::InputTag& filterTag, const Vids& filterIds, const Keys& filterKeys): filterTag_(filterTag.encode()), filterIds_(filterIds), filterKeys_(filterKeys) { }
44  };
45 
47  private:
51  std::vector<std::string> collectionTags_;
57  std::vector<TriggerFilterObject> triggerFilters_;
58 
60  public:
64  usedProcessName_(usedProcessName),
67  triggerObjects_(),
69  {
70  collectionTags_.reserve(nc); collectionKeys_.reserve(nc);
71  triggerObjects_.reserve(no); triggerFilters_.reserve(nf);
72  }
73 
75  void addObjects(const TriggerObjectCollection& triggerObjects) {triggerObjects_.insert(triggerObjects_.end(), triggerObjects.begin(), triggerObjects.end());}
76 
77  void addCollections(const std::vector<edm::InputTag>& collectionTags, const Keys& collectionKeys) {
78  assert(collectionTags.size()==collectionKeys.size());
79  const trigger::size_type n(collectionTags.size());
80  for (trigger::size_type i=0; i!=n; ++i) {
81  collectionTags_.push_back(collectionTags[i].encode());
82  }
83  collectionKeys_.insert(collectionKeys_.end(), collectionKeys.begin(), collectionKeys.end());
84  }
85 
86  void addCollections(const std::vector<std::string>& collectionTags, const Keys& collectionKeys) {
87  assert(collectionTags.size()==collectionKeys.size());
88  collectionTags_.insert(collectionTags_.end(), collectionTags.begin(), collectionTags.end());
89  collectionKeys_.insert(collectionKeys_.end(), collectionKeys.begin(), collectionKeys.end());
90  }
91 
92  void addFilter(const edm::InputTag& filterTag, const Vids& filterIds, const Keys& filterKeys) {triggerFilters_.push_back(TriggerFilterObject(filterTag, filterIds, filterKeys));}
93 
95  const std::string& usedProcessName() const {return usedProcessName_;}
96  const std::vector<std::string>& collectionTags() const {return collectionTags_;}
97  const Keys& collectionKeys() const {return collectionKeys_;}
99 
103  const edm::InputTag filterTag(trigger::size_type index) const {return edm::InputTag(triggerFilters_.at(index).filterTag_);}
104  const std::string & filterTagEncoded(trigger::size_type index) const {return triggerFilters_.at(index).filterTag_;}
106  const std::string & tag = triggerFilters_.at(index).filterTag_;
107  std::string::size_type idx = tag.find(':');
108  return (idx == std::string::npos ? tag : tag.substr(0,idx));
109  }
110  const Vids& filterIds(trigger::size_type index) const {return triggerFilters_.at(index).filterIds_;}
111  const Keys& filterKeys(trigger::size_type index) const {return triggerFilters_.at(index).filterKeys_;}
112 
115  const std::string encodedCollectionTag(collectionTag.encode());
116  const trigger::size_type n(collectionTags_.size());
117  for (trigger::size_type i=0; i!=n; ++i) {
118  if (encodedCollectionTag==collectionTags_[i]) {return i;}
119  }
120  return n;
121  }
124  const std::string encodedFilterTag(filterTag.encode());
125  const trigger::size_type n(triggerFilters_.size());
126  for (trigger::size_type i=0; i!=n; ++i) {
127  if (encodedFilterTag==triggerFilters_[i].filterTag_) {return i;}
128  }
129  return n;
130  }
131 
136 
137  };
138 
139 }
140 
141 #endif
const std::string & collectionTagEncoded(trigger::size_type index) const
Definition: TriggerEvent.h:101
int i
Definition: DBlmapReader.cc:9
const std::vector< std::string > & collectionTags() const
Definition: TriggerEvent.h:96
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:135
trigger::size_type collectionKey(trigger::size_type index) const
Definition: TriggerEvent.h:102
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:111
TriggerFilterObject(const edm::InputTag &filterTag)
Definition: TriggerEvent.h:42
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:123
std::vector< std::string > collectionTags_
Input tags of packed up collections.
Definition: TriggerEvent.h:51
void addCollections(const std::vector< edm::InputTag > &collectionTags, const Keys &collectionKeys)
Definition: TriggerEvent.h:77
void addCollections(const std::vector< std::string > &collectionTags, const Keys &collectionKeys)
Definition: TriggerEvent.h:86
uint16_t size_type
std::string encode() const
Definition: InputTag.cc:164
TriggerObjectCollection triggerObjects_
collection of all unique physics objects (linearised vector)
Definition: TriggerEvent.h:55
const Keys & collectionKeys() const
Definition: TriggerEvent.h:97
const Vids & filterIds(trigger::size_type index) const
Definition: TriggerEvent.h:110
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
const std::string & usedProcessName() const
getters
Definition: TriggerEvent.h:95
std::string filterLabel(trigger::size_type index) const
Definition: TriggerEvent.h:105
void addFilter(const edm::InputTag &filterTag, const Vids &filterIds, const Keys &filterKeys)
Definition: TriggerEvent.h:92
TriggerFilterObject(const edm::InputTag &filterTag, const Vids &filterIds, const Keys &filterKeys)
Definition: TriggerEvent.h:43
const edm::InputTag collectionTag(trigger::size_type index) const
Definition: TriggerEvent.h:100
std::string filterTag_
encoded InputTag of filter product
Definition: TriggerEvent.h:33
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
Keys collectionKeys_
1-past-end indices into linearised vector
Definition: TriggerEvent.h:53
const edm::InputTag filterTag(trigger::size_type index) const
Definition: TriggerEvent.h:103
std::string usedProcessName_
data members
Definition: TriggerEvent.h:49
trigger::size_type collectionIndex(const edm::InputTag &collectionTag) const
find index of collection from collection tag
Definition: TriggerEvent.h:114
std::vector< TriggerFilterObject > triggerFilters_
collection of all TriggerFilterObjects
Definition: TriggerEvent.h:57
trigger::size_type sizeObjects() const
Definition: TriggerEvent.h:134
std::vector< size_type > Keys
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
Vids filterIds_
physics object type as per filter
Definition: TriggerEvent.h:35
trigger::size_type sizeCollections() const
other
Definition: TriggerEvent.h:133
Keys filterKeys_
indices pointing into collection of unique TriggerObjects
Definition: TriggerEvent.h:37
void addObjects(const TriggerObjectCollection &triggerObjects)
setters
Definition: TriggerEvent.h:75
Helper class: recording trigger objects firing a single filter.
Definition: TriggerEvent.h:30
const std::string & filterTagEncoded(trigger::size_type index) const
Definition: TriggerEvent.h:104
TriggerEvent(const std::string &usedProcessName, trigger::size_type nc, trigger::size_type no, trigger::size_type nf)
Definition: TriggerEvent.h:63
std::vector< int > Vids