CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
pat::TriggerObjectStandAlone Class Reference

Analysis-level trigger object class (stand-alone) More...

#include "DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h"

Inheritance diagram for pat::TriggerObjectStandAlone:
pat::TriggerObject reco::LeafCandidate reco::Candidate

Public Member Functions

void addAlgorithmName (const std::string &algorithmName, bool algoCondAccepted=true)
 Adds a new L1 algorithm name. More...
 
void addConditionName (const std::string &conditionName)
 Adds a new L1 condition name. More...
 
void addFilterLabel (const std::string &filterLabel)
 Adds a new HLT filter label. More...
 
void addPathName (const std::string &pathName, bool pathLastFilterAccepted=true, bool pathL3FilterAccepted=true)
 Adds a new HLT path name. More...
 
bool algo (const std::string &algorithmName, unsigned algoCondAccepted=1) const
 Calls 'hasAlgorithmName(...)'. More...
 
std::vector< std::string > algorithmNames (bool algoCondAccepted=true) const
 Gets all L1 algorithm names. More...
 
std::vector< std::string > const * allLabels (edm::ParameterSetID const &psetid, const edm::EventBase &event, const edm::TriggerResults &res) const
 
bool coll (const std::string &collName) const override
 Calls 'hasCollection(...)' (method override) More...
 
bool cond (const std::string &conditionName) const
 Calls 'hasConditionName(...)'. More...
 
const std::vector< std::string > & conditionNames () const
 Gets all L1 condition names. More...
 
TriggerObjectStandAlone copy () const
 Methods. More...
 
bool filter (const std::string &filterLabel) const
 Calls 'hasFilterLabel(...)'. More...
 
const std::vector< std::string > & filterLabels () const
 Gets all HLT filter labels. More...
 
bool hasAlgoCondAccepted () const
 
bool hasAlgorithmName (const std::string &algorithmName, bool algoCondAccepted=true) const
 Checks, if a certain L1 algorithm name is assigned. More...
 
bool hasCollection (const std::string &collName) const override
 Checks, if a certain label of original collection is assigned (method overrides) More...
 
bool hasCollection (const edm::InputTag &collName) const override
 
bool hasConditionName (const std::string &conditionName) const
 Checks, if a certain L1 condition name is assigned. More...
 
bool hasFilterLabel (const std::string &filterLabel) const
 Checks, if a certain HLT filter label is assigned. More...
 
bool hasPathL3FilterAccepted () const
 
bool hasPathLastFilterAccepted () const
 Checks, if the usage indicator vector has been filled. More...
 
bool hasPathName (const std::string &pathName, bool pathLastFilterAccepted=false, bool pathL3FilterAccepted=true) const
 Checks, if a certain HLT path name is assigned. More...
 
void packFilterLabels (const edm::EventBase &event, const edm::TriggerResults &res)
 
void packFilterLabels (const std::vector< std::string > &labels)
 pack filter labels into indices; note that the labels must be sorted! More...
 
void packP4 ()
 reduce the precision on the 4-vector More...
 
void packPathNames (const edm::TriggerNames &names)
 pack trigger names into indices More...
 
bool path (const std::string &pathName, unsigned pathLastFilterAccepted=0, unsigned pathL3FilterAccepted=1) const
 Calls 'hasPathName(...)'. More...
 
std::vector< std::string > pathNames (bool pathLastFilterAccepted=false, bool pathL3FilterAccepted=true) const
 Gets all HLT path names. More...
 
const edm::ParameterSetIDpsetID () const
 
void setPSetID (const edm::ParameterSetID &psetId)
 set the psetid of the trigger process More...
 
TriggerObject triggerObject ()
 Gets the pat::TriggerObject (parent class) More...
 
 TriggerObjectStandAlone ()
 Constructors and Destructor. More...
 
 TriggerObjectStandAlone (const TriggerObject &trigObj)
 Constructor from pat::TriggerObject. More...
 
 TriggerObjectStandAlone (const trigger::TriggerObject &trigObj)
 Constructor from trigger::TriggerObject. More...
 
 TriggerObjectStandAlone (const reco::LeafCandidate &leafCand)
 Constructor from reco::Candidate. More...
 
 TriggerObjectStandAlone (const reco::Particle::LorentzVector &vec, int id=0)
 Constructors from Lorentz-vectors and (optional) PDG ID. More...
 
 TriggerObjectStandAlone (const reco::Particle::PolarLorentzVector &vec, int id=0)
 
 TriggerObjectStandAlone (const TriggerObjectStandAlone &)=default
 
void unpackFilterLabels (const std::vector< std::string > &labels)
 unpack filter labels from indices More...
 
void unpackFilterLabels (const edm::EventBase &event, const edm::TriggerResults &res)
 unpack filter labels from indices More...
 
void unpackNamesAndLabels (const edm::EventBase &event, const edm::TriggerResults &res)
 unpack both filter labels and trigger names More...
 
void unpackPathNames (const edm::TriggerNames &names)
 unpack trigger names into indices More...
 
 ~TriggerObjectStandAlone () override
 Destructor. More...
 
- Public Member Functions inherited from pat::TriggerObject
void addFilterId (trigger::TriggerObjectType triggerObjectType)
 
void addFilterId (int triggerObjectType)
 
void addTriggerObjectType (trigger::TriggerObjectType triggerObjectType)
 Add a new trigger object type identifier. More...
 
void addTriggerObjectType (int triggerObjectType)
 
const std::string & collection () const
 Get the label of the collection the trigger object originates from. More...
 
std::vector< int > filterIds () const
 
bool hasFilterId (trigger::TriggerObjectType triggerObjectType) const
 
bool hasFilterId (int triggerObjectType) const
 
bool hasTriggerObjectType (trigger::TriggerObjectType triggerObjectType) const
 Checks, if a certain trigger object type identifier is assigned. More...
 
bool hasTriggerObjectType (int triggerObjectType) const
 
bool id (trigger::TriggerObjectType triggerObjectType) const
 
bool id (int triggerObjectType) const
 
const l1extra::L1EmParticleRef origL1EmRef () const
 
const l1extra::L1EtMissParticleRef origL1EtMissRef () const
 
const L1GctEmCandorigL1GctEmCand () const
 
const L1GctEtHadorigL1GctEtHad () const
 
const L1GctEtMissorigL1GctEtMiss () const
 
const L1GctEtTotalorigL1GctEtTotal () const
 
const L1GctHtMissorigL1GctHtMiss () const
 
const L1GctJetCandorigL1GctJetCand () const
 
const L1MuGMTExtendedCandorigL1GmtMuonCand () const
 
const l1extra::L1JetParticleRef origL1JetRef () const
 
const l1extra::L1MuonParticleRef origL1MuonRef () const
 
const reco::CandidateorigObjCand () const
 
const reco::CandidateBaseReforigObjRef () const
 Special methods for 'l1extra' particles. More...
 
void setCollection (const std::string &collName)
 Methods. More...
 
void setCollection (const edm::InputTag &collName)
 
 TriggerObject ()
 Constructors and Destructor. More...
 
 TriggerObject (const trigger::TriggerObject &trigObj)
 Constructor from trigger::TriggerObject. More...
 
 TriggerObject (const reco::LeafCandidate &leafCand)
 Constructors from base class object. More...
 
 TriggerObject (const reco::CandidateBaseRef &candRef)
 Constructors from base candidate reference (for 'l1extra' particles) More...
 
 TriggerObject (const reco::Particle::LorentzVector &vec, int id=0)
 Constructors from Lorentz-vectors and (optional) PDG ID. More...
 
 TriggerObject (const reco::Particle::PolarLorentzVector &vec, int id=0)
 
std::vector< int > triggerObjectTypes () const
 Get all trigger object type identifiers. More...
 
bool type (trigger::TriggerObjectType triggerObjectType) const
 Calls 'hasTriggerObjectType(...)'. More...
 
bool type (int triggerObjectType) const
 
 ~TriggerObject () override
 Destructor. More...
 
- Public Member Functions inherited from reco::LeafCandidate
Vector boostToCM () const final
 
int charge () const final
 electric charge More...
 
LeafCandidateclone () const override
 returns a clone of the Candidate object More...
 
void construct (int qx3, float pt, float eta, float phi, float mass, const Point &vtx, int pdgId, int status)
 
const Candidatedaughter (size_type) const override
 return daughter at a given position (throws an exception) More...
 
Candidatedaughter (size_type) override
 return daughter at a given position (throws an exception) More...
 
Candidatedaughter (const std::string &s) override
 return daughter with a specified role name More...
 
const Candidatedaughter (const std::string &s) const override
 return daughter with a specified role name More...
 
double energy () const final
 energy More...
 
double et () const final
 transverse energy More...
 
double et2 () const final
 transverse energy squared (use this for cut!) More...
 
double eta () const final
 momentum pseudorapidity More...
 
void fillVertexCovariance (CovarianceMatrix &v) const override
 fill SMatrix More...
 
template<typename T >
T get () const
 get a component More...
 
template<typename T , typename Tag >
T get () const
 get a component More...
 
template<typename T >
T get (size_type i) const
 get a component More...
 
template<typename T , typename Tag >
T get (size_type i) const
 get a component More...
 
bool hasMasterClone () const override
 
bool hasMasterClonePtr () const override
 
bool isCaloMuon () const override
 
bool isConvertedPhoton () const override
 
bool isElectron () const override
 
bool isGlobalMuon () const override
 
bool isJet () const override
 
bool isMuon () const override
 
bool isPhoton () const override
 
bool isStandAloneMuon () const override
 
bool isTrackerMuon () const override
 
 LeafCandidate ()
 
 LeafCandidate (const Candidate &c)
 
template<typename... Args>
 LeafCandidate (Args &&...args)
 
 LeafCandidate (LeafCandidate &rh)
 
 LeafCandidate (LeafCandidate &&)=default
 
 LeafCandidate (LeafCandidate const &)=default
 
bool longLived () const final
 is long lived? More...
 
double mass () const final
 mass More...
 
bool massConstraint () const final
 do mass constraint? More...
 
double massSqr () const final
 mass squared More...
 
const CandidateBaseRefmasterClone () const override
 
const CandidatePtrmasterClonePtr () const override
 
template<typename Ref >
Ref masterRef () const
 cast master clone reference to a concrete type More...
 
Vector momentum () const final
 spatial momentum vector More...
 
const Candidatemother (size_type) const override
 return mother at a given position (throws an exception) More...
 
double mt () const final
 transverse mass More...
 
double mtSqr () const final
 transverse mass squared More...
 
template<typename T >
size_type numberOf () const
 number of components More...
 
template<typename T , typename Tag >
size_type numberOf () const
 number of components More...
 
size_t numberOfDaughters () const override
 number of daughters More...
 
size_t numberOfMothers () const override
 number of mothers More...
 
size_t numberOfSourceCandidatePtrs () const override
 
LeafCandidateoperator= (LeafCandidate &&)=default
 
LeafCandidateoperator= (LeafCandidate const &)=default
 
double p () const final
 magnitude of momentum vector More...
 
const LorentzVectorp4 () const final
 four-momentum Lorentz vector More...
 
int pdgId () const final
 PDG identifier. More...
 
double phi () const final
 momentum azimuthal angle More...
 
const PolarLorentzVectorpolarP4 () const final
 four-momentum Lorentz vector More...
 
double pt () const final
 transverse momentum More...
 
double px () const final
 x coordinate of momentum vector More...
 
double py () const final
 y coordinate of momentum vector More...
 
double pz () const final
 z coordinate of momentum vector More...
 
double rapidity () const final
 rapidity More...
 
void setCharge (Charge q) final
 set electric charge More...
 
void setLongLived () final
 
void setMass (double m) final
 set particle mass More...
 
void setMassConstraint () final
 
void setP4 (const LorentzVector &p4) final
 set 4-momentum More...
 
void setP4 (const PolarLorentzVector &p4) final
 set 4-momentum More...
 
void setPdgId (int pdgId) final
 
void setPz (double pz) final
 
void setStatus (int status) final
 set status word More...
 
void setThreeCharge (Charge qx3) final
 set electric charge More...
 
void setVertex (const Point &vertex) override
 set vertex More...
 
CandidatePtr sourceCandidatePtr (size_type i) const override
 
int status () const final
 status word More...
 
double theta () const final
 momentum polar angle More...
 
int threeCharge () const final
 electric charge More...
 
const Pointvertex () const override
 vertex position (overwritten by PF...) More...
 
double vertexChi2 () const override
 chi-squares More...
 
double vertexCovariance (int i, int j) const override
 (i, j)-th element of error matrix, i, j = 0, ... 2 More...
 
CovarianceMatrix vertexCovariance () const final
 return SMatrix More...
 
double vertexNdof () const override
 
double vertexNormalizedChi2 () const override
 chi-squared divided by n.d.o.f. More...
 
double vx () const override
 x coordinate of vertex position More...
 
double vy () const override
 y coordinate of vertex position More...
 
double vz () const override
 z coordinate of vertex position More...
 
double y () const final
 rapidity More...
 
 ~LeafCandidate () override
 destructor More...
 
- Public Member Functions inherited from reco::Candidate
const_iterator begin () const
 first daughter const_iterator More...
 
iterator begin ()
 first daughter iterator More...
 
virtual const TrackbestTrack () const
 
 Candidate ()
 default constructor More...
 
virtual float dxyError () const
 uncertainty on dxy More...
 
virtual float dzError () const
 uncertainty on dz More...
 
const_iterator end () const
 last daughter const_iterator More...
 
iterator end ()
 last daughter iterator More...
 
template<typename T >
T get () const
 get a component More...
 
template<typename T , typename Tag >
T get () const
 get a component More...
 
template<typename T >
T get (size_type i) const
 get a component More...
 
template<typename T , typename Tag >
T get (size_type i) const
 get a component More...
 
template<typename Ref >
Ref masterRef () const
 cast master clone reference to a concrete type More...
 
template<typename T >
size_type numberOf () const
 number of components More...
 
template<typename T , typename Tag >
size_type numberOf () const
 number of components More...
 
virtual void setSourceCandidatePtr (const CandidatePtr &ptr)
 Set the ptr to the source Candidate. More...
 
virtual ~Candidate ()
 destructor More...
 

Private Member Functions

void addFilterOrCondition (const std::string &name)
 Adds a new HLT filter label or L1 condition name. More...
 
void addPathOrAlgorithm (const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted)
 Adds a new HLT path or L1 algorithm name. More...
 
bool checkIfFiltersAreUnpacked (bool throwIfPacked=true) const
 Check if trigger names have been packed by calling packFilterLabels() and not yet unpacked. More...
 
bool checkIfPathsAreUnpacked (bool throwIfPacked=true) const
 Check if trigger names have been packed by calling packPathNames() and not yet unpacked. More...
 
const std::vector< std::string > & filtersOrConditions () const
 Gets all HLT filter labels or L1 condition names. More...
 
bool hasAnyName (const std::string &name, const std::vector< std::string > &nameVec) const
 Private methods. More...
 
bool hasFilterOrCondition (const std::string &name) const
 Checks, if a certain HLT filter label or L1 condition name is assigned. More...
 
bool hasL3Filter () const
 
bool hasLastFilter () const
 Check, if the usage indicator vectors have been filled. More...
 
bool hasPathOrAlgorithm (const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
 Checks, if a certain HLT path or L1 algorithm name is assigned. More...
 
std::vector< std::string > pathsOrAlgorithms (bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
 Gets all HLT path or L1 algorithm names. More...
 

Private Attributes

std::vector< uint16_t > filterLabelIndices_
 
std::vector< std::string > filterLabels_
 Vector of labels of all HLT filters or names of L1 conditions the trigger objects has been used in. More...
 
std::vector< uint16_t > pathIndices_
 
std::vector< bool > pathL3FilterAccepted_
 
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. More...
 
edm::ParameterSetID psetId_
 

Static Private Attributes

static const char wildcard_ = '*'
 Constants. More...
 

Additional Inherited Members

- Public Types inherited from reco::LeafCandidate
typedef int Charge
 electric charge type More...
 
typedef CandidateCollection daughters
 collection of daughter candidates More...
 
typedef unsigned int index
 
typedef math::XYZTLorentzVector LorentzVector
 Lorentz vector. More...
 
typedef math::XYZPoint Point
 point in the space More...
 
typedef math::PtEtaPhiMLorentzVector PolarLorentzVector
 Lorentz vector. More...
 
typedef math::XYZVector Vector
 point in the space More...
 
- Public Types inherited from reco::Candidate
enum  { dimension = 3 }
 
enum  { size = dimension * (dimension + 1)/2 }
 matix size More...
 
typedef int Charge
 electric charge type More...
 
typedef candidate::const_iterator const_iterator
 
typedef math::Error< dimension >::type CovarianceMatrix
 covariance error matrix (3x3) More...
 
typedef unsigned int index
 index type More...
 
typedef candidate::iterator iterator
 
typedef math::XYZTLorentzVector LorentzVector
 Lorentz vector. More...
 
typedef math::XYZPoint Point
 point in the space More...
 
typedef math::PtEtaPhiMLorentzVector PolarLorentzVector
 Lorentz vector. More...
 
typedef size_t size_type
 
typedef math::XYZVector Vector
 point in the space More...
 

Detailed Description

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

Author
Volker Adler

Definition at line 32 of file TriggerObjectStandAlone.h.

Constructor & Destructor Documentation

TriggerObjectStandAlone::TriggerObjectStandAlone ( )

Constructors and Destructor.

Default constructor

Definition at line 27 of file TriggerObjectStandAlone.cc.

References filterLabelIndices_, filterLabels_, pathL3FilterAccepted_, pathLastFilterAccepted_, and pathNames_.

27  :
29 {
30  filterLabels_.clear();
31  filterLabelIndices_.clear();
32  pathNames_.clear();
34  pathL3FilterAccepted_.clear();
35 }
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 of L1 conditions the trigger objects has been used in...
std::vector< bool > pathL3FilterAccepted_
TriggerObject()
Constructors and Destructor.
std::vector< uint16_t > filterLabelIndices_
std::vector< bool > pathLastFilterAccepted_
TriggerObjectStandAlone::TriggerObjectStandAlone ( const TriggerObject trigObj)

Constructor from pat::TriggerObject.

Definition at line 39 of file TriggerObjectStandAlone.cc.

References filterLabelIndices_, filterLabels_, pathL3FilterAccepted_, pathLastFilterAccepted_, and pathNames_.

39  :
40  TriggerObject( trigObj )
41 {
42  filterLabels_.clear();
43  filterLabelIndices_.clear();
44  pathNames_.clear();
46  pathL3FilterAccepted_.clear();
47 }
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 of L1 conditions the trigger objects has been used in...
std::vector< bool > pathL3FilterAccepted_
TriggerObject()
Constructors and Destructor.
std::vector< uint16_t > filterLabelIndices_
std::vector< bool > pathLastFilterAccepted_
TriggerObjectStandAlone::TriggerObjectStandAlone ( const trigger::TriggerObject trigObj)

Constructor from trigger::TriggerObject.

Definition at line 51 of file TriggerObjectStandAlone.cc.

References filterLabelIndices_, filterLabels_, pathL3FilterAccepted_, pathLastFilterAccepted_, and pathNames_.

51  :
52  TriggerObject( trigObj )
53 {
54  filterLabels_.clear();
55  filterLabelIndices_.clear();
56  pathNames_.clear();
58  pathL3FilterAccepted_.clear();
59 }
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 of L1 conditions the trigger objects has been used in...
std::vector< bool > pathL3FilterAccepted_
TriggerObject()
Constructors and Destructor.
std::vector< uint16_t > filterLabelIndices_
std::vector< bool > pathLastFilterAccepted_
TriggerObjectStandAlone::TriggerObjectStandAlone ( const reco::LeafCandidate leafCand)

Constructor from reco::Candidate.

Definition at line 63 of file TriggerObjectStandAlone.cc.

References filterLabelIndices_, filterLabels_, pathL3FilterAccepted_, pathLastFilterAccepted_, and pathNames_.

63  :
64  TriggerObject( leafCand )
65 {
66  filterLabels_.clear();
67  filterLabelIndices_.clear();
68  pathNames_.clear();
70  pathL3FilterAccepted_.clear();
71 }
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 of L1 conditions the trigger objects has been used in...
std::vector< bool > pathL3FilterAccepted_
TriggerObject()
Constructors and Destructor.
std::vector< uint16_t > filterLabelIndices_
std::vector< bool > pathLastFilterAccepted_
TriggerObjectStandAlone::TriggerObjectStandAlone ( const reco::Particle::LorentzVector vec,
int  id = 0 
)

Constructors from Lorentz-vectors and (optional) PDG ID.

Definition at line 75 of file TriggerObjectStandAlone.cc.

References filterLabelIndices_, filterLabels_, pathL3FilterAccepted_, pathLastFilterAccepted_, and pathNames_.

75  :
76  TriggerObject( vec, id )
77 {
78  filterLabels_.clear();
79  filterLabelIndices_.clear();
80  pathNames_.clear();
82  pathL3FilterAccepted_.clear();
83 }
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 of L1 conditions the trigger objects has been used in...
std::vector< bool > pathL3FilterAccepted_
TriggerObject()
Constructors and Destructor.
std::vector< uint16_t > filterLabelIndices_
std::vector< bool > pathLastFilterAccepted_
TriggerObjectStandAlone::TriggerObjectStandAlone ( const reco::Particle::PolarLorentzVector vec,
int  id = 0 
)

Definition at line 84 of file TriggerObjectStandAlone.cc.

References filterLabelIndices_, filterLabels_, pathL3FilterAccepted_, pathLastFilterAccepted_, and pathNames_.

84  :
85  TriggerObject( vec, id )
86 {
87  filterLabels_.clear();
88  filterLabelIndices_.clear();
89  pathNames_.clear();
91  pathL3FilterAccepted_.clear();
92 }
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 of L1 conditions the trigger objects has been used in...
std::vector< bool > pathL3FilterAccepted_
TriggerObject()
Constructors and Destructor.
std::vector< uint16_t > filterLabelIndices_
std::vector< bool > pathLastFilterAccepted_
pat::TriggerObjectStandAlone::TriggerObjectStandAlone ( const TriggerObjectStandAlone )
default
pat::TriggerObjectStandAlone::~TriggerObjectStandAlone ( )
inlineoverride

Destructor.

Definition at line 106 of file TriggerObjectStandAlone.h.

106 {};

Member Function Documentation

void pat::TriggerObjectStandAlone::addAlgorithmName ( const std::string &  algorithmName,
bool  algoCondAccepted = true 
)
inline

Adds a new L1 algorithm name.

Definition at line 121 of file TriggerObjectStandAlone.h.

121 { addPathOrAlgorithm( algorithmName, algoCondAccepted, false ); };
void addPathOrAlgorithm(const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted)
Adds a new HLT path or L1 algorithm name.
void pat::TriggerObjectStandAlone::addConditionName ( const std::string &  conditionName)
inline

Adds a new L1 condition name.

Definition at line 117 of file TriggerObjectStandAlone.h.

117 { addFilterOrCondition( conditionName ); };
void addFilterOrCondition(const std::string &name)
Adds a new HLT filter label or L1 condition name.
void pat::TriggerObjectStandAlone::addFilterLabel ( const std::string &  filterLabel)
inline

Adds a new HLT filter label.

Definition at line 115 of file TriggerObjectStandAlone.h.

Referenced by pat::PATTriggerProducer::produce().

115 { addFilterOrCondition( filterLabel ); };
void addFilterOrCondition(const std::string &name)
Adds a new HLT filter label or L1 condition name.
void pat::TriggerObjectStandAlone::addFilterOrCondition ( const std::string &  name)
inlineprivate

Adds a new HLT filter label or L1 condition name.

Definition at line 68 of file TriggerObjectStandAlone.h.

References dataset::name, and AlCaHLTBitMon_QueryRunRegistry::string.

68 { if ( ! hasFilterOrCondition( name ) ) filterLabels_.push_back( name ); };
std::vector< std::string > filterLabels_
Vector of labels of all HLT filters or names of L1 conditions the trigger objects has been used in...
bool hasFilterOrCondition(const std::string &name) const
Checks, if a certain HLT filter label or L1 condition name is assigned.
void pat::TriggerObjectStandAlone::addPathName ( const std::string &  pathName,
bool  pathLastFilterAccepted = true,
bool  pathL3FilterAccepted = true 
)
inline

Adds a new HLT path name.

Definition at line 119 of file TriggerObjectStandAlone.h.

Referenced by pat::PATTriggerProducer::produce().

119 { addPathOrAlgorithm( pathName, pathLastFilterAccepted, pathL3FilterAccepted ); };
void addPathOrAlgorithm(const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted)
Adds a new HLT path or L1 algorithm name.
void TriggerObjectStandAlone::addPathOrAlgorithm ( const std::string &  name,
bool  pathLastFilterAccepted,
bool  pathL3FilterAccepted 
)
private

Adds a new HLT path or L1 algorithm name.

Definition at line 145 of file TriggerObjectStandAlone.cc.

References checkIfPathsAreUnpacked(), hasPathOrAlgorithm(), dataset::name, pathL3FilterAccepted_, pathLastFilterAccepted_, and pathNames_.

146 {
148 
149  // Check, if path is already assigned
150  if ( ! hasPathOrAlgorithm( name, false, false ) ) {
151  // The path itself
152  pathNames_.push_back( name );
153  // The corresponding usage of the trigger objects
154  pathLastFilterAccepted_.push_back( pathLastFilterAccepted );
155  pathL3FilterAccepted_.push_back( pathL3FilterAccepted );
156  // Enable status updates
157  } else if ( pathLastFilterAccepted || pathL3FilterAccepted ) {
158  // Search for path
159  unsigned index( 0 );
160  while ( index < pathNames_.size() ) {
161  if ( pathNames_.at( index ) == name ) break;
162  ++index;
163  }
164  // Status update
165  if ( index < pathNames_.size() ) {
166  pathLastFilterAccepted_.at( index ) = pathLastFilterAccepted_.at( index ) || pathLastFilterAccepted;
167  pathL3FilterAccepted_.at( index ) = pathL3FilterAccepted_.at( index ) || pathL3FilterAccepted;
168  }
169  }
170 }
bool checkIfPathsAreUnpacked(bool throwIfPacked=true) const
Check if trigger names have been packed by calling packPathNames() and not yet unpacked.
std::vector< std::string > pathNames_
Vector of names of all HLT paths or L1 algorithms the trigger objects has been used in...
unsigned int index
Definition: LeafCandidate.h:31
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::vector< bool > pathLastFilterAccepted_
bool pat::TriggerObjectStandAlone::algo ( const std::string &  algorithmName,
unsigned  algoCondAccepted = 1 
) const
inline

Calls 'hasAlgorithmName(...)'.

Definition at line 159 of file TriggerObjectStandAlone.h.

159 { return hasAlgorithmName( algorithmName, bool( algoCondAccepted ) ); };
bool hasAlgorithmName(const std::string &algorithmName, bool algoCondAccepted=true) const
Checks, if a certain L1 algorithm name is assigned.
std::vector< std::string > pat::TriggerObjectStandAlone::algorithmNames ( bool  algoCondAccepted = true) const
inline

Gets all L1 algorithm names.

Definition at line 129 of file TriggerObjectStandAlone.h.

129 { return pathsOrAlgorithms( algoCondAccepted, false ); };
std::vector< std::string > pathsOrAlgorithms(bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
Gets all HLT path or L1 algorithm names.
std::vector< std::string > const * TriggerObjectStandAlone::allLabels ( edm::ParameterSetID const &  psetid,
const edm::EventBase event,
const edm::TriggerResults res 
) const

Definition at line 396 of file TriggerObjectStandAlone.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), mps_fire::i, edm::ParameterSet::insert(), funct::m, gen::n, edm::EventBase::parameterSet(), and muonDTDigis_cfi::pset.

Referenced by packFilterLabels(), and unpackFilterLabels().

396  {
397 
398  // If TriggerNames was already created and cached here in the map,
399  // then look it up and return that one
400  AllLabelsMap::const_iterator iter =
401  allLabelsMap.find(psetid);
402  if (iter != allLabelsMap.end()) {
403  return &iter->second;
404  }
405 
406  const auto& triggerNames= event.triggerNames(res);
407  edm::ParameterSet const* pset=nullptr;
408  //getting the ParameterSet from the event ensures that the registry is filled
409  if (nullptr!=(pset=event.parameterSet(psetid ))) {
410  using namespace std;
411  using namespace edm;
412  using namespace trigger;
413 
414 
415  const unsigned int n(triggerNames.size());
416  std::set<std::string> saveTags;
417  for (unsigned int i=0;i!=n; ++i) {
418  if (pset->existsAs<vector<string> >(triggerNames.triggerName(i),true)) {
419  auto modules = pset->getParameter<vector<string> >(triggerNames.triggerName(i));
420  for(size_t m=0; m < modules.size(); m++){
421  auto module=modules[m];
422  auto moduleStrip=module.front()!='-' ? module : module.substr(1);
423 
424  if (pset->exists(moduleStrip)) {
425  const auto& modulePSet= pset->getParameterSet(moduleStrip);
426  if (modulePSet.existsAs<bool>("saveTags",true) and
427  modulePSet.getParameter<bool>("saveTags") ) {
428  saveTags.insert(moduleStrip);
429  }
430  }
431  }
432  }
433  }
434  std::vector<std::string> allModules(saveTags.begin(),saveTags.end());
435  std::pair<AllLabelsMap::iterator, bool> ret =
436  allLabelsMap.insert(std::pair<edm::ParameterSetID, std::vector<std::string> >(psetid, allModules));
437  return &(ret.first->second);
438  }
439  return nullptr;
440  }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
bool exists(std::string const &parameterName) const
checks if a parameter exists
void insert(bool ok_to_replace, char const *, Entry const &)
virtual edm::ParameterSet const * parameterSet(edm::ParameterSetID const &psID) const =0
ParameterSet const & getParameterSet(std::string const &) const
HLT enums.
Definition: vlib.h:208
bool TriggerObjectStandAlone::checkIfFiltersAreUnpacked ( bool  throwIfPacked = true) const
private

Check if trigger names have been packed by calling packFilterLabels() and not yet unpacked.

Definition at line 274 of file TriggerObjectStandAlone.cc.

References Exception, and filterLabelIndices_.

Referenced by hasFilterOrCondition().

274  {
275  bool unpacked = filterLabelIndices_.empty();
276  if (!unpacked && throwIfPacked) throw cms::Exception("RuntimeError", "This TriggerObjectStandAlone object has packed trigger filter labels. Before accessing path names you must call unpackFilterLabels with an edm::EventBase object. Both the edm::Event or fwlite::Event are derived from edm::EventBase and can be passed\n");
277  return unpacked;
278 }
std::vector< uint16_t > filterLabelIndices_
bool TriggerObjectStandAlone::checkIfPathsAreUnpacked ( bool  throwIfPacked = true) const
private

Check if trigger names have been packed by calling packPathNames() and not yet unpacked.

Definition at line 269 of file TriggerObjectStandAlone.cc.

References Exception, pathIndices_, and pathNames_.

Referenced by addPathOrAlgorithm(), hasPathOrAlgorithm(), and pathsOrAlgorithms().

269  {
270  bool unpacked = (!pathNames_.empty() || pathIndices_.empty());
271  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");
272  return unpacked;
273 }
std::vector< std::string > pathNames_
Vector of names of all HLT paths or L1 algorithms the trigger objects has been used in...
std::vector< uint16_t > pathIndices_
bool pat::TriggerObjectStandAlone::coll ( const std::string &  collName) const
inlineoverridevirtual

Calls 'hasCollection(...)' (method override)

Reimplemented from pat::TriggerObject.

Definition at line 161 of file TriggerObjectStandAlone.h.

161 { return hasCollection( collName ); };
bool hasCollection(const std::string &collName) const override
Checks, if a certain label of original collection is assigned (method overrides)
bool pat::TriggerObjectStandAlone::cond ( const std::string &  conditionName) const
inline

Calls 'hasConditionName(...)'.

Definition at line 155 of file TriggerObjectStandAlone.h.

155 { return hasConditionName( conditionName ); };
bool hasConditionName(const std::string &conditionName) const
Checks, if a certain L1 condition name is assigned.
const std::vector< std::string >& pat::TriggerObjectStandAlone::conditionNames ( ) const
inline

Gets all L1 condition names.

Definition at line 125 of file TriggerObjectStandAlone.h.

125 { return filtersOrConditions(); };
const std::vector< std::string > & filtersOrConditions() const
Gets all HLT filter labels or L1 condition names.
TriggerObjectStandAlone pat::TriggerObjectStandAlone::copy ( ) const
inline

Methods.

Definition at line 110 of file TriggerObjectStandAlone.h.

110  {
111  return *this;
112  }
bool pat::TriggerObjectStandAlone::filter ( const std::string &  filterLabel) const
inline

Calls 'hasFilterLabel(...)'.

Special methods for the cut string parser

  • argument types usable in the cut string parser
  • short names for readable configuration files

Definition at line 153 of file TriggerObjectStandAlone.h.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

153 { return hasFilterLabel( filterLabel ); };
bool hasFilterLabel(const std::string &filterLabel) const
Checks, if a certain HLT filter label is assigned.
const std::vector< std::string >& pat::TriggerObjectStandAlone::filterLabels ( ) const
inline

Gets all HLT filter labels.

Definition at line 123 of file TriggerObjectStandAlone.h.

123 { return filtersOrConditions(); };
const std::vector< std::string > & filtersOrConditions() const
Gets all HLT filter labels or L1 condition names.
const std::vector< std::string >& pat::TriggerObjectStandAlone::filtersOrConditions ( ) const
inlineprivate

Gets all HLT filter labels or L1 condition names.

Definition at line 72 of file TriggerObjectStandAlone.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

bool checkIfFiltersAreUnpacked(bool throwIfPacked=true) const
Check if trigger names have been packed by calling packFilterLabels() and not yet unpacked...
std::vector< std::string > filterLabels_
Vector of labels of all HLT filters or names of L1 conditions the trigger objects has been used in...
bool pat::TriggerObjectStandAlone::hasAlgoCondAccepted ( ) const
inline

Definition at line 145 of file TriggerObjectStandAlone.h.

145 { return hasLastFilter(); };
bool hasLastFilter() const
Check, if the usage indicator vectors have been filled.
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 139 of file TriggerObjectStandAlone.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by pat::PATObject< ObjectType >::triggerObjectMatchByAlgorithm(), and pat::PATObject< ObjectType >::triggerObjectMatchesByAlgorithm().

139 { return hasPathOrAlgorithm( algorithmName, algoCondAccepted, false ); };
bool hasPathOrAlgorithm(const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
Checks, if a certain HLT path or L1 algorithm name is assigned.
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 99 of file TriggerObjectStandAlone.cc.

References runEdmFileComparison::failed, split, AlCaHLTBitMon_QueryRunRegistry::string, and wildcard_.

Referenced by hasCollection(), hasFilterOrCondition(), and hasPathOrAlgorithm().

100 {
101  // Special cases first
102  // Always false for empty vector to check
103  if ( nameVec.empty() ) return false;
104  // Always true for general wild-card(s)
105  if ( name.find_first_not_of( wildcard_ ) == std::string::npos ) return true;
106  // Split name to evaluate in parts, seperated by wild-cards
107  std::vector< std::string > namePartsVec;
108  boost::split( namePartsVec, name, boost::is_any_of( std::string( 1, wildcard_ ) ), boost::token_compress_on );
109  // Iterate over vector of names to search
110  for ( std::vector< std::string >::const_iterator iVec = nameVec.begin(); iVec != nameVec.end(); ++iVec ) {
111  // Not failed yet
112  bool failed( false );
113  // Start searching at the first character
114  size_type index( 0 );
115  // Iterate over evaluation name parts
116  for ( std::vector< std::string >::const_iterator iName = namePartsVec.begin(); iName != namePartsVec.end(); ++iName ) {
117  // Empty parts due to
118  // - wild-card at beginning/end or
119  // - multiple wild-cards (should be supressed by 'boost::token_compress_on')
120  if ( iName->length() == 0 ) continue;
121  // Search from current index and
122  // set index to found occurence
123  index = iVec->find( *iName, index );
124  // Failed and exit loop, if
125  // - part not found
126  // - part at beginning not found there
127  if ( index == std::string::npos || ( iName == namePartsVec.begin() && index > 0 ) ) {
128  failed = true;
129  break;
130  }
131  // Increase index by length of found part
132  index += iName->length();
133  }
134  // Failed, if end of name not reached
135  if ( index < iVec->length() && namePartsVec.back().length() != 0 ) failed = true;
136  // Match found!
137  if ( ! failed ) return true;
138  }
139  // No match found!
140  return false;
141 }
static const char wildcard_
Constants.
uint16_t size_type
unsigned int index
Definition: LeafCandidate.h:31
double split
Definition: MVATrainer.cc:139
bool TriggerObjectStandAlone::hasCollection ( const std::string &  collName) const
overridevirtual

Checks, if a certain label of original collection is assigned (method overrides)

Reimplemented from pat::TriggerObject.

Definition at line 245 of file TriggerObjectStandAlone.cc.

References pat::TriggerObject::collection(), hasAnyName(), pat::TriggerObject::hasCollection(), edm::InputTag::instance(), edm::InputTag::label(), edm::InputTag::process(), and wildcard_.

Referenced by pat::PATTriggerProducer::produce(), pat::PATObject< ObjectType >::triggerObjectMatchByCollection(), and pat::PATObject< ObjectType >::triggerObjectMatchesByCollection().

246 {
247  // Move to wild-card parser, if needed only
248  if ( collName.find( wildcard_ ) != std::string::npos ) {
249  // True, if collection name is simply fine
250  if ( hasAnyName( collName, std::vector< std::string >( 1, collection() ) ) ) return true;
251  // Check, if collection name possibly fits in an edm::InputTag approach
252  const edm::InputTag collectionTag( collection() );
253  const edm::InputTag collTag( collName );
254  // If evaluated collection tag contains a process name, it must have been found already by identity check
255  if ( collTag.process().empty() ) {
256  // Check instance ...
257  if ( ( collTag.instance().empty() && collectionTag.instance().empty() ) || hasAnyName( collTag.instance(), std::vector< std::string >( 1, collectionTag.instance() ) ) ) {
258  // ... and label
259  return hasAnyName( collTag.label(), std::vector< std::string >( 1, collectionTag.label() ) );
260  }
261  }
262  return false;
263  }
264  // Use parent class's method otherwise
265  return TriggerObject::hasCollection( collName );
266 }
static const char wildcard_
Constants.
bool hasAnyName(const std::string &name, const std::vector< std::string > &nameVec) const
Private methods.
const std::string & collection() const
Get the label of the collection the trigger object originates from.
Definition: TriggerObject.h:92
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned.
bool pat::TriggerObjectStandAlone::hasCollection ( const edm::InputTag collName) const
inlineoverridevirtual

Reimplemented from pat::TriggerObject.

Definition at line 142 of file TriggerObjectStandAlone.h.

References edm::InputTag::encode(), and hasCollection().

Referenced by hasCollection().

142 { return hasCollection( collName.encode() ); };
bool hasCollection(const std::string &collName) const override
Checks, if a certain label of original collection is assigned (method overrides)
std::string encode() const
Definition: InputTag.cc:166
bool pat::TriggerObjectStandAlone::hasConditionName ( const std::string &  conditionName) const
inline

Checks, if a certain L1 condition name is assigned.

Definition at line 135 of file TriggerObjectStandAlone.h.

Referenced by pat::PATObject< ObjectType >::triggerObjectMatchByCondition(), and pat::PATObject< ObjectType >::triggerObjectMatchesByCondition().

135 { return hasFilterOrCondition( conditionName ); };
bool hasFilterOrCondition(const std::string &name) const
Checks, if a certain HLT filter label or L1 condition name is assigned.
bool pat::TriggerObjectStandAlone::hasFilterLabel ( const std::string &  filterLabel) const
inline

Checks, if a certain HLT filter label is assigned.

Definition at line 133 of file TriggerObjectStandAlone.h.

Referenced by pat::PATObject< ObjectType >::triggerObjectMatchByFilter(), and pat::PATObject< ObjectType >::triggerObjectMatchesByFilter().

133 { return hasFilterOrCondition( filterLabel ); };
bool hasFilterOrCondition(const std::string &name) const
Checks, if a certain HLT filter label or L1 condition name is assigned.
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 195 of file TriggerObjectStandAlone.cc.

References checkIfFiltersAreUnpacked(), filterLabels_, spr::find(), hasAnyName(), dataset::name, and wildcard_.

196 {
198 
199  // Move to wild-card parser, if needed
200  if ( name.find( wildcard_ ) != std::string::npos ) return hasAnyName( name, filterLabels_ );
201  // Return, if filter label is assigned
202  return ( std::find( filterLabels_.begin(), filterLabels_.end(), name ) != filterLabels_.end() );
203 }
bool checkIfFiltersAreUnpacked(bool throwIfPacked=true) const
Check if trigger names have been packed by calling packFilterLabels() and not yet unpacked...
static const char wildcard_
Constants.
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 find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
bool hasAnyName(const std::string &name, const std::vector< std::string > &nameVec) const
Private methods.
bool pat::TriggerObjectStandAlone::hasL3Filter ( ) const
inlineprivate

Definition at line 81 of file TriggerObjectStandAlone.h.

Referenced by hasPathOrAlgorithm(), and pathsOrAlgorithms().

81 { return ( !pathL3FilterAccepted_.empty() && pathL3FilterAccepted_.size() == pathNames_.size() ); };
std::vector< std::string > pathNames_
Vector of names of all HLT paths or L1 algorithms the trigger objects has been used in...
std::vector< bool > pathL3FilterAccepted_
bool pat::TriggerObjectStandAlone::hasLastFilter ( ) const
inlineprivate

Check, if the usage indicator vectors have been filled.

Definition at line 80 of file TriggerObjectStandAlone.h.

Referenced by hasPathOrAlgorithm(), and pathsOrAlgorithms().

80 { return ( !pathLastFilterAccepted_.empty() && pathLastFilterAccepted_.size() == pathNames_.size() ); };
std::vector< std::string > pathNames_
Vector of names of all HLT paths or L1 algorithms the trigger objects has been used in...
std::vector< bool > pathLastFilterAccepted_
bool pat::TriggerObjectStandAlone::hasPathL3FilterAccepted ( ) const
inline

Definition at line 146 of file TriggerObjectStandAlone.h.

146 { return hasL3Filter(); };
bool pat::TriggerObjectStandAlone::hasPathLastFilterAccepted ( ) const
inline

Checks, if the usage indicator vector has been filled.

Definition at line 144 of file TriggerObjectStandAlone.h.

144 { return hasLastFilter(); };
bool hasLastFilter() const
Check, if the usage indicator vectors have been filled.
bool pat::TriggerObjectStandAlone::hasPathName ( const std::string &  pathName,
bool  pathLastFilterAccepted = false,
bool  pathL3FilterAccepted = true 
) const
inline

Checks, if a certain HLT path name is assigned.

Definition at line 137 of file TriggerObjectStandAlone.h.

Referenced by pat::PATObject< ObjectType >::triggerObjectMatchByPath(), and pat::PATObject< ObjectType >::triggerObjectMatchesByPath().

137 { return hasPathOrAlgorithm( pathName, pathLastFilterAccepted, pathL3FilterAccepted ); };
bool hasPathOrAlgorithm(const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
Checks, if a certain HLT path or L1 algorithm name is assigned.
bool TriggerObjectStandAlone::hasPathOrAlgorithm ( const std::string &  name,
bool  pathLastFilterAccepted,
bool  pathL3FilterAccepted 
) const
private

Checks, if a certain HLT path or L1 algorithm name is assigned.

Definition at line 207 of file TriggerObjectStandAlone.cc.

References checkIfPathsAreUnpacked(), spr::find(), hasAnyName(), hasL3Filter(), hasLastFilter(), match(), dataset::name, pathL3FilterAccepted_, pathLastFilterAccepted_, pathNames_, pathsOrAlgorithms(), and wildcard_.

Referenced by addPathOrAlgorithm().

208 {
210 
211  // Move to wild-card parser, if needed
212  if ( name.find( wildcard_ ) != std::string::npos ) return hasAnyName( name, pathsOrAlgorithms( pathLastFilterAccepted, pathL3FilterAccepted ) );
213  // Deal with older PAT-tuples, where trigger object usage is not available
214  if ( ! hasLastFilter() ) pathLastFilterAccepted = false;
215  if ( ! hasL3Filter() ) pathL3FilterAccepted = false;
216  // Check, if path name is assigned at all
217  std::vector< std::string >::const_iterator match( std::find( pathNames_.begin(), pathNames_.end(), name ) );
218  // False, if path name not assigned
219  if ( match == pathNames_.end() ) return false;
220  if ( ! pathLastFilterAccepted && ! pathL3FilterAccepted ) return true;
221  bool foundLastFilter( pathLastFilterAccepted ? pathLastFilterAccepted_.at( match - pathNames_.begin() ) : true );
222  bool foundL3Filter( pathL3FilterAccepted ? pathL3FilterAccepted_.at( match - pathNames_.begin() ) : true );
223  // Return for assigned path name, if trigger object usage meets requirement
224  return ( foundLastFilter && foundL3Filter );
225 }
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 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...
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
bool hasAnyName(const std::string &name, const std::vector< std::string > &nameVec) const
Private methods.
bool hasLastFilter() const
Check, if the usage indicator vectors have been filled.
std::vector< bool > pathL3FilterAccepted_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
std::vector< bool > pathLastFilterAccepted_
void TriggerObjectStandAlone::packFilterLabels ( const edm::EventBase event,
const edm::TriggerResults res 
)

Definition at line 373 of file TriggerObjectStandAlone.cc.

References allLabels(), and psetId_.

373  {
374  packFilterLabels(*allLabels(psetId_,event,res));
375 }
void packFilterLabels(const edm::EventBase &event, const edm::TriggerResults &res)
std::vector< std::string > const * allLabels(edm::ParameterSetID const &psetid, const edm::EventBase &event, const edm::TriggerResults &res) const
void TriggerObjectStandAlone::packFilterLabels ( const std::vector< std::string > &  labels)

pack filter labels into indices; note that the labels must be sorted!

Definition at line 327 of file TriggerObjectStandAlone.cc.

References Exception, filterLabelIndices_, filterLabels_, mps_fire::i, match(), eostools::move(), and gen::n.

327  {
328  if (!filterLabelIndices_.empty()) {
329  throw cms::Exception("RuntimeError", "Error, trying to pack filter labels for an already packed TriggerObjectStandAlone");
330  }
331  std::vector<std::string> unmatched;
332  std::vector<uint16_t> indices;
333  indices.reserve(filterLabels_.size());
334 
335  auto nStart = names.begin(), nEnd = names.end();
336  for (unsigned int i = 0, n = filterLabels_.size(); i < n; ++i) {
337  auto match = std::lower_bound(nStart, nEnd, filterLabels_[i]);
338  if (match != nEnd && *match == filterLabels_[i]) {
339  indices.push_back(match - nStart);
340  } else {
341  static std::atomic<int> _warn(0);
342  if(++_warn < 5) edm::LogWarning("TriggerObjectStandAlone::packFilterLabels()") << "Warning: can't resolve '" << filterLabels_[i] << "' to a label index. idx: " << i <<std::endl;
343  unmatched.push_back(std::move(filterLabels_[i]));
344  }
345  }
346  std::sort(indices.begin(), indices.end()); // try reduce enthropy
347  filterLabelIndices_.swap(indices);
348  filterLabels_.swap(unmatched);
349 }
std::vector< std::string > filterLabels_
Vector of labels of all HLT filters or names of L1 conditions the trigger objects has been used in...
const std::string names[nVars_]
std::vector< uint16_t > filterLabelIndices_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
def move(src, dest)
Definition: eostools.py:510
void TriggerObjectStandAlone::packP4 ( )

reduce the precision on the 4-vector

Definition at line 378 of file TriggerObjectStandAlone.cc.

References CMS_THREAD_SAFE, reco::LeafCandidate::eta(), reco::LeafCandidate::mass(), reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), reco::LeafCandidate::setP4(), and edm::Hash< I >::smallHash().

378  {
380  MiniFloatConverter::reduceMantissaToNbitsRounding<14>(pt()),
381  MiniFloatConverter::reduceMantissaToNbitsRounding<11>(eta()),
382  MiniFloatConverter::reduceMantissaToNbits<11>(phi()),
383  MiniFloatConverter::reduceMantissaToNbitsRounding<8>(mass()) ));
384 }
double eta() const final
momentum pseudorapidity
double pt() const final
transverse momentum
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:23
double phi() const final
momentum azimuthal angle
void setP4(const LorentzVector &p4) final
set 4-momentum
double mass() const final
mass
void TriggerObjectStandAlone::packPathNames ( const edm::TriggerNames names)

pack trigger names into indices

Definition at line 282 of file TriggerObjectStandAlone.cc.

References reco::Candidate::end(), Exception, mps_fire::i, pat::TriggerObject::id(), gen::n, convertSQLiteXML::ok, pathIndices_, pathNames_, edm::TriggerNames::size(), and edm::TriggerNames::triggerIndex().

282  {
283  if (!pathIndices_.empty()) {
284  if (!pathNames_.empty()) {
285  throw cms::Exception("RuntimeError", "Error, trying to pack a partially packed TriggerObjectStandAlone");
286  } else {
287  return;
288  }
289  }
290  bool ok = true;
291  unsigned int n = pathNames_.size(), end = names.size();
292  std::vector<uint16_t> indices(n);
293  for (unsigned int i = 0; i < n; ++i) {
294  uint16_t id = names.triggerIndex(pathNames_[i]);
295  if (id >= end) {
296  static std::atomic<int> _warn(0);
297  if (++_warn < 5) edm::LogWarning("TriggerObjectStandAlone::packPathNames()") << "Warning: can't resolve '" << pathNames_[i] << "' to a path index" << std::endl;
298  ok = false; break;
299  } else {
300  indices[i] = id;
301  }
302  }
303  if (ok) {
304  pathIndices_.swap(indices);
305  pathNames_.clear();
306  }
307 }
bool id(trigger::TriggerObjectType triggerObjectType) const
std::vector< std::string > pathNames_
Vector of names of all HLT paths or L1 algorithms the trigger objects has been used in...
Strings::size_type size() const
Definition: TriggerNames.cc:39
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
const_iterator end() const
last daughter const_iterator
Definition: Candidate.h:146
std::vector< uint16_t > pathIndices_
bool pat::TriggerObjectStandAlone::path ( const std::string &  pathName,
unsigned  pathLastFilterAccepted = 0,
unsigned  pathL3FilterAccepted = 1 
) const
inline

Calls 'hasPathName(...)'.

Definition at line 157 of file TriggerObjectStandAlone.h.

157 { return hasPathName( pathName, bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ) ); };
bool hasPathName(const std::string &pathName, bool pathLastFilterAccepted=false, bool pathL3FilterAccepted=true) const
Checks, if a certain HLT path name is assigned.
std::vector< std::string > pat::TriggerObjectStandAlone::pathNames ( bool  pathLastFilterAccepted = false,
bool  pathL3FilterAccepted = true 
) const
inline

Gets all HLT path names.

Definition at line 127 of file TriggerObjectStandAlone.h.

127 { return pathsOrAlgorithms( pathLastFilterAccepted, pathL3FilterAccepted ); };
std::vector< std::string > pathsOrAlgorithms(bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
Gets all HLT path or L1 algorithm names.
std::vector< std::string > TriggerObjectStandAlone::pathsOrAlgorithms ( bool  pathLastFilterAccepted,
bool  pathL3FilterAccepted 
) const
private

Gets all HLT path or L1 algorithm names.

Definition at line 174 of file TriggerObjectStandAlone.cc.

References checkIfPathsAreUnpacked(), hasL3Filter(), hasLastFilter(), pathL3FilterAccepted_, pathLastFilterAccepted_, and pathNames_.

Referenced by hasPathOrAlgorithm().

175 {
177 
178  // Deal with older PAT-tuples, where trigger object usage is not available
179  if ( ! hasLastFilter() ) pathLastFilterAccepted = false;
180  if ( ! hasL3Filter() ) pathL3FilterAccepted = false;
181  // All path names, if usage not restricted (not required or not available)
182  if ( ! pathLastFilterAccepted && ! pathL3FilterAccepted ) return pathNames_;
183  // Temp vector of path names
184  std::vector< std::string > paths;
185  // Loop over usage vector and fill corresponding paths into temp vector
186  for ( unsigned iPath = 0; iPath < pathNames_.size(); ++iPath ) {
187  if ( ( ! pathLastFilterAccepted || pathLastFilterAccepted_.at( iPath ) ) && ( ! pathL3FilterAccepted || pathL3FilterAccepted_.at( iPath ) ) ) paths.push_back( pathNames_.at( iPath ) ); // order matters in order to protect from empty vectors in old data
188  }
189  // Return temp vector
190  return paths;
191 }
bool checkIfPathsAreUnpacked(bool throwIfPacked=true) const
Check if trigger names have been packed by calling packPathNames() and not yet unpacked.
std::vector< std::string > pathNames_
Vector of names of all HLT paths or L1 algorithms the trigger objects has been used in...
bool hasLastFilter() const
Check, if the usage indicator vectors have been filled.
std::vector< bool > pathL3FilterAccepted_
std::vector< bool > pathLastFilterAccepted_
const edm::ParameterSetID& pat::TriggerObjectStandAlone::psetID ( ) const
inline
void pat::TriggerObjectStandAlone::setPSetID ( const edm::ParameterSetID psetId)
inline

set the psetid of the trigger process

Definition at line 164 of file TriggerObjectStandAlone.h.

164 {psetId_=psetId;}
TriggerObject TriggerObjectStandAlone::triggerObject ( )

Gets the pat::TriggerObject (parent class)

Definition at line 232 of file TriggerObjectStandAlone.cc.

References pat::TriggerObject::addTriggerObjectType(), pat::TriggerObject::collection(), mps_fire::i, reco::LeafCandidate::p4(), reco::LeafCandidate::pdgId(), pat::TriggerObject::setCollection(), and pat::TriggerObject::triggerObjectTypes().

233 {
234  // Create a TriggerObjects
235  TriggerObject theObj( p4(), pdgId() );
236  // Set its collection and trigger objects types (no c'tor for that)
237  theObj.setCollection( collection() );
238  for ( size_t i = 0; i < triggerObjectTypes().size(); ++i ) theObj.addTriggerObjectType( triggerObjectTypes().at( i ) );
239  // Return TriggerObject
240  return theObj;
241 }
int pdgId() const final
PDG identifier.
const std::string & collection() const
Get the label of the collection the trigger object originates from.
Definition: TriggerObject.h:92
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
std::vector< int > triggerObjectTypes() const
Get all trigger object type identifiers.
void TriggerObjectStandAlone::unpackFilterLabels ( const std::vector< std::string > &  labels)

unpack filter labels from indices

Definition at line 362 of file TriggerObjectStandAlone.cc.

References Exception, filterLabelIndices_, filterLabels_, mps_fire::i, funct::m, and gen::n.

Referenced by unpackFilterLabels(), and unpackNamesAndLabels().

362  {
363  if (filterLabelIndices_.empty()) return;
364 
365  std::vector<std::string> mylabels(filterLabels_);
366  for (unsigned int i = 0, n = filterLabelIndices_.size(), m = labels.size(); i < n; ++i) {
367  if (filterLabelIndices_[i] >= m) throw cms::Exception("RuntimeError", "Error, filter label index out of bounds");
368  mylabels.push_back(labels[filterLabelIndices_[i]]);
369  }
370  filterLabelIndices_.clear();
371  filterLabels_.swap(mylabels);
372 }
std::vector< std::string > filterLabels_
Vector of labels of all HLT filters or names of L1 conditions the trigger objects has been used in...
std::vector< uint16_t > filterLabelIndices_
void TriggerObjectStandAlone::unpackFilterLabels ( const edm::EventBase event,
const edm::TriggerResults res 
)

unpack filter labels from indices

Definition at line 358 of file TriggerObjectStandAlone.cc.

References allLabels(), psetId_, and unpackFilterLabels().

358  {
359  unpackFilterLabels(*allLabels(psetId_,event,res));
360 }
std::vector< std::string > const * allLabels(edm::ParameterSetID const &psetid, const edm::EventBase &event, const edm::TriggerResults &res) const
void unpackFilterLabels(const std::vector< std::string > &labels)
unpack filter labels from indices
void TriggerObjectStandAlone::unpackNamesAndLabels ( const edm::EventBase event,
const edm::TriggerResults res 
)

unpack both filter labels and trigger names

Definition at line 351 of file TriggerObjectStandAlone.cc.

References edm::EventBase::triggerNames(), unpackFilterLabels(), and unpackPathNames().

352 {
353  unpackPathNames(event.triggerNames(res));
354  unpackFilterLabels(event,res);
355 
356 }
void unpackPathNames(const edm::TriggerNames &names)
unpack trigger names into indices
void unpackFilterLabels(const std::vector< std::string > &labels)
unpack filter labels from indices
virtual TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const =0
void TriggerObjectStandAlone::unpackPathNames ( const edm::TriggerNames names)

unpack trigger names into indices

Definition at line 309 of file TriggerObjectStandAlone.cc.

References reco::Candidate::end(), Exception, mps_fire::i, gen::n, pathIndices_, pathNames_, edm::TriggerNames::size(), and edm::TriggerNames::triggerName().

Referenced by pat::PATMuonProducer::fillHltTriggerInfo(), pat::PATMuonProducer::fillL1TriggerInfo(), and unpackNamesAndLabels().

309  {
310  if (!pathNames_.empty()) {
311  if (!pathIndices_.empty()) {
312  throw cms::Exception("RuntimeError", "Error, trying to unpack a partially unpacked TriggerObjectStandAlone");
313  } else {
314  return;
315  }
316  }
317  unsigned int n = pathIndices_.size(), end = names.size();
318  std::vector<std::string> paths(n);
319  for (unsigned int i = 0; i < n; ++i) {
320  if (pathIndices_[i] >= end) throw cms::Exception("RuntimeError", "Error, path index out of bounds");
321  paths[i] = names.triggerName(pathIndices_[i]);
322  }
323  pathIndices_.clear();
324  pathNames_.swap(paths);
325 }
std::vector< std::string > pathNames_
Vector of names of all HLT paths or L1 algorithms the trigger objects has been used in...
Strings::size_type size() const
Definition: TriggerNames.cc:39
const_iterator end() const
last daughter const_iterator
Definition: Candidate.h:146
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
std::vector< uint16_t > pathIndices_

Member Data Documentation

std::vector< uint16_t > pat::TriggerObjectStandAlone::filterLabelIndices_
private
std::vector< std::string > pat::TriggerObjectStandAlone::filterLabels_
private

Vector of labels of all HLT filters or names of 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 hasFilterOrCondition(), packFilterLabels(), TriggerObjectStandAlone(), and unpackFilterLabels().

std::vector< uint16_t > pat::TriggerObjectStandAlone::pathIndices_
private
std::vector< bool > pat::TriggerObjectStandAlone::pathL3FilterAccepted_
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 an L3 filter (HLT only) The vector is empty for data (size 0), if the according information is not available.

Definition at line 54 of file TriggerObjectStandAlone.h.

Referenced by addPathOrAlgorithm(), hasPathOrAlgorithm(), pathsOrAlgorithms(), and TriggerObjectStandAlone().

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.

Definition at line 50 of file TriggerObjectStandAlone.h.

Referenced by addPathOrAlgorithm(), hasPathOrAlgorithm(), pathsOrAlgorithms(), and TriggerObjectStandAlone().

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 43 of file TriggerObjectStandAlone.h.

Referenced by addPathOrAlgorithm(), checkIfPathsAreUnpacked(), hasPathOrAlgorithm(), packPathNames(), pathsOrAlgorithms(), TriggerObjectStandAlone(), and unpackPathNames().

edm::ParameterSetID pat::TriggerObjectStandAlone::psetId_
private

Definition at line 56 of file TriggerObjectStandAlone.h.

Referenced by packFilterLabels(), and unpackFilterLabels().

const char TriggerObjectStandAlone::wildcard_ = '*'
staticprivate

Constants.

Constant defining the wild-card used in 'hasAnyName()'

Definition at line 61 of file TriggerObjectStandAlone.h.

Referenced by hasAnyName(), hasCollection(), hasFilterOrCondition(), and hasPathOrAlgorithm().