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 
5 // -*- C++ -*-
6 //
7 // Package: PatCandidates
8 // Class: pat::TriggerObjectStandAlone
9 //
10 //
28 namespace edm { class TriggerNames; }
29 
30 namespace pat {
31 
33 
37 
39  std::vector< std::string > filterLabels_;
40  std::vector< uint16_t > filterLabelIndices_;
41 
43  std::vector< std::string > pathNames_;
44  std::vector< uint16_t > pathIndices_;
45 
50  std::vector< bool > pathLastFilterAccepted_;
54  std::vector< bool > pathL3FilterAccepted_;
55 
57 
59 
61  static const char wildcard_ = '*';
62 
64 
66  bool hasAnyName( const std::string & name, const std::vector< std::string > & nameVec ) const;
68  void addFilterOrCondition( const std::string & name ) { if ( ! hasFilterOrCondition( name ) ) filterLabels_.push_back( name ); };
70  void addPathOrAlgorithm( const std::string & name, bool pathLastFilterAccepted, bool pathL3FilterAccepted );
72  const std::vector< std::string > & filtersOrConditions() const { checkIfFiltersAreUnpacked(); return filterLabels_; };
74  std::vector< std::string > pathsOrAlgorithms( bool pathLastFilterAccepted, bool pathL3FilterAccepted ) const;
76  bool hasFilterOrCondition( const std::string & name ) const;
78  bool hasPathOrAlgorithm( const std::string & name, bool pathLastFilterAccepted, bool pathL3FilterAccepted ) const;
80  bool hasLastFilter() const { return ( !pathLastFilterAccepted_.empty() && pathLastFilterAccepted_.size() == pathNames_.size() ); };
81  bool hasL3Filter() const { return ( !pathL3FilterAccepted_.empty() && pathL3FilterAccepted_.size() == pathNames_.size() ); };
82 
84  bool checkIfPathsAreUnpacked(bool throwIfPacked=true) const ;
86  bool checkIfFiltersAreUnpacked(bool throwIfPacked=true) const ;
87 
88  public:
89 
91 
95  TriggerObjectStandAlone( const TriggerObject & trigObj );
99  TriggerObjectStandAlone( const reco::LeafCandidate & leafCand );
101  TriggerObjectStandAlone( const reco::Particle::LorentzVector & vec, int id = 0 );
104 
107 
109 
111  return *this;
112  }
113 
115  void addFilterLabel( const std::string & filterLabel ) { addFilterOrCondition( filterLabel ); };
117  void addConditionName( const std::string & conditionName ) { addFilterOrCondition( conditionName ); };
119  void addPathName( const std::string & pathName, bool pathLastFilterAccepted = true, bool pathL3FilterAccepted = true ) { addPathOrAlgorithm( pathName, pathLastFilterAccepted, pathL3FilterAccepted ); };
121  void addAlgorithmName( const std::string & algorithmName, bool algoCondAccepted = true ) { addPathOrAlgorithm( algorithmName, algoCondAccepted, false ); };
123  const std::vector< std::string > & filterLabels() const { return filtersOrConditions(); };
125  const std::vector< std::string > & conditionNames() const { return filtersOrConditions(); };
127  std::vector< std::string > pathNames( bool pathLastFilterAccepted = false, bool pathL3FilterAccepted = true ) const { return pathsOrAlgorithms( pathLastFilterAccepted, pathL3FilterAccepted ); };
129  std::vector< std::string > algorithmNames( bool algoCondAccepted = true ) const { return pathsOrAlgorithms( algoCondAccepted, false ); };
131  TriggerObject triggerObject();
133  bool hasFilterLabel( const std::string & filterLabel ) const { return hasFilterOrCondition( filterLabel ); };
135  bool hasConditionName( const std::string & conditionName ) const { return hasFilterOrCondition( conditionName ); };
137  bool hasPathName( const std::string & pathName, bool pathLastFilterAccepted = false, bool pathL3FilterAccepted = true ) const { return hasPathOrAlgorithm( pathName, pathLastFilterAccepted, pathL3FilterAccepted ); };
139  bool hasAlgorithmName( const std::string & algorithmName, bool algoCondAccepted = true ) const { return hasPathOrAlgorithm( algorithmName, algoCondAccepted, false ); };
141  bool hasCollection( const std::string & collName ) const override;
142  bool hasCollection( const edm::InputTag & collName ) const override { return hasCollection( collName.encode() ); };
144  bool hasPathLastFilterAccepted() const { return hasLastFilter(); };
145  bool hasAlgoCondAccepted() const { return hasLastFilter(); };
146  bool hasPathL3FilterAccepted() const { return hasL3Filter(); };
147 
151 
153  bool filter( const std::string & filterLabel ) const { return hasFilterLabel( filterLabel ); };
155  bool cond( const std::string & conditionName ) const { return hasConditionName( conditionName ); };
157  bool path( const std::string & pathName, unsigned pathLastFilterAccepted = 0, unsigned pathL3FilterAccepted = 1 ) const { return hasPathName( pathName, bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ) ); };
159  bool algo( const std::string & algorithmName, unsigned algoCondAccepted = 1 ) const { return hasAlgorithmName( algorithmName, bool( algoCondAccepted ) ); };
161  bool coll( const std::string & collName ) const override { return hasCollection( collName ); };
162 
164  void setPSetID(const edm::ParameterSetID &psetId){psetId_=psetId;}
165 
166  const edm::ParameterSetID &psetID() const {return psetId_;}
167 
168 
171  void packPathNames(const edm::TriggerNames &names) ;
173  void unpackPathNames(const edm::TriggerNames &names) ;
175  void packFilterLabels(const std::vector<std::string> &labels) ;
177  void unpackFilterLabels(const std::vector<std::string> &labels) ;
179  void unpackFilterLabels(const edm::EventBase & event,const edm::TriggerResults &res) ;
181  void unpackNamesAndLabels(const edm::EventBase & event,const edm::TriggerResults &res);
182 
184  void packP4();
185 
186  std::vector<std::string> const* allLabels(edm::ParameterSetID const& psetid,const edm::EventBase & event,const edm::TriggerResults &res) const ;
187 
188  };
189 
190 
192  typedef std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection;
203 
204 }
205 
206 
207 #endif
edm::RefVector< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRefVector
Vector of persistent references to items in the same TriggerObjectStandAloneCollection.
bool hasPathName(const std::string &pathName, bool pathLastFilterAccepted=false, bool pathL3FilterAccepted=true) const
Checks, if a certain HLT path name is assigned.
static const HistoName names[]
edm::RefVectorIterator< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRefVectorIterator
Const iterator over vector of persistent references to items in the same TriggerObjectStandAloneColle...
bool algo(const std::string &algorithmName, unsigned algoCondAccepted=1) const
Calls &#39;hasAlgorithmName(...)&#39;.
std::vector< std::string > pathNames_
Vector of names of all HLT paths or L1 algorithms the trigger objects has been used in...
const std::vector< std::string > & filterLabels() const
Gets all HLT filter labels.
std::vector< std::string > algorithmNames(bool algoCondAccepted=true) const
Gets all L1 algorithm names.
std::vector< std::string > filterLabels_
Vector of labels of all HLT filters or names of L1 conditions the trigger objects has been used in...
void addAlgorithmName(const std::string &algorithmName, bool algoCondAccepted=true)
Adds a new L1 algorithm name.
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
std::vector< std::string > pathNames(bool pathLastFilterAccepted=false, bool pathL3FilterAccepted=true) const
Gets all HLT path names.
std::string encode() const
Definition: InputTag.cc:166
void addConditionName(const std::string &conditionName)
Adds a new L1 condition name.
void addFilterLabel(const std::string &filterLabel)
Adds a new HLT filter label.
Definition: Electron.h:6
TriggerObjectStandAlone copy() const
Methods.
Definition: HeavyIon.h:7
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
bool path(const std::string &pathName, unsigned pathLastFilterAccepted=0, unsigned pathL3FilterAccepted=1) const
Calls &#39;hasPathName(...)&#39;.
bool hasAlgorithmName(const std::string &algorithmName, bool algoCondAccepted=true) const
Checks, if a certain L1 algorithm name is assigned.
void addPathName(const std::string &pathName, bool pathLastFilterAccepted=true, bool pathL3FilterAccepted=true)
Adds a new HLT path name.
bool coll(const std::string &collName) const override
Calls &#39;hasCollection(...)&#39; (method override)
void setPSetID(const edm::ParameterSetID &psetId)
set the psetid of the trigger process
edm::Association< TriggerObjectStandAloneCollection > TriggerObjectStandAloneMatch
Association of TriggerObjectStandAlones to store matches to Candidates.
bool hasPathLastFilterAccepted() const
Checks, if the usage indicator vector has been filled.
const std::vector< std::string > & filtersOrConditions() const
Gets all HLT filter labels or L1 condition names.
bool hasLastFilter() const
Check, if the usage indicator vectors have been filled.
bool hasFilterLabel(const std::string &filterLabel) const
Checks, if a certain HLT filter label is assigned.
bool hasConditionName(const std::string &conditionName) const
Checks, if a certain L1 condition name is assigned.
std::vector< bool > pathL3FilterAccepted_
const std::vector< std::string > & conditionNames() const
Gets all L1 condition names.
bool cond(const std::string &conditionName) const
Calls &#39;hasConditionName(...)&#39;.
void addFilterOrCondition(const std::string &name)
Adds a new HLT filter label or L1 condition name.
const edm::ParameterSetID & psetID() const
bool filter(const std::string &filterLabel) const
Calls &#39;hasFilterLabel(...)&#39;.
HLT enums.
std::vector< uint16_t > pathIndices_
edm::RefProd< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRefProd
Persistent reference to a TriggerObjectStandAloneCollection product.
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:23
std::vector< uint16_t > filterLabelIndices_
bool hasCollection(const edm::InputTag &collName) const override
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
std::vector< bool > pathLastFilterAccepted_
Definition: event.py:1
Analysis-level trigger object class (stand-alone)
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
~TriggerObjectStandAlone() override
Destructor.