Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:37

0001 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
0002 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
0003 #include "FWCore/Utilities/interface/Exception.h"
0004 
0005 using namespace reco;
0006 
0007 RecoCandidate::~RecoCandidate() {}
0008 
0009 RecoCandidate* RecoCandidate::clone() const {
0010   throw cms::Exception("LogicError", "reco::RecoCandidate is abstract, so it's clone() method can't be implemented.\n");
0011 }
0012 
0013 TrackRef RecoCandidate::track() const { return TrackRef(); }
0014 
0015 TrackRef RecoCandidate::track(size_t) const { return TrackRef(); }
0016 
0017 size_t RecoCandidate::numberOfTracks() const { return 0; }
0018 
0019 GsfTrackRef RecoCandidate::gsfTrack() const { return GsfTrackRef(); }
0020 
0021 TrackRef RecoCandidate::standAloneMuon() const { return TrackRef(); }
0022 
0023 TrackRef RecoCandidate::combinedMuon() const { return TrackRef(); }
0024 
0025 SuperClusterRef RecoCandidate::superCluster() const { return SuperClusterRef(); }
0026 
0027 CaloTowerRef RecoCandidate::caloTower() const { return CaloTowerRef(); }
0028 
0029 const Track* RecoCandidate::bestTrack() const {
0030   TrackRef muRef = combinedMuon();
0031   if (muRef.isNonnull())
0032     return muRef.get();
0033   TrackRef trkRef = track();
0034   if (trkRef.isNonnull())
0035     return trkRef.get();
0036   GsfTrackRef gsfTrkRef = gsfTrack();
0037   if (gsfTrkRef.isNonnull())
0038     return gsfTrkRef.get();
0039   TrackRef staRef = standAloneMuon();
0040   if (staRef.isNonnull())
0041     return staRef.get();
0042   return nullptr;
0043 }
0044 
0045 TrackBaseRef RecoCandidate::bestTrackRef() const {
0046   TrackRef muRef = combinedMuon();
0047   if (muRef.isNonnull())
0048     return TrackBaseRef(muRef);
0049   TrackRef trkRef = track();
0050   if (trkRef.isNonnull())
0051     return TrackBaseRef(trkRef);
0052   GsfTrackRef gsfTrkRef = gsfTrack();
0053   if (gsfTrkRef.isNonnull())
0054     return TrackBaseRef(gsfTrkRef);
0055   TrackRef staRef = standAloneMuon();
0056   if (staRef.isNonnull())
0057     return TrackBaseRef(staRef);
0058   return TrackBaseRef();
0059 }
0060 
0061 RecoCandidate::TrackType RecoCandidate::bestTrackType() const {
0062   if (combinedMuon().isNonnull())
0063     return recoTrackType;
0064   if (track().isNonnull())
0065     return recoTrackType;
0066   if (gsfTrack().isNonnull())
0067     return gsfTrackType;
0068   return noTrackType;
0069 }
0070 
0071 float RecoCandidate::dzError() const {
0072   const Track* tr = bestTrack();
0073   if (tr != nullptr)
0074     return tr->dzError();
0075   else
0076     return 0;
0077 }
0078 float RecoCandidate::dxyError() const {
0079   const Track* tr = bestTrack();
0080   if (tr != nullptr)
0081     return tr->dxyError();
0082   else
0083     return 0;
0084 }