7 #include <boost/algorithm/string.hpp>
94 if ( nameVec.empty() )
return false;
96 if ( name.find_first_not_of(
wildcard_ ) == std::string::npos )
return true;
98 std::vector< std::string > namePartsVec;
101 for ( std::vector< std::string >::const_iterator iVec = nameVec.begin(); iVec != nameVec.end(); ++iVec ) {
103 bool failed(
false );
107 for ( std::vector< std::string >::const_iterator iName = namePartsVec.begin(); iName != namePartsVec.end(); ++iName ) {
111 if ( iName->length() == 0 )
continue;
114 index = iVec->find( *iName, index );
118 if ( index == std::string::npos || ( iName == namePartsVec.begin() && index > 0 ) ) {
123 index += iName->length();
126 if (
index < iVec->length() && namePartsVec.back().length() != 0 ) failed =
true;
128 if ( ! failed )
return true;
148 }
else if ( pathLastFilterAccepted || pathL3FilterAccepted ) {
171 if ( !
hasL3Filter() ) pathL3FilterAccepted =
false;
173 if ( ! pathLastFilterAccepted && ! pathL3FilterAccepted )
return pathNames_;
175 std::vector< std::string >
paths;
177 for (
unsigned iPath = 0; iPath <
pathNames_.size(); ++iPath ) {
204 if ( !
hasL3Filter() ) pathL3FilterAccepted =
false;
208 if ( match ==
pathNames_.end() )
return false;
209 if ( ! pathLastFilterAccepted && ! pathL3FilterAccepted )
return true;
213 return ( foundLastFilter && foundL3Filter );
237 if ( collName.find(
wildcard_ ) != std::string::npos ) {
244 if ( collTag.
process().empty() ) {
260 if (!unpacked && throwIfPacked)
throw cms::Exception(
"RuntimeError",
"This TriggerObjectStandAlone object has packed trigger path names. Before accessing path names you must call unpackPathNames with an edm::TriggerNames object. You can get the latter from the edm::Event or fwlite::Event and the TriggerResults\n");
267 throw cms::Exception(
"RuntimeError",
"Error, trying to pack a partially packed TriggerObjectStandAlone");
274 std::vector<uint16_t> indices(n);
275 for (
unsigned int i = 0;
i <
n; ++
i) {
278 static int _warn = 0;
279 if (++_warn < 5)
std::cerr <<
"Warning: can't resolve '" <<
pathNames_[
i] <<
"' to a path index" << std::endl;
294 throw cms::Exception(
"RuntimeError",
"Error, trying to unpack a partially unpacked TriggerObjectStandAlone");
300 std::vector<std::string>
paths(n);
301 for (
unsigned int i = 0;
i <
n; ++
i) {
virtual int pdgId() const
PDG identifier.
std::vector< std::string > pathsOrAlgorithms(bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
Gets all HLT path or L1 algorithm names.
bool checkIfPathsAreUnpacked(bool throwIfPacked=true) const
Check if trigger names have been packed by calling packPathNames() and not yet unpacked.
static const HistoName names[]
bool id(trigger::TriggerObjectType triggerObjectType) const
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.
std::vector< std::string > pathNames_
Vector of names of all HLT paths or L1 algorithms the trigger objects has been used in...
std::vector< std::string > filterLabels_
Vector of labels of all HLT filters or names od L1 conditions the trigger objects has been used in...
Strings::size_type size() const
void unpackPathNames(const edm::TriggerNames &names)
unpack trigger names into indices
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Analysis-level trigger object class.
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)
TriggerObject triggerObject()
Gets the pat::TriggerObject (parent class)
unsigned int triggerIndex(std::string const &name) const
void setCollection(const std::string &collName)
Methods.
const std::string & collection() const
Get the label of the collection the trigger object originates from.
TriggerObjectStandAlone()
Constructors and Destructor.
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned.
bool hasLastFilter() const
Check, if the usage indicator vectors have been filled.
unsigned int index
index type
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_
std::string const & triggerName(unsigned int index) const
void packPathNames(const edm::TriggerNames &names)
pack trigger names into indices
std::vector< uint16_t > pathIndices_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
std::vector< int > triggerObjectTypes() const
Get all trigger object type identifiers.
bool hasFilterOrCondition(const std::string &name) const
Checks, if a certain HLT filter label or L1 condition name is assigned.
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
void addTriggerObjectType(trigger::TriggerObjectType triggerObjectType)
Add a new trigger object type identifier.
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::vector< bool > pathLastFilterAccepted_
virtual const_iterator end() const
last daughter const_iterator