CMS 3D CMS Logo

Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

pat::GenericParticle Class Reference

Analysis-level Generic Particle class (e.g. for hadron or muon not fully reconstructed) More...

#include <DataFormats/PatCandidates/interface/GenericParticle.h>

Inheritance diagram for pat::GenericParticle:
pat::PATObject< reco::RecoCandidate > reco::RecoCandidate reco::LeafCandidate reco::Candidate

List of all members.

Public Member Functions

float caloIso () const
virtual CaloTowerRef caloTower () const
virtual GenericParticleclone () const
 required reimplementation of the Candidate's clone method
virtual reco::TrackRef combinedMuon () const
float ecalIso () const
const IsoDepositecalIsoDeposit () const
void ecalIsoDeposit (const IsoDeposit &dep)
void embedCaloTower ()
 embeds the calotower instead of keeping a reference to it
void embedCombined ()
 embeds the combined track instead of keeping a reference to it
void embedGsfTrack ()
 embeds the gsf track instead of keeping a reference to it
void embedStandalone ()
 embeds the stand-alone track instead of keeping a reference to it
void embedSuperCluster ()
 embeds the supercluster instead of keeping a reference to it
void embedTrack ()
 embeds the master track instead of keeping a reference to it
void embedTracks ()
 embeds the other tracks instead of keeping references
 GenericParticle (const edm::Ptr< reco::Candidate > &aGenericParticleRef)
 constructor from ref to Candidate
 GenericParticle (const reco::Candidate &aGenericParticle)
 constructor from Candidate
 GenericParticle ()
 default constructor
 GenericParticle (const edm::RefToBase< reco::Candidate > &aGenericParticleRef)
 constructor from ref to Candidate
virtual reco::GsfTrackRef gsfTrack () const
float hcalIso () const
const IsoDeposithcalIsoDeposit () const
void hcalIsoDeposit (const IsoDeposit &dep)
const IsoDepositisoDeposit (IsolationKeys key) const
 Returns the IsoDeposit associated with some key, or a null pointer if it is not available.
virtual size_t numberOfTracks () const
 number of multiple tracks (not including the master one)
virtual bool overlap (const Candidate &) const
float quality ()
 returns a user defined quality value, if set by the user to some meaningful value
virtual void setCaloTower (const CaloTowerRef &ref, bool embed=false)
 sets calotower reference (or even embed it into the object)
virtual void setCombinedMuon (const reco::TrackRef &ref, bool embed=false)
 sets combined muon track reference (or even embed it into the object)
void setEcalIso (float caloIso)
 Sets ecal isolation variable.
virtual void setGsfTrack (const reco::GsfTrackRef &ref, bool embed=false)
 sets gsf track reference (or even embed it into the object)
void setHcalIso (float caloIso)
 Sets hcal isolation variable.
void setIsoDeposit (IsolationKeys key, const IsoDeposit &dep)
 Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.
void setIsolation (IsolationKeys key, float value)
void setQuality (float quality)
 sets a user defined quality value
virtual void setStandAloneMuon (const reco::TrackRef &ref, bool embed=false)
 sets stand-alone muon track reference (or even embed it into the object)
virtual void setSuperCluster (const reco::SuperClusterRef &ref, bool embed=false)
 sets supercluster reference (or even embed it into the object)
virtual void setTrack (const reco::TrackRef &ref, bool embed=false)
 sets master track reference (or even embed it into the object)
void setTrackIso (float trackIso)
 Sets tracker isolation variable.
virtual void setTracks (const reco::TrackRefVector &refs, bool embed=false)
 sets multiple track references (or even embed the tracks into the object - whatch out for disk size issues!)
void setUserIso (float value, uint8_t index=0)
 Sets user isolation variable index.
void setVertexAssociation (const pat::VertexAssociation &assoc)
 Set a single vertex association.
void setVertexAssociations (const std::vector< pat::VertexAssociation > &assocs)
 Set multiple vertex associations.
virtual reco::TrackRef standAloneMuon () const
virtual reco::SuperClusterRef superCluster () const
virtual reco::TrackRef track () const
virtual reco::TrackRef track (size_t idx) const
float trackIso () const
const IsoDeposittrackIsoDeposit () const
void trackIsoDeposit (const IsoDeposit &dep)
const IsoDeposituserIsoDeposit (uint8_t index=0) const
void userIsoDeposit (const IsoDeposit &dep, uint8_t index=0)
float userIsolation (IsolationKeys key) const
float userIsolation (const std::string &key) const
const pat::VertexAssociationvertexAssociation (size_t index=0) const
 Vertex association (or associations, if any). Return null pointer if none has been set.
const std::vector
< pat::VertexAssociation > & 
vertexAssociations () const
 Vertex associations. Can be empty if it was not enabled in the config file.
virtual ~GenericParticle ()
 destructor

Protected Types

typedef std::vector< std::pair
< IsolationKeys,
pat::IsoDeposit > > 
IsoDepositPairs

Protected Member Functions

void fillInFrom (const reco::Candidate &cand)

Protected Attributes

CaloTowerCollection caloTower_
CaloTowerRef caloTowerRef_
reco::TrackCollection combinedTrack_
reco::TrackRef combinedTrackRef_
reco::GsfTrackCollection gsfTrack_
reco::GsfTrackRef gsfTrackRef_
IsoDepositPairs isoDeposits_
std::vector< float > isolations_
float quality_
reco::TrackCollection standaloneTrack_
reco::TrackRef standaloneTrackRef_
reco::SuperClusterCollection superCluster_
reco::SuperClusterRef superClusterRef_
reco::TrackCollection track_
reco::TrackRef trackRef_
reco::TrackRefVector trackRefs_
reco::TrackCollection tracks_
std::vector
< pat::VertexAssociation
vtxAss_

Detailed Description

Analysis-level Generic Particle class (e.g. for hadron or muon not fully reconstructed)

GenericParticle implements the analysis-level generic particle class within the 'pat' namespace.

Author:
Giovanni Petrucciani
Version:
Id:
GenericParticle.h,v 1.9 2010/03/02 21:02:46 rwolf Exp

Definition at line 42 of file GenericParticle.h.


Member Typedef Documentation

typedef std::vector<std::pair<IsolationKeys, pat::IsoDeposit> > pat::GenericParticle::IsoDepositPairs [protected]

Definition at line 283 of file GenericParticle.h.


Constructor & Destructor Documentation

GenericParticle::GenericParticle ( )

default constructor

Definition at line 12 of file GenericParticle.cc.

Referenced by clone().

                                 :
    PATObject<reco::RecoCandidate>()
{
}
pat::GenericParticle::GenericParticle ( const reco::Candidate aGenericParticle)

constructor from Candidate

pat::GenericParticle::GenericParticle ( const edm::RefToBase< reco::Candidate > &  aGenericParticleRef)

constructor from ref to Candidate

pat::GenericParticle::GenericParticle ( const edm::Ptr< reco::Candidate > &  aGenericParticleRef)

constructor from ref to Candidate

GenericParticle::~GenericParticle ( ) [virtual]

destructor

Definition at line 45 of file GenericParticle.cc.

                                  {
}

Member Function Documentation

float pat::GenericParticle::caloIso ( ) const [inline]

Return the sum of ecal and hcal isolation variable that were stored in this object when produced, or -1.0 if at least one is missing

Definition at line 198 of file GenericParticle.h.

References pat::CaloIso, and userIsolation().

Referenced by ZToMuMuIsolationSelector< Isolator >::ZToMuMuIsolationSelector().

virtual CaloTowerRef pat::GenericParticle::caloTower ( ) const [inline, virtual]

reference to a CaloTower (might be transient ref if CaloTower is embedded) returns null ref if there is no calotower

Reimplemented from reco::RecoCandidate.

Definition at line 91 of file GenericParticle.h.

References caloTower_, caloTowerRef_, and edm::SortedCollection< T, SORT >::empty().

Referenced by reco::CompositeRefCandidateT< GenParticleRefVector >::overlap().

virtual GenericParticle* pat::GenericParticle::clone ( void  ) const [inline, virtual]

required reimplementation of the Candidate's clone method

Reimplemented from reco::RecoCandidate.

Definition at line 58 of file GenericParticle.h.

References GenericParticle().

{ return new GenericParticle(*this); }
virtual reco::TrackRef pat::GenericParticle::combinedMuon ( ) const [inline, virtual]

reference to a combined muon Track (might be transient ref if SuperCluster is embedded) returns null ref if there is no combined muon track

Reimplemented from reco::RecoCandidate.

Definition at line 85 of file GenericParticle.h.

References combinedTrack_, and combinedTrackRef_.

Referenced by reco::CompositeRefCandidateT< GenParticleRefVector >::overlap().

float pat::GenericParticle::ecalIso ( ) const [inline]

Return the ecal isolation variable that was stored in this object when produced, or -1.0 if there is none

Definition at line 201 of file GenericParticle.h.

References pat::EcalIso, and userIsolation().

Referenced by ZToMuMuIsolationSelector< Isolator >::ZToMuMuIsolationSelector().

const IsoDeposit* pat::GenericParticle::ecalIsoDeposit ( ) const [inline]

Definition at line 239 of file GenericParticle.h.

References pat::EcalIso, and isoDeposit().

{ return isoDeposit(pat::EcalIso ); }
void pat::GenericParticle::ecalIsoDeposit ( const IsoDeposit dep) [inline]

Definition at line 245 of file GenericParticle.h.

References pat::EcalIso, and setIsoDeposit().

void GenericParticle::embedCaloTower ( )
void GenericParticle::embedCombined ( )

embeds the combined track instead of keeping a reference to it

Definition at line 119 of file GenericParticle.cc.

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

Referenced by pat::PATGenericParticleProducer::produce(), and setCombinedMuon().

                                    { 
    combinedTrack_.clear();
    if (combinedTrackRef_.isNonnull()) combinedTrack_.push_back(*combinedTrackRef_); // import
    combinedTrackRef_ = reco::TrackRef(); // clear, to save space (zeroes compress better)
}
void GenericParticle::embedGsfTrack ( )

embeds the gsf track instead of keeping a reference to it

Definition at line 125 of file GenericParticle.cc.

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

Referenced by pat::PATGenericParticleProducer::produce(), and setGsfTrack().

                                    { 
    gsfTrack_.clear();
    if (gsfTrackRef_.isNonnull()) gsfTrack_.push_back(*gsfTrackRef_); // import
    gsfTrackRef_ = reco::GsfTrackRef(); // clear, to save space (zeroes compress better)
}
void GenericParticle::embedStandalone ( )

embeds the stand-alone track instead of keeping a reference to it

Definition at line 113 of file GenericParticle.cc.

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

Referenced by pat::PATGenericParticleProducer::produce(), and setStandAloneMuon().

                                      { 
    standaloneTrack_.clear();
    if (standaloneTrackRef_.isNonnull()) standaloneTrack_.push_back(*standaloneTrackRef_); // import
    standaloneTrackRef_ = reco::TrackRef(); // clear, to save space (zeroes compress better)
}
void GenericParticle::embedSuperCluster ( )

embeds the supercluster instead of keeping a reference to it

Definition at line 132 of file GenericParticle.cc.

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

Referenced by pat::PATGenericParticleProducer::produce(), and setSuperCluster().

                                        { 
    superCluster_.clear();
    if (superClusterRef_.isNonnull()) superCluster_.push_back(*superClusterRef_); // import
    superClusterRef_ = reco::SuperClusterRef(); // clear, to save space (zeroes compress better)
}
void GenericParticle::embedTrack ( )

embeds the master track instead of keeping a reference to it

Definition at line 98 of file GenericParticle.cc.

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

Referenced by pat::PATGenericParticleProducer::produce(), and setTrack().

                                 { 
    track_.clear();
    if (trackRef_.isNonnull()) track_.push_back(*trackRef_); // import
    trackRef_ = reco::TrackRef(); // clear, to save space (zeroes compress better)
}
void GenericParticle::embedTracks ( )

embeds the other tracks instead of keeping references

Definition at line 104 of file GenericParticle.cc.

References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), edm::RefVector< C, T, F >::size(), trackRefs_, and tracks_.

Referenced by pat::PATGenericParticleProducer::produce(), and setTracks().

                                  { 
    tracks_.clear();
    tracks_.reserve(trackRefs_.size());
    for (reco::TrackRefVector::const_iterator it = trackRefs_.begin(); it != trackRefs_.end(); ++it) {
        if (it->isNonnull()) tracks_.push_back(**it); // embed track
    }
    trackRefs_ = reco::TrackRefVector(); // clear, to save space
}
void GenericParticle::fillInFrom ( const reco::Candidate cand) [protected]

Definition at line 145 of file GenericParticle.cc.

References reco::Candidate::charge(), i, reco::Candidate::pdgId(), reco::Candidate::polarP4(), edm::RefVector< C, T, F >::push_back(), setCaloTower(), reco::LeafCandidate::setCharge(), setCombinedMuon(), setGsfTrack(), reco::LeafCandidate::setP4(), reco::LeafCandidate::setPdgId(), setStandAloneMuon(), reco::LeafCandidate::setStatus(), setSuperCluster(), setTrack(), setTracks(), reco::LeafCandidate::setVertex(), reco::Candidate::status(), testEve_cfg::tracks, and reco::Candidate::vertex().

                                                          {
    // first, kinematics & status
    setCharge(cand.charge());
    setP4(cand.polarP4());
    setVertex(cand.vertex());
    setPdgId(cand.pdgId());
    setStatus(cand.status());
    // then RECO part, if available
    const reco::RecoCandidate *rc = dynamic_cast<const reco::RecoCandidate *>(&cand);
    if (rc != 0) {
        setTrack(rc->track());    
        setGsfTrack(rc->gsfTrack());    
        setStandAloneMuon(rc->standAloneMuon());    
        setCombinedMuon(rc->combinedMuon());
        setSuperCluster(rc->superCluster());    
        setCaloTower(rc->caloTower());    
        size_t ntracks = rc->numberOfTracks();
        if (ntracks > 0) {
            reco::TrackRefVector tracks;
            for (size_t i = 0; i < ntracks; ++i) {
                tracks.push_back(rc->track(i));
            }
            setTracks(tracks);
        }
    }
}
virtual reco::GsfTrackRef pat::GenericParticle::gsfTrack ( ) const [inline, virtual]

reference to a GsfTrack (might be transient ref if SuperCluster is embedded) returns null ref if there is no gsf track

Reimplemented from reco::RecoCandidate.

Definition at line 79 of file GenericParticle.h.

References gsfTrack_, and gsfTrackRef_.

Referenced by reco::CompositeRefCandidateT< GenParticleRefVector >::overlap().

{ return (gsfTrack_.empty() ? gsfTrackRef_ : reco::GsfTrackRef(&gsfTrack_, 0)); }
float pat::GenericParticle::hcalIso ( ) const [inline]

Return the hcal isolation variable that was stored in this object when produced, or -1.0 if there is none

Definition at line 204 of file GenericParticle.h.

References pat::HcalIso, and userIsolation().

Referenced by ZToMuMuIsolationSelector< Isolator >::ZToMuMuIsolationSelector().

const IsoDeposit* pat::GenericParticle::hcalIsoDeposit ( ) const [inline]

Definition at line 240 of file GenericParticle.h.

References pat::HcalIso, and isoDeposit().

{ return isoDeposit(pat::HcalIso ); }
void pat::GenericParticle::hcalIsoDeposit ( const IsoDeposit dep) [inline]

Definition at line 246 of file GenericParticle.h.

References pat::HcalIso, and setIsoDeposit().

const IsoDeposit* pat::GenericParticle::isoDeposit ( IsolationKeys  key) const [inline]

Returns the IsoDeposit associated with some key, or a null pointer if it is not available.

Definition at line 219 of file GenericParticle.h.

References isoDeposits_.

Referenced by ZMuMuIsolationAnalyzer::analyze(), ZMuMu_Radiative_analyzer::analyze(), ecalIsoDeposit(), hcalIsoDeposit(), trackIsoDeposit(), and userIsoDeposit().

                                                             {
          for (IsoDepositPairs::const_iterator it = isoDeposits_.begin(), ed = isoDeposits_.end(); 
                  it != ed; ++it) 
          {
              if (it->first == key) return & it->second;
          }
          return 0;
      } 
virtual size_t pat::GenericParticle::numberOfTracks ( ) const [inline, virtual]

number of multiple tracks (not including the master one)

Reimplemented from reco::RecoCandidate.

Definition at line 76 of file GenericParticle.h.

References edm::RefVector< C, T, F >::size(), trackRefs_, and tracks_.

Referenced by track().

{ return tracks_.empty() ? trackRefs_.size() : tracks_.size(); }
virtual bool pat::GenericParticle::overlap ( const Candidate &  ) const [virtual]

Checks for overlap with another candidate. It will return 'true' if the other candidate is a RecoCandidate, and if they reference to at least one same non null track, supercluster or calotower (except for the multiple tracks) NOTE: It won't work with embedded references

float pat::GenericParticle::quality ( ) [inline]

returns a user defined quality value, if set by the user to some meaningful value

Definition at line 124 of file GenericParticle.h.

References quality_.

Referenced by setQuality().

{ return quality_; }
void GenericParticle::setCaloTower ( const CaloTowerRef ref,
bool  embed = false 
) [virtual]

sets calotower reference (or even embed it into the object)

Definition at line 86 of file GenericParticle.cc.

References caloTower_, caloTowerRef_, embedCaloTower(), edm::SortedCollection< T, SORT >::empty(), and edm::SortedCollection< T, SORT >::swap().

Referenced by fillInFrom().

void GenericParticle::setCombinedMuon ( const reco::TrackRef ref,
bool  embed = false 
) [virtual]

sets combined muon track reference (or even embed it into the object)

Definition at line 68 of file GenericParticle.cc.

References combinedTrack_, combinedTrackRef_, and embedCombined().

Referenced by fillInFrom().

                                                                         {
    combinedTrackRef_ = ref;
    if (embed) embedCombined(); else combinedTrack_.clear();
}
void pat::GenericParticle::setEcalIso ( float  caloIso) [inline]

Sets ecal isolation variable.

Definition at line 210 of file GenericParticle.h.

References pat::EcalIso, and setIsolation().

void GenericParticle::setGsfTrack ( const reco::GsfTrackRef ref,
bool  embed = false 
) [virtual]

sets gsf track reference (or even embed it into the object)

Definition at line 74 of file GenericParticle.cc.

References embedGsfTrack(), gsfTrack_, and gsfTrackRef_.

Referenced by fillInFrom().

                                                                        {
    gsfTrackRef_ = ref;
    if (embed) embedGsfTrack(); else gsfTrack_.clear();
}
void pat::GenericParticle::setHcalIso ( float  caloIso) [inline]

Sets hcal isolation variable.

Definition at line 212 of file GenericParticle.h.

References pat::HcalIso, and setIsolation().

void pat::GenericParticle::setIsoDeposit ( IsolationKeys  key,
const IsoDeposit dep 
) [inline]

Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.

Definition at line 229 of file GenericParticle.h.

References isoDeposits_.

Referenced by ecalIsoDeposit(), hcalIsoDeposit(), pat::PATGenericParticleProducer::produce(), trackIsoDeposit(), and userIsoDeposit().

                                                                   {
          IsoDepositPairs::iterator it = isoDeposits_.begin(), ed = isoDeposits_.end();
          for (; it != ed; ++it) {
              if (it->first == key) { it->second = dep; return; }
          }
          isoDeposits_.push_back(std::make_pair(key,dep));
      } 
void pat::GenericParticle::setIsolation ( IsolationKeys  key,
float  value 
) [inline]

Sets the isolation variable for a specifc key. Note that you can't set isolation for a pseudo-key like CaloIso

Definition at line 178 of file GenericParticle.h.

References Exception, isolations_, combine::key, and relativeConstraints::value.

Referenced by ZMuMuTrackUserData::produce(), pat::PATGenericParticleProducer::produce(), setEcalIso(), setHcalIso(), setTrackIso(), and setUserIso().

                                                        {
          if (key >= 0) {
              if (size_t(key) >= isolations_.size()) isolations_.resize(key+1, -1.0);
              isolations_[key] = value;
          } else {
              throw cms::Exception("Illegal Argument") << 
                  "The key for which you're setting isolation does not correspond " <<
                  "to an individual isolation but to the sum of more independent isolations " <<
                  "(e.g. Calo = Ecal + Hcal), so you can't SET the value, just GET it.\n" <<
                  "Please set up each component independly.\n";
          }
      }
void pat::GenericParticle::setQuality ( float  quality) [inline]

sets a user defined quality value

Definition at line 126 of file GenericParticle.h.

References quality(), and quality_.

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

void GenericParticle::setStandAloneMuon ( const reco::TrackRef ref,
bool  embed = false 
) [virtual]

sets stand-alone muon track reference (or even embed it into the object)

Definition at line 62 of file GenericParticle.cc.

References embedStandalone(), standaloneTrack_, and standaloneTrackRef_.

Referenced by fillInFrom().

                                                                           {
    standaloneTrackRef_ = ref;
    if (embed) embedStandalone(); else standaloneTrack_.clear();
}
void GenericParticle::setSuperCluster ( const reco::SuperClusterRef ref,
bool  embed = false 
) [virtual]

sets supercluster reference (or even embed it into the object)

Definition at line 80 of file GenericParticle.cc.

References embedSuperCluster(), superCluster_, and superClusterRef_.

Referenced by fillInFrom().

                                                                                {
    superClusterRef_ = ref;
    if (embed) embedSuperCluster(); else superCluster_.clear();
}
void GenericParticle::setTrack ( const reco::TrackRef ref,
bool  embed = false 
) [virtual]

sets master track reference (or even embed it into the object)

Definition at line 50 of file GenericParticle.cc.

References embedTrack(), track_, and trackRef_.

Referenced by fillInFrom().

                                                                  {
    trackRef_ = ref;
    if (embed) embedTrack(); else track_.clear();
}
void pat::GenericParticle::setTrackIso ( float  trackIso) [inline]

Sets tracker isolation variable.

Definition at line 208 of file GenericParticle.h.

References setIsolation(), and pat::TrackIso.

void GenericParticle::setTracks ( const reco::TrackRefVector refs,
bool  embed = false 
) [virtual]

sets multiple track references (or even embed the tracks into the object - whatch out for disk size issues!)

Definition at line 56 of file GenericParticle.cc.

References embedTracks(), trackRefs_, and tracks_.

Referenced by fillInFrom().

                                                                          {
    trackRefs_ = refs;
    if (embed) embedTracks(); else tracks_.clear();
}
void pat::GenericParticle::setUserIso ( float  value,
uint8_t  index = 0 
) [inline]

Sets user isolation variable index.

Definition at line 214 of file GenericParticle.h.

References setIsolation(), and pat::UserBaseIso.

void pat::GenericParticle::setVertexAssociation ( const pat::VertexAssociation assoc) [inline]

Set a single vertex association.

Definition at line 254 of file GenericParticle.h.

References vtxAss_.

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

{ vtxAss_ = std::vector<pat::VertexAssociation>(1, assoc); }
void pat::GenericParticle::setVertexAssociations ( const std::vector< pat::VertexAssociation > &  assocs) [inline]

Set multiple vertex associations.

Definition at line 256 of file GenericParticle.h.

References vtxAss_.

{ vtxAss_ = assocs; }
virtual reco::TrackRef pat::GenericParticle::standAloneMuon ( ) const [inline, virtual]

reference to a stand-alone muon Track (might be transient ref if SuperCluster is embedded) returns null ref if there is no stand-alone muon track

Reimplemented from reco::RecoCandidate.

Definition at line 82 of file GenericParticle.h.

References standaloneTrack_, and standaloneTrackRef_.

Referenced by reco::CompositeRefCandidateT< GenParticleRefVector >::overlap().

virtual reco::SuperClusterRef pat::GenericParticle::superCluster ( ) const [inline, virtual]

reference to a SuperCluster (might be transient ref if SuperCluster is embedded) returns null ref if there is no supercluster

Reimplemented from reco::RecoCandidate.

Definition at line 88 of file GenericParticle.h.

References superCluster_, and superClusterRef_.

Referenced by reco::CompositeRefCandidateT< GenParticleRefVector >::overlap().

virtual reco::TrackRef pat::GenericParticle::track ( size_t  idx) const [inline, virtual]

reference to one of a set of multiple tracks (might be transient refs if Tracks are embedded) throws exception if idx >= numberOfTracks()

Reimplemented from reco::RecoCandidate.

Definition at line 71 of file GenericParticle.h.

References Exception, UserOptions_cff::idx, numberOfTracks(), trackRefs_, and tracks_.

                                                     {  
            if (idx >= numberOfTracks()) throw cms::Exception("Index out of bounds") << "Requested track " << idx << " out of " << numberOfTracks() << ".\n";
            return (tracks_.empty() ? trackRefs_[idx] : reco::TrackRef(&tracks_, idx) );
      }
virtual reco::TrackRef pat::GenericParticle::track ( void  ) const [inline, virtual]

reference to a master track (might be transient refs if Tracks are embedded) returns null ref if there is no master track

Reimplemented from reco::RecoCandidate.

Definition at line 68 of file GenericParticle.h.

References track_, and trackRef_.

Referenced by ZMuMu_vtxAnalyzer::analyze(), reco::CompositeRefCandidateT< GenParticleRefVector >::overlap(), ZMuMuTrackUserData::produce(), and ZToLLEdmNtupleDumper::produce().

{ return track_.empty() ? trackRef_ : reco::TrackRef(&track_, 0); }
float pat::GenericParticle::trackIso ( ) const [inline]

Return the tracker isolation variable that was stored in this object when produced, or -1.0 if there is none

Definition at line 194 of file GenericParticle.h.

References pat::TrackIso, and userIsolation().

Referenced by ZMuMu_efficiencyAnalyzer::analyze(), ZMuMu_vtxAnalyzer::analyze(), and ZToMuMuIsolationSelector< Isolator >::ZToMuMuIsolationSelector().

const IsoDeposit* pat::GenericParticle::trackIsoDeposit ( ) const [inline]

Definition at line 238 of file GenericParticle.h.

References isoDeposit(), and pat::TrackIso.

void pat::GenericParticle::trackIsoDeposit ( const IsoDeposit dep) [inline]

Definition at line 244 of file GenericParticle.h.

References setIsoDeposit(), and pat::TrackIso.

void pat::GenericParticle::userIsoDeposit ( const IsoDeposit dep,
uint8_t  index = 0 
) [inline]

Definition at line 247 of file GenericParticle.h.

References setIsoDeposit(), and pat::UserBaseIso.

const IsoDeposit* pat::GenericParticle::userIsoDeposit ( uint8_t  index = 0) const [inline]

Definition at line 241 of file GenericParticle.h.

References isoDeposit(), and pat::UserBaseIso.

float pat::GenericParticle::userIsolation ( const std::string &  key) const [inline]

Returns the isolation variable for string type function arguments (to be used with the cut-string parser); the possible values of the strings are the enums defined in DataFormats/PatCandidates/interface/Isolation.h

Definition at line 154 of file GenericParticle.h.

References pat::CaloIso, pat::EcalIso, pat::HcalIso, combine::key, pat::PfAllParticleIso, pat::PfChargedHadronIso, pat::PfGammaIso, pat::PfNeutralHadronIso, pat::TrackIso, pat::User1Iso, pat::User2Iso, pat::User3Iso, pat::User4Iso, pat::User5Iso, pat::UserBaseIso, and userIsolation().

                                                      {
        // remove leading namespace specifier
        std::string prunedKey = ( key.find("pat::") == 0 ) ? std::string(key, 5) : key;
        if ( prunedKey == "TrackIso" ) return userIsolation(pat::TrackIso);
        if ( prunedKey == "EcalIso" ) return userIsolation(pat::EcalIso);
        if ( prunedKey == "HcalIso" ) return userIsolation(pat::HcalIso);
        if ( prunedKey == "PfAllParticleIso" ) return userIsolation(pat::PfAllParticleIso);
        if ( prunedKey == "PfChargedHadronIso" ) return userIsolation(pat::PfChargedHadronIso);
        if ( prunedKey == "PfNeutralHadronIso" ) return userIsolation(pat::PfNeutralHadronIso);
        if ( prunedKey == "PfGammaIso" ) return userIsolation(pat::PfGammaIso);
        if ( prunedKey == "User1Iso" ) return userIsolation(pat::User1Iso);
        if ( prunedKey == "User2Iso" ) return userIsolation(pat::User2Iso);
        if ( prunedKey == "User3Iso" ) return userIsolation(pat::User3Iso);
        if ( prunedKey == "User4Iso" ) return userIsolation(pat::User4Iso);
        if ( prunedKey == "User5Iso" ) return userIsolation(pat::User5Iso);
        if ( prunedKey == "UserBaseIso" ) return userIsolation(pat::UserBaseIso);
        if ( prunedKey == "CaloIso" ) return userIsolation(pat::CaloIso);
        //throw cms::Excepton("Missing Data")
        //<< "Isolation corresponding to key " 
        //<< key << " was not stored for this particle.";
        return -1.0;
      }
float pat::GenericParticle::userIsolation ( IsolationKeys  key) const [inline]

Returns the isolation variable for a specifc key (or pseudo-key like CaloIso), or -1.0 if not available

Definition at line 131 of file GenericParticle.h.

References pat::CaloIso, pat::EcalIso, pat::HcalIso, isolations_, and combine::key.

Referenced by caloIso(), ecalIso(), hcalIso(), trackIso(), and userIsolation().

                                                   { 
          if (key >= 0) {
              //if (key >= isolations_.size()) throw cms::Excepton("Missing Data") 
              //<< "Isolation corresponding to key " 
              //<< key << " was not stored for this particle.";
              if (size_t(key) >= isolations_.size()) return -1.0;
              return isolations_[key];
          } else switch (key) {
          case pat::CaloIso:  
            //if (isolations_.size() <= pat::HcalIso) throw cms::Excepton("Missing Data") 
            //<< "CalIsoo Isolation was not stored for this particle.";
            if (isolations_.size() <= pat::HcalIso) return -1.0; 
            return isolations_[pat::EcalIso] + isolations_[pat::HcalIso];
          default:
            return -1.0;
            //throw cms::Excepton("Missing Data") << "Isolation corresponding to key " 
            //<< key << " was not stored for this particle.";
          }
      }
const pat::VertexAssociation* pat::GenericParticle::vertexAssociation ( size_t  index = 0) const [inline]

Vertex association (or associations, if any). Return null pointer if none has been set.

Definition at line 250 of file GenericParticle.h.

References vtxAss_.

{ return vtxAss_.size() > index ? & vtxAss_[index] : 0; }
const std::vector<pat::VertexAssociation>& pat::GenericParticle::vertexAssociations ( ) const [inline]

Vertex associations. Can be empty if it was not enabled in the config file.

Definition at line 252 of file GenericParticle.h.

References vtxAss_.

{ return vtxAss_; }

Member Data Documentation

Definition at line 268 of file GenericParticle.h.

Referenced by caloTower(), embedCaloTower(), and setCaloTower().

Definition at line 267 of file GenericParticle.h.

Referenced by caloTower(), embedCaloTower(), and setCaloTower().

Definition at line 260 of file GenericParticle.h.

Referenced by combinedMuon(), embedCombined(), and setCombinedMuon().

Definition at line 259 of file GenericParticle.h.

Referenced by combinedMuon(), embedCombined(), and setCombinedMuon().

Definition at line 264 of file GenericParticle.h.

Referenced by embedGsfTrack(), gsfTrack(), and setGsfTrack().

Definition at line 263 of file GenericParticle.h.

Referenced by embedGsfTrack(), gsfTrack(), and setGsfTrack().

Definition at line 284 of file GenericParticle.h.

Referenced by isoDeposit(), and setIsoDeposit().

std::vector<float> pat::GenericParticle::isolations_ [protected]

Definition at line 285 of file GenericParticle.h.

Referenced by setIsolation(), and userIsolation().

float pat::GenericParticle::quality_ [protected]

Definition at line 280 of file GenericParticle.h.

Referenced by quality(), and setQuality().

Definition at line 260 of file GenericParticle.h.

Referenced by embedStandalone(), setStandAloneMuon(), and standAloneMuon().

Definition at line 259 of file GenericParticle.h.

Referenced by embedStandalone(), setStandAloneMuon(), and standAloneMuon().

Definition at line 272 of file GenericParticle.h.

Referenced by embedSuperCluster(), setSuperCluster(), and superCluster().

Definition at line 271 of file GenericParticle.h.

Referenced by embedSuperCluster(), setSuperCluster(), and superCluster().

Definition at line 260 of file GenericParticle.h.

Referenced by embedTrack(), setTrack(), and track().

Definition at line 259 of file GenericParticle.h.

Referenced by embedTrack(), setTrack(), and track().

Definition at line 275 of file GenericParticle.h.

Referenced by embedTracks(), numberOfTracks(), setTracks(), and track().

Definition at line 276 of file GenericParticle.h.

Referenced by embedTracks(), numberOfTracks(), setTracks(), and track().