CMS 3D CMS Logo

TriggerObjectStandAlone.h
Go to the documentation of this file.
1 #ifndef DataFormats_PatCandidates_TriggerObjectStandAlone_h
2 #define DataFormats_PatCandidates_TriggerObjectStandAlone_h
3 
4 // -*- C++ -*-
5 //
6 // Package: PatCandidates
7 // Class: pat::TriggerObjectStandAlone
8 //
9 //
26 namespace edm {
27  class TriggerNames;
28 }
29 
30 namespace pat {
31 
36 
38  std::vector<std::string> filterLabels_;
39  std::vector<uint16_t> filterLabelIndices_;
40 
42  std::vector<std::string> pathNames_;
43  std::vector<uint16_t> pathIndices_;
44 
49  std::vector<bool> pathLastFilterAccepted_;
53  std::vector<bool> pathL3FilterAccepted_;
54 
56 
58 
60  static const char wildcard_ = '*';
61 
63 
65  bool hasAnyName(const std::string &name, const std::vector<std::string> &nameVec) const;
69  filterLabels_.push_back(name);
70  };
72  void addPathOrAlgorithm(const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted);
74  const std::vector<std::string> &filtersOrConditions() const {
76  return filterLabels_;
77  };
79  std::vector<std::string> pathsOrAlgorithms(bool pathLastFilterAccepted, bool pathL3FilterAccepted) const;
81  bool hasFilterOrCondition(const std::string &name) const;
83  bool hasPathOrAlgorithm(const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted) const;
85  bool hasLastFilter() const {
86  return (!pathLastFilterAccepted_.empty() && pathLastFilterAccepted_.size() == pathNames_.size());
87  };
88  bool hasL3Filter() const {
89  return (!pathL3FilterAccepted_.empty() && pathL3FilterAccepted_.size() == pathNames_.size());
90  };
91 
93  bool checkIfPathsAreUnpacked(bool throwIfPacked = true) const;
95  bool checkIfFiltersAreUnpacked(bool throwIfPacked = true) const;
96 
97  public:
99 
103  TriggerObjectStandAlone(const TriggerObject &trigObj);
112 
115 
117 
118  TriggerObjectStandAlone copy() const { return *this; }
119 
123  void addConditionName(const std::string &conditionName) { addFilterOrCondition(conditionName); };
126  bool pathLastFilterAccepted = true,
127  bool pathL3FilterAccepted = true) {
128  addPathOrAlgorithm(pathName, pathLastFilterAccepted, pathL3FilterAccepted);
129  };
131  void addAlgorithmName(const std::string &algorithmName, bool algoCondAccepted = true) {
132  addPathOrAlgorithm(algorithmName, algoCondAccepted, false);
133  };
135  const std::vector<std::string> &filterLabels() const { return filtersOrConditions(); };
137  const std::vector<std::string> &conditionNames() const { return filtersOrConditions(); };
139  std::vector<std::string> pathNames(bool pathLastFilterAccepted = false, bool pathL3FilterAccepted = true) const {
140  return pathsOrAlgorithms(pathLastFilterAccepted, pathL3FilterAccepted);
141  };
143  std::vector<std::string> algorithmNames(bool algoCondAccepted = true) const {
144  return pathsOrAlgorithms(algoCondAccepted, false);
145  };
151  bool hasConditionName(const std::string &conditionName) const { return hasFilterOrCondition(conditionName); };
154  bool pathLastFilterAccepted = false,
155  bool pathL3FilterAccepted = true) const {
156  return hasPathOrAlgorithm(pathName, pathLastFilterAccepted, pathL3FilterAccepted);
157  };
159  bool hasAlgorithmName(const std::string &algorithmName, bool algoCondAccepted = true) const {
160  return hasPathOrAlgorithm(algorithmName, algoCondAccepted, false);
161  };
163  bool hasCollection(const std::string &collName) const override;
164  bool hasCollection(const edm::InputTag &collName) const override { return hasCollection(collName.encode()); };
166  bool hasPathLastFilterAccepted() const { return hasLastFilter(); };
167  bool hasAlgoCondAccepted() const { return hasLastFilter(); };
168  bool hasPathL3FilterAccepted() const { return hasL3Filter(); };
169 
173 
175  bool filter(const std::string &filterLabel) const { return hasFilterLabel(filterLabel); };
177  bool cond(const std::string &conditionName) const { return hasConditionName(conditionName); };
179  bool path(const std::string &pathName,
180  unsigned pathLastFilterAccepted = 0,
181  unsigned pathL3FilterAccepted = 1) const {
182  return hasPathName(pathName, bool(pathLastFilterAccepted), bool(pathL3FilterAccepted));
183  };
185  bool algo(const std::string &algorithmName, unsigned algoCondAccepted = 1) const {
186  return hasAlgorithmName(algorithmName, bool(algoCondAccepted));
187  };
189  bool coll(const std::string &collName) const override { return hasCollection(collName); };
190 
192  void setPSetID(const edm::ParameterSetID &psetId) { psetId_ = psetId; }
193 
194  const edm::ParameterSetID &psetID() const { return psetId_; }
195 
202  void packFilterLabels(const std::vector<std::string> &labels);
204  void unpackFilterLabels(const std::vector<std::string> &labels);
209 
211  void packP4();
212 
213  std::vector<std::string> const *allLabels(edm::ParameterSetID const &psetid,
214  const edm::EventBase &event,
215  const edm::TriggerResults &res) const;
216  };
217 
219  typedef std::vector<TriggerObjectStandAlone> TriggerObjectStandAloneCollection;
230 
231 } // namespace pat
232 
233 #endif
edm::RefProd
Definition: EDProductfwd.h:25
TriggerObject
Definition: TriggerObject.py:1
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
pat::TriggerObjectStandAlone::hasAlgorithmName
bool hasAlgorithmName(const std::string &algorithmName, bool algoCondAccepted=true) const
Checks, if a certain L1 algorithm name is assigned.
Definition: TriggerObjectStandAlone.h:159
pat::TriggerObjectStandAlone::hasPathName
bool hasPathName(const std::string &pathName, bool pathLastFilterAccepted=false, bool pathL3FilterAccepted=true) const
Checks, if a certain HLT path name is assigned.
Definition: TriggerObjectStandAlone.h:153
pat::TriggerObjectStandAlone::unpackFilterLabels
void unpackFilterLabels(const std::vector< std::string > &labels)
unpack filter labels from indices
Definition: TriggerObjectStandAlone.cc:363
pat::TriggerObjectStandAloneRefVectorIterator
edm::RefVectorIterator< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRefVectorIterator
Const iterator over vector of persistent references to items in the same TriggerObjectStandAloneColle...
Definition: TriggerObjectStandAlone.h:227
TriggerResults.h
pat::TriggerObjectStandAlone::packP4
void packP4()
reduce the precision on the 4-vector
Definition: TriggerObjectStandAlone.cc:380
pat::TriggerObjectStandAloneMatch
edm::Association< TriggerObjectStandAloneCollection > TriggerObjectStandAloneMatch
Association of TriggerObjectStandAlones to store matches to Candidates.
Definition: TriggerObjectStandAlone.h:229
pat::TriggerObjectStandAlone::conditionNames
const std::vector< std::string > & conditionNames() const
Gets all L1 condition names.
Definition: TriggerObjectStandAlone.h:137
pat::TriggerObjectStandAlone
Analysis-level trigger object class (stand-alone)
Definition: TriggerObjectStandAlone.h:32
pat::TriggerObjectStandAlone::addPathName
void addPathName(const std::string &pathName, bool pathLastFilterAccepted=true, bool pathL3FilterAccepted=true)
Adds a new HLT path name.
Definition: TriggerObjectStandAlone.h:125
edm
HLT enums.
Definition: AlignableModifier.h:19
pat::TriggerObjectStandAlone::hasFilterOrCondition
bool hasFilterOrCondition(const std::string &name) const
Checks, if a certain HLT filter label or L1 condition name is assigned.
Definition: TriggerObjectStandAlone.cc:183
pat::TriggerObjectStandAlone::checkIfFiltersAreUnpacked
bool checkIfFiltersAreUnpacked(bool throwIfPacked=true) const
Check if trigger names have been packed by calling packFilterLabels() and not yet unpacked.
Definition: TriggerObjectStandAlone.cc:268
pat::TriggerObjectStandAlone::allLabels
const std::vector< std::string > * allLabels(edm::ParameterSetID const &psetid, const edm::EventBase &event, const edm::TriggerResults &res) const
Definition: TriggerObjectStandAlone.cc:395
trigObjTnPSource_cfi.collName
collName
Definition: trigObjTnPSource_cfi.py:66
pat::TriggerObjectStandAloneRefProd
edm::RefProd< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRefProd
Persistent reference to a TriggerObjectStandAloneCollection product.
Definition: TriggerObjectStandAlone.h:223
edm::RefVector
Definition: EDProductfwd.h:27
pat::TriggerObjectStandAlone::hasFilterLabel
bool hasFilterLabel(const std::string &filterLabel) const
Checks, if a certain HLT filter label is assigned.
Definition: TriggerObjectStandAlone.h:149
pat::TriggerObjectStandAlone::coll
bool coll(const std::string &collName) const override
Calls 'hasCollection(...)' (method override)
Definition: TriggerObjectStandAlone.h:189
pat::TriggerObjectStandAlone::setPSetID
void setPSetID(const edm::ParameterSetID &psetId)
set the psetid of the trigger process
Definition: TriggerObjectStandAlone.h:192
EventBase.h
pat::TriggerObjectStandAloneRefVector
edm::RefVector< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRefVector
Vector of persistent references to items in the same TriggerObjectStandAloneCollection.
Definition: TriggerObjectStandAlone.h:225
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
pat::TriggerObjectStandAlone::addFilterOrCondition
void addFilterOrCondition(const std::string &name)
Adds a new HLT filter label or L1 condition name.
Definition: TriggerObjectStandAlone.h:67
pat::TriggerObjectStandAlone::path
bool path(const std::string &pathName, unsigned pathLastFilterAccepted=0, unsigned pathL3FilterAccepted=1) const
Calls 'hasPathName(...)'.
Definition: TriggerObjectStandAlone.h:179
pat::TriggerObjectStandAlone::addPathOrAlgorithm
void addPathOrAlgorithm(const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted)
Adds a new HLT path or L1 algorithm name.
Definition: TriggerObjectStandAlone.cc:128
edm::Ref
Definition: AssociativeIterator.h:58
pat::TriggerObjectStandAlone::packPathNames
void packPathNames(const edm::TriggerNames &names)
pack trigger names into indices
Definition: TriggerObjectStandAlone.cc:278
pat::TriggerObjectStandAlone::filterLabels
const std::vector< std::string > & filterLabels() const
Gets all HLT filter labels.
Definition: TriggerObjectStandAlone.h:135
pat::TriggerObjectStandAlone::filterLabelIndices_
std::vector< uint16_t > filterLabelIndices_
Definition: TriggerObjectStandAlone.h:39
pat::TriggerObjectStandAlone::hasPathOrAlgorithm
bool hasPathOrAlgorithm(const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
Checks, if a certain HLT path or L1 algorithm name is assigned.
Definition: TriggerObjectStandAlone.cc:194
pat::TriggerObjectStandAlone::triggerObject
TriggerObject triggerObject()
Gets the pat::TriggerObject (parent class)
Definition: TriggerObjectStandAlone.cc:223
pat::TriggerObjectStandAlone::hasLastFilter
bool hasLastFilter() const
Check, if the usage indicator vectors have been filled.
Definition: TriggerObjectStandAlone.h:85
pat::TriggerObjectStandAloneRef
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
Definition: TriggerObjectStandAlone.h:221
hltMonBTagIPClient_cfi.pathName
pathName
Definition: hltMonBTagIPClient_cfi.py:5
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
pat::TriggerObjectStandAlone::hasPathLastFilterAccepted
bool hasPathLastFilterAccepted() const
Checks, if the usage indicator vector has been filled.
Definition: TriggerObjectStandAlone.h:166
pat::TriggerObjectStandAlone::TriggerObjectStandAlone
TriggerObjectStandAlone()
Constructors and Destructor.
Definition: TriggerObjectStandAlone.cc:23
pat::TriggerObjectStandAlone::copy
TriggerObjectStandAlone copy() const
Methods.
Definition: TriggerObjectStandAlone.h:118
pat::TriggerObjectStandAlone::algo
bool algo(const std::string &algorithmName, unsigned algoCondAccepted=1) const
Calls 'hasAlgorithmName(...)'.
Definition: TriggerObjectStandAlone.h:185
pat::TriggerObjectStandAlone::pathL3FilterAccepted_
std::vector< bool > pathL3FilterAccepted_
Definition: TriggerObjectStandAlone.h:53
edm::Hash< ParameterSetType >
pat::TriggerObjectStandAlone::hasPathL3FilterAccepted
bool hasPathL3FilterAccepted() const
Definition: TriggerObjectStandAlone.h:168
reco::Particle::PolarLorentzVector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:23
pat::TriggerObjectStandAlone::hasConditionName
bool hasConditionName(const std::string &conditionName) const
Checks, if a certain L1 condition name is assigned.
Definition: TriggerObjectStandAlone.h:151
trigger::TriggerObject
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
pat::TriggerObjectStandAlone::psetId_
edm::ParameterSetID psetId_
Definition: TriggerObjectStandAlone.h:55
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_FULL_cff.filterLabel
filterLabel
Definition: HLT_FULL_cff.py:89708
pat::TriggerObjectStandAlone::wildcard_
static const char wildcard_
Constants.
Definition: TriggerObjectStandAlone.h:60
pat::TriggerObjectStandAlone::hasCollection
bool hasCollection(const edm::InputTag &collName) const override
Definition: TriggerObjectStandAlone.h:164
pat::TriggerObjectStandAlone::pathsOrAlgorithms
std::vector< std::string > pathsOrAlgorithms(bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
Gets all HLT path or L1 algorithm names.
Definition: TriggerObjectStandAlone.cc:158
pat::TriggerObjectStandAlone::addAlgorithmName
void addAlgorithmName(const std::string &algorithmName, bool algoCondAccepted=true)
Adds a new L1 algorithm name.
Definition: TriggerObjectStandAlone.h:131
pat::TriggerObjectStandAloneCollection
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
Definition: TriggerObjectStandAlone.h:219
pat::TriggerObjectStandAlone::unpackPathNames
void unpackPathNames(const edm::TriggerNames &names)
unpack trigger names into indices
Definition: TriggerObjectStandAlone.cc:308
edm::Association
Definition: Association.h:18
pat
Definition: HeavyIon.h:7
res
Definition: Electron.h:6
pat::TriggerObjectStandAlone::addConditionName
void addConditionName(const std::string &conditionName)
Adds a new L1 condition name.
Definition: TriggerObjectStandAlone.h:123
pat::TriggerObjectStandAlone::hasAlgoCondAccepted
bool hasAlgoCondAccepted() const
Definition: TriggerObjectStandAlone.h:167
pat::TriggerObjectStandAlone::filterLabels_
std::vector< std::string > filterLabels_
Vector of labels of all HLT filters or names of L1 conditions the trigger objects has been used in.
Definition: TriggerObjectStandAlone.h:38
pat::TriggerObjectStandAlone::filtersOrConditions
const std::vector< std::string > & filtersOrConditions() const
Gets all HLT filter labels or L1 condition names.
Definition: TriggerObjectStandAlone.h:74
pat::TriggerObjectStandAlone::~TriggerObjectStandAlone
~TriggerObjectStandAlone() override
Destructor.
Definition: TriggerObjectStandAlone.h:114
pat::TriggerObjectStandAlone::unpackNamesAndLabels
void unpackNamesAndLabels(const edm::EventBase &event, const edm::TriggerResults &res)
unpack both filter labels and trigger names
Definition: TriggerObjectStandAlone.cc:354
edm::EventBase
Definition: EventBase.h:46
pat::TriggerObjectStandAlone::hasCollection
bool hasCollection(const std::string &collName) const override
Checks, if a certain label of original collection is assigned (method overrides)
Definition: TriggerObjectStandAlone.cc:235
edm::RefVectorIterator
Definition: EDProductfwd.h:33
edm::TriggerNames
Definition: TriggerNames.h:55
pat::TriggerObjectStandAlone::pathLastFilterAccepted_
std::vector< bool > pathLastFilterAccepted_
Definition: TriggerObjectStandAlone.h:49
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
pat::TriggerObjectStandAlone::hasL3Filter
bool hasL3Filter() const
Definition: TriggerObjectStandAlone.h:88
pat::TriggerObjectStandAlone::algorithmNames
std::vector< std::string > algorithmNames(bool algoCondAccepted=true) const
Gets all L1 algorithm names.
Definition: TriggerObjectStandAlone.h:143
pat::TriggerObjectStandAlone::addFilterLabel
void addFilterLabel(const std::string &filterLabel)
Adds a new HLT filter label.
Definition: TriggerObjectStandAlone.h:121
pat::TriggerObjectStandAlone::hasAnyName
bool hasAnyName(const std::string &name, const std::vector< std::string > &nameVec) const
Private methods.
Definition: TriggerObjectStandAlone.cc:79
pat::TriggerObjectStandAlone::pathNames_
std::vector< std::string > pathNames_
Vector of names of all HLT paths or L1 algorithms the trigger objects has been used in.
Definition: TriggerObjectStandAlone.h:42
pat::TriggerObjectStandAlone::psetID
const edm::ParameterSetID & psetID() const
Definition: TriggerObjectStandAlone.h:194
reco::LeafCandidate
Definition: LeafCandidate.h:16
event
Definition: event.py:1
pat::TriggerObjectStandAlone::filter
bool filter(const std::string &filterLabel) const
Calls 'hasFilterLabel(...)'.
Definition: TriggerObjectStandAlone.h:175
pat::TriggerObjectStandAlone::pathIndices_
std::vector< uint16_t > pathIndices_
Definition: TriggerObjectStandAlone.h:43
pat::TriggerObjectStandAlone::cond
bool cond(const std::string &conditionName) const
Calls 'hasConditionName(...)'.
Definition: TriggerObjectStandAlone.h:177
edm::InputTag
Definition: InputTag.h:15
edm::TriggerResults
Definition: TriggerResults.h:35
pat::TriggerObjectStandAlone::packFilterLabels
void packFilterLabels(const edm::EventBase &event, const edm::TriggerResults &res)
Definition: TriggerObjectStandAlone.cc:376
pat::TriggerObjectStandAlone::checkIfPathsAreUnpacked
bool checkIfPathsAreUnpacked(bool throwIfPacked=true) const
Check if trigger names have been packed by calling packPathNames() and not yet unpacked.
Definition: TriggerObjectStandAlone.cc:259
pat::TriggerObjectStandAlone::pathNames
std::vector< std::string > pathNames(bool pathLastFilterAccepted=false, bool pathL3FilterAccepted=true) const
Gets all HLT path names.
Definition: TriggerObjectStandAlone.h:139
TriggerObject.h