CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 //
26 namespace edm { class TriggerNames; }
27 
28 namespace pat {
29 
31 
35 
37  std::vector< std::string > filterLabels_;
39  std::vector< std::string > pathNames_;
40  std::vector< uint16_t > pathIndices_;
41 
46  std::vector< bool > pathLastFilterAccepted_;
50  std::vector< bool > pathL3FilterAccepted_;
51 
53 
55  static const char wildcard_ = '*';
56 
58 
60  bool hasAnyName( const std::string & name, const std::vector< std::string > & nameVec ) const;
62  void addFilterOrCondition( const std::string & name ) { if ( ! hasFilterOrCondition( name ) ) filterLabels_.push_back( name ); };
64  void addPathOrAlgorithm( const std::string & name, bool pathLastFilterAccepted, bool pathL3FilterAccepted );
66  const std::vector< std::string > & filtersOrConditions() const { return filterLabels_; };
68  std::vector< std::string > pathsOrAlgorithms( bool pathLastFilterAccepted, bool pathL3FilterAccepted ) const;
70  bool hasFilterOrCondition( const std::string & name ) const;
72  bool hasPathOrAlgorithm( const std::string & name, bool pathLastFilterAccepted, bool pathL3FilterAccepted ) const;
74  bool hasLastFilter() const { return ( pathLastFilterAccepted_.size() > 0 && pathLastFilterAccepted_.size() == pathNames_.size() ); };
75  bool hasL3Filter() const { return ( pathL3FilterAccepted_.size() > 0 && pathL3FilterAccepted_.size() == pathNames_.size() ); };
76 
78  bool checkIfPathsAreUnpacked(bool throwIfPacked=true) const ;
79 
80  public:
81 
83 
87  TriggerObjectStandAlone( const TriggerObject & trigObj );
91  TriggerObjectStandAlone( const reco::LeafCandidate & leafCand );
93  TriggerObjectStandAlone( const reco::Particle::LorentzVector & vec, int id = 0 );
95 
98 
100 
102  void addFilterLabel( const std::string & filterLabel ) { addFilterOrCondition( filterLabel ); };
104  void addConditionName( const std::string & conditionName ) { addFilterOrCondition( conditionName ); };
106  void addPathName( const std::string & pathName, bool pathLastFilterAccepted = true, bool pathL3FilterAccepted = true ) { addPathOrAlgorithm( pathName, pathLastFilterAccepted, pathL3FilterAccepted ); };
108  void addAlgorithmName( const std::string & algorithmName, bool algoCondAccepted = true ) { addPathOrAlgorithm( algorithmName, algoCondAccepted, false ); };
110  const std::vector< std::string > & filterLabels() const { return filtersOrConditions(); };
112  const std::vector< std::string > & conditionNames() const { return filtersOrConditions(); };
114  std::vector< std::string > pathNames( bool pathLastFilterAccepted = false, bool pathL3FilterAccepted = true ) const { return pathsOrAlgorithms( pathLastFilterAccepted, pathL3FilterAccepted ); };
116  std::vector< std::string > algorithmNames( bool algoCondAccepted = true ) const { return pathsOrAlgorithms( algoCondAccepted, false ); };
120  bool hasFilterLabel( const std::string & filterLabel ) const { return hasFilterOrCondition( filterLabel ); };
122  bool hasConditionName( const std::string & conditionName ) const { return hasFilterOrCondition( conditionName ); };
124  bool hasPathName( const std::string & pathName, bool pathLastFilterAccepted = false, bool pathL3FilterAccepted = true ) const { return hasPathOrAlgorithm( pathName, pathLastFilterAccepted, pathL3FilterAccepted ); };
126  bool hasAlgorithmName( const std::string & algorithmName, bool algoCondAccepted = true ) const { return hasPathOrAlgorithm( algorithmName, algoCondAccepted, false ); };
128  virtual bool hasCollection( const std::string & collName ) const;
129  virtual bool hasCollection( const edm::InputTag & collName ) const { return hasCollection( collName.encode() ); };
131  bool hasPathLastFilterAccepted() const { return hasLastFilter(); };
132  bool hasAlgoCondAccepted() const { return hasLastFilter(); };
133  bool hasPathL3FilterAccepted() const { return hasL3Filter(); };
134 
138 
140  bool filter( const std::string & filterLabel ) const { return hasFilterLabel( filterLabel ); };
142  bool cond( const std::string & conditionName ) const { return hasConditionName( conditionName ); };
144  bool path( const std::string & pathName, unsigned pathLastFilterAccepted = 0, unsigned pathL3FilterAccepted = 1 ) const { return hasPathName( pathName, bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ) ); };
146  bool algo( const std::string & algorithmName, unsigned algoCondAccepted = 1 ) const { return hasAlgorithmName( algorithmName, bool( algoCondAccepted ) ); };
148  virtual bool coll( const std::string & collName ) const { return hasCollection( collName ); };
149 
151  void packPathNames(const edm::TriggerNames &names) ;
154 
155  };
156 
157 
159  typedef std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection;
170 
171 }
172 
173 
174 #endif
std::vector< std::string > pathsOrAlgorithms(bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
Gets all HLT path or L1 algorithm names.
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.
bool checkIfPathsAreUnpacked(bool throwIfPacked=true) const
Check if trigger names have been packed by calling packPathNames() and not yet unpacked.
static const HistoName names[]
edm::RefVectorIterator< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRefVectorIterator
Const iterator over vector of persistent references to items in the same TriggerObjectStandAloneColle...
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned (method overrides)
static const char wildcard_
Constants.
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 od L1 conditions the trigger objects has been used in...
void addAlgorithmName(const std::string &algorithmName, bool algoCondAccepted=true)
Adds a new L1 algorithm name.
void unpackPathNames(const edm::TriggerNames &names)
unpack trigger names into indices
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
std::vector< std::string > pathNames(bool pathLastFilterAccepted=false, bool pathL3FilterAccepted=true) const
Gets all HLT path names.
Analysis-level trigger object class.
Definition: TriggerObject.h:47
std::string encode() const
Definition: InputTag.cc:164
void addConditionName(const std::string &conditionName)
Adds a new L1 condition name.
void addFilterLabel(const std::string &filterLabel)
Methods.
bool hasAnyName(const std::string &name, const std::vector< std::string > &nameVec) const
Private methods.
void addPathOrAlgorithm(const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted)
Adds a new HLT path or L1 algorithm name.
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;.
TriggerObject triggerObject()
Gets the pat::TriggerObject (parent class)
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.
TriggerObjectStandAlone()
Constructors and Destructor.
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.
bool hasPathOrAlgorithm(const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
Checks, if a certain HLT path or L1 algorithm name is assigned.
std::vector< bool > pathL3FilterAccepted_
const std::vector< std::string > & conditionNames() const
Gets all L1 condition names.
void packPathNames(const edm::TriggerNames &names)
pack trigger names into indices
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.
bool filter(const std::string &filterLabel) const
Calls &#39;hasFilterLabel(...)&#39;.
std::vector< uint16_t > pathIndices_
edm::RefProd< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRefProd
Persistent reference to a TriggerObjectStandAloneCollection product.
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:29
virtual bool coll(const std::string &collName) const
Calls &#39;hasCollection(...)&#39; (method override)
bool hasFilterOrCondition(const std::string &name) const
Checks, if a certain HLT filter label or L1 condition name is assigned.
virtual bool hasCollection(const edm::InputTag &collName) const
virtual ~TriggerObjectStandAlone()
Destructor.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:27
std::vector< bool > pathLastFilterAccepted_
Analysis-level trigger object class (stand-alone)
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.