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_.size() > 0 && pathLastFilterAccepted_.size() == pathNames_.size() ); };
81  bool hasL3Filter() const { return ( pathL3FilterAccepted_.size() > 0 && 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 );
103 
106 
108 
110  void addFilterLabel( const std::string & filterLabel ) { addFilterOrCondition( filterLabel ); };
112  void addConditionName( const std::string & conditionName ) { addFilterOrCondition( conditionName ); };
114  void addPathName( const std::string & pathName, bool pathLastFilterAccepted = true, bool pathL3FilterAccepted = true ) { addPathOrAlgorithm( pathName, pathLastFilterAccepted, pathL3FilterAccepted ); };
116  void addAlgorithmName( const std::string & algorithmName, bool algoCondAccepted = true ) { addPathOrAlgorithm( algorithmName, algoCondAccepted, false ); };
118  const std::vector< std::string > & filterLabels() const { return filtersOrConditions(); };
120  const std::vector< std::string > & conditionNames() const { return filtersOrConditions(); };
122  std::vector< std::string > pathNames( bool pathLastFilterAccepted = false, bool pathL3FilterAccepted = true ) const { return pathsOrAlgorithms( pathLastFilterAccepted, pathL3FilterAccepted ); };
124  std::vector< std::string > algorithmNames( bool algoCondAccepted = true ) const { return pathsOrAlgorithms( algoCondAccepted, false ); };
126  TriggerObject triggerObject();
128  bool hasFilterLabel( const std::string & filterLabel ) const { return hasFilterOrCondition( filterLabel ); };
130  bool hasConditionName( const std::string & conditionName ) const { return hasFilterOrCondition( conditionName ); };
132  bool hasPathName( const std::string & pathName, bool pathLastFilterAccepted = false, bool pathL3FilterAccepted = true ) const { return hasPathOrAlgorithm( pathName, pathLastFilterAccepted, pathL3FilterAccepted ); };
134  bool hasAlgorithmName( const std::string & algorithmName, bool algoCondAccepted = true ) const { return hasPathOrAlgorithm( algorithmName, algoCondAccepted, false ); };
136  virtual bool hasCollection( const std::string & collName ) const;
137  virtual bool hasCollection( const edm::InputTag & collName ) const { return hasCollection( collName.encode() ); };
139  bool hasPathLastFilterAccepted() const { return hasLastFilter(); };
140  bool hasAlgoCondAccepted() const { return hasLastFilter(); };
141  bool hasPathL3FilterAccepted() const { return hasL3Filter(); };
142 
146 
148  bool filter( const std::string & filterLabel ) const { return hasFilterLabel( filterLabel ); };
150  bool cond( const std::string & conditionName ) const { return hasConditionName( conditionName ); };
152  bool path( const std::string & pathName, unsigned pathLastFilterAccepted = 0, unsigned pathL3FilterAccepted = 1 ) const { return hasPathName( pathName, bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ) ); };
154  bool algo( const std::string & algorithmName, unsigned algoCondAccepted = 1 ) const { return hasAlgorithmName( algorithmName, bool( algoCondAccepted ) ); };
156  virtual bool coll( const std::string & collName ) const { return hasCollection( collName ); };
157 
159  void setPSetID(const edm::ParameterSetID &psetId){psetId_=psetId;}
160 
161  const edm::ParameterSetID &psetID() const {return psetId_;}
162 
163 
166  void packPathNames(const edm::TriggerNames &names) ;
168  void unpackPathNames(const edm::TriggerNames &names) ;
170  void packFilterLabels(const std::vector<std::string> &labels) ;
172  void unpackFilterLabels(const std::vector<std::string> &labels) ;
174  void unpackFilterLabels(const edm::EventBase & event,const edm::TriggerResults &res) ;
176  void unpackNamesAndLabels(const edm::EventBase & event,const edm::TriggerResults &res);
177 
179  void packP4();
180 
181  std::vector<std::string> const* allLabels(edm::ParameterSetID const& psetid,const edm::EventBase & event,const edm::TriggerResults &res) const ;
182 
183  };
184 
185 
187  typedef std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection;
198 
199 }
200 
201 
202 #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)
Methods.
Definition: Electron.h:4
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.
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_
virtual bool coll(const std::string &collName) const
Calls &#39;hasCollection(...)&#39; (method override)
virtual bool hasCollection(const edm::InputTag &collName) const
virtual ~TriggerObjectStandAlone()
Destructor.
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.