CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
pat::PATObject< ObjectType > Class Template Reference

Templated PAT object container. More...

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

Inheritance diagram for pat::PATObject< ObjectType >:

Public Types

typedef ObjectType base_type
 

Public Member Functions

void addGenParticleRef (const reco::GenParticleRef &ref)
 
void addTriggerObjectMatch (const TriggerObjectStandAlone &trigObj)
 add a trigger match More...
 
void addUserCand (const std::string &label, const reco::CandidatePtr &data, const bool overwrite=false)
 Set user-defined int. More...
 
template<typename T >
void addUserData (const std::string &label, const T &data, bool transientOnly=false, bool overwrite=false)
 
void addUserDataFromPtr (const std::string &label, const edm::Ptr< pat::UserData > &data, bool overwrite=false)
 
void addUserFloat (const std::string &label, float data, const bool overwrite=false)
 Set user-defined float. More...
 
void addUserInt (const std::string &label, int32_t data, const bool overwrite=false)
 Set user-defined int. More...
 
std::vector< std::pair< std::string, pat::LookupTableRecord > > efficiencies () const
 Returns the efficiencies as <name,value> pairs (by value) More...
 
const pat::LookupTableRecordefficiency (const std::string &name) const
 Returns an efficiency given its name. More...
 
const std::vector< std::string > & efficiencyNames () const
 Returns the list of the names of the stored efficiencies. More...
 
const std::vector< pat::LookupTableRecord > & efficiencyValues () const
 Returns the list of the values of the stored efficiencies (the ordering is the same as in efficiencyNames()) More...
 
void embedGenParticle ()
 
const reco::GenParticlegenParticle (size_t idx=0) const
 
reco::GenParticleRef genParticleById (int pdgId, int status, uint8_t autoCharge=0) const
 
reco::GenParticleRef genParticleRef (size_t idx=0) const
 
std::vector< reco::GenParticleRefgenParticleRefs () const
 
size_t genParticlesSize () const
 Number of generator level particles stored as ref or embedded. More...
 
const pat::CandKinResolutiongetKinResolution (const std::string &label="") const
 
bool hasKinResolution (const std::string &label="") const
 Check if the kinematic resolutions are stored into this object (possibly specifying a label for them) More...
 
bool hasOverlaps (const std::string &label) const
 Returns true if there was at least one overlap for this test label. More...
 
bool hasUserCand (const std::string &key) const
 Return true if there is a user-defined int with a given name. More...
 
bool hasUserData (const std::string &key) const
 Check if user data with a specific type is present. More...
 
bool hasUserFloat (const std::string &key) const
 Return true if there is a user-defined float with a given name. More...
 
bool hasUserFloat (const char *key) const
 a CINT-friendly interface More...
 
bool hasUserInt (const std::string &key) const
 Return true if there is a user-defined int with a given name. More...
 
const reco::CandidateoriginalObject () const
 access to the original object; returns zero for null Ref and throws for unavailable collection More...
 
const edm::Ptr< reco::Candidate > & originalObjectRef () const
 reference to original object. Returns a null reference if not available More...
 
const std::vector< std::string > & overlapLabels () const
 Returns the labels of the overlap tests that found at least one overlap. More...
 
const reco::CandidatePtrVectoroverlaps (const std::string &label) const
 
 PATObject ()
 default constructor More...
 
 PATObject (const ObjectType &obj)
 constructor from a base object (leaves invalid reference to original object!) More...
 
 PATObject (const edm::RefToBase< ObjectType > &ref)
 constructor from reference More...
 
 PATObject (const edm::Ptr< ObjectType > &ref)
 constructor from reference More...
 
double resolE (const std::string &label="") const
 Resolution on energy, possibly with a label to specify which resolution to use. More...
 
double resolEt (const std::string &label="") const
 Resolution on et, possibly with a label to specify which resolution to use. More...
 
double resolEta (const std::string &label="") const
 Resolution on eta, possibly with a label to specify which resolution to use. More...
 
double resolM (const std::string &label="") const
 
double resolP (const std::string &label="") const
 Resolution on p, possibly with a label to specify which resolution to use. More...
 
double resolPhi (const std::string &label="") const
 Resolution on phi, possibly with a label to specify which resolution to use. More...
 
double resolPInv (const std::string &label="") const
 Resolution on 1/p, possibly with a label to specify which resolution to use. More...
 
double resolPt (const std::string &label="") const
 Resolution on pt, possibly with a label to specify which resolution to use. More...
 
double resolPx (const std::string &label="") const
 Resolution on px, possibly with a label to specify which resolution to use. More...
 
double resolPy (const std::string &label="") const
 Resolution on py, possibly with a label to specify which resolution to use. More...
 
double resolPz (const std::string &label="") const
 Resolution on pz, possibly with a label to specify which resolution to use. More...
 
double resolTheta (const std::string &label="") const
 Resolution on theta, possibly with a label to specify which resolution to use. More...
 
void setEfficiency (const std::string &name, const pat::LookupTableRecord &value)
 
void setGenParticle (const reco::GenParticle &particle)
 Set the generator level particle from a particle not in the Event (embedding it, of course) More...
 
void setGenParticleRef (const reco::GenParticleRef &ref, bool embed=false)
 Set the generator level particle reference. More...
 
void setKinResolution (const pat::CandKinResolution &resol, const std::string &label="")
 Add a kinematic resolution to this object (possibly with a label) More...
 
void setOverlaps (const std::string &label, const reco::CandidatePtrVector &overlaps)
 
const TriggerObjectStandAlonetriggerObjectMatch (const size_t idx=0) const
 get one matched trigger object by index More...
 
const TriggerObjectStandAlonetriggerObjectMatchByAlgorithm (const std::string &nameAlgorithm, const bool algoCondAccepted=true, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByAlgorithm (const char *nameAlgorithm, const bool algoCondAccepted=true, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByAlgorithm (const std::string &nameAlgorithm, const unsigned algoCondAccepted, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByAlgorithm (const char *nameAlgorithm, const unsigned algoCondAccepted, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByCollection (const std::string &coll, const size_t idx=0) const
 get one matched trigger object from a certain collection by index More...
 
const TriggerObjectStandAlonetriggerObjectMatchByCollection (const char *coll, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByCondition (const std::string &nameCondition, const size_t idx=0) const
 get one matched L1 object used in a succeeding object combination of a certain L1 condition by index More...
 
const TriggerObjectStandAlonetriggerObjectMatchByCondition (const char *nameCondition, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByFilter (const std::string &labelFilter, const size_t idx=0) const
 get one matched HLT object used in a certain HLT filter by index More...
 
const TriggerObjectStandAlonetriggerObjectMatchByFilter (const char *labelFilter, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByFilterID (const unsigned triggerObjectType, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByPath (const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByPath (const char *namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByPath (const std::string &namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByPath (const char *namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByType (const trigger::TriggerObjectType triggerObjectType, const size_t idx=0) const
 get one matched trigger object of a certain type by index More...
 
const TriggerObjectStandAlonetriggerObjectMatchByType (const unsigned triggerObjectType, const size_t idx=0) const
 
const TriggerObjectStandAloneCollectiontriggerObjectMatches () const
 get all matched trigger objects More...
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm (const std::string &nameAlgorithm, const bool algoCondAccepted=true) const
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm (const char *nameAlgorithm, const bool algoCondAccepted=true) const
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm (const std::string &nameAlgorithm, const unsigned algoCondAccepted) const
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm (const char *nameAlgorithm, const unsigned algoCondAccepted) const
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByCollection (const std::string &coll) const
 get all matched trigger objects from a certain collection More...
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByCollection (const char *coll) const
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByCondition (const std::string &nameCondition) const
 get all matched L1 objects used in a succeeding object combination of a certain L1 condition More...
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByCondition (const char *nameCondition) const
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByFilter (const std::string &labelFilter) const
 get all matched HLT objects used in a certain HLT filter More...
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByFilter (const char *labelFilter) const
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByFilterID (const unsigned triggerObjectType) const
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath (const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath (const char *namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath (const std::string &namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1) const
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath (const char *namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1) const
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByType (const trigger::TriggerObjectType triggerObjectType) const
 
const TriggerObjectStandAloneCollection triggerObjectMatchesByType (const unsigned triggerObjectType) const
 
void unpackTriggerObjectPathNames (const edm::TriggerNames &names)
 unpack path names of matched trigger objects (if they were packed before embedding, which is not normally the case) More...
 
reco::CandidatePtr userCand (const std::string &key) const
 
const std::vector< std::string > & userCandNames () const
 Get list of user-defined cand names. More...
 
template<typename T >
const TuserData (const std::string &key) const
 Returns user-defined data. Returns NULL if the data is not present, or not of type T. More...
 
const void * userDataBare (const std::string &key) const
 
const std::vector< std::string > & userDataNames () const
 Get list of user data object names. More...
 
const std::string & userDataObjectType (const std::string &key) const
 Get human-readable type of user data object, for debugging. More...
 
float userFloat (const std::string &key) const
 
float userFloat (const char *key) const
 a CINT-friendly interface More...
 
const std::vector< std::string > & userFloatNames () const
 Get list of user-defined float names. More...
 
std::vector< float > userFloatRange (const std::string &key) const
 return a range of values corresponding to key More...
 
int32_t userInt (const std::string &key) const
 
const std::vector< std::string > & userIntNames () const
 Get list of user-defined int names. More...
 
std::vector< int > userIntRange (const std::string &key) const
 returns a range of values corresponding to key More...
 
 ~PATObject () override
 destructor More...
 

Protected Member Functions

void addUserDataObject_ (const std::string &label, std::unique_ptr< pat::UserData > value, bool overwrite=false)
 

Protected Attributes

std::vector< std::string > efficiencyNames_
 vector of the efficiencies (names) More...
 
std::vector< pat::LookupTableRecordefficiencyValues_
 vector of the efficiencies (values) More...
 
std::vector< reco::GenParticlegenParticleEmbedded_
 vector to hold an embedded generator level particle More...
 
std::vector< reco::GenParticleRefgenParticleRef_
 Reference to a generator level particle. More...
 
std::vector< std::string > kinResolutionLabels_
 
std::vector< pat::CandKinResolutionkinResolutions_
 Kinematic resolutions. More...
 
std::vector< reco::CandidatePtrVectoroverlapItems_
 Overlapping items (sorted by distance) More...
 
std::vector< std::string > overlapLabels_
 Overlapping test labels (only if there are any overlaps) More...
 
edm::Ptr< reco::CandidaterefToOrig_
 
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
 vector of trigger matches More...
 
std::vector< std::string > userCandLabels_
 
std::vector< reco::CandidatePtruserCands_
 
std::vector< std::string > userDataLabels_
 User data object. More...
 
pat::UserDataCollection userDataObjects_
 
std::vector< std::string > userFloatLabels_
 
std::vector< float > userFloats_
 
std::vector< std::string > userIntLabels_
 
std::vector< int32_t > userInts_
 

Private Member Functions

const pat::UserDatauserDataObject_ (const std::string &key) const
 

Detailed Description

template<class ObjectType>
class pat::PATObject< ObjectType >

Templated PAT object container.

PATObject is the templated base PAT object that wraps around reco objects.

Please post comments and questions to the Physics Tools hypernews: https://hypernews.cern.ch/HyperNews/CMS/get/physTools.html

Author
Steven Lowette, Giovanni Petrucciani, Frederic Ronga, Volker Adler, Sal Rappoccio

Definition at line 48 of file PATObject.h.

Member Typedef Documentation

template<class ObjectType>
typedef ObjectType pat::PATObject< ObjectType >::base_type

Definition at line 50 of file PATObject.h.

Constructor & Destructor Documentation

template<class ObjectType >
pat::PATObject< ObjectType >::PATObject ( )

default constructor

Definition at line 509 of file PATObject.h.

509 {}
template<class ObjectType>
pat::PATObject< ObjectType >::PATObject ( const ObjectType &  obj)

constructor from a base object (leaves invalid reference to original object!)

Definition at line 512 of file PATObject.h.

512 : ObjectType(obj), refToOrig_() {}
edm::Ptr< reco::Candidate > refToOrig_
Definition: PATObject.h:463
template<class ObjectType>
pat::PATObject< ObjectType >::PATObject ( const edm::RefToBase< ObjectType > &  ref)

constructor from reference

Definition at line 515 of file PATObject.h.

516  : ObjectType(*ref),
517  refToOrig_(ref.id(),
518  ref.get(),
519  ref.key()) // correct way to convert RefToBase=>Ptr, if ref is guaranteed to be available
520  // which happens to be true, otherwise the line before this throws ex. already
521  {}
value_type const * get() const
Definition: RefToBase.h:209
ProductID id() const
Definition: RefToBase.h:214
size_t key() const
Definition: RefToBase.h:219
edm::Ptr< reco::Candidate > refToOrig_
Definition: PATObject.h:463
template<class ObjectType>
pat::PATObject< ObjectType >::PATObject ( const edm::Ptr< ObjectType > &  ref)

constructor from reference

Definition at line 524 of file PATObject.h.

524 : ObjectType(*ref), refToOrig_(ref) {}
edm::Ptr< reco::Candidate > refToOrig_
Definition: PATObject.h:463
template<class ObjectType>
pat::PATObject< ObjectType >::~PATObject ( )
inlineoverride

destructor

Definition at line 61 of file PATObject.h.

61 {}

Member Function Documentation

template<class ObjectType >
void pat::PATObject< ObjectType >::addGenParticleRef ( const reco::GenParticleRef ref)

Add a generator level particle reference If there is already an embedded particle, this ref will be embedded too

Definition at line 756 of file PATObject.h.

References pat::PATObject< ObjectType >::genParticleEmbedded_, pat::PATObject< ObjectType >::genParticleRef_, and edm::Ref< C, T, F >::isNonnull().

Referenced by pat::PATElectronProducer::fillElectron(), pat::PATElectronProducer::fillElectron2(), pat::PATMuonProducer::fillMuon(), pat::PATPFParticleProducer::produce(), pat::PATGenericParticleProducer::produce(), pat::PATTauProducer::produce(), and pat::PATPhotonProducer::produce().

756  {
757  if (!genParticleEmbedded_.empty()) { // we're embedding
758  if (ref.isNonnull())
759  genParticleEmbedded_.push_back(*ref);
760  } else {
761  genParticleRef_.push_back(ref);
762  }
763  }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:474
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:476
template<class ObjectType>
void pat::PATObject< ObjectType >::addTriggerObjectMatch ( const TriggerObjectStandAlone trigObj)
inline

add a trigger match

Definition at line 243 of file PATObject.h.

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

243  {
244  triggerObjectMatchesEmbedded_.push_back(trigObj);
245  };
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:466
template<class ObjectType >
void pat::PATObject< ObjectType >::addUserCand ( const std::string &  label,
const reco::CandidatePtr data,
const bool  overwrite = false 
)

Set user-defined int.

Definition at line 959 of file PATObject.h.

References data, HLT_2018_cff::distance, label, pat::PATObject< ObjectType >::userCandLabels_, and pat::PATObject< ObjectType >::userCands_.

961  {
962  auto it = std::lower_bound(userCandLabels_.begin(), userCandLabels_.end(), label);
963  const auto dist = std::distance(userCandLabels_.begin(), it);
964  if (it == userCandLabels_.end() || *it != label) {
965  userCandLabels_.insert(it, label);
966  userCands_.insert(userCands_.begin() + dist, data);
967  } else if (overwrite) {
968  userCands_[dist] = data;
969  } else {
970  userCandLabels_.insert(it + 1, label);
971  userCands_.insert(userCands_.begin() + dist + 1, data);
972  }
973  }
std::vector< reco::CandidatePtr > userCands_
Definition: PATObject.h:494
std::vector< std::string > userCandLabels_
Definition: PATObject.h:493
char const * label
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
template<class ObjectType>
template<typename T >
void pat::PATObject< ObjectType >::addUserData ( const std::string &  label,
const T data,
bool  transientOnly = false,
bool  overwrite = false 
)
inline

Set user-defined data Needs dictionaries for T and for pat::UserHolder<T>, and it will throw exception if they're missing, unless transientOnly is set to true

Definition at line 353 of file PATObject.h.

Referenced by OniaPhotonConversionProducer::makePhotonCandidate(), OniaAddV0TracksProducer::produce(), Onia2MuMuPAT::produce(), and BPHWriteSpecificDecay::write().

353  {
354  std::unique_ptr<pat::UserData> made(pat::UserData::make<T>(data, transientOnly));
355  addUserDataObject_(label, std::move(made), overwrite);
356  }
void addUserDataObject_(const std::string &label, std::unique_ptr< pat::UserData > value, bool overwrite=false)
Definition: PATObject.h:858
char const * label
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
def move(src, dest)
Definition: eostools.py:511
template<class ObjectType>
void pat::PATObject< ObjectType >::addUserDataFromPtr ( const std::string &  label,
const edm::Ptr< pat::UserData > &  data,
bool  overwrite = false 
)
inline

Set user-defined data. To be used only to fill from ValueMap<Ptr<UserData>> Do not use unless you know what you are doing.

Definition at line 360 of file PATObject.h.

360  {
361  std::unique_ptr<pat::UserData> cloned(data->clone());
363  }
void addUserDataObject_(const std::string &label, std::unique_ptr< pat::UserData > value, bool overwrite=false)
Definition: PATObject.h:858
char const * label
virtual UserData * clone() const =0
Necessary for deep copy in OwnVector.
def move(src, dest)
Definition: eostools.py:511
template<class ObjectType >
void pat::PATObject< ObjectType >::addUserDataObject_ ( const std::string &  label,
std::unique_ptr< pat::UserData value,
bool  overwrite = false 
)
protected

Definition at line 858 of file PATObject.h.

References edm::OwnVector< T, P >::begin(), HLT_2018_cff::distance, edm::OwnVector< T, P >::insert(), label, eostools::move(), edm::OwnVector< T, P >::set(), pat::PATObject< ObjectType >::userDataLabels_, and pat::PATObject< ObjectType >::userDataObjects_.

860  {
861  auto it = std::lower_bound(userDataLabels_.begin(), userDataLabels_.end(), label);
862  const auto dist = std::distance(userDataLabels_.begin(), it);
863  if (it == userDataLabels_.end() || *it != label) {
864  userDataLabels_.insert(it, label);
866  } else if (overwrite) {
868  } else {
869  //create a range by adding behind the first entry
870  userDataLabels_.insert(it + 1, label);
872  }
873  }
std::vector< std::string > userDataLabels_
User data object.
Definition: PATObject.h:484
iterator begin()
Definition: OwnVector.h:280
char const * label
void set(size_t i, D *&d)
Definition: OwnVector.h:357
pat::UserDataCollection userDataObjects_
Definition: PATObject.h:485
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
void insert(const_iterator i, D *&d)
Definition: OwnVector.h:395
def move(src, dest)
Definition: eostools.py:511
template<class ObjectType >
void pat::PATObject< ObjectType >::addUserFloat ( const std::string &  label,
float  data,
const bool  overwrite = false 
)

Set user-defined float.

Definition at line 897 of file PATObject.h.

References data, HLT_2018_cff::distance, label, pat::PATObject< ObjectType >::userFloatLabels_, and pat::PATObject< ObjectType >::userFloats_.

Referenced by ZeeCandidateFilter::filter(), EGEtScaleSysModifier::modifyObject(), ZMuMuTrackUserData::produce(), pat::PATPhotonSlimmer::produce(), ZMuMuMuonUserData::produce(), ZMuMuUserData::produce(), ZMuMuUserDataOneTrack::produce(), Onia2MuMuPAT::produce(), PatJPsiProducer::produce(), and BPHWriteSpecificDecay::write().

897  {
898  auto it = std::lower_bound(userFloatLabels_.begin(), userFloatLabels_.end(), label);
899  const auto dist = std::distance(userFloatLabels_.begin(), it);
900  if (it == userFloatLabels_.end() || *it != label) {
901  userFloatLabels_.insert(it, label);
902  userFloats_.insert(userFloats_.begin() + dist, data);
903  } else if (overwrite) {
904  userFloats_[dist] = data;
905  } else {
906  //create a range by adding behind the first entry
907  userFloatLabels_.insert(it + 1, label);
908  userFloats_.insert(userFloats_.begin() + dist + 1, data);
909  }
910  }
std::vector< float > userFloats_
Definition: PATObject.h:488
char const * label
std::vector< std::string > userFloatLabels_
Definition: PATObject.h:487
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
template<class ObjectType>
void pat::PATObject< ObjectType >::addUserInt ( const std::string &  label,
int32_t  data,
const bool  overwrite = false 
)

Set user-defined int.

Definition at line 934 of file PATObject.h.

References data, HLT_2018_cff::distance, label, pat::PATObject< ObjectType >::userIntLabels_, and pat::PATObject< ObjectType >::userInts_.

Referenced by ZeeCandidateFilter::filter(), and Onia2MuMuPAT::produce().

934  {
935  auto it = std::lower_bound(userIntLabels_.begin(), userIntLabels_.end(), label);
936  const auto dist = std::distance(userIntLabels_.begin(), it);
937  if (it == userIntLabels_.end() || *it != label) {
938  userIntLabels_.insert(it, label);
939  userInts_.insert(userInts_.begin() + dist, data);
940  } else if (overwrite) {
941  userInts_[dist] = data;
942  } else {
943  //create a range by adding behind the first entry
944  userIntLabels_.insert(it + 1, label);
945  userInts_.insert(userInts_.begin() + dist + 1, data);
946  }
947  }
char const * label
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
std::vector< int32_t > userInts_
Definition: PATObject.h:491
std::vector< std::string > userIntLabels_
Definition: PATObject.h:490
template<class ObjectType >
std::vector< std::pair< std::string, pat::LookupTableRecord > > pat::PATObject< ObjectType >::efficiencies ( ) const

Returns the efficiencies as <name,value> pairs (by value)

Definition at line 721 of file PATObject.h.

References pat::PATObject< ObjectType >::efficiencyNames_, pat::PATObject< ObjectType >::efficiencyValues_, and runTheMatrix::ret.

721  {
722  std::vector<std::pair<std::string, pat::LookupTableRecord> > ret;
723  std::vector<std::string>::const_iterator itn = efficiencyNames_.begin(), edn = efficiencyNames_.end();
724  std::vector<pat::LookupTableRecord>::const_iterator itv = efficiencyValues_.begin();
725  for (; itn != edn; ++itn, ++itv) {
726  ret.emplace_back(*itn, *itv);
727  }
728  return ret;
729  }
std::vector< std::string > efficiencyNames_
vector of the efficiencies (names)
Definition: PATObject.h:471
ret
prodAgent to be discontinued
std::vector< pat::LookupTableRecord > efficiencyValues_
vector of the efficiencies (values)
Definition: PATObject.h:469
template<class ObjectType >
const pat::LookupTableRecord & pat::PATObject< ObjectType >::efficiency ( const std::string &  name) const

Returns an efficiency given its name.

Definition at line 711 of file PATObject.h.

References HLT_2018_cff::distance, pat::PATObject< ObjectType >::efficiencyNames_, pat::PATObject< ObjectType >::efficiencyValues_, Exception, and Skims_PA_cff::name.

711  {
712  // find the name in the (sorted) list of names
713  auto it = std::lower_bound(efficiencyNames_.cbegin(), efficiencyNames_.cend(), name);
714  if ((it == efficiencyNames_.end()) || (*it != name)) {
715  throw cms::Exception("Invalid Label") << "There is no efficiency with name '" << name << "' in this PAT Object\n";
716  }
717  return efficiencyValues_[std::distance(efficiencyNames_.cbegin(), it)];
718  }
std::vector< std::string > efficiencyNames_
vector of the efficiencies (names)
Definition: PATObject.h:471
std::vector< pat::LookupTableRecord > efficiencyValues_
vector of the efficiencies (values)
Definition: PATObject.h:469
template<class ObjectType>
const std::vector<std::string>& pat::PATObject< ObjectType >::efficiencyNames ( ) const
inline

Returns the list of the names of the stored efficiencies.

Definition at line 260 of file PATObject.h.

260 { return efficiencyNames_; }
std::vector< std::string > efficiencyNames_
vector of the efficiencies (names)
Definition: PATObject.h:471
template<class ObjectType>
const std::vector<pat::LookupTableRecord>& pat::PATObject< ObjectType >::efficiencyValues ( ) const
inline

Returns the list of the values of the stored efficiencies (the ordering is the same as in efficiencyNames())

Definition at line 262 of file PATObject.h.

262 { return efficiencyValues_; }
std::vector< pat::LookupTableRecord > efficiencyValues_
vector of the efficiencies (values)
Definition: PATObject.h:469
template<class ObjectType >
void pat::PATObject< ObjectType >::embedGenParticle ( )

Embed the generator level particle(s) in this PATObject Note that generator level particles can only be all embedded or all not embedded.

Definition at line 773 of file PATObject.h.

References pat::PATObject< ObjectType >::genParticleEmbedded_, and pat::PATObject< ObjectType >::genParticleRef_.

Referenced by pat::PATElectronProducer::fillElectron(), pat::PATElectronProducer::fillElectron2(), pat::PATMuonProducer::fillMuon(), Onia2MuMuPAT::produce(), pat::PATGenericParticleProducer::produce(), pat::PATPFParticleProducer::produce(), pat::PATTauProducer::produce(), pat::PATPhotonProducer::produce(), and pat::PATObject< ObjectType >::setGenParticleRef().

773  {
774  genParticleEmbedded_.clear();
775  for (std::vector<reco::GenParticleRef>::const_iterator it = genParticleRef_.begin(); it != genParticleRef_.end();
776  ++it) {
777  if (it->isNonnull())
778  genParticleEmbedded_.push_back(**it);
779  }
780  genParticleRef_.clear();
781  }
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:474
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:476
template<class ObjectType>
const reco::GenParticle* pat::PATObject< ObjectType >::genParticle ( size_t  idx = 0) const
inline

Get generator level particle, as C++ pointer (might be 0 if the ref was null) If you stored multiple GenParticles, you can specify which one you want.

Definition at line 290 of file PATObject.h.

Referenced by ZMuMu_Radiative_analyzer::analyze(), gamma_radiative_analyzer::analyze(), EmbeddingLHEProducer::assign_4vector(), and pat::Lepton< reco::Muon >::genLepton().

290  {
292  return ref.isNonnull() ? ref.get() : nullptr;
293  }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
reco::GenParticleRef genParticleRef(size_t idx=0) const
Definition: PATObject.h:270
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
template<class ObjectType >
reco::GenParticleRef pat::PATObject< ObjectType >::genParticleById ( int  pdgId,
int  status,
uint8_t  autoCharge = 0 
) const

Get a generator level particle reference with a given pdg id and status If there is no MC match with that pdgId and status, it will return a null ref Note: this might be a transient ref if the genParticle was embedded If status == 0, only the pdgId will be checked; likewise, if pdgId == 0, only the status will be checked. When autoCharge is set to true, and a charged reco particle is matched to a charged gen particle, positive pdgId means 'same charge', negative pdgId means 'opposite charge'; for example, electron.genParticleById(11,0,true) will get an e^+ matched to e^+ or e^- matched to e^-, while genParticleById(-15,0,true) will get e^+ matched to e^- or vice versa. If a neutral reco particle is matched to a charged gen particle, the sign of the pdgId passed to getParticleById must match that of the gen particle; for example photon.getParticleById(11) will match gamma to e^-, while genParticleById(-11) will match gamma to e^+ (pdgId=-11)

Definition at line 795 of file PATObject.h.

References funct::abs(), ALCARECOTkAlJpsiMuMu_cff::charge, reco::LeafCandidate::charge(), end, g, pat::PATObject< ObjectType >::genParticleEmbedded_, pat::PATObject< ObjectType >::genParticleRef_, pat::PATObject< ObjectType >::genParticleRefs(), reco::LeafCandidate::pdgId(), mps_update::status, and reco::LeafCandidate::status().

795  {
796  // get a vector, avoiding an unneeded copy if there is no embedding
797  const std::vector<reco::GenParticleRef> &vec = (genParticleEmbedded_.empty() ? genParticleRef_ : genParticleRefs());
798  for (std::vector<reco::GenParticleRef>::const_iterator ref = vec.begin(), end = vec.end(); ref != end; ++ref) {
799  if (ref->isNonnull()) {
800  const reco::GenParticle &g = **ref;
801  if ((status != 0) && (g.status() != status))
802  continue;
803  if (pdgId == 0) {
804  return *ref;
805  } else if (!autoCharge) {
806  if (pdgId == g.pdgId())
807  return *ref;
808  } else if (abs(pdgId) == abs(g.pdgId())) {
809  // I want pdgId > 0 to match "correct charge" (for charged particles)
810  if (g.charge() == 0)
811  return *ref;
812  else if ((this->charge() == 0) && (pdgId == g.pdgId()))
813  return *ref;
814  else if (g.charge() * this->charge() * pdgId > 0)
815  return *ref;
816  }
817  }
818  }
819  return reco::GenParticleRef();
820  }
int pdgId() const final
PDG identifier.
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:474
edm::Ref< GenParticleCollection > GenParticleRef
persistent reference to a GenParticle
int charge() const final
electric charge
std::vector< reco::GenParticleRef > genParticleRefs() const
Definition: PATObject.h:784
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:476
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define end
Definition: vmac.h:39
int status() const final
status word
template<class ObjectType>
reco::GenParticleRef pat::PATObject< ObjectType >::genParticleRef ( size_t  idx = 0) const
inline

Get generator level particle reference (might be a transient ref if the genParticle was embedded) If you stored multiple GenParticles, you can specify which one you want.

Definition at line 270 of file PATObject.h.

Referenced by DimuonStatistics::analyze(), and DimuonMCMatcher::produce().

270  {
271  if (idx >= genParticlesSize())
272  return reco::GenParticleRef();
274  }
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:474
size_t genParticlesSize() const
Number of generator level particles stored as ref or embedded.
Definition: PATObject.h:295
edm::Ref< GenParticleCollection > GenParticleRef
persistent reference to a GenParticle
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:476
template<class ObjectType >
std::vector< reco::GenParticleRef > pat::PATObject< ObjectType >::genParticleRefs ( ) const

Return the list of generator level particles. Note that the refs can be transient refs to embedded GenParticles

Definition at line 784 of file PATObject.h.

References pat::PATObject< ObjectType >::genParticleEmbedded_, pat::PATObject< ObjectType >::genParticleRef_, mps_fire::i, dqmiodumpmetadata::n, and runTheMatrix::ret.

Referenced by pat::PATObject< ObjectType >::genParticleById(), and getGenTau().

784  {
785  if (genParticleEmbedded_.empty())
786  return genParticleRef_;
787  std::vector<reco::GenParticleRef> ret(genParticleEmbedded_.size());
788  for (size_t i = 0, n = ret.size(); i < n; ++i) {
790  }
791  return ret;
792  }
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:474
ret
prodAgent to be discontinued
edm::Ref< GenParticleCollection > GenParticleRef
persistent reference to a GenParticle
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:476
template<class ObjectType>
size_t pat::PATObject< ObjectType >::genParticlesSize ( ) const
inline

Number of generator level particles stored as ref or embedded.

Definition at line 295 of file PATObject.h.

295  {
296  return genParticleEmbedded_.empty() ? genParticleRef_.size() : genParticleEmbedded_.size();
297  }
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:474
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:476
template<class ObjectType >
const pat::CandKinResolution & pat::PATObject< ObjectType >::getKinResolution ( const std::string &  label = "") const

Return the kinematic resolutions associated to this object, possibly specifying a label for it. If not present, it will throw an exception.

Definition at line 976 of file PATObject.h.

References HLT_2018_cff::distance, Exception, pat::PATObject< ObjectType >::kinResolutionLabels_, pat::PATObject< ObjectType >::kinResolutions_, label, and match().

976  {
977  const bool has_unlabelled = (kinResolutionLabels_.size() + 1 == kinResolutions_.size());
978  if (label.empty()) {
979  if (has_unlabelled) {
980  return kinResolutions_[0];
981  } else {
982  throw cms::Exception("Missing Data", "This object does not contain an un-labelled kinematic resolution");
983  }
984  } else {
985  auto match = std::lower_bound(kinResolutionLabels_.cbegin(), kinResolutionLabels_.cend(), label);
986  const auto dist = std::distance(kinResolutionLabels_.begin(), match);
987  const size_t increment = (has_unlabelled ? 1 : 0);
988  if (match == kinResolutionLabels_.end() || *match != label) {
989  cms::Exception ex("Missing Data");
990  ex << "This object does not contain a kinematic resolution with name '" << label << "'.\n";
991  ex << "The known labels are: ";
992  for (std::vector<std::string>::const_iterator it = kinResolutionLabels_.cbegin();
993  it != kinResolutionLabels_.cend();
994  ++it) {
995  ex << "'" << *it << "' ";
996  }
997  ex << "\n";
998  throw ex;
999  } else {
1000  return kinResolutions_[dist + increment];
1001  }
1002  }
1003  }
std::vector< pat::CandKinResolution > kinResolutions_
Kinematic resolutions.
Definition: PATObject.h:497
char const * label
std::vector< std::string > kinResolutionLabels_
Definition: PATObject.h:500
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
template<class ObjectType >
bool pat::PATObject< ObjectType >::hasKinResolution ( const std::string &  label = "") const

Check if the kinematic resolutions are stored into this object (possibly specifying a label for them)

Definition at line 1006 of file PATObject.h.

References pat::PATObject< ObjectType >::kinResolutionLabels_, pat::PATObject< ObjectType >::kinResolutions_, label, and match().

1006  {
1007  if (label.empty()) {
1008  return (kinResolutionLabels_.size() + 1 == kinResolutions_.size());
1009  } else {
1010  auto match = std::lower_bound(kinResolutionLabels_.cbegin(), kinResolutionLabels_.cend(), label);
1011  return (match != kinResolutionLabels_.cend() && *match == label);
1012  }
1013  }
std::vector< pat::CandKinResolution > kinResolutions_
Kinematic resolutions.
Definition: PATObject.h:497
char const * label
std::vector< std::string > kinResolutionLabels_
Definition: PATObject.h:500
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
template<class ObjectType >
bool pat::PATObject< ObjectType >::hasOverlaps ( const std::string &  label) const

Returns true if there was at least one overlap for this test label.

Definition at line 823 of file PATObject.h.

References label, match(), and pat::PATObject< ObjectType >::overlapLabels_.

823  {
824  auto match = std::lower_bound(overlapLabels_.cbegin(), overlapLabels_.cend(), label);
825  return (match != overlapLabels_.end() && *match == label);
826  }
char const * label
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< std::string > overlapLabels_
Overlapping test labels (only if there are any overlaps)
Definition: PATObject.h:479
template<class ObjectType>
bool pat::PATObject< ObjectType >::hasUserCand ( const std::string &  key) const
inline

Return true if there is a user-defined int with a given name.

Definition at line 408 of file PATObject.h.

408  {
409  auto it = std::lower_bound(userCandLabels_.cbegin(), userCandLabels_.cend(), key);
410  return (it != userCandLabels_.cend() && *it == key);
411  }
std::vector< std::string > userCandLabels_
Definition: PATObject.h:493
template<class ObjectType>
bool pat::PATObject< ObjectType >::hasUserData ( const std::string &  key) const
inline

Check if user data with a specific type is present.

Definition at line 332 of file PATObject.h.

Referenced by BPHUserData::getByRef().

332 { return (userDataObject_(key) != nullptr); }
const pat::UserData * userDataObject_(const std::string &key) const
Definition: PATObject.h:849
template<class ObjectType>
bool pat::PATObject< ObjectType >::hasUserFloat ( const std::string &  key) const
inline

Return true if there is a user-defined float with a given name.

Definition at line 378 of file PATObject.h.

Referenced by BPHFittedBasicSelect::accept(), WenuPlots::analyze(), BPHHistoSpecificDecay::endJob(), PFJetIDSelectionFunctor::firstDataCuts(), and Jet.Jet::puMva().

378  {
379  auto it = std::lower_bound(userFloatLabels_.cbegin(), userFloatLabels_.cend(), key);
380  return (it != userFloatLabels_.cend() && *it == key);
381  }
std::vector< std::string > userFloatLabels_
Definition: PATObject.h:487
template<class ObjectType>
bool pat::PATObject< ObjectType >::hasUserFloat ( const char *  key) const
inline

a CINT-friendly interface

Definition at line 383 of file PATObject.h.

Referenced by pat::PATObject< reco::Muon >::hasUserFloat(), and Jet.Jet::puMva().

383 { return hasUserFloat(std::string(key)); }
bool hasUserFloat(const std::string &key) const
Return true if there is a user-defined float with a given name.
Definition: PATObject.h:378
template<class ObjectType>
bool pat::PATObject< ObjectType >::hasUserInt ( const std::string &  key) const
inline

Return true if there is a user-defined int with a given name.

Definition at line 395 of file PATObject.h.

Referenced by WenuPlots::analyze(), WenuPlots::PassPreselectionCriteria(), ZeePlots::PassPreselectionCriteria1(), and ZeePlots::PassPreselectionCriteria2().

395  {
396  auto it = std::lower_bound(userIntLabels_.cbegin(), userIntLabels_.cend(), key);
397  return (it != userIntLabels_.cend() && *it == key);
398  }
std::vector< std::string > userIntLabels_
Definition: PATObject.h:490
template<class ObjectType >
const reco::Candidate * pat::PATObject< ObjectType >::originalObject ( ) const

access to the original object; returns zero for null Ref and throws for unavailable collection

Definition at line 527 of file PATObject.h.

References Exception, edm::Ptr< T >::get(), edm::Ptr< T >::isAvailable(), edm::Ptr< T >::isNull(), edm::errors::ProductNotFound, and pat::PATObject< ObjectType >::refToOrig_.

Referenced by hitfit::JetTranslatorBase< AJet >::CheckEta(), and hitfit::JetTranslatorBase< AJet >::operator()().

527  {
528  if (refToOrig_.isNull()) {
529  // this object was not produced from a reference, so no link to the
530  // original object exists -> return a 0-pointer
531  return nullptr;
532  } else if (!refToOrig_.isAvailable()) {
534  << "The original collection from which this PAT object was made is not present any more in the event, hence "
535  "you cannot access the originating object anymore.";
536  } else {
537  return refToOrig_.get();
538  }
539  }
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
bool isAvailable() const
Definition: Ptr.h:229
bool isNull() const
Checks for null.
Definition: Ptr.h:142
edm::Ptr< reco::Candidate > refToOrig_
Definition: PATObject.h:463
template<class ObjectType >
const edm::Ptr< reco::Candidate > & pat::PATObject< ObjectType >::originalObjectRef ( ) const
template<class ObjectType>
const std::vector<std::string>& pat::PATObject< ObjectType >::overlapLabels ( ) const
inline

Returns the labels of the overlap tests that found at least one overlap.

Definition at line 319 of file PATObject.h.

319 { return overlapLabels_; }
std::vector< std::string > overlapLabels_
Overlapping test labels (only if there are any overlaps)
Definition: PATObject.h:479
template<class ObjectType >
const reco::CandidatePtrVector & pat::PATObject< ObjectType >::overlaps ( const std::string &  label) const

Return the list of overlaps for one label (can be empty) The original ordering of items is kept (usually it's by increasing deltaR from this item)

Definition at line 829 of file PATObject.h.

References HLT_2018_cff::distance, pat::pat_statics::EMPTY_CPV, label, match(), pat::PATObject< ObjectType >::overlapItems_, and pat::PATObject< ObjectType >::overlapLabels_.

Referenced by pat::PATObject< ObjectType >::setOverlaps().

829  {
830  auto match = std::lower_bound(overlapLabels_.cbegin(), overlapLabels_.cend(), label);
831  if (match == overlapLabels_.cend() || *match != label)
832  return pat_statics::EMPTY_CPV;
834  }
char const * label
std::vector< reco::CandidatePtrVector > overlapItems_
Overlapping items (sorted by distance)
Definition: PATObject.h:481
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< std::string > overlapLabels_
Overlapping test labels (only if there are any overlaps)
Definition: PATObject.h:479
static const reco::CandidatePtrVector EMPTY_CPV
Definition: PATObject.h:43
template<class ObjectType>
double pat::PATObject< ObjectType >::resolE ( const std::string &  label = "") const
inline

Resolution on energy, possibly with a label to specify which resolution to use.

Definition at line 434 of file PATObject.h.

434 { return getKinResolution(label).resolE(this->p4()); }
char const * label
double p4[4]
Definition: TauolaWrapper.h:92
double resolE(const LorentzVector &p4) const
Resolution on energy, given the 4-momentum of the associated Candidate.
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:976
template<class ObjectType>
double pat::PATObject< ObjectType >::resolEt ( const std::string &  label = "") const
inline

Resolution on et, possibly with a label to specify which resolution to use.

Definition at line 437 of file PATObject.h.

437 { return getKinResolution(label).resolEt(this->p4()); }
char const * label
double p4[4]
Definition: TauolaWrapper.h:92
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:976
double resolEt(const LorentzVector &p4) const
Resolution on et, given the 4-momentum of the associated Candidate.
template<class ObjectType>
double pat::PATObject< ObjectType >::resolEta ( const std::string &  label = "") const
inline

Resolution on eta, possibly with a label to specify which resolution to use.

Definition at line 425 of file PATObject.h.

425 { return getKinResolution(label).resolEta(this->p4()); }
char const * label
double p4[4]
Definition: TauolaWrapper.h:92
double resolEta(const LorentzVector &p4) const
Resolution on eta, given the 4-momentum of the associated Candidate.
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:976
template<class ObjectType>
double pat::PATObject< ObjectType >::resolM ( const std::string &  label = "") const
inline

Resolution on mass, possibly with a label to specify which resolution to use Note: this will be zero if a mass-constrained parametrization is used for this object

Definition at line 459 of file PATObject.h.

459 { return getKinResolution(label).resolM(this->p4()); }
char const * label
double p4[4]
Definition: TauolaWrapper.h:92
double resolM(const LorentzVector &p4) const
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:976
template<class ObjectType>
double pat::PATObject< ObjectType >::resolP ( const std::string &  label = "") const
inline

Resolution on p, possibly with a label to specify which resolution to use.

Definition at line 440 of file PATObject.h.

440 { return getKinResolution(label).resolP(this->p4()); }
char const * label
double resolP(const LorentzVector &p4) const
Resolution on p, given the 4-momentum of the associated Candidate.
double p4[4]
Definition: TauolaWrapper.h:92
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:976
template<class ObjectType>
double pat::PATObject< ObjectType >::resolPhi ( const std::string &  label = "") const
inline

Resolution on phi, possibly with a label to specify which resolution to use.

Definition at line 431 of file PATObject.h.

431 { return getKinResolution(label).resolPhi(this->p4()); }
double resolPhi(const LorentzVector &p4) const
Resolution on phi, given the 4-momentum of the associated Candidate.
char const * label
double p4[4]
Definition: TauolaWrapper.h:92
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:976
template<class ObjectType>
double pat::PATObject< ObjectType >::resolPInv ( const std::string &  label = "") const
inline

Resolution on 1/p, possibly with a label to specify which resolution to use.

Definition at line 446 of file PATObject.h.

446 { return getKinResolution(label).resolPInv(this->p4()); }
char const * label
double p4[4]
Definition: TauolaWrapper.h:92
double resolPInv(const LorentzVector &p4) const
Resolution on 1/p, given the 4-momentum of the associated Candidate.
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:976
template<class ObjectType>
double pat::PATObject< ObjectType >::resolPt ( const std::string &  label = "") const
inline

Resolution on pt, possibly with a label to specify which resolution to use.

Definition at line 443 of file PATObject.h.

443 { return getKinResolution(label).resolPt(this->p4()); }
char const * label
double p4[4]
Definition: TauolaWrapper.h:92
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:976
double resolPt(const LorentzVector &p4) const
Resolution on pt, given the 4-momentum of the associated Candidate.
template<class ObjectType>
double pat::PATObject< ObjectType >::resolPx ( const std::string &  label = "") const
inline

Resolution on px, possibly with a label to specify which resolution to use.

Definition at line 449 of file PATObject.h.

449 { return getKinResolution(label).resolPx(this->p4()); }
char const * label
double p4[4]
Definition: TauolaWrapper.h:92
double resolPx(const LorentzVector &p4) const
Resolution on px, given the 4-momentum of the associated Candidate.
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:976
template<class ObjectType>
double pat::PATObject< ObjectType >::resolPy ( const std::string &  label = "") const
inline

Resolution on py, possibly with a label to specify which resolution to use.

Definition at line 452 of file PATObject.h.

452 { return getKinResolution(label).resolPy(this->p4()); }
char const * label
double resolPy(const LorentzVector &p4) const
Resolution on py, given the 4-momentum of the associated Candidate.
double p4[4]
Definition: TauolaWrapper.h:92
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:976
template<class ObjectType>
double pat::PATObject< ObjectType >::resolPz ( const std::string &  label = "") const
inline

Resolution on pz, possibly with a label to specify which resolution to use.

Definition at line 455 of file PATObject.h.

455 { return getKinResolution(label).resolPz(this->p4()); }
double resolPz(const LorentzVector &p4) const
Resolution on pz, given the 4-momentum of the associated Candidate.
char const * label
double p4[4]
Definition: TauolaWrapper.h:92
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:976
template<class ObjectType>
double pat::PATObject< ObjectType >::resolTheta ( const std::string &  label = "") const
inline

Resolution on theta, possibly with a label to specify which resolution to use.

Definition at line 428 of file PATObject.h.

428 { return getKinResolution(label).resolTheta(this->p4()); }
char const * label
double p4[4]
Definition: TauolaWrapper.h:92
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:976
double resolTheta(const LorentzVector &p4) const
Resolution on theta, given the 4-momentum of the associated Candidate.
template<class ObjectType >
void pat::PATObject< ObjectType >::setEfficiency ( const std::string &  name,
const pat::LookupTableRecord value 
)

Store one efficiency in this item, in addition to the existing ones If an efficiency with the same name exists, the old value is replaced by this one Calling this method many times with names not sorted alphabetically will be slow

Definition at line 732 of file PATObject.h.

References HLT_2018_cff::distance, pat::PATObject< ObjectType >::efficiencyNames_, pat::PATObject< ObjectType >::efficiencyValues_, Skims_PA_cff::name, and relativeConstraints::value.

Referenced by pat::helper::EfficiencyLoader::setEfficiencies().

732  {
733  // look for the name, or to the place where we can insert it without violating the alphabetic order
734  auto it = std::lower_bound(efficiencyNames_.begin(), efficiencyNames_.end(), name);
735  const auto dist = std::distance(efficiencyNames_.begin(), it);
736  if (it == efficiencyNames_.end()) { // insert at the end
737  efficiencyNames_.push_back(name);
738  efficiencyValues_.push_back(value);
739  } else if (*it == name) { // replace existing
740  efficiencyValues_[dist] = value;
741  } else { // insert in the middle :-(
742  efficiencyNames_.insert(it, name);
743  efficiencyValues_.insert(efficiencyValues_.begin() + dist, value);
744  }
745  }
std::vector< std::string > efficiencyNames_
vector of the efficiencies (names)
Definition: PATObject.h:471
std::vector< pat::LookupTableRecord > efficiencyValues_
vector of the efficiencies (values)
Definition: PATObject.h:469
template<class ObjectType >
void pat::PATObject< ObjectType >::setGenParticle ( const reco::GenParticle particle)

Set the generator level particle from a particle not in the Event (embedding it, of course)

Definition at line 766 of file PATObject.h.

References pat::PATObject< ObjectType >::genParticleEmbedded_, and pat::PATObject< ObjectType >::genParticleRef_.

766  {
767  genParticleEmbedded_.clear();
768  genParticleEmbedded_.push_back(particle);
769  genParticleRef_.clear();
770  }
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:474
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:476
template<class ObjectType >
void pat::PATObject< ObjectType >::setGenParticleRef ( const reco::GenParticleRef ref,
bool  embed = false 
)

Set the generator level particle reference.

Definition at line 748 of file PATObject.h.

References pat::PATObject< ObjectType >::embedGenParticle(), pat::PATObject< ObjectType >::genParticleEmbedded_, and pat::PATObject< ObjectType >::genParticleRef_.

Referenced by Onia2MuMuPAT::produce(), and pat::Lepton< reco::Muon >::setGenLepton().

748  {
749  genParticleRef_ = std::vector<reco::GenParticleRef>(1, ref);
750  genParticleEmbedded_.clear();
751  if (embed)
753  }
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:474
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:476
#define embed
Definition: AMPTWrapper.h:188
void embedGenParticle()
Definition: PATObject.h:773
template<class ObjectType >
void pat::PATObject< ObjectType >::setKinResolution ( const pat::CandKinResolution resol,
const std::string &  label = "" 
)

Add a kinematic resolution to this object (possibly with a label)

Definition at line 1016 of file PATObject.h.

References HLT_2018_cff::distance, pat::PATObject< ObjectType >::kinResolutionLabels_, pat::PATObject< ObjectType >::kinResolutions_, label, and match().

Referenced by pat::helper::KinResolutionsLoader::setResolutions().

1016  {
1017  const bool has_unlabelled = (kinResolutionLabels_.size() + 1 == kinResolutions_.size());
1018  if (label.empty()) {
1019  if (has_unlabelled) {
1020  // There is already an un-labelled object. Replace it
1021  kinResolutions_[0] = resol;
1022  } else {
1023  // Insert. Note that the un-labelled is always the first, so we need to insert before begin()
1024  // (for an empty vector, this should not cost more than push_back)
1025  kinResolutions_.insert(kinResolutions_.begin(), resol);
1026  }
1027  } else {
1028  auto match = std::lower_bound(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
1029  const auto dist = std::distance(kinResolutionLabels_.begin(), match);
1030  const size_t increment = (has_unlabelled ? 1 : 0);
1031  if (match != kinResolutionLabels_.end() && *match == label) {
1032  // Existing object: replace
1033  kinResolutions_[dist + increment] = resol;
1034  } else {
1035  kinResolutionLabels_.insert(match, label);
1036  kinResolutions_.insert(kinResolutions_.begin() + dist + increment, resol);
1037  }
1038  }
1039  }
std::vector< pat::CandKinResolution > kinResolutions_
Kinematic resolutions.
Definition: PATObject.h:497
char const * label
std::vector< std::string > kinResolutionLabels_
Definition: PATObject.h:500
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
template<class ObjectType >
void pat::PATObject< ObjectType >::setOverlaps ( const std::string &  label,
const reco::CandidatePtrVector overlaps 
)

Sets the list of overlapping items for one label Note that adding an empty PtrVector has no effect at all Items within the list should already be sorted appropriately (this method won't sort them)

Definition at line 837 of file PATObject.h.

References HLT_2018_cff::distance, label, match(), pat::PATObject< ObjectType >::overlapItems_, pat::PATObject< ObjectType >::overlapLabels_, and pat::PATObject< ObjectType >::overlaps().

837  {
838  auto match = std::lower_bound(overlapLabels_.begin(), overlapLabels_.end(), label);
839  const auto dist = std::distance(overlapLabels_.begin(), match);
840  if (match == overlapLabels_.end() || *match != label) {
841  overlapLabels_.insert(match, label);
842  overlapItems_.insert(overlapItems_.begin() + dist, overlaps);
843  } else {
844  overlapItems_[dist] = overlaps;
845  }
846  }
const reco::CandidatePtrVector & overlaps(const std::string &label) const
Definition: PATObject.h:829
char const * label
std::vector< reco::CandidatePtrVector > overlapItems_
Overlapping items (sorted by distance)
Definition: PATObject.h:481
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< std::string > overlapLabels_
Overlapping test labels (only if there are any overlaps)
Definition: PATObject.h:479
template<class ObjectType >
const TriggerObjectStandAlone * pat::PATObject< ObjectType >::triggerObjectMatch ( const size_t  idx = 0) const

get one matched trigger object by index

Definition at line 547 of file PATObject.h.

References edm::Ref< C, T, F >::get(), edm::Ref< C, T, F >::isNonnull(), findQualityFiles::size, pat::PATObject< ObjectType >::triggerObjectMatches(), and pat::PATObject< ObjectType >::triggerObjectMatchesEmbedded_.

Referenced by pat::PATObject< ObjectType >::triggerObjectMatchByAlgorithm(), pat::PATObject< ObjectType >::triggerObjectMatchByCollection(), pat::PATObject< ObjectType >::triggerObjectMatchByCondition(), pat::PATObject< ObjectType >::triggerObjectMatchByFilter(), pat::PATObject< ObjectType >::triggerObjectMatchByPath(), pat::PATObject< ObjectType >::triggerObjectMatchByType(), pat::PATObject< ObjectType >::triggerObjectMatchesByAlgorithm(), pat::PATObject< ObjectType >::triggerObjectMatchesByCollection(), pat::PATObject< ObjectType >::triggerObjectMatchesByCondition(), pat::PATObject< ObjectType >::triggerObjectMatchesByFilter(), pat::PATObject< ObjectType >::triggerObjectMatchesByPath(), and pat::PATObject< ObjectType >::triggerObjectMatchesByType().

547  {
548  if (idx >= triggerObjectMatches().size())
549  return nullptr;
551  return ref.isNonnull() ? ref.get() : nullptr;
552  }
size
Write out results.
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:466
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:75
template<class ObjectType >
const TriggerObjectStandAlone * pat::PATObject< ObjectType >::triggerObjectMatchByAlgorithm ( const std::string &  nameAlgorithm,
const bool  algoCondAccepted = true,
const size_t  idx = 0 
) const

get one matched L1 object used in a succeeding object combination of a condition in a certain L1 (physics) algorithm by index; if 'algoCondAccepted' is set to 'true' (default), only objects used in succeeding conditions of succeeding algorithms are considered ("firing" objects)

Definition at line 642 of file PATObject.h.

References pat::TriggerObjectStandAlone::hasAlgorithmName(), mps_fire::i, edm::Ref< C, T, F >::isNonnull(), pat::PATObject< ObjectType >::triggerObjectMatch(), pat::PATObject< ObjectType >::triggerObjectMatches(), and pat::PATObject< ObjectType >::triggerObjectMatchesEmbedded_.

644  {
645  std::vector<size_t> refs;
646  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
647  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasAlgorithmName(nameAlgorithm, algoCondAccepted))
648  refs.push_back(i);
649  }
650  if (idx >= refs.size())
651  return nullptr;
653  return ref.isNonnull() ? ref.get() : nullptr;
654  }
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:466
bool hasAlgorithmName(const std::string &algorithmName, bool algoCondAccepted=true) const
Checks, if a certain L1 algorithm name is assigned.
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:547
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:75
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByAlgorithm ( const char *  nameAlgorithm,
const bool  algoCondAccepted = true,
const size_t  idx = 0 
) const
inline

Definition at line 154 of file PATObject.h.

156  {
157  return triggerObjectMatchByAlgorithm(std::string(nameAlgorithm), algoCondAccepted, idx);
158  };
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true, const size_t idx=0) const
Definition: PATObject.h:642
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByAlgorithm ( const std::string &  nameAlgorithm,
const unsigned  algoCondAccepted,
const size_t  idx = 0 
) const
inline

Definition at line 160 of file PATObject.h.

162  {
163  return triggerObjectMatchByAlgorithm(nameAlgorithm, bool(algoCondAccepted), idx);
164  };
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true, const size_t idx=0) const
Definition: PATObject.h:642
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByAlgorithm ( const char *  nameAlgorithm,
const unsigned  algoCondAccepted,
const size_t  idx = 0 
) const
inline

Definition at line 166 of file PATObject.h.

168  {
169  return triggerObjectMatchByAlgorithm(std::string(nameAlgorithm), bool(algoCondAccepted), idx);
170  };
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true, const size_t idx=0) const
Definition: PATObject.h:642
template<class ObjectType >
const TriggerObjectStandAlone * pat::PATObject< ObjectType >::triggerObjectMatchByCollection ( const std::string &  coll,
const size_t  idx = 0 
) const

get one matched trigger object from a certain collection by index

Definition at line 591 of file PATObject.h.

References pat::TriggerObjectStandAlone::hasCollection(), mps_fire::i, edm::Ref< C, T, F >::isNonnull(), pat::PATObject< ObjectType >::triggerObjectMatch(), pat::PATObject< ObjectType >::triggerObjectMatches(), and pat::PATObject< ObjectType >::triggerObjectMatchesEmbedded_.

592  {
593  std::vector<size_t> refs;
594  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
596  refs.push_back(i);
597  }
598  }
599  if (idx >= refs.size())
600  return nullptr;
602  return ref.isNonnull() ? ref.get() : nullptr;
603  }
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:466
bool hasCollection(const std::string &collName) const override
Checks, if a certain label of original collection is assigned (method overrides)
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:547
JetCorrectorParametersCollection coll
Definition: classes.h:10
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:75
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByCollection ( const char *  coll,
const size_t  idx = 0 
) const
inline

Definition at line 110 of file PATObject.h.

110  {
112  };
const TriggerObjectStandAlone * triggerObjectMatchByCollection(const std::string &coll, const size_t idx=0) const
get one matched trigger object from a certain collection by index
Definition: PATObject.h:591
JetCorrectorParametersCollection coll
Definition: classes.h:10
template<class ObjectType >
const TriggerObjectStandAlone * pat::PATObject< ObjectType >::triggerObjectMatchByCondition ( const std::string &  nameCondition,
const size_t  idx = 0 
) const

get one matched L1 object used in a succeeding object combination of a certain L1 condition by index

Definition at line 617 of file PATObject.h.

References pat::TriggerObjectStandAlone::hasConditionName(), mps_fire::i, edm::Ref< C, T, F >::isNonnull(), pat::PATObject< ObjectType >::triggerObjectMatch(), pat::PATObject< ObjectType >::triggerObjectMatches(), and pat::PATObject< ObjectType >::triggerObjectMatchesEmbedded_.

618  {
619  std::vector<size_t> refs;
620  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
621  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasConditionName(nameCondition))
622  refs.push_back(i);
623  }
624  if (idx >= refs.size())
625  return nullptr;
627  return ref.isNonnull() ? ref.get() : nullptr;
628  }
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:466
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:547
bool hasConditionName(const std::string &conditionName) const
Checks, if a certain L1 condition name is assigned.
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:75
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByCondition ( const char *  nameCondition,
const size_t  idx = 0 
) const
inline

Definition at line 123 of file PATObject.h.

124  {
125  return triggerObjectMatchByCondition(std::string(nameCondition), idx);
126  };
const TriggerObjectStandAlone * triggerObjectMatchByCondition(const std::string &nameCondition, const size_t idx=0) const
get one matched L1 object used in a succeeding object combination of a certain L1 condition by index ...
Definition: PATObject.h:617
template<class ObjectType >
const TriggerObjectStandAlone * pat::PATObject< ObjectType >::triggerObjectMatchByFilter ( const std::string &  labelFilter,
const size_t  idx = 0 
) const

get one matched HLT object used in a certain HLT filter by index

Definition at line 668 of file PATObject.h.

References pat::TriggerObjectStandAlone::hasFilterLabel(), mps_fire::i, edm::Ref< C, T, F >::isNonnull(), pat::PATObject< ObjectType >::triggerObjectMatch(), pat::PATObject< ObjectType >::triggerObjectMatches(), and pat::PATObject< ObjectType >::triggerObjectMatchesEmbedded_.

669  {
670  std::vector<size_t> refs;
671  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
672  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasFilterLabel(labelFilter))
673  refs.push_back(i);
674  }
675  if (idx >= refs.size())
676  return nullptr;
678  return ref.isNonnull() ? ref.get() : nullptr;
679  }
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:466
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:547
bool hasFilterLabel(const std::string &filterLabel) const
Checks, if a certain HLT filter label is assigned.
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:75
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByFilter ( const char *  labelFilter,
const size_t  idx = 0 
) const
inline

Definition at line 181 of file PATObject.h.

181  {
182  return triggerObjectMatchByFilter(std::string(labelFilter), idx);
183  };
const TriggerObjectStandAlone * triggerObjectMatchByFilter(const std::string &labelFilter, const size_t idx=0) const
get one matched HLT object used in a certain HLT filter by index
Definition: PATObject.h:668
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByFilterID ( const unsigned  triggerObjectType,
const size_t  idx = 0 
) const
inline

Definition at line 97 of file PATObject.h.

98  {
99  return triggerObjectMatchByType(trigger::TriggerObjectType(triggerObjectType), idx);
100  };
const TriggerObjectStandAlone * triggerObjectMatchByType(const trigger::TriggerObjectType triggerObjectType, const size_t idx=0) const
get one matched trigger object of a certain type by index
Definition: PATObject.h:566
template<class ObjectType >
const TriggerObjectStandAlone * pat::PATObject< ObjectType >::triggerObjectMatchByPath ( const std::string &  namePath,
const bool  pathLastFilterAccepted = false,
const bool  pathL3FilterAccepted = true,
const size_t  idx = 0 
) const

get one matched HLT object used in a certain HLT path by index; if 'pathLastFilterAccepted' is set to 'true' (default), only objects used in the final filter of a succeeding path are considered ("firing" objects, old style only valid for single object triggers); if 'pathL3FilterAccepted' is set to 'true' (default), only objects used in L3 filters (identified by the "saveTags" parameter being 'true') of a succeeding path are considered ("firing" objects also valid for x-triggers)

Definition at line 694 of file PATObject.h.

References pat::TriggerObjectStandAlone::hasPathName(), mps_fire::i, edm::Ref< C, T, F >::isNonnull(), pat::PATObject< ObjectType >::triggerObjectMatch(), pat::PATObject< ObjectType >::triggerObjectMatches(), and pat::PATObject< ObjectType >::triggerObjectMatchesEmbedded_.

697  {
698  std::vector<size_t> refs;
699  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
700  if (triggerObjectMatch(i) != nullptr &&
701  triggerObjectMatch(i)->hasPathName(namePath, pathLastFilterAccepted, pathL3FilterAccepted))
702  refs.push_back(i);
703  }
704  if (idx >= refs.size())
705  return nullptr;
707  return ref.isNonnull() ? ref.get() : nullptr;
708  }
bool hasPathName(const std::string &pathName, bool pathLastFilterAccepted=false, bool pathL3FilterAccepted=true) const
Checks, if a certain HLT path name is assigned.
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:466
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:547
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:75
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByPath ( const char *  namePath,
const bool  pathLastFilterAccepted = false,
const bool  pathL3FilterAccepted = true,
const size_t  idx = 0 
) const
inline

Definition at line 221 of file PATObject.h.

224  {
225  return triggerObjectMatchByPath(std::string(namePath), pathLastFilterAccepted, pathL3FilterAccepted, idx);
226  };
const TriggerObjectStandAlone * triggerObjectMatchByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true, const size_t idx=0) const
Definition: PATObject.h:694
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByPath ( const std::string &  namePath,
const unsigned  pathLastFilterAccepted,
const unsigned  pathL3FilterAccepted = 1,
const size_t  idx = 0 
) const
inline

Definition at line 228 of file PATObject.h.

231  {
232  return triggerObjectMatchByPath(namePath, bool(pathLastFilterAccepted), bool(pathL3FilterAccepted), idx);
233  };
const TriggerObjectStandAlone * triggerObjectMatchByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true, const size_t idx=0) const
Definition: PATObject.h:694
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByPath ( const char *  namePath,
const unsigned  pathLastFilterAccepted,
const unsigned  pathL3FilterAccepted = 1,
const size_t  idx = 0 
) const
inline

Definition at line 235 of file PATObject.h.

238  {
240  std::string(namePath), bool(pathLastFilterAccepted), bool(pathL3FilterAccepted), idx);
241  };
const TriggerObjectStandAlone * triggerObjectMatchByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true, const size_t idx=0) const
Definition: PATObject.h:694
template<class ObjectType >
const TriggerObjectStandAlone * pat::PATObject< ObjectType >::triggerObjectMatchByType ( const trigger::TriggerObjectType  triggerObjectType,
const size_t  idx = 0 
) const

get one matched trigger object of a certain type by index

Definition at line 566 of file PATObject.h.

References pat::TriggerObject::hasTriggerObjectType(), mps_fire::i, edm::Ref< C, T, F >::isNonnull(), pat::PATObject< ObjectType >::triggerObjectMatch(), pat::PATObject< ObjectType >::triggerObjectMatches(), and pat::PATObject< ObjectType >::triggerObjectMatchesEmbedded_.

567  {
568  std::vector<size_t> refs;
569  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
570  if (triggerObjectMatch(i) != nullptr && triggerObjectMatch(i)->hasTriggerObjectType(triggerObjectType))
571  refs.push_back(i);
572  }
573  if (idx >= refs.size())
574  return nullptr;
576  return ref.isNonnull() ? ref.get() : nullptr;
577  }
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:466
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:547
bool hasTriggerObjectType(trigger::TriggerObjectType triggerObjectType) const
Checks, if a certain trigger object type identifier is assigned.
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:75
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByType ( const unsigned  triggerObjectType,
const size_t  idx = 0 
) const
inline

Definition at line 92 of file PATObject.h.

93  {
94  return triggerObjectMatchByType(trigger::TriggerObjectType(triggerObjectType), idx);
95  };
const TriggerObjectStandAlone * triggerObjectMatchByType(const trigger::TriggerObjectType triggerObjectType, const size_t idx=0) const
get one matched trigger object of a certain type by index
Definition: PATObject.h:566
template<class ObjectType>
const TriggerObjectStandAloneCollection& pat::PATObject< ObjectType >::triggerObjectMatches ( ) const
inline
template<class ObjectType >
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByAlgorithm ( const std::string &  nameAlgorithm,
const bool  algoCondAccepted = true 
) const

get all matched L1 objects used in a succeeding object combination of a condition in a certain L1 (physics) algorithm; if 'algoCondAccepted' is set to 'true' (default), only objects used in succeeding conditions of succeeding algorithms are considered ("firing" objects)

Definition at line 631 of file PATObject.h.

References pat::TriggerObjectStandAlone::hasAlgorithmName(), mps_fire::i, patCandidatesForDimuonsSequences_cff::matches, pat::PATObject< ObjectType >::triggerObjectMatch(), and pat::PATObject< ObjectType >::triggerObjectMatches().

632  {
634  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
635  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasAlgorithmName(nameAlgorithm, algoCondAccepted))
636  matches.push_back(*(triggerObjectMatch(i)));
637  }
638  return matches;
639  }
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
bool hasAlgorithmName(const std::string &algorithmName, bool algoCondAccepted=true) const
Checks, if a certain L1 algorithm name is assigned.
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:547
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:75
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByAlgorithm ( const char *  nameAlgorithm,
const bool  algoCondAccepted = true 
) const
inline

Definition at line 133 of file PATObject.h.

134  {
135  return triggerObjectMatchesByAlgorithm(std::string(nameAlgorithm), algoCondAccepted);
136  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true) const
Definition: PATObject.h:631
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByAlgorithm ( const std::string &  nameAlgorithm,
const unsigned  algoCondAccepted 
) const
inline

Definition at line 138 of file PATObject.h.

139  {
140  return triggerObjectMatchesByAlgorithm(nameAlgorithm, bool(algoCondAccepted));
141  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true) const
Definition: PATObject.h:631
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByAlgorithm ( const char *  nameAlgorithm,
const unsigned  algoCondAccepted 
) const
inline

Definition at line 143 of file PATObject.h.

144  {
145  return triggerObjectMatchesByAlgorithm(std::string(nameAlgorithm), bool(algoCondAccepted));
146  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true) const
Definition: PATObject.h:631
template<class ObjectType >
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByCollection ( const std::string &  coll) const

get all matched trigger objects from a certain collection

Definition at line 580 of file PATObject.h.

References pat::TriggerObjectStandAlone::hasCollection(), mps_fire::i, patCandidatesForDimuonsSequences_cff::matches, pat::PATObject< ObjectType >::triggerObjectMatch(), and pat::PATObject< ObjectType >::triggerObjectMatches().

581  {
583  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
585  matches.push_back(*(triggerObjectMatch(i)));
586  }
587  return matches;
588  }
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
bool hasCollection(const std::string &collName) const override
Checks, if a certain label of original collection is assigned (method overrides)
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:547
JetCorrectorParametersCollection coll
Definition: classes.h:10
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:75
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByCollection ( const char *  coll) const
inline

Definition at line 104 of file PATObject.h.

104  {
106  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByCollection(const std::string &coll) const
get all matched trigger objects from a certain collection
Definition: PATObject.h:580
JetCorrectorParametersCollection coll
Definition: classes.h:10
template<class ObjectType >
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByCondition ( const std::string &  nameCondition) const

get all matched L1 objects used in a succeeding object combination of a certain L1 condition

Definition at line 606 of file PATObject.h.

References pat::TriggerObjectStandAlone::hasConditionName(), mps_fire::i, patCandidatesForDimuonsSequences_cff::matches, pat::PATObject< ObjectType >::triggerObjectMatch(), and pat::PATObject< ObjectType >::triggerObjectMatches().

607  {
609  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
610  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasConditionName(nameCondition))
611  matches.push_back(*(triggerObjectMatch(i)));
612  }
613  return matches;
614  }
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:547
bool hasConditionName(const std::string &conditionName) const
Checks, if a certain L1 condition name is assigned.
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:75
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByCondition ( const char *  nameCondition) const
inline

Definition at line 116 of file PATObject.h.

116  {
117  return triggerObjectMatchesByCondition(std::string(nameCondition));
118  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByCondition(const std::string &nameCondition) const
get all matched L1 objects used in a succeeding object combination of a certain L1 condition ...
Definition: PATObject.h:606
template<class ObjectType >
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByFilter ( const std::string &  labelFilter) const

get all matched HLT objects used in a certain HLT filter

Definition at line 657 of file PATObject.h.

References pat::TriggerObjectStandAlone::hasFilterLabel(), mps_fire::i, patCandidatesForDimuonsSequences_cff::matches, pat::PATObject< ObjectType >::triggerObjectMatch(), and pat::PATObject< ObjectType >::triggerObjectMatches().

658  {
660  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
661  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasFilterLabel(labelFilter))
662  matches.push_back(*(triggerObjectMatch(i)));
663  }
664  return matches;
665  }
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:547
bool hasFilterLabel(const std::string &filterLabel) const
Checks, if a certain HLT filter label is assigned.
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:75
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByFilter ( const char *  labelFilter) const
inline

Definition at line 174 of file PATObject.h.

174  {
175  return triggerObjectMatchesByFilter(std::string(labelFilter));
176  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByFilter(const std::string &labelFilter) const
get all matched HLT objects used in a certain HLT filter
Definition: PATObject.h:657
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByFilterID ( const unsigned  triggerObjectType) const
inline

Definition at line 86 of file PATObject.h.

86  {
87  return triggerObjectMatchesByType(trigger::TriggerObjectType(triggerObjectType));
88  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByType(const trigger::TriggerObjectType triggerObjectType) const
Definition: PATObject.h:555
template<class ObjectType >
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByPath ( const std::string &  namePath,
const bool  pathLastFilterAccepted = false,
const bool  pathL3FilterAccepted = true 
) const

get all matched HLT objects used in a certain HLT path; if 'pathLastFilterAccepted' is set to 'true' (default), only objects used in the final filter of a succeeding path are considered ("firing" objects old style only valid for single object triggers); if 'pathL3FilterAccepted' is set to 'true' (default), only objects used in L3 filters (identified by the "saveTags" parameter being 'true') of a succeeding path are considered ("firing" objects old style only valid for single object triggers)

Definition at line 682 of file PATObject.h.

References pat::TriggerObjectStandAlone::hasPathName(), mps_fire::i, patCandidatesForDimuonsSequences_cff::matches, pat::PATObject< ObjectType >::triggerObjectMatch(), and pat::PATObject< ObjectType >::triggerObjectMatches().

Referenced by testAnalyzer::analyze(), ZMuMu_vtxAnalyzer::analyze(), ZMuMu_efficiencyAnalyzer::analyze(), ZMuMu_MCanalyzer::analyze(), ZMuMu_Radiative_analyzer::analyze(), modules::ZHLTMatchFilter::operator()(), ZMuMuMuonUserData::produce(), and ZToLLEdmNtupleDumper::produce().

683  {
685  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
686  if (triggerObjectMatch(i) != nullptr &&
687  triggerObjectMatch(i)->hasPathName(namePath, pathLastFilterAccepted, pathL3FilterAccepted))
688  matches.push_back(*(triggerObjectMatch(i)));
689  }
690  return matches;
691  }
bool hasPathName(const std::string &pathName, bool pathLastFilterAccepted=false, bool pathL3FilterAccepted=true) const
Checks, if a certain HLT path name is assigned.
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:547
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:75
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByPath ( const char *  namePath,
const bool  pathLastFilterAccepted = false,
const bool  pathL3FilterAccepted = true 
) const
inline

Definition at line 193 of file PATObject.h.

195  {
196  return triggerObjectMatchesByPath(std::string(namePath), pathLastFilterAccepted, pathL3FilterAccepted);
197  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:682
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByPath ( const std::string &  namePath,
const unsigned  pathLastFilterAccepted,
const unsigned  pathL3FilterAccepted = 1 
) const
inline

Definition at line 199 of file PATObject.h.

201  {
202  return triggerObjectMatchesByPath(namePath, bool(pathLastFilterAccepted), bool(pathL3FilterAccepted));
203  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:682
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByPath ( const char *  namePath,
const unsigned  pathLastFilterAccepted,
const unsigned  pathL3FilterAccepted = 1 
) const
inline

Definition at line 205 of file PATObject.h.

207  {
209  std::string(namePath), bool(pathLastFilterAccepted), bool(pathL3FilterAccepted));
210  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:682
template<class ObjectType >
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByType ( const trigger::TriggerObjectType  triggerObjectType) const

get all matched trigger objects of a certain type; trigger object types are defined in 'enum trigger::TriggerObjectType' (DataFormats/HLTReco/interface/TriggerTypeDefs.h)

Definition at line 555 of file PATObject.h.

References pat::TriggerObject::hasTriggerObjectType(), mps_fire::i, patCandidatesForDimuonsSequences_cff::matches, pat::PATObject< ObjectType >::triggerObjectMatch(), and pat::PATObject< ObjectType >::triggerObjectMatches().

556  {
558  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
559  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasTriggerObjectType(triggerObjectType))
560  matches.push_back(*(triggerObjectMatch(i)));
561  }
562  return matches;
563  }
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:547
bool hasTriggerObjectType(trigger::TriggerObjectType triggerObjectType) const
Checks, if a certain trigger object type identifier is assigned.
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:75
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByType ( const unsigned  triggerObjectType) const
inline

Definition at line 82 of file PATObject.h.

82  {
83  return triggerObjectMatchesByType(trigger::TriggerObjectType(triggerObjectType));
84  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByType(const trigger::TriggerObjectType triggerObjectType) const
Definition: PATObject.h:555
template<class ObjectType>
void pat::PATObject< ObjectType >::unpackTriggerObjectPathNames ( const edm::TriggerNames names)
inline

unpack path names of matched trigger objects (if they were packed before embedding, which is not normally the case)

Definition at line 247 of file PATObject.h.

247  {
248  for (std::vector<TriggerObjectStandAlone>::iterator it = triggerObjectMatchesEmbedded_.begin(),
250  it != ed;
251  ++it)
252  it->unpackPathNames(names);
253  }
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:466
template<class ObjectType >
reco::CandidatePtr pat::PATObject< ObjectType >::userCand ( const std::string &  key) const

Get user-defined candidate ptr Note: it will a null pointer if the key is not found; you can check if the key exists with 'hasUserInt' method.

Definition at line 950 of file PATObject.h.

References HLT_2018_cff::distance, crabWrapper::key, pat::PATObject< ObjectType >::userCandLabels_, and pat::PATObject< ObjectType >::userCands_.

950  {
951  auto it = std::lower_bound(userCandLabels_.cbegin(), userCandLabels_.cend(), key);
952  if (it != userCandLabels_.cend()) {
953  return userCands_[std::distance(userCandLabels_.begin(), it)];
954  }
955  return reco::CandidatePtr();
956  }
std::vector< reco::CandidatePtr > userCands_
Definition: PATObject.h:494
std::vector< std::string > userCandLabels_
Definition: PATObject.h:493
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
template<class ObjectType>
const std::vector<std::string>& pat::PATObject< ObjectType >::userCandNames ( ) const
inline

Get list of user-defined cand names.

Definition at line 406 of file PATObject.h.

406 { return userCandLabels_; }
std::vector< std::string > userCandLabels_
Definition: PATObject.h:493
template<class ObjectType>
template<typename T >
const T* pat::PATObject< ObjectType >::userData ( const std::string &  key) const
inline

Returns user-defined data. Returns NULL if the data is not present, or not of type T.

Definition at line 327 of file PATObject.h.

Referenced by BPHWriteSpecificDecay::fill(), and BPHUserData::getByRef().

327  {
329  return (data != nullptr ? data->template get<T>() : nullptr);
330  }
const pat::UserData * userDataObject_(const std::string &key) const
Definition: PATObject.h:849
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
Base class for data that users can add to pat objects.
Definition: UserData.h:23
template<class ObjectType>
const void* pat::PATObject< ObjectType >::userDataBare ( const std::string &  key) const
inline

Get the data as a void *, for CINT usage. COMPLETELY UNSUPPORTED, USE ONLY FOR DEBUGGING

Definition at line 343 of file PATObject.h.

343  {
345  return (data != nullptr ? data->bareData() : nullptr);
346  }
const pat::UserData * userDataObject_(const std::string &key) const
Definition: PATObject.h:849
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
Base class for data that users can add to pat objects.
Definition: UserData.h:23
const void * bareData() const
Definition: UserData.h:50
template<class ObjectType>
const std::vector<std::string>& pat::PATObject< ObjectType >::userDataNames ( ) const
inline

Get list of user data object names.

Definition at line 339 of file PATObject.h.

339 { return userDataLabels_; }
std::vector< std::string > userDataLabels_
User data object.
Definition: PATObject.h:484
template<class ObjectType >
const pat::UserData * pat::PATObject< ObjectType >::userDataObject_ ( const std::string &  key) const
private

Definition at line 849 of file PATObject.h.

References HLT_2018_cff::distance, crabWrapper::key, pat::PATObject< ObjectType >::userDataLabels_, and pat::PATObject< ObjectType >::userDataObjects_.

849  {
850  auto it = std::lower_bound(userDataLabels_.cbegin(), userDataLabels_.cend(), key);
851  if (it != userDataLabels_.cend() && *it == key) {
852  return &userDataObjects_[std::distance(userDataLabels_.cbegin(), it)];
853  }
854  return nullptr;
855  }
std::vector< std::string > userDataLabels_
User data object.
Definition: PATObject.h:484
pat::UserDataCollection userDataObjects_
Definition: PATObject.h:485
template<class ObjectType>
const std::string& pat::PATObject< ObjectType >::userDataObjectType ( const std::string &  key) const
inline

Get human-readable type of user data object, for debugging.

Definition at line 334 of file PATObject.h.

334  {
336  return (data != nullptr ? data->typeName() : pat_statics::EMPTY_STR);
337  };
static const std::string EMPTY_STR("")
virtual const std::string & typeName() const =0
Human readable name of the concrete type of stored data.
const pat::UserData * userDataObject_(const std::string &key) const
Definition: PATObject.h:849
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
Base class for data that users can add to pat objects.
Definition: UserData.h:23
template<class ObjectType >
float pat::PATObject< ObjectType >::userFloat ( const std::string &  key) const

Get user-defined float Note: throws if the key is not found; you can check if the key exists with 'hasUserFloat' method.

Definition at line 876 of file PATObject.h.

References HLT_2018_cff::distance, crabWrapper::key, pat::throwMissingLabel(), pat::PATObject< ObjectType >::userFloatLabels_, and pat::PATObject< ObjectType >::userFloats_.

Referenced by BPHFittedBasicSelect::accept(), ZeePlots::analyze(), WenuPlots::analyze(), BPHHistoSpecificDecay::endJob(), PFJetIDSelectionFunctor::firstDataCuts(), EGEtScaleSysModifier::modifyObject(), PhoMVACut::operator()(), GsfEleMVACut::operator()(), PhoAnyPFIsoWithEAAndExpoScalingCut::operator()(), PhoAnyPFIsoWithEACut::operator()(), PhoAnyPFIsoWithEAAndExpoScalingEBCut::operator()(), PhoAnyPFIsoWithEAAndQuadScalingCut::operator()(), Jet.Jet::puMva(), MuScleFitMuonSelector::selectMuons(), PhoMVACut::value(), PhoAnyPFIsoWithEAAndExpoScalingCut::value(), PhoAnyPFIsoWithEACut::value(), PhoAnyPFIsoWithEAAndQuadScalingCut::value(), PhoAnyPFIsoWithEAAndExpoScalingEBCut::value(), and GsfEleMVACut::value().

876  {
877  auto it = std::lower_bound(userFloatLabels_.cbegin(), userFloatLabels_.cend(), key);
878  if (it != userFloatLabels_.cend() && *it == key) {
879  return userFloats_[std::distance(userFloatLabels_.cbegin(), it)];
880  }
881  throwMissingLabel("UserFloat", key, userFloatLabels_);
882  return std::numeric_limits<float>::quiet_NaN();
883  }
std::vector< float > userFloats_
Definition: PATObject.h:488
std::vector< std::string > userFloatLabels_
Definition: PATObject.h:487
void throwMissingLabel(const std::string &what, const std::string &bad_label, const std::vector< std::string > &available)
template<class ObjectType>
float pat::PATObject< ObjectType >::userFloat ( const char *  key) const
inline

a CINT-friendly interface

Definition at line 371 of file PATObject.h.

Referenced by Jet.Jet::puMva(), and pat::PATObject< reco::Muon >::userFloat().

371 { return userFloat(std::string(key)); }
float userFloat(const std::string &key) const
Definition: PATObject.h:876
template<class ObjectType>
const std::vector<std::string>& pat::PATObject< ObjectType >::userFloatNames ( ) const
inline

Get list of user-defined float names.

Definition at line 376 of file PATObject.h.

376 { return userFloatLabels_; }
std::vector< std::string > userFloatLabels_
Definition: PATObject.h:487
template<class ObjectType >
std::vector< float > pat::PATObject< ObjectType >::userFloatRange ( const std::string &  key) const

return a range of values corresponding to key

Definition at line 886 of file PATObject.h.

References HLT_2018_cff::distance, crabWrapper::key, FastTimerService_cff::range, mps_fire::result, pat::PATObject< ObjectType >::userFloatLabels_, and pat::PATObject< ObjectType >::userFloats_.

886  {
887  auto range = std::equal_range(userFloatLabels_.cbegin(), userFloatLabels_.cend(), key);
888  std::vector<float> result;
889  result.reserve(std::distance(range.first, range.second));
890  for (auto it = range.first; it != range.second; ++it) {
891  result.push_back(userFloats_[std::distance(userFloatLabels_.cbegin(), it)]);
892  }
893  return result;
894  }
std::vector< float > userFloats_
Definition: PATObject.h:488
std::vector< std::string > userFloatLabels_
Definition: PATObject.h:487
template<class ObjectType >
int pat::PATObject< ObjectType >::userInt ( const std::string &  key) const

Get user-defined int Note: throws if the key is not found; you can check if the key exists with 'hasUserInt' method.

Definition at line 913 of file PATObject.h.

References HLT_2018_cff::distance, crabWrapper::key, SiStripPI::max, pat::throwMissingLabel(), pat::PATObject< ObjectType >::userIntLabels_, and pat::PATObject< ObjectType >::userInts_.

Referenced by WenuPlots::analyze(), PhoMVACut::operator()(), GsfEleMVACut::operator()(), WenuPlots::PassPreselectionCriteria(), ZeePlots::PassPreselectionCriteria1(), and ZeePlots::PassPreselectionCriteria2().

913  {
914  auto it = std::lower_bound(userIntLabels_.cbegin(), userIntLabels_.cend(), key);
915  if (it != userIntLabels_.cend() && *it == key) {
916  return userInts_[std::distance(userIntLabels_.cbegin(), it)];
917  }
918  throwMissingLabel("UserInt", key, userIntLabels_);
920  }
void throwMissingLabel(const std::string &what, const std::string &bad_label, const std::vector< std::string > &available)
std::vector< int32_t > userInts_
Definition: PATObject.h:491
std::vector< std::string > userIntLabels_
Definition: PATObject.h:490
template<class ObjectType>
const std::vector<std::string>& pat::PATObject< ObjectType >::userIntNames ( ) const
inline

Get list of user-defined int names.

Definition at line 393 of file PATObject.h.

393 { return userIntLabels_; }
std::vector< std::string > userIntLabels_
Definition: PATObject.h:490
template<class ObjectType >
std::vector< int > pat::PATObject< ObjectType >::userIntRange ( const std::string &  key) const

returns a range of values corresponding to key

Definition at line 923 of file PATObject.h.

References HLT_2018_cff::distance, crabWrapper::key, FastTimerService_cff::range, mps_fire::result, pat::PATObject< ObjectType >::userIntLabels_, and pat::PATObject< ObjectType >::userInts_.

923  {
924  auto range = std::equal_range(userIntLabels_.cbegin(), userIntLabels_.cend(), key);
925  std::vector<int> result;
926  result.reserve(std::distance(range.first, range.second));
927  for (auto it = range.first; it != range.second; ++it) {
928  result.push_back(userInts_[std::distance(userIntLabels_.cbegin(), it)]);
929  }
930  return result;
931  }
std::vector< int32_t > userInts_
Definition: PATObject.h:491
std::vector< std::string > userIntLabels_
Definition: PATObject.h:490

Member Data Documentation

template<class ObjectType>
std::vector<std::string> pat::PATObject< ObjectType >::efficiencyNames_
protected
template<class ObjectType>
std::vector<pat::LookupTableRecord> pat::PATObject< ObjectType >::efficiencyValues_
protected
template<class ObjectType>
std::vector<reco::GenParticle> pat::PATObject< ObjectType >::genParticleEmbedded_
protected
template<class ObjectType>
std::vector<reco::GenParticleRef> pat::PATObject< ObjectType >::genParticleRef_
protected
template<class ObjectType>
std::vector<std::string> pat::PATObject< ObjectType >::kinResolutionLabels_
protected

Labels for the kinematic resolutions. if (kinResolutions_.size() == kinResolutionLabels_.size()+1), then the first resolution has no label.

Definition at line 500 of file PATObject.h.

Referenced by pat::PATObject< ObjectType >::getKinResolution(), pat::PATObject< ObjectType >::hasKinResolution(), and pat::PATObject< ObjectType >::setKinResolution().

template<class ObjectType>
std::vector<pat::CandKinResolution> pat::PATObject< ObjectType >::kinResolutions_
protected
template<class ObjectType>
std::vector<reco::CandidatePtrVector> pat::PATObject< ObjectType >::overlapItems_
protected

Overlapping items (sorted by distance)

Definition at line 481 of file PATObject.h.

Referenced by pat::PATObject< ObjectType >::overlaps(), and pat::PATObject< ObjectType >::setOverlaps().

template<class ObjectType>
std::vector<std::string> pat::PATObject< ObjectType >::overlapLabels_
protected

Overlapping test labels (only if there are any overlaps)

Definition at line 479 of file PATObject.h.

Referenced by pat::PATObject< ObjectType >::hasOverlaps(), pat::PATObject< ObjectType >::overlaps(), and pat::PATObject< ObjectType >::setOverlaps().

template<class ObjectType>
edm::Ptr<reco::Candidate> pat::PATObject< ObjectType >::refToOrig_
protected
template<class ObjectType>
TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesEmbedded_
protected
template<class ObjectType>
std::vector<std::string> pat::PATObject< ObjectType >::userCandLabels_
protected
template<class ObjectType>
std::vector<reco::CandidatePtr> pat::PATObject< ObjectType >::userCands_
protected
template<class ObjectType>
std::vector<std::string> pat::PATObject< ObjectType >::userDataLabels_
protected
template<class ObjectType>
pat::UserDataCollection pat::PATObject< ObjectType >::userDataObjects_
protected
template<class ObjectType>
std::vector<std::string> pat::PATObject< ObjectType >::userFloatLabels_
protected
template<class ObjectType>
std::vector<float> pat::PATObject< ObjectType >::userFloats_
protected
template<class ObjectType>
std::vector<std::string> pat::PATObject< ObjectType >::userIntLabels_
protected
template<class ObjectType>
std::vector<int32_t> pat::PATObject< ObjectType >::userInts_
protected