CMS 3D CMS Logo

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>

List of all members.

Public Types

typedef ObjectType base_type

Public Member Functions

void addGenParticleRef (const reco::GenParticleRef &ref)
void addTriggerObjectMatch (const TriggerObjectStandAlone &trigObj)
 add a trigger match
void addUserCand (const std::string &label, const reco::CandidatePtr &data)
 Set user-defined int.
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.
void addUserInt (const std::string &label, int32_t data)
 Set user-defined int.
std::vector< std::pair
< std::string,
pat::LookupTableRecord > > 
efficiencies () const
 Returns the efficiencies as <name,value> pairs (by value)
const pat::LookupTableRecordefficiency (const std::string &name) const
 Returns an efficiency given its name.
const std::vector< std::string > & efficiencyNames () const
 Returns the list of the names of the stored efficiencies.
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())
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.
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)
bool hasOverlaps (const std::string &label) const
 Returns true if there was at least one overlap for this test label.
bool hasUserCand (const std::string &key) const
 Return true if there is a user-defined int with a given name.
bool hasUserData (const std::string &key) const
 Check if user data with a specific type is present.
bool hasUserFloat (const std::string &key) const
 Return true if there is a user-defined float with a given name.
bool hasUserFloat (const char *key) const
 a CINT-friendly interface
bool hasUserInt (const std::string &key) const
 Return true if there is a user-defined int with a given name.
const reco::CandidateoriginalObject () const
 access to the original object; returns zero for null Ref and throws for unavailable collection
const edm::Ptr< reco::Candidate > & originalObjectRef () const
 reference to original object. Returns a null reference if not available
const std::vector< std::string > & overlapLabels () const
 Returns the labels of the overlap tests that found at least one overlap.
const reco::CandidatePtrVectoroverlaps (const std::string &label) const
 PATObject (const edm::Ptr< ObjectType > &ref)
 constructor from reference
 PATObject (const ObjectType &obj)
 constructor from a base object (leaves invalid reference to original object!)
 PATObject (const edm::RefToBase< ObjectType > &ref)
 constructor from reference
 PATObject ()
 default constructor
double resolE (const std::string &label="") const
 Resolution on energy, possibly with a label to specify which resolution to use.
double resolEt (const std::string &label="") const
 Resolution on et, possibly with a label to specify which resolution to use.
double resolEta (const std::string &label="") const
 Resolution on eta, possibly with a label to specify which resolution to use.
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.
double resolPhi (const std::string &label="") const
 Resolution on phi, possibly with a label to specify which resolution to use.
double resolPInv (const std::string &label="") const
 Resolution on 1/p, possibly with a label to specify which resolution to use.
double resolPt (const std::string &label="") const
 Resolution on pt, possibly with a label to specify which resolution to use.
double resolPx (const std::string &label="") const
 Resolution on px, possibly with a label to specify which resolution to use.
double resolPy (const std::string &label="") const
 Resolution on py, possibly with a label to specify which resolution to use.
double resolPz (const std::string &label="") const
 Resolution on pz, possibly with a label to specify which resolution to use.
double resolTheta (const std::string &label="") const
 Resolution on theta, possibly with a label to specify which resolution to use.
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)
void setGenParticleRef (const reco::GenParticleRef &ref, bool embed=false)
 Set the generator level particle reference.
void setKinResolution (const pat::CandKinResolution &resol, const std::string &label="")
 Add a kinematic resolution to this object (possibly with a label)
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
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
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
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
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 char *namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true, const size_t idx=0) const
const TriggerObjectStandAlonetriggerObjectMatchByPath (const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true, const size_t idx=0) const
const TriggerObjectStandAlonetriggerObjectMatchByPath (const char *namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1, const size_t idx=0) const
const TriggerObjectStandAlonetriggerObjectMatchByPath (const std::string &namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1, const size_t idx=0) const
const TriggerObjectStandAlonetriggerObjectMatchByType (const trigger::TriggerObjectType triggerObjectType, const size_t idx=0) const
 get one matched trigger object of a certain type by index
const TriggerObjectStandAlonetriggerObjectMatchByType (const unsigned triggerObjectType, const size_t idx=0) const
const
TriggerObjectStandAloneCollection
triggerObjectMatches () const
 get all matched trigger objects
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByAlgorithm (const std::string &nameAlgorithm, const bool algoCondAccepted=true) const
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByAlgorithm (const char *nameAlgorithm, const unsigned algoCondAccepted) 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 
triggerObjectMatchesByCollection (const std::string &coll) const
 get all matched trigger objects from a certain collection
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByCollection (const char *coll) const
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByCondition (const char *nameCondition) 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
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByFilter (const std::string &labelFilter) const
 get all matched HLT objects used in a certain HLT filter
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByFilter (const char *labelFilter) const
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByFilterID (const unsigned triggerObjectType) const
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByPath (const char *namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByPath (const std::string &namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1) const
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByPath (const char *namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1) const
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByPath (const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByType (const unsigned triggerObjectType) const
const
TriggerObjectStandAloneCollection 
triggerObjectMatchesByType (const trigger::TriggerObjectType triggerObjectType) const
reco::CandidatePtr userCand (const std::string &key) const
const std::vector< std::string > & userCandNames () const
 Get list of user-defined cand names.
template<typename T >
const TuserData (const std::string &key) const
 Returns user-defined data. Returns NULL if the data is not present, or not of type T.
const void * userDataBare (const std::string &key) const
const std::vector< std::string > & userDataNames () const
 Get list of user data object names.
const std::string & userDataObjectType (const std::string &key) const
 Get human-readable type of user data object, for debugging.
float userFloat (const char *key) const
 a CINT-friendly interface
float userFloat (const std::string &key) const
const std::vector< std::string > & userFloatNames () const
 Get list of user-defined float names.
int32_t userInt (const std::string &key) const
const std::vector< std::string > & userIntNames () const
 Get list of user-defined int names.
virtual ~PATObject ()
 destructor

Protected Attributes

std::vector< std::string > efficiencyNames_
 vector of the efficiencies (names)
std::vector
< pat::LookupTableRecord
efficiencyValues_
 vector of the efficiencies (values)
std::vector< reco::GenParticlegenParticleEmbedded_
 vector to hold an embedded generator level particle
std::vector< reco::GenParticleRefgenParticleRef_
 Reference to a generator level particle.
std::vector< std::string > kinResolutionLabels_
std::vector
< pat::CandKinResolution
kinResolutions_
 Kinematic resolutions.
std::vector
< reco::CandidatePtrVector
overlapItems_
 Overlapping items (sorted by distance)
std::vector< std::string > overlapLabels_
 Overlapping test labels (only if there are any overlaps)
edm::Ptr< reco::CandidaterefToOrig_
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
 vector of trigger matches
std::vector< std::string > userCandLabels_
std::vector< reco::CandidatePtruserCands_
std::vector< std::string > userDataLabels_
 User data object.
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.38 2012/01/20 08:51:05 cbern Exp

Definition at line 43 of file PATObject.h.


Member Typedef Documentation

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

Definition at line 46 of file PATObject.h.


Constructor & Destructor Documentation

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

default constructor

Definition at line 449 of file PATObject.h.

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

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

Definition at line 452 of file PATObject.h.

template<class ObjectType>
pat::PATObject< ObjectType >::PATObject ( const edm::RefToBase< ObjectType > &  ref)

constructor from reference

Definition at line 457 of file PATObject.h.

                                                                                                   :
    ObjectType(*ref),
    refToOrig_(ref.id(), ref.get(), ref.key()) // correct way to convert RefToBase=>Ptr, if ref is guaranteed to be available
                                               // which happens to be true, otherwise the line before this throws ex. already
      {
      }
template<class ObjectType>
pat::PATObject< ObjectType >::PATObject ( const edm::Ptr< ObjectType > &  ref)

constructor from reference

Definition at line 464 of file PATObject.h.

                                                                                             :
    ObjectType(*ref),
    refToOrig_(ref) {
  }
template<class ObjectType>
virtual pat::PATObject< ObjectType >::~PATObject ( ) [inline, virtual]

destructor

Definition at line 57 of file PATObject.h.

{}

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 659 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::PATTauProducer::produce(), pat::PATGenericParticleProducer::produce(), and pat::PATPFParticleProducer::produce().

                                                                             {
      if (!genParticleEmbedded_.empty()) { // we're embedding
          if (ref.isNonnull()) genParticleEmbedded_.push_back(*ref);
      } else {
          genParticleRef_.push_back(ref);
      }
  }
template<class ObjectType>
void pat::PATObject< ObjectType >::addTriggerObjectMatch ( const TriggerObjectStandAlone trigObj) [inline]

add a trigger match

Definition at line 198 of file PATObject.h.

{ triggerObjectMatchesEmbedded_.push_back( trigObj ); };
template<class ObjectType >
void pat::PATObject< ObjectType >::addUserCand ( const std::string &  label,
const reco::CandidatePtr data 
)

Set user-defined int.

Definition at line 800 of file PATObject.h.

  {
    userCandLabels_.push_back(label);
    userCands_.push_back( data );
  }
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 300 of file PATObject.h.

                                                                                            {
          userDataLabels_.push_back(label);
          userDataObjects_.push_back(pat::UserData::make<T>(data, transientOnly));
      }
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 307 of file PATObject.h.

                                                                                           {
          userDataLabels_.push_back(label);
          userDataObjects_.push_back(data->clone());
      }
template<class ObjectType >
void pat::PATObject< ObjectType >::addUserFloat ( const std::string &  label,
float  data 
)
template<class ObjectType>
void pat::PATObject< ObjectType >::addUserInt ( const std::string &  label,
int32_t  data 
)

Set user-defined int.

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

References runTheMatrix::ret.

                                            {
    std::vector<std::pair<std::string,pat::LookupTableRecord> > ret;
    std::vector<std::string>::const_iterator itn = efficiencyNames_.begin(), edn = efficiencyNames_.end();
    std::vector<pat::LookupTableRecord>::const_iterator itv = efficiencyValues_.begin();
    for ( ; itn != edn; ++itn, ++itv) {
        ret.push_back( std::pair<std::string,pat::LookupTableRecord>(*itn, *itv) );
    }
    return ret;
  }
template<class ObjectType >
const pat::LookupTableRecord & pat::PATObject< ObjectType >::efficiency ( const std::string &  name) const

Returns an efficiency given its name.

Definition at line 615 of file PATObject.h.

References Exception, and mergeVDriftHistosByStation::name.

                                                               {
    // find the name in the (sorted) list of names
    std::vector<std::string>::const_iterator it = std::lower_bound(efficiencyNames_.begin(), efficiencyNames_.end(), name);
    if ((it == efficiencyNames_.end()) || (*it != name)) {
        throw cms::Exception("Invalid Label") << "There is no efficiency with name '" << name << "' in this PAT Object\n";
    }
    return efficiencyValues_[it - efficiencyNames_.begin()];
  }
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 205 of file PATObject.h.

{ return efficiencyNames_; }
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 207 of file PATObject.h.

{ return efficiencyValues_; }
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 675 of file PATObject.h.

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

                                               {
      genParticleEmbedded_.clear();
      for (std::vector<reco::GenParticleRef>::const_iterator it = genParticleRef_.begin(); it != genParticleRef_.end(); ++it) {
          if (it->isNonnull()) genParticleEmbedded_.push_back(**it);
      }
      genParticleRef_.clear();
  }
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 234 of file PATObject.h.

Referenced by ZMuMu_Radiative_analyzer::analyze(), and gamma_radiative_analyzer::analyze().

                                                                 {
            reco::GenParticleRef ref = genParticleRef(idx);
            return ref.isNonnull() ? ref.get() : 0;
      }
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 694 of file PATObject.h.

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

                                                                                                           {
        // get a vector, avoiding an unneeded copy if there is no embedding
        const std::vector<reco::GenParticleRef> & vec = (genParticleEmbedded_.empty() ? genParticleRef_ : genParticleRefs());
        for (std::vector<reco::GenParticleRef>::const_iterator ref = vec.begin(), end = vec.end(); ref != end; ++ref) {
            if (ref->isNonnull()) {
                const reco::GenParticle & g = **ref;
                if ((status != 0) && (g.status() != status)) continue;
                if (pdgId == 0) {
                    return *ref;
                } else if (!autoCharge) {
                    if (pdgId == g.pdgId()) return *ref;
                } else if (abs(pdgId) == abs(g.pdgId())) {
                    // I want pdgId > 0 to match "correct charge" (for charged particles)
                    if (g.charge() == 0) return *ref;
                    else if ((this->charge() == 0) && (pdgId == g.pdgId())) return *ref;
                    else if (g.charge()*this->charge()*pdgId > 0) return *ref;
                }
            }
        }
        return reco::GenParticleRef();
  }
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 215 of file PATObject.h.

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

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

References i, n, and runTheMatrix::ret.

Referenced by getGenTau().

                                                                             {
        if (genParticleEmbedded_.empty()) return genParticleRef_;
        std::vector<reco::GenParticleRef> ret(genParticleEmbedded_.size());
        for (size_t i = 0, n = ret.size(); i < n; ++i) {
            ret[i] = reco::GenParticleRef(&genParticleEmbedded_, i);
        }
        return ret;
  }
template<class ObjectType>
size_t pat::PATObject< ObjectType >::genParticlesSize ( ) const [inline]

Number of generator level particles stored as ref or embedded.

Definition at line 239 of file PATObject.h.

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

                                      {
            return genParticleEmbedded_.empty() ? genParticleRef_.size() : genParticleEmbedded_.size();
      }
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 809 of file PATObject.h.

References 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().

                                                                                                   {
    if (label.empty()) {
        if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
            return kinResolutions_[0];
        } else {
            throw cms::Exception("Missing Data", "This object does not contain an un-labelled kinematic resolution");
        }
    } else {
        std::vector<std::string>::const_iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
        if (match == kinResolutionLabels_.end()) {
            cms::Exception ex("Missing Data");
            ex << "This object does not contain a kinematic resolution with name '" << label << "'.\n";
            ex << "The known labels are: " ;
            for (std::vector<std::string>::const_iterator it = kinResolutionLabels_.begin(); it != kinResolutionLabels_.end(); ++it) {
                ex << "'" << *it << "' ";
            }
            ex << "\n";
            throw ex;
        } else {
            if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
                // skip un-labelled resolution
                return kinResolutions_[match - kinResolutionLabels_.begin() + 1];
            } else {
                // all are labelled, so this is the real index
                return kinResolutions_[match - kinResolutionLabels_.begin()];
            }
        }
    }
  }
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 840 of file PATObject.h.

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

                                                                           {
    if (label.empty()) {
        return (kinResolutionLabels_.size()+1 == kinResolutions_.size());
    } else {
        std::vector<std::string>::const_iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
        return match != kinResolutionLabels_.end();
    }
  }
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 717 of file PATObject.h.

References spr::find(), and label.

                                                                      {
        return std::find(overlapLabels_.begin(), overlapLabels_.end(), label) != overlapLabels_.end();
  }
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 349 of file PATObject.h.

                                                      {
        return std::find(userCandLabels_.begin(), userCandLabels_.end(), key) != userCandLabels_.end();
      }
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 276 of file PATObject.h.

                                                   {
          return (userDataObject_(key) != 0);
      }
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 323 of file PATObject.h.

                                                       {
        return std::find(userFloatLabels_.begin(), userFloatLabels_.end(), key) != userFloatLabels_.end();
      }
template<class ObjectType>
bool pat::PATObject< ObjectType >::hasUserFloat ( const char *  key) const [inline]

a CINT-friendly interface

Definition at line 327 of file PATObject.h.

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

{return hasUserFloat( std::string(key) );}
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 337 of file PATObject.h.

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

                                                     {
        return std::find(userIntLabels_.begin(), userIntLabels_.end(), key) != userIntLabels_.end();
      }
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 469 of file PATObject.h.

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

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

                                                                                                {
    if (refToOrig_.isNull()) {
      // this object was not produced from a reference, so no link to the
      // original object exists -> return a 0-pointer
      return 0;
    } else if (!refToOrig_.isAvailable()) {
      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.";
    } else {
      return refToOrig_.get();
    }
  }
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 482 of file PATObject.h.

{ return refToOrig_; }
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 263 of file PATObject.h.

{ return overlapLabels_; }
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 722 of file PATObject.h.

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

                                                                                             {
        static const reco::CandidatePtrVector EMPTY;
        std::vector<std::string>::const_iterator match = std::find(overlapLabels_.begin(), overlapLabels_.end(), label);
        if (match == overlapLabels_.end()) return EMPTY;
        return overlapItems_[match - overlapLabels_.begin()];
  }
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 374 of file PATObject.h.

{ return getKinResolution(label).resolE(this->p4()); }
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 377 of file PATObject.h.

{ return getKinResolution(label).resolEt(this->p4()); }
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 365 of file PATObject.h.

{ return getKinResolution(label).resolEta(this->p4()); }
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 399 of file PATObject.h.

{ return getKinResolution(label).resolM(this->p4()); }
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 380 of file PATObject.h.

{ return getKinResolution(label).resolP(this->p4()); }
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 371 of file PATObject.h.

{ return getKinResolution(label).resolPhi(this->p4()); }
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 386 of file PATObject.h.

{ return getKinResolution(label).resolPInv(this->p4()); }
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 383 of file PATObject.h.

{ return getKinResolution(label).resolPt(this->p4()); }
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 389 of file PATObject.h.

{ return getKinResolution(label).resolPx(this->p4()); }
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 392 of file PATObject.h.

{ return getKinResolution(label).resolPy(this->p4()); }
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 395 of file PATObject.h.

{ return getKinResolution(label).resolPz(this->p4()); }
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 368 of file PATObject.h.

{ return getKinResolution(label).resolTheta(this->p4()); }
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 637 of file PATObject.h.

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

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

                                                                                                     {
    // look for the name, or to the place where we can insert it without violating the alphabetic order
    std::vector<std::string>::iterator it = std::lower_bound(efficiencyNames_.begin(), efficiencyNames_.end(), name);
    if (it == efficiencyNames_.end()) { // insert at the end
        efficiencyNames_.push_back(name);
        efficiencyValues_.push_back(value);
    } else if (*it == name) {           // replace existing
        efficiencyValues_[it - efficiencyNames_.begin()] = value;
    } else {                            // insert in the middle :-(
        efficiencyNames_. insert(it, name);
        efficiencyValues_.insert( efficiencyValues_.begin() + (it - efficiencyNames_.begin()), value );
    }
  }
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 668 of file PATObject.h.

                                                                              {
      genParticleEmbedded_.clear();
      genParticleEmbedded_.push_back(particle);
      genParticleRef_.clear();
  }
template<class ObjectType >
void pat::PATObject< ObjectType >::setGenParticleRef ( const reco::GenParticleRef ref,
bool  embed = false 
)

Set the generator level particle reference.

Definition at line 652 of file PATObject.h.

                                                                                         {
          genParticleRef_ = std::vector<reco::GenParticleRef>(1,ref);
          genParticleEmbedded_.clear();
          if (embed) embedGenParticle();
  }
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 850 of file PATObject.h.

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

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

                                                                                                        {
    if (label.empty()) {
        if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
            // There is already an un-labelled object. Replace it
            kinResolutions_[0] = resol;
        } else {
            // Insert. Note that the un-labelled is always the first, so we need to insert before begin()
            // (for an empty vector, this should not cost more than push_back)
            kinResolutions_.insert(kinResolutions_.begin(), resol);
        }
    } else {
        std::vector<std::string>::iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
        if (match != kinResolutionLabels_.end()) {
            // Existing object: replace
            if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
                kinResolutions_[(match - kinResolutionLabels_.begin())+1] = resol;
            } else {
                kinResolutions_[(match - kinResolutionLabels_.begin())] = resol;
            }
        } else {
            kinResolutionLabels_.push_back(label);
            kinResolutions_.push_back(resol);
        }
    }
  }
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 730 of file PATObject.h.

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

                                                                                                         {
        if (!overlaps.empty()) {
            std::vector<std::string>::const_iterator match = std::find(overlapLabels_.begin(), overlapLabels_.end(), label);
            if (match == overlapLabels_.end()) {
                overlapLabels_.push_back(label);
                overlapItems_.push_back(overlaps);
            } else {
                overlapItems_[match - overlapLabels_.begin()] = overlaps;
            }
        }
  }
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 485 of file PATObject.h.

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

                                                                                                    {
    if ( idx >= triggerObjectMatches().size() ) return 0;
    TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, idx );
    return ref.isNonnull() ? ref.get() : 0;
  }
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 563 of file PATObject.h.

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

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

                                                                                                                                                                             {
    std::vector< size_t > refs;
    for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
      if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasAlgorithmName( nameAlgorithm, algoCondAccepted ) ) refs.push_back( i );
    }
    if ( idx >= refs.size() ) return 0;
    TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
    return ref.isNonnull() ? ref.get() : 0;
  }
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 142 of file PATObject.h.

                                                                                                                                                                    {
        return triggerObjectMatchByAlgorithm( nameAlgorithm, bool( algoCondAccepted ), idx );
      };
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 138 of file PATObject.h.

                                                                                                                                                                  {
        return triggerObjectMatchByAlgorithm( std::string( nameAlgorithm ), algoCondAccepted, idx );
      };
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 146 of file PATObject.h.

                                                                                                                                                               {
        return triggerObjectMatchByAlgorithm( std::string( nameAlgorithm ), bool( algoCondAccepted ), idx );
      };
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 521 of file PATObject.h.

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

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

                                                                                                                                        {
    std::vector< size_t > refs;
    for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
      if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasCollection( coll ) ) {
        refs.push_back( i );
      }
    }
    if ( idx >= refs.size() ) return 0;
    TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
    return ref.isNonnull() ? ref.get() : 0;
  }
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByCollection ( const char *  coll,
const size_t  idx = 0 
) const [inline]

Definition at line 102 of file PATObject.h.

                                                                                                                      {
        return triggerObjectMatchByCollection( std::string( coll ), idx );
      };
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 543 of file PATObject.h.

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

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

                                                                                                                                                {
    std::vector< size_t > refs;
    for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
      if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasConditionName( nameCondition ) ) refs.push_back( i );
    }
    if ( idx >= refs.size() ) return 0;
    TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
    return ref.isNonnull() ? ref.get() : 0;
  }
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByCondition ( const char *  nameCondition,
const size_t  idx = 0 
) const [inline]

Definition at line 114 of file PATObject.h.

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

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

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

                                                                                                                                           {
    std::vector< size_t > refs;
    for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
      if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasFilterLabel( labelFilter ) ) refs.push_back( i );
    }
    if ( idx >= refs.size() ) return 0;
    TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
    return ref.isNonnull() ? ref.get() : 0;
  }
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByFilter ( const char *  labelFilter,
const size_t  idx = 0 
) const [inline]

Definition at line 158 of file PATObject.h.

                                                                                                                         {
        return triggerObjectMatchByFilter( std::string( labelFilter ), idx );
      };
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByFilterID ( const unsigned  triggerObjectType,
const size_t  idx = 0 
) const [inline]

Definition at line 90 of file PATObject.h.

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

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

Definition at line 603 of file PATObject.h.

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

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

                                                                                                                                                                                                          {
    std::vector< size_t > refs;
    for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
      if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasPathName( namePath, pathLastFilterAccepted, pathL3FilterAccepted ) ) refs.push_back( i );
    }
    if ( idx >= refs.size() ) return 0;
    TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
    return ref.isNonnull() ? ref.get() : 0;
  }
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByPath ( const std::string &  namePath,
const unsigned  pathLastFilterAccepted,
const unsigned  pathL3FilterAccepted = 1,
const size_t  idx = 0 
) const [inline]

Definition at line 190 of file PATObject.h.

                                                                                                                                                                                                         {
        return triggerObjectMatchByPath( namePath, bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ), idx );
      };
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByPath ( const char *  namePath,
const bool  pathLastFilterAccepted = false,
const bool  pathL3FilterAccepted = true,
const size_t  idx = 0 
) const [inline]

Definition at line 186 of file PATObject.h.

                                                                                                                                                                                                       {
        return triggerObjectMatchByPath( std::string( namePath ), pathLastFilterAccepted, pathL3FilterAccepted, idx );
      };
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByPath ( const char *  namePath,
const unsigned  pathLastFilterAccepted,
const unsigned  pathL3FilterAccepted = 1,
const size_t  idx = 0 
) const [inline]

Definition at line 194 of file PATObject.h.

                                                                                                                                                                                                    {
        return triggerObjectMatchByPath( std::string( namePath ), bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ), idx );
      };
template<class ObjectType>
const TriggerObjectStandAlone* pat::PATObject< ObjectType >::triggerObjectMatchByType ( const unsigned  triggerObjectType,
const size_t  idx = 0 
) const [inline]

Definition at line 86 of file PATObject.h.

                                                                                                                               {
        return triggerObjectMatchByType( trigger::TriggerObjectType( triggerObjectType ), idx );
      };
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 501 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().

                                                                                                                                                            {
    std::vector< size_t > refs;
    for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
      if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasTriggerObjectType( triggerObjectType ) ) refs.push_back( i );
    }
    if ( idx >= refs.size() ) return 0;
    TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
    return ref.isNonnull() ? ref.get() : 0;
  }
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 71 of file PATObject.h.

template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByAlgorithm ( const std::string &  nameAlgorithm,
const unsigned  algoCondAccepted 
) const [inline]

Definition at line 126 of file PATObject.h.

                                                                                                                                                        {
        return triggerObjectMatchesByAlgorithm( nameAlgorithm, bool( algoCondAccepted ) );
      };
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByAlgorithm ( const char *  nameAlgorithm,
const bool  algoCondAccepted = true 
) const [inline]

Definition at line 122 of file PATObject.h.

                                                                                                                                                      {
        return triggerObjectMatchesByAlgorithm( std::string( nameAlgorithm ), algoCondAccepted );
      };
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByAlgorithm ( const char *  nameAlgorithm,
const unsigned  algoCondAccepted 
) const [inline]

Definition at line 130 of file PATObject.h.

                                                                                                                                                   {
        return triggerObjectMatchesByAlgorithm( std::string( nameAlgorithm ), bool( algoCondAccepted ) );
      };
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 554 of file PATObject.h.

References i.

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

                                                                                                                                                                     {
    TriggerObjectStandAloneCollection matches;
    for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
      if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasAlgorithmName( nameAlgorithm, algoCondAccepted ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
    }
    return matches;
  }
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 512 of file PATObject.h.

References i.

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

                                                                                                                                {
    TriggerObjectStandAloneCollection matches;
    for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
      if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasCollection( coll ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
    }
    return matches;
  }
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByCollection ( const char *  coll) const [inline]

Definition at line 96 of file PATObject.h.

                                                                                                          {
        return triggerObjectMatchesByCollection( std::string( coll ) );
      };
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByCondition ( const char *  nameCondition) const [inline]

Definition at line 108 of file PATObject.h.

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

References i.

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

                                                                                                                                        {
    TriggerObjectStandAloneCollection matches;
    for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
      if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasConditionName( nameCondition ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
    }
    return matches;
  }
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByFilter ( const char *  labelFilter) const [inline]

Definition at line 152 of file PATObject.h.

                                                                                                             {
        return triggerObjectMatchesByFilter( std::string( labelFilter ) );
      };
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 574 of file PATObject.h.

References i.

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

                                                                                                                                   {
    TriggerObjectStandAloneCollection matches;
    for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
      if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasFilterLabel( labelFilter ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
    }
    return matches;
  }
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByFilterID ( const unsigned  triggerObjectType) const [inline]

Definition at line 81 of file PATObject.h.

                                                                                                                       {
        return triggerObjectMatchesByType( trigger::TriggerObjectType( triggerObjectType ) );
      };
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByPath ( const char *  namePath,
const unsigned  pathLastFilterAccepted,
const unsigned  pathL3FilterAccepted = 1 
) const [inline]

Definition at line 176 of file PATObject.h.

                                                                                                                                                                                        {
        return triggerObjectMatchesByPath( std::string( namePath ), bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ) );
      };
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByPath ( const std::string &  namePath,
const unsigned  pathLastFilterAccepted,
const unsigned  pathL3FilterAccepted = 1 
) const [inline]

Definition at line 172 of file PATObject.h.

                                                                                                                                                                                             {
        return triggerObjectMatchesByPath( namePath, bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ) );
      };
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByPath ( const char *  namePath,
const bool  pathLastFilterAccepted = false,
const bool  pathL3FilterAccepted = true 
) const [inline]

Definition at line 168 of file PATObject.h.

                                                                                                                                                                                           {
        return triggerObjectMatchesByPath( std::string( namePath ), pathLastFilterAccepted, pathL3FilterAccepted );
      };
template<class ObjectType >
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByPath ( const std::string &  namePath,
const bool  pathLastFilterAccepted = false,
const bool  pathL3FilterAccepted = true 
) const

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

Definition at line 594 of file PATObject.h.

References i.

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

                                                                                                                                                                                                  {
    TriggerObjectStandAloneCollection matches;
    for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
      if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasPathName( namePath, pathLastFilterAccepted, pathL3FilterAccepted ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
    }
    return matches;
  }
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 492 of file PATObject.h.

References i.

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

                                                                                                                                                    {
    TriggerObjectStandAloneCollection matches;
    for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
      if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasTriggerObjectType( triggerObjectType ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
    }
    return matches;
  }
template<class ObjectType>
const TriggerObjectStandAloneCollection pat::PATObject< ObjectType >::triggerObjectMatchesByType ( const unsigned  triggerObjectType) const [inline]

Definition at line 77 of file PATObject.h.

                                                                                                                   {
        return triggerObjectMatchesByType( trigger::TriggerObjectType( triggerObjectType ) );
      };
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 790 of file PATObject.h.

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

  {
    std::vector<std::string>::const_iterator it = std::find(userCandLabels_.begin(), userCandLabels_.end(), key);
    if (it != userCandLabels_.end()) {
        return userCands_[it - userCandLabels_.begin()];
    }
    return reco::CandidatePtr();
  }
template<class ObjectType>
const std::vector<std::string>& pat::PATObject< ObjectType >::userCandNames ( ) const [inline]

Get list of user-defined cand names.

Definition at line 347 of file PATObject.h.

{ return userCandLabels_; }
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 270 of file PATObject.h.

                                                                          {
          const pat::UserData * data = userDataObject_(key);
          return (data != 0 ? data->template get<T>() : 0);

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

                                                            {
          const pat::UserData * data = userDataObject_(key);
          return (data != 0 ? data->bareData() : 0);
      }
template<class ObjectType>
const std::vector<std::string>& pat::PATObject< ObjectType >::userDataNames ( ) const [inline]

Get list of user data object names.

Definition at line 286 of file PATObject.h.

{ return userDataLabels_; }
template<class ObjectType >
const pat::UserData * pat::PATObject< ObjectType >::userDataObject_ ( const std::string &  key) const [private]

Definition at line 743 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().

  {
    std::vector<std::string>::const_iterator it = std::find(userDataLabels_.begin(), userDataLabels_.end(), key);
    if (it != userDataLabels_.end()) {
        return & userDataObjects_[it - userDataLabels_.begin()];
    }
    return 0;
  }
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 280 of file PATObject.h.

                                                                       {
          static const std::string EMPTY("");
          const pat::UserData * data = userDataObject_(key);
          return (data != 0 ? data->typeName() : EMPTY);
      };
template<class ObjectType>
float pat::PATObject< ObjectType >::userFloat ( const char *  key) const [inline]

a CINT-friendly interface

Definition at line 316 of file PATObject.h.

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

{ return userFloat( std::string(key) ); }
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 753 of file PATObject.h.

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

Referenced by WenuPlots::analyze(), and MuScleFitMuonSelector::selectMuons().

  {
    std::vector<std::string>::const_iterator it = std::find(userFloatLabels_.begin(), userFloatLabels_.end(), key);
    if (it != userFloatLabels_.end()) {
        return userFloats_[it - userFloatLabels_.begin()];
    }
    return 0.0;
  }
template<class ObjectType>
const std::vector<std::string>& pat::PATObject< ObjectType >::userFloatNames ( ) const [inline]

Get list of user-defined float names.

Definition at line 321 of file PATObject.h.

{ return userFloatLabels_; }
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 772 of file PATObject.h.

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

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

  {
    std::vector<std::string>::const_iterator it = std::find(userIntLabels_.begin(), userIntLabels_.end(), key);
    if (it != userIntLabels_.end()) {
        return userInts_[it - userIntLabels_.begin()];
    }
    return 0;
  }
template<class ObjectType>
const std::vector<std::string>& pat::PATObject< ObjectType >::userIntNames ( ) const [inline]

Get list of user-defined int names.

Definition at line 335 of file PATObject.h.

{ return userIntLabels_; }

Member Data Documentation

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

vector of the efficiencies (names)

Definition at line 413 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 411 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 418 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 416 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 442 of file PATObject.h.

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

Kinematic resolutions.

Definition at line 439 of file PATObject.h.

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

Overlapping items (sorted by distance)

Definition at line 423 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 421 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 405 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 436 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 430 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 433 of file PATObject.h.