Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef RecoCandidate_RecoChargedRefCandidate_h
0002 #define RecoCandidate_RecoChargedRefCandidate_h
0003 
0004 #include "DataFormats/Candidate/interface/LeafRefCandidateT.h"
0005 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0006 #include "DataFormats/TrackReco/interface/Track.h"
0007 
0008 namespace reco {
0009 
0010   typedef LeafRefCandidateT RecoChargedRefCandidateBase;
0011 
0012   class RecoChargedRefCandidate : public LeafRefCandidateT {
0013   public:
0014     RecoChargedRefCandidate() {}
0015     RecoChargedRefCandidate(TrackRef ref, float m) : LeafRefCandidateT(ref, m) {}
0016 
0017     ~RecoChargedRefCandidate() override {}
0018 
0019     RecoChargedRefCandidate* clone() const override { return new RecoChargedRefCandidate(*this); }
0020 
0021     reco::TrackRef track() const { return getRef<reco::TrackRef>(); }
0022     // return a pointer to the best track, if available.
0023     // otherwise, return a null pointer
0024     const reco::Track* bestTrack() const override {
0025       if (track().isNonnull() && track().isAvailable())
0026         return &(*track());
0027       else
0028         return nullptr;
0029     }
0030 
0031     /// uncertainty on dz
0032     float dzError() const override {
0033       const Track* tr = bestTrack();
0034       if (tr != nullptr)
0035         return tr->dzError();
0036       else
0037         return 0;
0038     }
0039     /// uncertainty on dxy
0040     float dxyError() const override {
0041       const Track* tr = bestTrack();
0042       if (tr != nullptr)
0043         return tr->dxyError();
0044       else
0045         return 0;
0046     }
0047   };
0048 }  // namespace reco
0049 
0050 #endif