CMS 3D CMS Logo

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 #include <cassert>
21 
22 namespace trigger {
23 
26  public:
29  public:
42  };
43 
45  private:
49  std::vector<std::string> collectionTags_;
55  std::vector<TriggerFilterObject> triggerFilters_;
56 
58  public:
66  triggerFilters_() {
67  collectionTags_.reserve(nc);
68  collectionKeys_.reserve(nc);
69  triggerObjects_.reserve(no);
70  triggerFilters_.reserve(nf);
71  }
72 
75  triggerObjects_.insert(triggerObjects_.end(), triggerObjects.begin(), triggerObjects.end());
76  }
77 
78  void addCollections(const std::vector<edm::InputTag>& collectionTags, const Keys& collectionKeys) {
79  assert(collectionTags.size() == collectionKeys.size());
80  const trigger::size_type n(collectionTags.size());
81  for (trigger::size_type i = 0; i != n; ++i) {
82  collectionTags_.push_back(collectionTags[i].encode());
83  }
84  collectionKeys_.insert(collectionKeys_.end(), collectionKeys.begin(), collectionKeys.end());
85  }
86 
87  void addCollections(const std::vector<std::string>& collectionTags, const Keys& collectionKeys) {
88  assert(collectionTags.size() == collectionKeys.size());
89  collectionTags_.insert(collectionTags_.end(), collectionTags.begin(), collectionTags.end());
90  collectionKeys_.insert(collectionKeys_.end(), collectionKeys.begin(), collectionKeys.end());
91  }
92 
95  }
96 
98  const std::string& usedProcessName() const { return usedProcessName_; }
99  const std::vector<std::string>& collectionTags() const { return collectionTags_; }
100  const Keys& collectionKeys() const { return collectionKeys_; }
102 
104  return edm::InputTag(collectionTags_.at(index));
105  }
109  return edm::InputTag(triggerFilters_.at(index).filterTag_);
110  }
113  const std::string& tag = triggerFilters_.at(index).filterTag_;
114  std::string::size_type idx = tag.find(':');
115  return (idx == std::string::npos ? tag : tag.substr(0, idx));
116  }
117  const Vids& filterIds(trigger::size_type index) const { return triggerFilters_.at(index).filterIds_; }
118  const Keys& filterKeys(trigger::size_type index) const { return triggerFilters_.at(index).filterKeys_; }
119 
122  const std::string encodedCollectionTag(collectionTag.encode());
123  const trigger::size_type n(collectionTags_.size());
124  for (trigger::size_type i = 0; i != n; ++i) {
125  if (encodedCollectionTag == collectionTags_[i]) {
126  return i;
127  }
128  }
129  return n;
130  }
133  const std::string encodedFilterTag(filterTag.encode());
134  const trigger::size_type n(triggerFilters_.size());
135  for (trigger::size_type i = 0; i != n; ++i) {
136  if (encodedFilterTag == triggerFilters_[i].filterTag_) {
137  return i;
138  }
139  }
140  return n;
141  }
142 
145  trigger::size_type sizeObjects() const { return triggerObjects_.size(); }
146  trigger::size_type sizeFilters() const { return triggerFilters_.size(); }
147  };
148 
149 } // namespace trigger
150 
151 #endif
trigger::TriggerEvent::TriggerFilterObject::TriggerFilterObject
TriggerFilterObject(const edm::InputTag &filterTag, const Vids &filterIds, const Keys &filterKeys)
Definition: TriggerEvent.h:40
trigger::TriggerEvent::sizeFilters
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:146
mps_fire.i
i
Definition: mps_fire.py:355
trigger::TriggerEvent::filterKeys
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:118
trigger::TriggerEvent::TriggerFilterObject::TriggerFilterObject
TriggerFilterObject()
constructors
Definition: TriggerEvent.h:37
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
trigger::TriggerEvent::collectionTags_
std::vector< std::string > collectionTags_
Input tags of packed up collections.
Definition: TriggerEvent.h:49
triggerMatchMonitor_cfi.triggerObjects
triggerObjects
Definition: triggerMatchMonitor_cfi.py:15
trigger::TriggerEvent::collectionKeys
const Keys & collectionKeys() const
Definition: TriggerEvent.h:100
trigger::Vids
std::vector< int > Vids
Definition: TriggerTypeDefs.h:21
trigger::TriggerEvent::collectionTagEncoded
const std::string & collectionTagEncoded(trigger::size_type index) const
Definition: TriggerEvent.h:106
trigger::TriggerEvent::TriggerFilterObject::filterTag_
std::string filterTag_
encoded InputTag of filter product
Definition: TriggerEvent.h:31
cms::cuda::assert
assert(be >=bs)
trigger::TriggerEvent::TriggerFilterObject::filterIds_
Vids filterIds_
physics object type as per filter
Definition: TriggerEvent.h:33
TriggerTypeDefs.h
charmTagsComputerCvsB_cfi.idx
idx
Definition: charmTagsComputerCvsB_cfi.py:108
trigger::TriggerEvent::collectionTag
const edm::InputTag collectionTag(trigger::size_type index) const
Definition: TriggerEvent.h:103
trigger::TriggerEvent::collectionTags
const std::vector< std::string > & collectionTags() const
Definition: TriggerEvent.h:99
trigger::TriggerEvent::addCollections
void addCollections(const std::vector< edm::InputTag > &collectionTags, const Keys &collectionKeys)
Definition: TriggerEvent.h:78
trigger::TriggerEvent::collectionKey
trigger::size_type collectionKey(trigger::size_type index) const
Definition: TriggerEvent.h:107
trigger::TriggerEvent::addCollections
void addCollections(const std::vector< std::string > &collectionTags, const Keys &collectionKeys)
Definition: TriggerEvent.h:87
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
trigger::TriggerEvent::filterLabel
std::string filterLabel(trigger::size_type index) const
Definition: TriggerEvent.h:112
trigger::TriggerEvent::filterTag
const edm::InputTag filterTag(trigger::size_type index) const
Definition: TriggerEvent.h:108
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
trigger::TriggerEvent::TriggerFilterObject::filterKeys_
Keys filterKeys_
indices pointing into collection of unique TriggerObjects
Definition: TriggerEvent.h:35
trigger::TriggerEvent::triggerObjects_
TriggerObjectCollection triggerObjects_
collection of all unique physics objects (linearised vector)
Definition: TriggerEvent.h:53
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
trigger::TriggerEvent::collectionKeys_
Keys collectionKeys_
1-past-end indices into linearised vector
Definition: TriggerEvent.h:51
trigger::TriggerEvent::triggerFilters_
std::vector< TriggerFilterObject > triggerFilters_
collection of all TriggerFilterObjects
Definition: TriggerEvent.h:55
trigger::TriggerEvent::TriggerFilterObject::TriggerFilterObject
TriggerFilterObject(const edm::InputTag &filterTag)
Definition: TriggerEvent.h:38
trigger::TriggerEvent::sizeCollections
trigger::size_type sizeCollections() const
other
Definition: TriggerEvent.h:144
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
trigger::TriggerObjectCollection
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
trigger::TriggerEvent::usedProcessName_
std::string usedProcessName_
data members
Definition: TriggerEvent.h:47
trigger::TriggerEvent::filterIndex
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:132
trigger::Keys
std::vector< size_type > Keys
Definition: TriggerTypeDefs.h:19
edm::InputTag::encode
std::string encode() const
Definition: InputTag.cc:159
trigger::TriggerEvent::addFilter
void addFilter(const edm::InputTag &filterTag, const Vids &filterIds, const Keys &filterKeys)
Definition: TriggerEvent.h:93
trigger::TriggerEvent
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
edm::DoNotRecordParents
Definition: traits.h:95
trigger::TriggerEvent::getObjects
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:101
trigger::TriggerEvent::sizeObjects
trigger::size_type sizeObjects() const
Definition: TriggerEvent.h:145
trigger::TriggerEvent::filterIds
const Vids & filterIds(trigger::size_type index) const
Definition: TriggerEvent.h:117
TriggerObject.h
InputTag.h
trigger::TriggerEvent::filterTagEncoded
const std::string & filterTagEncoded(trigger::size_type index) const
Definition: TriggerEvent.h:111
alcaDQMUpload.encode
def encode(args, files)
Definition: alcaDQMUpload.py:32
trigger::TriggerEvent::addObjects
void addObjects(const TriggerObjectCollection &triggerObjects)
setters
Definition: TriggerEvent.h:74
trigger::TriggerEvent::TriggerEvent
TriggerEvent(const std::string &usedProcessName, trigger::size_type nc, trigger::size_type no, trigger::size_type nf)
Definition: TriggerEvent.h:61
trigger::TriggerEvent::collectionIndex
trigger::size_type collectionIndex(const edm::InputTag &collectionTag) const
find index of collection from collection tag
Definition: TriggerEvent.h:121
trigger::TriggerEvent::usedProcessName
const std::string & usedProcessName() const
getters
Definition: TriggerEvent.h:98
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
trigger
Definition: HLTPrescaleTableCond.h:8
traits.h
trigger::TriggerEvent::TriggerFilterObject
Helper class: recording trigger objects firing a single filter.
Definition: TriggerEvent.h:28
trigger::TriggerEvent::TriggerEvent
TriggerEvent()
methods
Definition: TriggerEvent.h:60
edm::InputTag
Definition: InputTag.h:15