![]() |
![]() |
Analysis-level trigger object class (stand-alone) More...
#include <DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h>
Public Member Functions | |
void | addAlgorithmName (const std::string &algorithmName, bool algoCondAccepted=true) |
Adds a new L1 algorithm name. | |
void | addConditionName (const std::string &conditionName) |
Adds a new L1 condition name. | |
void | addFilterLabel (const std::string &filterLabel) |
Methods. | |
void | addPathName (const std::string &pathName, bool pathLastFilterAccepted=true) |
Adds a new HLT path name. | |
bool | algo (const std::string &algorithmName, unsigned algoCondAccepted=1) const |
Calls 'hasAlgorithmName(...)'. | |
std::vector< std::string > | algorithmNames (bool algoCondAccepted=true) const |
Gets all L1 algorithm names. | |
virtual bool | coll (const std::string &collName) const |
Calls 'hasCollection(...)' (method override) | |
bool | cond (const std::string &conditionName) const |
Calls 'hasConditionName(...)'. | |
std::vector< std::string > | conditionNames () const |
Gets all L1 condition names. | |
bool | filter (const std::string &filterLabel) const |
Calls 'hasFilterLabel(...)'. | |
std::vector< std::string > | filterLabels () const |
Gets all HLT filter labels. | |
bool | hasAlgoCondAccepted () const |
bool | hasAlgorithmName (const std::string &algorithmName, bool algoCondAccepted=true) const |
Checks, if a certain L1 algorithm name is assigned. | |
virtual bool | hasCollection (const std::string &collName) const |
Checks, if a certain label of original collection is assigned (method overrides) | |
virtual bool | hasCollection (const edm::InputTag &collName) const |
bool | hasConditionName (const std::string &conditionName) const |
Checks, if a certain L1 condition name is assigned. | |
bool | hasFilterLabel (const std::string &filterLabel) const |
Checks, if a certain HLT filter label is assigned. | |
bool | hasPathLastFilterAccepted () const |
Checks, if the usage indicator vector has been filled. | |
bool | hasPathName (const std::string &pathName, bool pathLastFilterAccepted=true) const |
Checks, if a certain HLT path name is assigned. | |
bool | path (const std::string &pathName, unsigned pathLastFilterAccepted=1) const |
Calls 'hasPathName(...)'. | |
std::vector< std::string > | pathNames (bool pathLastFilterAccepted=true) const |
Gets all HLT path names. | |
TriggerObject | triggerObject () |
Gets the pat::TriggerObject (parent class) | |
TriggerObjectStandAlone (const reco::Particle::LorentzVector &vec, int id=0) | |
Constructors from Lorentz-vectors and (optional) PDG ID. | |
TriggerObjectStandAlone (const reco::LeafCandidate &leafCand) | |
Constructor from reco::Candidate. | |
TriggerObjectStandAlone (const reco::Particle::PolarLorentzVector &vec, int id=0) | |
TriggerObjectStandAlone (const trigger::TriggerObject &trigObj) | |
Constructor from trigger::TriggerObject. | |
TriggerObjectStandAlone (const TriggerObject &trigObj) | |
Constructor from pat::TriggerObject. | |
TriggerObjectStandAlone () | |
Constructors and Destructor. | |
virtual | ~TriggerObjectStandAlone () |
Destructor. | |
Private Member Functions | |
void | addFilterOrCondition (const std::string &name) |
Adds a new HLT filter label or L1 condition name. | |
void | addPathOrAlgorithm (const std::string &name, bool firing=true) |
Adds a new HLT path or L1 algorithm name. | |
std::vector< std::string > | filtersOrConditions () const |
Gets all HLT filter labels or L1 condition names. | |
bool | hasAnyName (const std::string &name, const std::vector< std::string > &nameVec) const |
Private methods. | |
bool | hasFilterOrCondition (const std::string &name) const |
Checks, if a certain HLT filter label or L1 condition name is assigned. | |
bool | hasFiring () const |
Checks, if the usage indicator vector has been filled. | |
bool | hasPathOrAlgorithm (const std::string &name, bool firing=true) const |
Checks, if a certain HLT path or L1 algorithm name is assigned. | |
std::vector< std::string > | pathsOrAlgorithms (bool firing=true) const |
Gets all HLT path or L1 algorithm names. | |
Private Attributes | |
std::vector< std::string > | filterLabels_ |
Vector of labels of all HLT filters or names od L1 conditions the trigger objects has been used in. | |
std::vector< bool > | pathLastFilterAccepted_ |
std::vector< std::string > | pathNames_ |
Vector of names of all HLT paths or L1 algorithms the trigger objects has been used in. | |
Static Private Attributes | |
static const char | wildcard_ = '*' |
Constants. |
Analysis-level trigger object class (stand-alone)
TriggerObjectStandAlone implements a container for trigger objects' information within the 'pat' namespace. These Trigger objects keep also information on filters and paths to be saved independently or embedded into PAT objects. The TriggerObjectStandAlone is also the data format used in the PAT trigger object matching. For detailed information, consult https://twiki.cern.ch/twiki/bin/view/CMS/SWGuidePATTrigger#TriggerObjectStandAlone
Definition at line 32 of file TriggerObjectStandAlone.h.
pat::TriggerObjectStandAlone::TriggerObjectStandAlone | ( | ) | [inline] |
Constructors and Destructor.
Default constructor
Definition at line 77 of file TriggerObjectStandAlone.h.
: TriggerObject() {};
pat::TriggerObjectStandAlone::TriggerObjectStandAlone | ( | const TriggerObject & | trigObj | ) | [inline] |
Constructor from pat::TriggerObject.
Definition at line 79 of file TriggerObjectStandAlone.h.
: TriggerObject( trigObj ) {};
pat::TriggerObjectStandAlone::TriggerObjectStandAlone | ( | const trigger::TriggerObject & | trigObj | ) | [inline] |
Constructor from trigger::TriggerObject.
Definition at line 81 of file TriggerObjectStandAlone.h.
: TriggerObject( trigObj ) {};
pat::TriggerObjectStandAlone::TriggerObjectStandAlone | ( | const reco::LeafCandidate & | leafCand | ) | [inline] |
Constructor from reco::Candidate.
Definition at line 83 of file TriggerObjectStandAlone.h.
: TriggerObject( leafCand ) {};
pat::TriggerObjectStandAlone::TriggerObjectStandAlone | ( | const reco::Particle::LorentzVector & | vec, |
int | id = 0 |
||
) | [inline] |
Constructors from Lorentz-vectors and (optional) PDG ID.
Definition at line 85 of file TriggerObjectStandAlone.h.
: TriggerObject( vec, id ) {};
pat::TriggerObjectStandAlone::TriggerObjectStandAlone | ( | const reco::Particle::PolarLorentzVector & | vec, |
int | id = 0 |
||
) | [inline] |
Definition at line 86 of file TriggerObjectStandAlone.h.
: TriggerObject( vec, id ) {};
virtual pat::TriggerObjectStandAlone::~TriggerObjectStandAlone | ( | ) | [inline, virtual] |
void pat::TriggerObjectStandAlone::addAlgorithmName | ( | const std::string & | algorithmName, |
bool | algoCondAccepted = true |
||
) | [inline] |
Adds a new L1 algorithm name.
Definition at line 100 of file TriggerObjectStandAlone.h.
References addPathOrAlgorithm().
{ addPathOrAlgorithm( algorithmName, algoCondAccepted ); };
void pat::TriggerObjectStandAlone::addConditionName | ( | const std::string & | conditionName | ) | [inline] |
Adds a new L1 condition name.
Definition at line 96 of file TriggerObjectStandAlone.h.
References addFilterOrCondition().
{ addFilterOrCondition( conditionName ); };
void pat::TriggerObjectStandAlone::addFilterLabel | ( | const std::string & | filterLabel | ) | [inline] |
Methods.
Adds a new HLT filter label
Definition at line 94 of file TriggerObjectStandAlone.h.
References addFilterOrCondition().
Referenced by pat::PATTriggerProducer::produce().
{ addFilterOrCondition( filterLabel ); };
void pat::TriggerObjectStandAlone::addFilterOrCondition | ( | const std::string & | name | ) | [inline, private] |
Adds a new HLT filter label or L1 condition name.
Definition at line 58 of file TriggerObjectStandAlone.h.
References filterLabels_, and hasFilterOrCondition().
Referenced by addConditionName(), and addFilterLabel().
{ if ( ! hasFilterOrCondition( name ) ) filterLabels_.push_back( name ); };
void pat::TriggerObjectStandAlone::addPathName | ( | const std::string & | pathName, |
bool | pathLastFilterAccepted = true |
||
) | [inline] |
Adds a new HLT path name.
Definition at line 98 of file TriggerObjectStandAlone.h.
References addPathOrAlgorithm().
Referenced by pat::PATTriggerProducer::produce().
{ addPathOrAlgorithm( pathName, pathLastFilterAccepted ); };
void TriggerObjectStandAlone::addPathOrAlgorithm | ( | const std::string & | name, |
bool | firing = true |
||
) | [private] |
Adds a new HLT path or L1 algorithm name.
Definition at line 70 of file TriggerObjectStandAlone.cc.
References hasPathOrAlgorithm(), pathLastFilterAccepted_, and pathNames_.
Referenced by addAlgorithmName(), and addPathName().
{ // Check, if path is already assigned if ( ! hasPathOrAlgorithm( name, false ) ) { // The path itself pathNames_.push_back( name ); // The corresponding usage of the trigger objects pathLastFilterAccepted_.push_back( firing ); } }
bool pat::TriggerObjectStandAlone::algo | ( | const std::string & | algorithmName, |
unsigned | algoCondAccepted = 1 |
||
) | const [inline] |
Calls 'hasAlgorithmName(...)'.
Definition at line 137 of file TriggerObjectStandAlone.h.
References hasAlgorithmName().
{ return hasAlgorithmName( algorithmName, bool( algoCondAccepted ) ); };
std::vector< std::string > pat::TriggerObjectStandAlone::algorithmNames | ( | bool | algoCondAccepted = true | ) | const [inline] |
Gets all L1 algorithm names.
Definition at line 108 of file TriggerObjectStandAlone.h.
References pathsOrAlgorithms().
{ return pathsOrAlgorithms( algoCondAccepted ); };
virtual bool pat::TriggerObjectStandAlone::coll | ( | const std::string & | collName | ) | const [inline, virtual] |
Calls 'hasCollection(...)' (method override)
Reimplemented from pat::TriggerObject.
Definition at line 139 of file TriggerObjectStandAlone.h.
References hasCollection().
{ return hasCollection( collName ); };
bool pat::TriggerObjectStandAlone::cond | ( | const std::string & | conditionName | ) | const [inline] |
Calls 'hasConditionName(...)'.
Definition at line 133 of file TriggerObjectStandAlone.h.
References hasConditionName().
{ return hasConditionName( conditionName ); };
std::vector< std::string > pat::TriggerObjectStandAlone::conditionNames | ( | ) | const [inline] |
Gets all L1 condition names.
Definition at line 104 of file TriggerObjectStandAlone.h.
References filtersOrConditions().
{ return filtersOrConditions(); };
bool pat::TriggerObjectStandAlone::filter | ( | const std::string & | filterLabel | ) | const [inline] |
Calls 'hasFilterLabel(...)'.
Special methods for the cut string parser
Definition at line 131 of file TriggerObjectStandAlone.h.
References hasFilterLabel().
{ return hasFilterLabel( filterLabel ); };
std::vector< std::string > pat::TriggerObjectStandAlone::filterLabels | ( | ) | const [inline] |
Gets all HLT filter labels.
Definition at line 102 of file TriggerObjectStandAlone.h.
References filtersOrConditions().
{ return filtersOrConditions(); };
std::vector< std::string > pat::TriggerObjectStandAlone::filtersOrConditions | ( | ) | const [inline, private] |
Gets all HLT filter labels or L1 condition names.
Definition at line 62 of file TriggerObjectStandAlone.h.
References filterLabels_.
Referenced by conditionNames(), and filterLabels().
{ return filterLabels_; };
bool pat::TriggerObjectStandAlone::hasAlgoCondAccepted | ( | ) | const [inline] |
Definition at line 124 of file TriggerObjectStandAlone.h.
References hasFiring().
{ return hasFiring(); };
bool pat::TriggerObjectStandAlone::hasAlgorithmName | ( | const std::string & | algorithmName, |
bool | algoCondAccepted = true |
||
) | const [inline] |
Checks, if a certain L1 algorithm name is assigned.
Definition at line 118 of file TriggerObjectStandAlone.h.
References hasPathOrAlgorithm().
Referenced by algo().
{ return hasPathOrAlgorithm( algorithmName, algoCondAccepted ); };
bool TriggerObjectStandAlone::hasAnyName | ( | const std::string & | name, |
const std::vector< std::string > & | nameVec | ||
) | const [private] |
Private methods.
Checks a string vector for occurence of a certain string, incl. wild-card mechanism
Definition at line 24 of file TriggerObjectStandAlone.cc.
References split, and wildcard_.
Referenced by hasCollection(), hasFilterOrCondition(), and hasPathOrAlgorithm().
{ // Special cases first // Always false for empty vector to check if ( nameVec.empty() ) return false; // Always true for general wild-card(s) if ( name.find_first_not_of( wildcard_ ) == std::string::npos ) return true; // Split name to evaluate in parts, seperated by wild-cards std::vector< std::string > namePartsVec; boost::split( namePartsVec, name, boost::is_any_of( std::string( 1, wildcard_ ) ), boost::token_compress_on ); // Iterate over vector of names to search for ( std::vector< std::string >::const_iterator iVec = nameVec.begin(); iVec != nameVec.end(); ++iVec ) { // Not failed yet bool failed( false ); // Start searching at the first character size_type index( 0 ); // Iterate over evaluation name parts for ( std::vector< std::string >::const_iterator iName = namePartsVec.begin(); iName != namePartsVec.end(); ++iName ) { // Empty parts due to // - wild-card at beginning/end or // - multiple wild-cards (should be supressed by 'boost::token_compress_on') if ( iName->length() == 0 ) continue; // Search from current index and // set index to found occurence index = iVec->find( *iName, index ); // Failed and exit loop, if // - part not found // - part at beginning not found there if ( index == std::string::npos || ( iName == namePartsVec.begin() && index > 0 ) ) { failed = true; break; } // Increase index by length of found part index += iName->length(); } // Failed, if end of name not reached if ( index < iVec->length() && namePartsVec.back().length() != 0 ) failed = true; // Match found! if ( ! failed ) return true; } // No match found! return false; }
bool TriggerObjectStandAlone::hasCollection | ( | const std::string & | collName | ) | const [virtual] |
Checks, if a certain label of original collection is assigned (method overrides)
Reimplemented from pat::TriggerObject.
Definition at line 141 of file TriggerObjectStandAlone.cc.
References pat::TriggerObject::collection(), hasAnyName(), edm::InputTag::instance(), edm::InputTag::label(), edm::InputTag::process(), and wildcard_.
Referenced by coll(), and pat::PATTriggerProducer::produce().
{ // Move to wild-card parser, if needed only if ( collName.find( wildcard_ ) != std::string::npos ) { // True, if collection name is simply fine if ( hasAnyName( collName, std::vector< std::string >( 1, collection() ) ) ) return true; // Check, if collection name possibly fits in an edm::InputTag approach const edm::InputTag collectionTag( collection() ); const edm::InputTag collTag( collName ); // If evaluated collection tag contains a process name, it must have been found already by identity check if ( collTag.process().empty() ) { // Check instance ... if ( ( collTag.instance().empty() && collectionTag.instance().empty() ) || hasAnyName( collTag.instance(), std::vector< std::string >( 1, collectionTag.instance() ) ) ) { // ... and label return hasAnyName( collTag.label(), std::vector< std::string >( 1, collectionTag.label() ) ); } } return false; } // Use parent class's method otherwise return TriggerObject::hasCollection( collName ); }
virtual bool pat::TriggerObjectStandAlone::hasCollection | ( | const edm::InputTag & | collName | ) | const [inline, virtual] |
Reimplemented from pat::TriggerObject.
Definition at line 121 of file TriggerObjectStandAlone.h.
References edm::InputTag::encode(), and hasCollection().
Referenced by hasCollection().
{ return hasCollection( collName.encode() ); };
bool pat::TriggerObjectStandAlone::hasConditionName | ( | const std::string & | conditionName | ) | const [inline] |
Checks, if a certain L1 condition name is assigned.
Definition at line 114 of file TriggerObjectStandAlone.h.
References hasFilterOrCondition().
Referenced by cond().
{ return hasFilterOrCondition( conditionName ); };
bool pat::TriggerObjectStandAlone::hasFilterLabel | ( | const std::string & | filterLabel | ) | const [inline] |
Checks, if a certain HLT filter label is assigned.
Definition at line 112 of file TriggerObjectStandAlone.h.
References hasFilterOrCondition().
Referenced by filter().
{ return hasFilterOrCondition( filterLabel ); };
bool TriggerObjectStandAlone::hasFilterOrCondition | ( | const std::string & | name | ) | const [private] |
Checks, if a certain HLT filter label or L1 condition name is assigned.
Definition at line 99 of file TriggerObjectStandAlone.cc.
References filterLabels_, spr::find(), hasAnyName(), AlCaRecoCosmics_cfg::name, and wildcard_.
Referenced by addFilterOrCondition(), hasConditionName(), and hasFilterLabel().
{ // Move to wild-card parser, if needed if ( name.find( wildcard_ ) != std::string::npos ) return hasAnyName( name, filterLabels_ ); // Return, if filter label is assigned return ( std::find( filterLabels_.begin(), filterLabels_.end(), name ) != filterLabels_.end() ); }
bool pat::TriggerObjectStandAlone::hasFiring | ( | ) | const [inline, private] |
Checks, if the usage indicator vector has been filled.
Definition at line 70 of file TriggerObjectStandAlone.h.
References pathLastFilterAccepted_, and pathNames_.
Referenced by hasAlgoCondAccepted(), hasPathLastFilterAccepted(), hasPathOrAlgorithm(), and pathsOrAlgorithms().
{ return ( pathLastFilterAccepted_.size() > 0 && pathLastFilterAccepted_.size() == pathNames_.size() ); };
bool pat::TriggerObjectStandAlone::hasPathLastFilterAccepted | ( | ) | const [inline] |
Checks, if the usage indicator vector has been filled.
Definition at line 123 of file TriggerObjectStandAlone.h.
References hasFiring().
{ return hasFiring(); };
bool pat::TriggerObjectStandAlone::hasPathName | ( | const std::string & | pathName, |
bool | pathLastFilterAccepted = true |
||
) | const [inline] |
Checks, if a certain HLT path name is assigned.
Definition at line 116 of file TriggerObjectStandAlone.h.
References hasPathOrAlgorithm().
Referenced by path().
{ return hasPathOrAlgorithm( pathName, pathLastFilterAccepted ); };
bool TriggerObjectStandAlone::hasPathOrAlgorithm | ( | const std::string & | name, |
bool | firing = true |
||
) | const [private] |
Checks, if a certain HLT path or L1 algorithm name is assigned.
Definition at line 109 of file TriggerObjectStandAlone.cc.
References spr::find(), hasAnyName(), hasFiring(), match(), AlCaRecoCosmics_cfg::name, pathLastFilterAccepted_, pathNames_, pathsOrAlgorithms(), and wildcard_.
Referenced by addPathOrAlgorithm(), hasAlgorithmName(), and hasPathName().
{ // Move to wild-card parser, if needed if ( name.find( wildcard_ ) != std::string::npos ) return hasAnyName( name, pathsOrAlgorithms( firing ) ); // Deal with older PAT-tuples, where trigger object usage is not available if ( ! hasFiring() ) firing = false; // Check, if path name is assigned at all std::vector< std::string >::const_iterator match( std::find( pathNames_.begin(), pathNames_.end(), name ) ); // False, if path name not assigned if ( match == pathNames_.end() ) return false; // Return for assigned path name, if trigger object usage meets requirement return ( firing ? pathLastFilterAccepted_.at( match - pathNames_.begin() ) : true ); }
bool pat::TriggerObjectStandAlone::path | ( | const std::string & | pathName, |
unsigned | pathLastFilterAccepted = 1 |
||
) | const [inline] |
Calls 'hasPathName(...)'.
Definition at line 135 of file TriggerObjectStandAlone.h.
References hasPathName().
{ return hasPathName( pathName, bool( pathLastFilterAccepted ) ); };
std::vector< std::string > pat::TriggerObjectStandAlone::pathNames | ( | bool | pathLastFilterAccepted = true | ) | const [inline] |
Gets all HLT path names.
Definition at line 106 of file TriggerObjectStandAlone.h.
References pathsOrAlgorithms().
{ return pathsOrAlgorithms( pathLastFilterAccepted ); };
std::vector< std::string > TriggerObjectStandAlone::pathsOrAlgorithms | ( | bool | firing = true | ) | const [private] |
Gets all HLT path or L1 algorithm names.
Definition at line 83 of file TriggerObjectStandAlone.cc.
References hasFiring(), pathLastFilterAccepted_, and pathNames_.
Referenced by algorithmNames(), hasPathOrAlgorithm(), and pathNames().
{ // All path names, if usage not restricted (not required or not available) if ( ! firing || ! hasFiring() ) return pathNames_; // Temp vector of path names std::vector< std::string > paths; // Loop over usage vector and fill corresponding paths into temp vector for ( unsigned iPath = 0; iPath < pathNames_.size(); ++iPath ) { if ( pathLastFilterAccepted_.at( iPath ) ) paths.push_back( pathNames_.at( iPath ) ); } // Return temp vector return paths; }
TriggerObject TriggerObjectStandAlone::triggerObject | ( | ) |
Gets the pat::TriggerObject (parent class)
Definition at line 128 of file TriggerObjectStandAlone.cc.
References pat::TriggerObject::addTriggerObjectType(), asciidump::at, pat::TriggerObject::collection(), i, reco::LeafCandidate::p4(), reco::LeafCandidate::pdgId(), pat::TriggerObject::setCollection(), and pat::TriggerObject::triggerObjectTypes().
{ // Create a TriggerObjects TriggerObject theObj( p4(), pdgId() ); // Set its collection and trigger objects types (no c'tor for that) theObj.setCollection( collection() ); for ( size_t i = 0; i < triggerObjectTypes().size(); ++i ) theObj.addTriggerObjectType( triggerObjectTypes().at( i ) ); // Return TriggerObject return theObj; }
std::vector< std::string > pat::TriggerObjectStandAlone::filterLabels_ [private] |
Vector of labels of all HLT filters or names od L1 conditions the trigger objects has been used in.
Data Members Keeping the old names of the data members for backward compatibility, although they refer only to HLT objects.
Definition at line 39 of file TriggerObjectStandAlone.h.
Referenced by addFilterOrCondition(), filtersOrConditions(), and hasFilterOrCondition().
std::vector< bool > pat::TriggerObjectStandAlone::pathLastFilterAccepted_ [private] |
Vector alligned with 'pathNames_' of boolean indicating the usage of the trigger object An element is true, if the corresponding path succeeded and the trigger object was used in the last filter (HLT or the corresponding algorithm succeeded as well as the corresponding condition (L1). The vector is empty for data (size 0), if the according information is not available in data.
Definition at line 46 of file TriggerObjectStandAlone.h.
Referenced by addPathOrAlgorithm(), hasFiring(), hasPathOrAlgorithm(), and pathsOrAlgorithms().
std::vector< std::string > pat::TriggerObjectStandAlone::pathNames_ [private] |
Vector of names of all HLT paths or L1 algorithms the trigger objects has been used in.
Definition at line 41 of file TriggerObjectStandAlone.h.
Referenced by addPathOrAlgorithm(), hasFiring(), hasPathOrAlgorithm(), and pathsOrAlgorithms().
const char TriggerObjectStandAlone::wildcard_ = '*' [static, private] |
Constants.
Constant defining the wild-card used in 'hasAnyName()'
Definition at line 51 of file TriggerObjectStandAlone.h.
Referenced by hasAnyName(), hasCollection(), hasFilterOrCondition(), and hasPathOrAlgorithm().