Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-28 03:10:23

0001 #ifndef TrackReco_TransientTrack_h
0002 #define TrackReco_TransientTrack_h
0003 
0004 /**

0005    * Definition of Transient Track class to be used for higher-level reconstruction

0006    *  (vertexing, b-tagging...). It allows access to several services that the 

0007    *  DataFormat tracks can not access (magnetic field, geometry)

0008    */
0009 
0010 #include "TrackingTools/TransientTrack/interface/BasicTransientTrack.h"
0011 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0012 
0013 #include "DataFormats/TrackReco/interface/Track.h"
0014 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0015 #include "DataFormats/Common/interface/RefToBase.h"
0016 
0017 namespace reco {
0018 
0019   class TransientTrack : private BasicTransientTrack::Proxy {
0020     typedef BasicTransientTrack::Proxy Base;
0021 
0022   public:
0023     TransientTrack() noexcept {}
0024 
0025     explicit TransientTrack(BasicTransientTrack* btt) noexcept : Base(btt) {}
0026 
0027     ~TransientTrack() noexcept {}
0028 
0029     TransientTrack(TransientTrack const& rh) noexcept : Base(rh) {}
0030 
0031     TransientTrack(TransientTrack&& rh) noexcept : Base(std::move(rh)) {}
0032 
0033     TransientTrack& operator=(TransientTrack&& rh) noexcept {
0034       Base::operator=(std::move(rh));
0035       return *this;
0036     }
0037 
0038     TransientTrack& operator=(TransientTrack const& rh) noexcept {
0039       Base::operator=(rh);
0040       return *this;
0041     }
0042 
0043     void swap(TransientTrack& rh) noexcept { Base::swap(rh); }
0044 
0045     TransientTrack(const Track& tk, const MagneticField* field);
0046     TransientTrack(const TrackRef& tk, const MagneticField* field);
0047     TransientTrack(const CandidatePtr& ptr, const MagneticField* field);
0048     TransientTrack(const TrackRef& tk,
0049                    const MagneticField* field,
0050                    const edm::ESHandle<GlobalTrackingGeometry>& trackingGeometry);
0051 
0052     TransientTrack(const Track& tk,
0053                    const MagneticField* field,
0054                    const edm::ESHandle<GlobalTrackingGeometry>& trackingGeometry);
0055     TransientTrack(const CandidatePtr& ptr,
0056                    const MagneticField* field,
0057                    const edm::ESHandle<GlobalTrackingGeometry>& trackingGeometry);
0058 
0059     TransientTrack(const Track& tk, const double time, const double dtime, const MagneticField* field);
0060     TransientTrack(const TrackRef& tk, const double time, const double dtime, const MagneticField* field);
0061     TransientTrack(const CandidatePtr& ptr, const double time, const double dtime, const MagneticField* field);
0062     TransientTrack(const TrackRef& tk,
0063                    const double time,
0064                    const double dtime,
0065                    const MagneticField* field,
0066                    const edm::ESHandle<GlobalTrackingGeometry>& trackingGeometry);
0067     TransientTrack(const Track& tk,
0068                    const double time,
0069                    const double dtime,
0070                    const MagneticField* field,
0071                    const edm::ESHandle<GlobalTrackingGeometry>& trackingGeometry);
0072     TransientTrack(const CandidatePtr& ptr,
0073                    const double time,
0074                    const double dtime,
0075                    const MagneticField* field,
0076                    const edm::ESHandle<GlobalTrackingGeometry>& trackingGeometry);
0077 
0078     void setTrackingGeometry(const edm::ESHandle<GlobalTrackingGeometry>& tg) { sharedData().setTrackingGeometry(tg); }
0079 
0080     void setBeamSpot(const reco::BeamSpot& beamSpot) { sharedData().setBeamSpot(beamSpot); }
0081 
0082     FreeTrajectoryState initialFreeState() const { return data().initialFreeState(); }
0083 
0084     TrajectoryStateOnSurface outermostMeasurementState() const { return data().outermostMeasurementState(); }
0085 
0086     TrajectoryStateOnSurface innermostMeasurementState() const { return data().innermostMeasurementState(); }
0087 
0088     TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint& point) const {
0089       return data().trajectoryStateClosestToPoint(point);
0090     }
0091 
0092     TrajectoryStateOnSurface stateOnSurface(const GlobalPoint& point) const { return data().stateOnSurface(point); }
0093 
0094     TrajectoryStateClosestToPoint impactPointTSCP() const { return data().impactPointTSCP(); }
0095 
0096     TrajectoryStateOnSurface impactPointState() const { return data().impactPointState(); }
0097 
0098     bool impactPointStateAvailable() const { return data().impactPointStateAvailable(); }
0099 
0100     TrackCharge charge() const { return data().charge(); }
0101 
0102     bool operator==(const TransientTrack& other) const { return &(data()) == &(other.data()); }
0103     // {return (a.persistentTrackRef()==tkr_);}

0104 
0105     bool operator<(const TransientTrack& other) const { return &(data()) < &(other.data()); }
0106     // {return (initialFTS.momentum().z()<a.initialFreeState().momentum().z());}

0107 
0108     const MagneticField* field() const { return data().field(); }
0109 
0110     const BasicTransientTrack* basicTransientTrack() const { return &(data()); }
0111 
0112     double timeExt() const { return data().timeExt(); }
0113     double dtErrorExt() const { return data().dtErrorExt(); }
0114 
0115     const Track& track() const { return data().track(); }
0116 
0117     TrackBaseRef trackBaseRef() const { return data().trackBaseRef(); }
0118 
0119     TrajectoryStateClosestToBeamLine stateAtBeamLine() const { return data().stateAtBeamLine(); }
0120 
0121     // Methods forwarded to original track.

0122 
0123     /// first iterator to RecHits

0124     trackingRecHit_iterator recHitsBegin() const { return track().recHitsBegin(); }
0125     /// last iterator to RecHits

0126     trackingRecHit_iterator recHitsEnd() const { return track().recHitsEnd(); }
0127     /// get n-th recHit

0128     TrackingRecHitRef recHit(size_t i) const { return track().recHit(i); }
0129     /// number of RecHits

0130     size_t recHitsSize() const { return track().recHitsSize(); }
0131     //  hit pattern

0132     const HitPattern& hitPattern() const { return track().hitPattern(); }
0133     /// number of hits found

0134     unsigned short numberOfValidHits() const { return track().hitPattern().numberOfValidHits(); }
0135     /// number of hits lost

0136     unsigned short numberOfLostHits() const { return track().hitPattern().numberOfLostHits(HitPattern::TRACK_HITS); }
0137     /// chi-squared of the fit

0138     double chi2() const { return track().chi2(); }
0139     /// number of degrees of freedom of the fit

0140     double ndof() const { return track().ndof(); }
0141     /// chi-squared divided by n.d.o.f.

0142     double normalizedChi2() const { return track().chi2() / track().ndof(); }
0143 
0144     /// Make the ReferenceCountingProxy method to check validity public

0145     bool isValid() const { return Base::isValid(); }
0146   };
0147 
0148 }  // namespace reco

0149 
0150 #endif