CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public 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)
 Set user-defined int. More...
 
template<typename T >
void addUserData (const std::string &label, const T &data, bool transientOnly=false)
 
void addUserDataFromPtr (const std::string &label, const edm::Ptr< pat::UserData > &data)
 
void addUserFloat (const std::string &label, float data)
 Set user-defined float. More...
 
void addUserInt (const std::string &label, int32_t data)
 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 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=true, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByPath (const char *namePath, const bool pathLastFilterAccepted=true, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByPath (const std::string &namePath, const unsigned pathLastFilterAccepted, const size_t idx=0) const
 
const TriggerObjectStandAlonetriggerObjectMatchByPath (const char *namePath, const unsigned pathLastFilterAccepted, 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
TriggerObjectStandAloneCollection
triggerObjectMatches () 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=true) const
 
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByPath (const char *namePath, const bool pathLastFilterAccepted=true) const
 
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByPath (const std::string &namePath, const unsigned pathLastFilterAccepted) const
 
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByPath (const char *namePath, const unsigned pathLastFilterAccepted) const
 
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByType (const trigger::TriggerObjectType triggerObjectType) const
 
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByType (const unsigned triggerObjectType) const
 
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 T * userData (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
 
const std::vector< std::string > & userFloatNames () const
 Get list of user-defined float names. More...
 
int32_t userInt (const std::string &key) const
 
const std::vector< std::string > & userIntNames () const
 Get list of user-defined int names. More...
 
virtual ~PATObject ()
 destructor More...
 

Protected Attributes

std::vector< std::string > efficiencyNames_
 vector of the efficiencies (names) More...
 
std::vector
< pat::LookupTableRecord
efficiencyValues_
 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::CandKinResolution
kinResolutions_
 Kinematic resolutions. More...
 
std::vector
< reco::CandidatePtrVector
overlapItems_
 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
Version
Id:
PATObject.h,v 1.32 2011/02/07 19:51:23 vadler Exp

Definition at line 42 of file PATObject.h.

Member Typedef Documentation

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

Definition at line 45 of file PATObject.h.

Constructor & Destructor Documentation

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

default constructor

Definition at line 438 of file PATObject.h.

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

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

Definition at line 441 of file PATObject.h.

441  :
442  ObjectType(obj),
443  refToOrig_() {
444  }
tuple obj
Example code starts here #.
Definition: VarParsing.py:655
edm::Ptr< reco::Candidate > refToOrig_
Definition: PATObject.h:394
template<class ObjectType>
pat::PATObject< ObjectType >::PATObject ( const edm::RefToBase< ObjectType > &  ref)

constructor from reference

Definition at line 446 of file PATObject.h.

446  :
447  ObjectType(*ref),
448  refToOrig_(ref.id(), ref.get(), ref.key()) // correct way to convert RefToBase=>Ptr, if ref is guaranteed to be available
449  // which happens to be true, otherwise the line before this throws ex. already
450  {
451  }
ProductID id() const
Definition: RefToBase.h:215
size_t key() const
Definition: RefToBase.h:223
edm::Ptr< reco::Candidate > refToOrig_
Definition: PATObject.h:394
value_type const * get() const
Definition: RefToBase.h:207
template<class ObjectType>
pat::PATObject< ObjectType >::PATObject ( const edm::Ptr< ObjectType > &  ref)

constructor from reference

Definition at line 453 of file PATObject.h.

453  :
454  ObjectType(*ref),
455  refToOrig_(ref) {
456  }
edm::Ptr< reco::Candidate > refToOrig_
Definition: PATObject.h:394
template<class ObjectType>
virtual pat::PATObject< ObjectType >::~PATObject ( )
inlinevirtual

destructor

Definition at line 56 of file PATObject.h.

56 {}

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 649 of file PATObject.h.

References edm::Ref< C, T, F >::isNonnull().

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

649  {
650  if (!genParticleEmbedded_.empty()) { // we're embedding
651  if (ref.isNonnull()) genParticleEmbedded_.push_back(*ref);
652  } else {
653  genParticleRef_.push_back(ref);
654  }
655  }
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:405
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:407
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:248
template<class ObjectType>
void pat::PATObject< ObjectType >::addTriggerObjectMatch ( const TriggerObjectStandAlone trigObj)
inline

add a trigger match

Definition at line 193 of file PATObject.h.

193 { triggerObjectMatchesEmbedded_.push_back( trigObj ); };
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:397
template<class ObjectType >
void pat::PATObject< ObjectType >::addUserCand ( const std::string &  label,
const reco::CandidatePtr data 
)

Set user-defined int.

Definition at line 790 of file PATObject.h.

792  {
793  userCandLabels_.push_back(label);
794  userCands_.push_back( data );
795  }
const std::string & label
Definition: MVAComputer.cc:186
std::vector< reco::CandidatePtr > userCands_
Definition: PATObject.h:425
std::vector< std::string > userCandLabels_
Definition: PATObject.h:424
template<class ObjectType>
template<typename T >
void pat::PATObject< ObjectType >::addUserData ( const std::string &  label,
const T &  data,
bool  transientOnly = 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 295 of file PATObject.h.

295  {
296  userDataLabels_.push_back(label);
297  userDataObjects_.push_back(pat::UserData::make<T>(data, transientOnly));
298  }
const std::string & label
Definition: MVAComputer.cc:186
std::vector< std::string > userDataLabels_
User data object.
Definition: PATObject.h:415
void push_back(D *&d)
Definition: OwnVector.h:288
pat::UserDataCollection userDataObjects_
Definition: PATObject.h:416
template<class ObjectType>
void pat::PATObject< ObjectType >::addUserDataFromPtr ( const std::string &  label,
const edm::Ptr< pat::UserData > &  data 
)
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 302 of file PATObject.h.

302  {
303  userDataLabels_.push_back(label);
304  userDataObjects_.push_back(data->clone());
305  }
const std::string & label
Definition: MVAComputer.cc:186
std::vector< std::string > userDataLabels_
User data object.
Definition: PATObject.h:415
void push_back(D *&d)
Definition: OwnVector.h:288
pat::UserDataCollection userDataObjects_
Definition: PATObject.h:416
template<class ObjectType >
void pat::PATObject< ObjectType >::addUserFloat ( const std::string &  label,
float  data 
)

Set user-defined float.

Definition at line 753 of file PATObject.h.

Referenced by ZMuMuTrackUserData::produce(), ZMuMuMuonUserData::produce(), ZMuMuUserData::produce(), ZMuMuUserDataOneTrack::produce(), and PatJPsiProducer::produce().

755  {
756  userFloatLabels_.push_back(label);
757  userFloats_.push_back( data );
758  }
const std::string & label
Definition: MVAComputer.cc:186
std::vector< float > userFloats_
Definition: PATObject.h:419
std::vector< std::string > userFloatLabels_
Definition: PATObject.h:418
template<class ObjectType>
void pat::PATObject< ObjectType >::addUserInt ( const std::string &  label,
int32_t  data 
)

Set user-defined int.

Definition at line 772 of file PATObject.h.

774  {
775  userIntLabels_.push_back(label);
776  userInts_.push_back( data );
777  }
const std::string & label
Definition: MVAComputer.cc:186
std::vector< int32_t > userInts_
Definition: PATObject.h:422
std::vector< std::string > userIntLabels_
Definition: PATObject.h:421
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 616 of file PATObject.h.

References runTheMatrix::ret.

616  {
617  std::vector<std::pair<std::string,pat::LookupTableRecord> > ret;
618  std::vector<std::string>::const_iterator itn = efficiencyNames_.begin(), edn = efficiencyNames_.end();
619  std::vector<pat::LookupTableRecord>::const_iterator itv = efficiencyValues_.begin();
620  for ( ; itn != edn; ++itn, ++itv) {
621  ret.push_back( std::pair<std::string,pat::LookupTableRecord>(*itn, *itv) );
622  }
623  return ret;
624  }
std::vector< std::string > efficiencyNames_
vector of the efficiencies (names)
Definition: PATObject.h:402
std::vector< pat::LookupTableRecord > efficiencyValues_
vector of the efficiencies (values)
Definition: PATObject.h:400
template<class ObjectType >
const pat::LookupTableRecord & pat::PATObject< ObjectType >::efficiency ( const std::string &  name) const

Returns an efficiency given its name.

Definition at line 605 of file PATObject.h.

References edm::hlt::Exception, and AlCaRecoCosmics_cfg::name.

605  {
606  // find the name in the (sorted) list of names
607  std::vector<std::string>::const_iterator it = std::lower_bound(efficiencyNames_.begin(), efficiencyNames_.end(), name);
608  if ((it == efficiencyNames_.end()) || (*it != name)) {
609  throw cms::Exception("Invalid Label") << "There is no efficiency with name '" << name << "' in this PAT Object\n";
610  }
611  return efficiencyValues_[it - efficiencyNames_.begin()];
612  }
std::vector< std::string > efficiencyNames_
vector of the efficiencies (names)
Definition: PATObject.h:402
std::vector< pat::LookupTableRecord > efficiencyValues_
vector of the efficiencies (values)
Definition: PATObject.h:400
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 200 of file PATObject.h.

200 { return efficiencyNames_; }
std::vector< std::string > efficiencyNames_
vector of the efficiencies (names)
Definition: PATObject.h:402
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 202 of file PATObject.h.

202 { return efficiencyValues_; }
std::vector< pat::LookupTableRecord > efficiencyValues_
vector of the efficiencies (values)
Definition: PATObject.h:400
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 665 of file PATObject.h.

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

665  {
666  genParticleEmbedded_.clear();
667  for (std::vector<reco::GenParticleRef>::const_iterator it = genParticleRef_.begin(); it != genParticleRef_.end(); ++it) {
668  if (it->isNonnull()) genParticleEmbedded_.push_back(**it);
669  }
670  genParticleRef_.clear();
671  }
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:405
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:407
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 229 of file PATObject.h.

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

229  {
231  return ref.isNonnull() ? ref.get() : 0;
232  }
reco::GenParticleRef genParticleRef(size_t idx=0) const
Definition: PATObject.h:210
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:248
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:239
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 684 of file PATObject.h.

References abs, DeDxDiscriminatorTools::charge(), reco::LeafCandidate::charge(), end, g, reco::LeafCandidate::pdgId(), reco::LeafCandidate::status(), and ntuplemaker::status.

684  {
685  // get a vector, avoiding an unneeded copy if there is no embedding
686  const std::vector<reco::GenParticleRef> & vec = (genParticleEmbedded_.empty() ? genParticleRef_ : genParticleRefs());
687  for (std::vector<reco::GenParticleRef>::const_iterator ref = vec.begin(), end = vec.end(); ref != end; ++ref) {
688  if (ref->isNonnull()) {
689  const reco::GenParticle & g = **ref;
690  if ((status != 0) && (g.status() != status)) continue;
691  if (pdgId == 0) {
692  return *ref;
693  } else if (!autoCharge) {
694  if (pdgId == g.pdgId()) return *ref;
695  } else if (abs(pdgId) == abs(g.pdgId())) {
696  // I want pdgId > 0 to match "correct charge" (for charged particles)
697  if (g.charge() == 0) return *ref;
698  else if ((this->charge() == 0) && (pdgId == g.pdgId())) return *ref;
699  else if (g.charge()*this->charge()*pdgId > 0) return *ref;
700  }
701  }
702  }
703  return reco::GenParticleRef();
704  }
virtual int pdgId() const
PDG identifier.
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:405
virtual int status() const
status word
edm::Ref< GenParticleCollection > GenParticleRef
persistent reference to a GenParticle
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< reco::GenParticleRef > genParticleRefs() const
Definition: PATObject.h:674
double charge(const std::vector< uint8_t > &Ampls)
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:407
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
virtual int charge() const
electric charge
#define end
Definition: vmac.h:38
tuple status
Definition: ntuplemaker.py:245
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 210 of file PATObject.h.

Referenced by DimuonStatistics::analyze(), pat::PATObject< reco::Muon >::genParticle(), and DimuonMCMatcher::produce().

210  {
211  if (idx >= genParticlesSize()) return reco::GenParticleRef();
213  }
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:405
size_t genParticlesSize() const
Number of generator level particles stored as ref or embedded.
Definition: PATObject.h:234
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:407
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 674 of file PATObject.h.

References i, n, and runTheMatrix::ret.

Referenced by getGenTau().

674  {
675  if (genParticleEmbedded_.empty()) return genParticleRef_;
676  std::vector<reco::GenParticleRef> ret(genParticleEmbedded_.size());
677  for (size_t i = 0, n = ret.size(); i < n; ++i) {
679  }
680  return ret;
681  }
int i
Definition: DBlmapReader.cc:9
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:405
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:407
template<class ObjectType>
size_t pat::PATObject< ObjectType >::genParticlesSize ( ) const
inline

Number of generator level particles stored as ref or embedded.

Definition at line 234 of file PATObject.h.

Referenced by pat::PATObject< reco::Muon >::genParticleRef().

234  {
235  return genParticleEmbedded_.empty() ? genParticleRef_.size() : genParticleEmbedded_.size();
236  }
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:405
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:407
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 799 of file PATObject.h.

References edm::hlt::Exception, spr::find(), label, and match().

Referenced by pat::PATObject< reco::Muon >::resolE(), pat::PATObject< reco::Muon >::resolEt(), pat::PATObject< reco::Muon >::resolEta(), pat::PATObject< reco::Muon >::resolM(), pat::PATObject< reco::Muon >::resolP(), pat::PATObject< reco::Muon >::resolPhi(), pat::PATObject< reco::Muon >::resolPInv(), pat::PATObject< reco::Muon >::resolPt(), pat::PATObject< reco::Muon >::resolPx(), pat::PATObject< reco::Muon >::resolPy(), pat::PATObject< reco::Muon >::resolPz(), and pat::PATObject< reco::Muon >::resolTheta().

799  {
800  if (label.empty()) {
801  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
802  return kinResolutions_[0];
803  } else {
804  throw cms::Exception("Missing Data", "This object does not contain an un-labelled kinematic resolution");
805  }
806  } else {
807  std::vector<std::string>::const_iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
808  if (match == kinResolutionLabels_.end()) {
809  cms::Exception ex("Missing Data");
810  ex << "This object does not contain a kinematic resolution with name '" << label << "'.\n";
811  ex << "The known labels are: " ;
812  for (std::vector<std::string>::const_iterator it = kinResolutionLabels_.begin(); it != kinResolutionLabels_.end(); ++it) {
813  ex << "'" << *it << "' ";
814  }
815  ex << "\n";
816  throw ex;
817  } else {
818  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
819  // skip un-labelled resolution
820  return kinResolutions_[match - kinResolutionLabels_.begin() + 1];
821  } else {
822  // all are labelled, so this is the real index
823  return kinResolutions_[match - kinResolutionLabels_.begin()];
824  }
825  }
826  }
827  }
const std::string & label
Definition: MVAComputer.cc:186
std::vector< pat::CandKinResolution > kinResolutions_
Kinematic resolutions.
Definition: PATObject.h:428
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< std::string > kinResolutionLabels_
Definition: PATObject.h:431
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
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 830 of file PATObject.h.

References spr::find(), label, and match().

830  {
831  if (label.empty()) {
832  return (kinResolutionLabels_.size()+1 == kinResolutions_.size());
833  } else {
834  std::vector<std::string>::const_iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
835  return match != kinResolutionLabels_.end();
836  }
837  }
const std::string & label
Definition: MVAComputer.cc:186
std::vector< pat::CandKinResolution > kinResolutions_
Kinematic resolutions.
Definition: PATObject.h:428
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< std::string > kinResolutionLabels_
Definition: PATObject.h:431
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
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 707 of file PATObject.h.

References spr::find(), and label.

707  {
708  return std::find(overlapLabels_.begin(), overlapLabels_.end(), label) != overlapLabels_.end();
709  }
const std::string & label
Definition: MVAComputer.cc:186
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< std::string > overlapLabels_
Overlapping test labels (only if there are any overlaps)
Definition: PATObject.h:410
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 338 of file PATObject.h.

338  {
339  return std::find(userCandLabels_.begin(), userCandLabels_.end(), key) != userCandLabels_.end();
340  }
std::vector< std::string > userCandLabels_
Definition: PATObject.h:424
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
list key
Definition: combine.py:13
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 271 of file PATObject.h.

271  {
272  return (userDataObject_(key) != 0);
273  }
const pat::UserData * userDataObject_(const std::string &key) const
Definition: PATObject.h:733
list key
Definition: combine.py:13
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 315 of file PATObject.h.

315  {
316  return std::find(userFloatLabels_.begin(), userFloatLabels_.end(), key) != userFloatLabels_.end();
317  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< std::string > userFloatLabels_
Definition: PATObject.h:418
list key
Definition: combine.py:13
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 326 of file PATObject.h.

326  {
327  return std::find(userIntLabels_.begin(), userIntLabels_.end(), key) != userIntLabels_.end();
328  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
list key
Definition: combine.py:13
std::vector< std::string > userIntLabels_
Definition: PATObject.h:421
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 459 of file PATObject.h.

References edm::hlt::Exception, and edm::errors::ProductNotFound.

459  {
460  if (refToOrig_.isNull()) {
461  // this object was not produced from a reference, so no link to the
462  // original object exists -> return a 0-pointer
463  return 0;
464  } else if (!refToOrig_.isAvailable()) {
465  throw edm::Exception(edm::errors::ProductNotFound) << "The original collection from which this PAT object was made is not present any more in the event, hence you cannot access the originating object anymore.";
466  } else {
467  return refToOrig_.get();
468  }
469  }
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:147
bool isNull() const
Checks for null.
Definition: Ptr.h:152
bool isAvailable() const
Definition: Ptr.h:162
edm::Ptr< reco::Candidate > refToOrig_
Definition: PATObject.h:394
template<class ObjectType >
const edm::Ptr< reco::Candidate > & pat::PATObject< ObjectType >::originalObjectRef ( ) const

reference to original object. Returns a null reference if not available

Definition at line 472 of file PATObject.h.

472 { return refToOrig_; }
edm::Ptr< reco::Candidate > refToOrig_
Definition: PATObject.h:394
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 258 of file PATObject.h.

258 { return overlapLabels_; }
std::vector< std::string > overlapLabels_
Overlapping test labels (only if there are any overlaps)
Definition: PATObject.h:410
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 712 of file PATObject.h.

References evf::evt::EMPTY, spr::find(), label, and match().

712  {
713  static const reco::CandidatePtrVector EMPTY;
714  std::vector<std::string>::const_iterator match = std::find(overlapLabels_.begin(), overlapLabels_.end(), label);
715  if (match == overlapLabels_.end()) return EMPTY;
716  return overlapItems_[match - overlapLabels_.begin()];
717  }
const std::string & label
Definition: MVAComputer.cc:186
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< reco::CandidatePtrVector > overlapItems_
Overlapping items (sorted by distance)
Definition: PATObject.h:412
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
std::vector< std::string > overlapLabels_
Overlapping test labels (only if there are any overlaps)
Definition: PATObject.h:410
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 363 of file PATObject.h.

363 { return getKinResolution(label).resolE(this->p4()); }
const std::string & label
Definition: MVAComputer.cc:186
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:799
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 366 of file PATObject.h.

366 { return getKinResolution(label).resolEt(this->p4()); }
const std::string & label
Definition: MVAComputer.cc:186
double p4[4]
Definition: TauolaWrapper.h:92
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:799
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 354 of file PATObject.h.

354 { return getKinResolution(label).resolEta(this->p4()); }
const std::string & label
Definition: MVAComputer.cc:186
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:799
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 388 of file PATObject.h.

388 { return getKinResolution(label).resolM(this->p4()); }
const std::string & label
Definition: MVAComputer.cc:186
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:799
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 369 of file PATObject.h.

369 { return getKinResolution(label).resolP(this->p4()); }
const std::string & label
Definition: MVAComputer.cc:186
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:799
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 360 of file PATObject.h.

360 { return getKinResolution(label).resolPhi(this->p4()); }
double resolPhi(const LorentzVector &p4) const
Resolution on phi, given the 4-momentum of the associated Candidate.
const std::string & label
Definition: MVAComputer.cc:186
double p4[4]
Definition: TauolaWrapper.h:92
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:799
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 375 of file PATObject.h.

375 { return getKinResolution(label).resolPInv(this->p4()); }
const std::string & label
Definition: MVAComputer.cc:186
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:799
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 372 of file PATObject.h.

372 { return getKinResolution(label).resolPt(this->p4()); }
const std::string & label
Definition: MVAComputer.cc:186
double p4[4]
Definition: TauolaWrapper.h:92
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:799
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 378 of file PATObject.h.

378 { return getKinResolution(label).resolPx(this->p4()); }
const std::string & label
Definition: MVAComputer.cc:186
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:799
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 381 of file PATObject.h.

381 { return getKinResolution(label).resolPy(this->p4()); }
const std::string & label
Definition: MVAComputer.cc:186
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:799
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 384 of file PATObject.h.

384 { return getKinResolution(label).resolPz(this->p4()); }
const std::string & label
Definition: MVAComputer.cc:186
double resolPz(const LorentzVector &p4) const
Resolution on pz, 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:799
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 357 of file PATObject.h.

357 { return getKinResolution(label).resolTheta(this->p4()); }
const std::string & label
Definition: MVAComputer.cc:186
double p4[4]
Definition: TauolaWrapper.h:92
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:799
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 627 of file PATObject.h.

References edm::eventsetup::heterocontainer::insert(), AlCaRecoCosmics_cfg::name, and relativeConstraints::value.

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

627  {
628  // look for the name, or to the place where we can insert it without violating the alphabetic order
629  std::vector<std::string>::iterator it = std::lower_bound(efficiencyNames_.begin(), efficiencyNames_.end(), name);
630  if (it == efficiencyNames_.end()) { // insert at the end
631  efficiencyNames_.push_back(name);
632  efficiencyValues_.push_back(value);
633  } else if (*it == name) { // replace existing
634  efficiencyValues_[it - efficiencyNames_.begin()] = value;
635  } else { // insert in the middle :-(
637  efficiencyValues_.insert( efficiencyValues_.begin() + (it - efficiencyNames_.begin()), value );
638  }
639  }
std::vector< std::string > efficiencyNames_
vector of the efficiencies (names)
Definition: PATObject.h:402
std::vector< pat::LookupTableRecord > efficiencyValues_
vector of the efficiencies (values)
Definition: PATObject.h:400
bool insert(Storage &, ItemType *, const IdTag &)
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 658 of file PATObject.h.

658  {
659  genParticleEmbedded_.clear();
660  genParticleEmbedded_.push_back(particle);
661  genParticleRef_.clear();
662  }
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:405
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:407
template<class ObjectType >
void pat::PATObject< ObjectType >::setGenParticleRef ( const reco::GenParticleRef ref,
bool  embed = false 
)

Set the generator level particle reference.

Definition at line 642 of file PATObject.h.

Referenced by pat::Lepton< reco::Muon >::setGenLepton().

642  {
643  genParticleRef_ = std::vector<reco::GenParticleRef>(1,ref);
644  genParticleEmbedded_.clear();
645  if (embed) embedGenParticle();
646  }
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:405
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:407
#define embed
Definition: AMPTWrapper.h:178
void embedGenParticle()
Definition: PATObject.h:665
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 840 of file PATObject.h.

References spr::find(), label, and match().

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

840  {
841  if (label.empty()) {
842  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
843  // There is already an un-labelled object. Replace it
844  kinResolutions_[0] = resol;
845  } else {
846  // Insert. Note that the un-labelled is always the first, so we need to insert before begin()
847  // (for an empty vector, this should not cost more than push_back)
848  kinResolutions_.insert(kinResolutions_.begin(), resol);
849  }
850  } else {
851  std::vector<std::string>::iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
852  if (match != kinResolutionLabels_.end()) {
853  // Existing object: replace
854  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
855  kinResolutions_[(match - kinResolutionLabels_.begin())+1] = resol;
856  } else {
857  kinResolutions_[(match - kinResolutionLabels_.begin())] = resol;
858  }
859  } else {
860  kinResolutionLabels_.push_back(label);
861  kinResolutions_.push_back(resol);
862  }
863  }
864  }
const std::string & label
Definition: MVAComputer.cc:186
std::vector< pat::CandKinResolution > kinResolutions_
Kinematic resolutions.
Definition: PATObject.h:428
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< std::string > kinResolutionLabels_
Definition: PATObject.h:431
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
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 720 of file PATObject.h.

References edm::PtrVectorBase::empty(), spr::find(), label, match(), and analyzePatCleaning_cfg::overlaps.

720  {
721  if (!overlaps.empty()) {
722  std::vector<std::string>::const_iterator match = std::find(overlapLabels_.begin(), overlapLabels_.end(), label);
723  if (match == overlapLabels_.end()) {
724  overlapLabels_.push_back(label);
725  overlapItems_.push_back(overlaps);
726  } else {
727  overlapItems_[match - overlapLabels_.begin()] = overlaps;
728  }
729  }
730  }
const std::string & label
Definition: MVAComputer.cc:186
bool empty() const
Is the RefVector empty.
Definition: PtrVectorBase.h:69
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const reco::CandidatePtrVector & overlaps(const std::string &label) const
Definition: PATObject.h:712
std::vector< reco::CandidatePtrVector > overlapItems_
Overlapping items (sorted by distance)
Definition: PATObject.h:412
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
std::vector< std::string > overlapLabels_
Overlapping test labels (only if there are any overlaps)
Definition: PATObject.h:410
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 475 of file PATObject.h.

References edm::Ref< C, T, F >::get(), edm::Ref< C, T, F >::isNonnull(), and findQualityFiles::size.

475  {
476  if ( idx >= triggerObjectMatches().size() ) return 0;
478  return ref.isNonnull() ? ref.get() : 0;
479  }
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:397
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:70
tuple size
Write out results.
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
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 553 of file PATObject.h.

References i, and edm::Ref< C, T, F >::isNonnull().

Referenced by pat::PATObject< reco::Muon >::triggerObjectMatchByAlgorithm().

553  {
554  std::vector< size_t > refs;
555  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
556  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasAlgorithmName( nameAlgorithm, algoCondAccepted ) ) refs.push_back( i );
557  }
558  if ( idx >= refs.size() ) return 0;
560  return ref.isNonnull() ? ref.get() : 0;
561  }
int i
Definition: DBlmapReader.cc:9
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:397
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:475
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:70
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
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 137 of file PATObject.h.

137  {
138  return triggerObjectMatchByAlgorithm( std::string( nameAlgorithm ), algoCondAccepted, idx );
139  };
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true, const size_t idx=0) const
Definition: PATObject.h:553
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 141 of file PATObject.h.

141  {
142  return triggerObjectMatchByAlgorithm( nameAlgorithm, bool( algoCondAccepted ), idx );
143  };
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true, const size_t idx=0) const
Definition: PATObject.h:553
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 145 of file PATObject.h.

145  {
146  return triggerObjectMatchByAlgorithm( std::string( nameAlgorithm ), bool( algoCondAccepted ), idx );
147  };
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true, const size_t idx=0) const
Definition: PATObject.h:553
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 511 of file PATObject.h.

References i, and edm::Ref< C, T, F >::isNonnull().

Referenced by pat::PATObject< reco::Muon >::triggerObjectMatchByCollection().

511  {
512  std::vector< size_t > refs;
513  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
514  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasCollection( coll ) ) {
515  refs.push_back( i );
516  }
517  }
518  if ( idx >= refs.size() ) return 0;
520  return ref.isNonnull() ? ref.get() : 0;
521  }
int i
Definition: DBlmapReader.cc:9
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned (method overrides)
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:397
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:475
JetCorrectorParametersCollection coll
Definition: classes.h:14
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:70
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByCollection ( const char *  coll,
const size_t  idx = 0 
) const
inline

Definition at line 101 of file PATObject.h.

101  {
102  return triggerObjectMatchByCollection( std::string( coll ), idx );
103  };
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:511
JetCorrectorParametersCollection coll
Definition: classes.h:14
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 533 of file PATObject.h.

References i, and edm::Ref< C, T, F >::isNonnull().

Referenced by pat::PATObject< reco::Muon >::triggerObjectMatchByCondition().

533  {
534  std::vector< size_t > refs;
535  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
536  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasConditionName( nameCondition ) ) refs.push_back( i );
537  }
538  if ( idx >= refs.size() ) return 0;
540  return ref.isNonnull() ? ref.get() : 0;
541  }
int i
Definition: DBlmapReader.cc:9
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:397
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:475
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:70
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByCondition ( const char *  nameCondition,
const size_t  idx = 0 
) const
inline

Definition at line 113 of file PATObject.h.

113  {
114  return triggerObjectMatchByCondition( std::string( nameCondition ), idx );
115  };
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:533
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 573 of file PATObject.h.

References i, and edm::Ref< C, T, F >::isNonnull().

Referenced by pat::PATObject< reco::Muon >::triggerObjectMatchByFilter().

573  {
574  std::vector< size_t > refs;
575  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
576  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasFilterLabel( labelFilter ) ) refs.push_back( i );
577  }
578  if ( idx >= refs.size() ) return 0;
580  return ref.isNonnull() ? ref.get() : 0;
581  }
int i
Definition: DBlmapReader.cc:9
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:397
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:475
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:70
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByFilter ( const char *  labelFilter,
const size_t  idx = 0 
) const
inline

Definition at line 157 of file PATObject.h.

157  {
158  return triggerObjectMatchByFilter( std::string( labelFilter ), idx );
159  };
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:573
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByFilterID ( const unsigned  triggerObjectType,
const size_t  idx = 0 
) const
inline

Definition at line 89 of file PATObject.h.

89  {
90  return triggerObjectMatchByType( trigger::TriggerObjectType( triggerObjectType ), idx );
91  };
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:491
template<class ObjectType >
const TriggerObjectStandAlone * pat::PATObject< ObjectType >::triggerObjectMatchByPath ( const std::string &  namePath,
const bool  pathLastFilterAccepted = 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 finalfilter of succeeding path are considered ("firing" objects)

Definition at line 593 of file PATObject.h.

References i, and edm::Ref< C, T, F >::isNonnull().

Referenced by pat::PATObject< reco::Muon >::triggerObjectMatchByPath().

593  {
594  std::vector< size_t > refs;
595  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
596  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasPathName( namePath, pathLastFilterAccepted ) ) refs.push_back( i );
597  }
598  if ( idx >= refs.size() ) return 0;
600  return ref.isNonnull() ? ref.get() : 0;
601  }
int i
Definition: DBlmapReader.cc:9
bool hasPathName(const std::string &pathName, bool pathLastFilterAccepted=true) const
Checks, if a certain HLT path name is assigned.
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:397
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:475
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:70
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByPath ( const char *  namePath,
const bool  pathLastFilterAccepted = true,
const size_t  idx = 0 
) const
inline

Definition at line 181 of file PATObject.h.

181  {
182  return triggerObjectMatchByPath( std::string( namePath ), pathLastFilterAccepted, idx );
183  };
const TriggerObjectStandAlone * triggerObjectMatchByPath(const std::string &namePath, const bool pathLastFilterAccepted=true, const size_t idx=0) const
Definition: PATObject.h:593
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByPath ( const std::string &  namePath,
const unsigned  pathLastFilterAccepted,
const size_t  idx = 0 
) const
inline

Definition at line 185 of file PATObject.h.

185  {
186  return triggerObjectMatchByPath( namePath, bool( pathLastFilterAccepted ), idx );
187  };
const TriggerObjectStandAlone * triggerObjectMatchByPath(const std::string &namePath, const bool pathLastFilterAccepted=true, const size_t idx=0) const
Definition: PATObject.h:593
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByPath ( const char *  namePath,
const unsigned  pathLastFilterAccepted,
const size_t  idx = 0 
) const
inline

Definition at line 189 of file PATObject.h.

189  {
190  return triggerObjectMatchByPath( std::string( namePath ), bool( pathLastFilterAccepted ), idx );
191  };
const TriggerObjectStandAlone * triggerObjectMatchByPath(const std::string &namePath, const bool pathLastFilterAccepted=true, const size_t idx=0) const
Definition: PATObject.h:593
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 491 of file PATObject.h.

References i, and edm::Ref< C, T, F >::isNonnull().

Referenced by pat::PATObject< reco::Muon >::triggerObjectMatchByFilterID(), and pat::PATObject< reco::Muon >::triggerObjectMatchByType().

491  {
492  std::vector< size_t > refs;
493  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
494  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasTriggerObjectType( triggerObjectType ) ) refs.push_back( i );
495  }
496  if ( idx >= refs.size() ) return 0;
498  return ref.isNonnull() ? ref.get() : 0;
499  }
int i
Definition: DBlmapReader.cc:9
bool hasTriggerObjectType(trigger::TriggerObjectType triggerObjectType) const
Checks, if a certain trigger object type identifier is assigned.
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:397
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:475
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:70
edm::Ref< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRef
Persistent reference to an item in a TriggerObjectStandAloneCollection.
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByType ( const unsigned  triggerObjectType,
const size_t  idx = 0 
) const
inline

Definition at line 85 of file PATObject.h.

85  {
86  return triggerObjectMatchByType( trigger::TriggerObjectType( triggerObjectType ), idx );
87  };
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:491
template<class ObjectType>
const TriggerObjectStandAloneCollection& pat::PATObject< ObjectType >::triggerObjectMatches ( ) const
inline

get all matched trigger objects

access to embedded trigger matches: duplicated functions using 'char*' instead of 'std::string' are needed in order to work properly in CINT command lines; duplicated functions using 'unsigned' instead of 'bool' are needed in order to work properly in the cut string parser;

Definition at line 70 of file PATObject.h.

TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:397
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 544 of file PATObject.h.

References i.

Referenced by pat::PATObject< reco::Muon >::triggerObjectMatchesByAlgorithm().

544  {
546  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
547  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasAlgorithmName( nameAlgorithm, algoCondAccepted ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
548  }
549  return matches;
550  }
int i
Definition: DBlmapReader.cc:9
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:475
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:70
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByAlgorithm ( const char *  nameAlgorithm,
const bool  algoCondAccepted = true 
) const
inline

Definition at line 121 of file PATObject.h.

121  {
122  return triggerObjectMatchesByAlgorithm( std::string( nameAlgorithm ), algoCondAccepted );
123  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true) const
Definition: PATObject.h:544
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByAlgorithm ( const std::string &  nameAlgorithm,
const unsigned  algoCondAccepted 
) const
inline

Definition at line 125 of file PATObject.h.

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

Definition at line 129 of file PATObject.h.

129  {
130  return triggerObjectMatchesByAlgorithm( std::string( nameAlgorithm ), bool( algoCondAccepted ) );
131  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true) const
Definition: PATObject.h:544
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 502 of file PATObject.h.

References i.

Referenced by pat::PATObject< reco::Muon >::triggerObjectMatchesByCollection().

502  {
504  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
505  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasCollection( coll ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
506  }
507  return matches;
508  }
int i
Definition: DBlmapReader.cc:9
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned (method overrides)
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:475
JetCorrectorParametersCollection coll
Definition: classes.h:14
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:70
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByCollection ( const char *  coll) const
inline

Definition at line 95 of file PATObject.h.

95  {
96  return triggerObjectMatchesByCollection( std::string( coll ) );
97  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByCollection(const std::string &coll) const
get all matched trigger objects from a certain collection
Definition: PATObject.h:502
JetCorrectorParametersCollection coll
Definition: classes.h:14
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 524 of file PATObject.h.

References i.

Referenced by pat::PATObject< reco::Muon >::triggerObjectMatchesByCondition().

524  {
526  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
527  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasConditionName( nameCondition ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
528  }
529  return matches;
530  }
int i
Definition: DBlmapReader.cc:9
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:475
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:70
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByCondition ( const char *  nameCondition) const
inline

Definition at line 107 of file PATObject.h.

107  {
108  return triggerObjectMatchesByCondition( std::string( nameCondition ) );
109  };
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:524
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 564 of file PATObject.h.

References i.

Referenced by pat::PATObject< reco::Muon >::triggerObjectMatchesByFilter().

564  {
566  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
567  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasFilterLabel( labelFilter ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
568  }
569  return matches;
570  }
int i
Definition: DBlmapReader.cc:9
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:475
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:70
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByFilter ( const char *  labelFilter) const
inline

Definition at line 151 of file PATObject.h.

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

Definition at line 80 of file PATObject.h.

80  {
81  return triggerObjectMatchesByType( trigger::TriggerObjectType( triggerObjectType ) );
82  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByType(const trigger::TriggerObjectType triggerObjectType) const
Definition: PATObject.h:482
template<class ObjectType >
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByPath ( const std::string &  namePath,
const bool  pathLastFilterAccepted = 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 finalfilter of succeeding path are considered ("firing" objects)

Definition at line 584 of file PATObject.h.

References i.

Referenced by testAnalyzer::analyze(), ZMuMu_efficiencyAnalyzer::analyze(), ZMuMu_vtxAnalyzer::analyze(), ZMuMu_MCanalyzer::analyze(), ZMuMu_Radiative_analyzer::analyze(), modules::ZHLTMatchFilter::operator()(), ZMuMuMuonUserData::produce(), ZToLLEdmNtupleDumper::produce(), and pat::PATObject< reco::Muon >::triggerObjectMatchesByPath().

584  {
586  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
587  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasPathName( namePath, pathLastFilterAccepted ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
588  }
589  return matches;
590  }
int i
Definition: DBlmapReader.cc:9
bool hasPathName(const std::string &pathName, bool pathLastFilterAccepted=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:475
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:70
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByPath ( const char *  namePath,
const bool  pathLastFilterAccepted = true 
) const
inline

Definition at line 165 of file PATObject.h.

165  {
166  return triggerObjectMatchesByPath( std::string( namePath ), pathLastFilterAccepted );
167  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=true) const
Definition: PATObject.h:584
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByPath ( const std::string &  namePath,
const unsigned  pathLastFilterAccepted 
) const
inline

Definition at line 169 of file PATObject.h.

169  {
170  return triggerObjectMatchesByPath( namePath, bool( pathLastFilterAccepted ) );
171  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=true) const
Definition: PATObject.h:584
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByPath ( const char *  namePath,
const unsigned  pathLastFilterAccepted 
) const
inline

Definition at line 173 of file PATObject.h.

173  {
174  return triggerObjectMatchesByPath( std::string( namePath ), bool( pathLastFilterAccepted ) );
175  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=true) const
Definition: PATObject.h:584
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 482 of file PATObject.h.

References i.

Referenced by pat::PATObject< reco::Muon >::triggerObjectMatchesByFilterID(), and pat::PATObject< reco::Muon >::triggerObjectMatchesByType().

482  {
484  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
485  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasTriggerObjectType( triggerObjectType ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
486  }
487  return matches;
488  }
int i
Definition: DBlmapReader.cc:9
bool hasTriggerObjectType(trigger::TriggerObjectType triggerObjectType) const
Checks, if a certain trigger object type identifier 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:475
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:70
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByType ( const unsigned  triggerObjectType) const
inline

Definition at line 76 of file PATObject.h.

76  {
77  return triggerObjectMatchesByType( trigger::TriggerObjectType( triggerObjectType ) );
78  };
const TriggerObjectStandAloneCollection triggerObjectMatchesByType(const trigger::TriggerObjectType triggerObjectType) const
Definition: PATObject.h:482
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 780 of file PATObject.h.

References spr::find(), and combine::key.

781  {
782  std::vector<std::string>::const_iterator it = std::find(userCandLabels_.begin(), userCandLabels_.end(), key);
783  if (it != userCandLabels_.end()) {
784  return userCands_[it - userCandLabels_.begin()];
785  }
786  return reco::CandidatePtr();
787  }
std::vector< reco::CandidatePtr > userCands_
Definition: PATObject.h:425
std::vector< std::string > userCandLabels_
Definition: PATObject.h:424
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
list key
Definition: combine.py:13
template<class ObjectType>
const std::vector<std::string>& pat::PATObject< ObjectType >::userCandNames ( ) const
inline

Get list of user-defined cand names.

Definition at line 336 of file PATObject.h.

336 { return userCandLabels_; }
std::vector< std::string > userCandLabels_
Definition: PATObject.h:424
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 265 of file PATObject.h.

265  {
267  return (data != 0 ? data->template get<T>() : 0);
268 
269  }
const pat::UserData * userDataObject_(const std::string &key) const
Definition: PATObject.h:733
list key
Definition: combine.py:13
Base class for data that users can add to pat objects.
Definition: UserData.h:25
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 285 of file PATObject.h.

285  {
287  return (data != 0 ? data->bareData() : 0);
288  }
const pat::UserData * userDataObject_(const std::string &key) const
Definition: PATObject.h:733
list key
Definition: combine.py:13
Base class for data that users can add to pat objects.
Definition: UserData.h:25
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 281 of file PATObject.h.

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

Definition at line 733 of file PATObject.h.

References spr::find(), and combine::key.

Referenced by pat::PATObject< reco::Muon >::hasUserData(), pat::PATObject< reco::Muon >::userData(), pat::PATObject< reco::Muon >::userDataBare(), and pat::PATObject< reco::Muon >::userDataObjectType().

734  {
735  std::vector<std::string>::const_iterator it = std::find(userDataLabels_.begin(), userDataLabels_.end(), key);
736  if (it != userDataLabels_.end()) {
737  return & userDataObjects_[it - userDataLabels_.begin()];
738  }
739  return 0;
740  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< std::string > userDataLabels_
User data object.
Definition: PATObject.h:415
pat::UserDataCollection userDataObjects_
Definition: PATObject.h:416
list key
Definition: combine.py:13
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 275 of file PATObject.h.

275  {
276  static const std::string EMPTY("");
278  return (data != 0 ? data->typeName() : EMPTY);
279  };
const pat::UserData * userDataObject_(const std::string &key) const
Definition: PATObject.h:733
list key
Definition: combine.py:13
virtual const std::string & typeName() const =0
Human readable name of the concrete type of stored data.
Base class for data that users can add to pat objects.
Definition: UserData.h:25
template<class ObjectType >
float pat::PATObject< ObjectType >::userFloat ( const std::string &  key) const

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

Definition at line 743 of file PATObject.h.

References spr::find(), and combine::key.

Referenced by MuScleFitMuonSelector::selectMuons().

744  {
745  std::vector<std::string>::const_iterator it = std::find(userFloatLabels_.begin(), userFloatLabels_.end(), key);
746  if (it != userFloatLabels_.end()) {
747  return userFloats_[it - userFloatLabels_.begin()];
748  }
749  return 0.0;
750  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< float > userFloats_
Definition: PATObject.h:419
std::vector< std::string > userFloatLabels_
Definition: PATObject.h:418
list key
Definition: combine.py:13
template<class ObjectType>
const std::vector<std::string>& pat::PATObject< ObjectType >::userFloatNames ( ) const
inline

Get list of user-defined float names.

Definition at line 313 of file PATObject.h.

313 { return userFloatLabels_; }
std::vector< std::string > userFloatLabels_
Definition: PATObject.h:418
template<class ObjectType >
int pat::PATObject< ObjectType >::userInt ( const std::string &  key) const

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

Definition at line 762 of file PATObject.h.

References spr::find(), and combine::key.

763  {
764  std::vector<std::string>::const_iterator it = std::find(userIntLabels_.begin(), userIntLabels_.end(), key);
765  if (it != userIntLabels_.end()) {
766  return userInts_[it - userIntLabels_.begin()];
767  }
768  return 0;
769  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
list key
Definition: combine.py:13
std::vector< int32_t > userInts_
Definition: PATObject.h:422
std::vector< std::string > userIntLabels_
Definition: PATObject.h:421
template<class ObjectType>
const std::vector<std::string>& pat::PATObject< ObjectType >::userIntNames ( ) const
inline

Get list of user-defined int names.

Definition at line 324 of file PATObject.h.

324 { return userIntLabels_; }
std::vector< std::string > userIntLabels_
Definition: PATObject.h:421

Member Data Documentation

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

vector of the efficiencies (names)

Definition at line 402 of file PATObject.h.

Referenced by pat::PATObject< reco::Muon >::efficiencyNames().

template<class ObjectType>
std::vector<pat::LookupTableRecord> pat::PATObject< ObjectType >::efficiencyValues_
protected

vector of the efficiencies (values)

Definition at line 400 of file PATObject.h.

Referenced by pat::PATObject< reco::Muon >::efficiencyValues().

template<class ObjectType>
std::vector<reco::GenParticle> pat::PATObject< ObjectType >::genParticleEmbedded_
protected

vector to hold an embedded generator level particle

Definition at line 407 of file PATObject.h.

Referenced by pat::PATObject< reco::Muon >::genParticleRef(), and pat::PATObject< reco::Muon >::genParticlesSize().

template<class ObjectType>
std::vector<reco::GenParticleRef> pat::PATObject< ObjectType >::genParticleRef_
protected

Reference to a generator level particle.

Definition at line 405 of file PATObject.h.

Referenced by pat::PATObject< reco::Muon >::genParticleRef(), and pat::PATObject< reco::Muon >::genParticlesSize().

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 431 of file PATObject.h.

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

Kinematic resolutions.

Definition at line 428 of file PATObject.h.

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

Overlapping items (sorted by distance)

Definition at line 412 of file PATObject.h.

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

Overlapping test labels (only if there are any overlaps)

Definition at line 410 of file PATObject.h.

Referenced by pat::PATObject< reco::Muon >::overlapLabels().

template<class ObjectType>
edm::Ptr<reco::Candidate> pat::PATObject< ObjectType >::refToOrig_
protected

Definition at line 394 of file PATObject.h.

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

Definition at line 425 of file PATObject.h.

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

Definition at line 419 of file PATObject.h.

template<class ObjectType>
std::vector<std::string> pat::PATObject< ObjectType >::userIntLabels_
protected
template<class ObjectType>
std::vector<int32_t> pat::PATObject< ObjectType >::userInts_
protected

Definition at line 422 of file PATObject.h.