CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/DataFormats/RecoCandidate/src/RecoCandidate.cc

Go to the documentation of this file.
00001 // $Id: RecoCandidate.cc,v 1.15 2010/10/21 07:54:49 gpetrucc Exp $
00002 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00003 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
00004 #include "FWCore/Utilities/interface/Exception.h"
00005 
00006 using namespace reco;
00007 
00008 RecoCandidate::~RecoCandidate() { }
00009 
00010 RecoCandidate * RecoCandidate::clone() const {
00011    throw cms::Exception("LogicError", "reco::RecoCandidate is abstract, so it's clone() method can't be implemented.\n");
00012 }
00013 
00014 TrackRef RecoCandidate::track() const {
00015   return TrackRef();
00016 }
00017 
00018 TrackRef RecoCandidate::track( size_t ) const {
00019   return TrackRef();
00020 }
00021 
00022 size_t RecoCandidate::numberOfTracks() const {
00023   return 0;
00024 }
00025 
00026 GsfTrackRef RecoCandidate::gsfTrack() const {
00027   return GsfTrackRef();
00028 }
00029 
00030 TrackRef RecoCandidate::standAloneMuon() const {
00031   return TrackRef();
00032 }
00033 
00034 TrackRef RecoCandidate::combinedMuon() const {
00035   return TrackRef();
00036 }
00037 
00038 SuperClusterRef RecoCandidate::superCluster() const {
00039   return SuperClusterRef();
00040 }
00041 
00042 CaloTowerRef RecoCandidate::caloTower() const {
00043   return CaloTowerRef();
00044 }
00045 
00046 const Track * RecoCandidate::bestTrack() const {
00047   TrackRef muRef = combinedMuon();
00048   if( muRef.isNonnull() ) 
00049     return muRef.get();
00050   TrackRef trkRef = track();
00051   if ( trkRef.isNonnull() ) 
00052     return trkRef.get();
00053   GsfTrackRef gsfTrkRef = gsfTrack();
00054   if ( gsfTrkRef.isNonnull() )
00055     return gsfTrkRef.get();
00056   TrackRef staRef = standAloneMuon(); 
00057   if ( staRef.isNonnull() ) 
00058     return staRef.get(); 
00059   return 0;
00060 }
00061 
00062 TrackBaseRef RecoCandidate::bestTrackRef() const {
00063   TrackRef muRef = combinedMuon();
00064   if( muRef.isNonnull() ) return TrackBaseRef(muRef);
00065   TrackRef trkRef = track();
00066   if ( trkRef.isNonnull() ) return TrackBaseRef(trkRef);
00067   GsfTrackRef gsfTrkRef = gsfTrack();
00068   if ( gsfTrkRef.isNonnull() ) return TrackBaseRef(gsfTrkRef);
00069   TrackRef staRef = standAloneMuon(); 
00070   if ( staRef.isNonnull() ) return TrackBaseRef(staRef); 
00071   return TrackBaseRef();
00072 }
00073 
00074 
00075 RecoCandidate::TrackType RecoCandidate::bestTrackType() const {
00076   if( combinedMuon().isNonnull() ) 
00077     return recoTrackType;
00078   if ( track().isNonnull() ) 
00079     return recoTrackType;
00080   if ( gsfTrack().isNonnull() ) 
00081     return gsfTrackType;
00082   return noTrackType;
00083 }