Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:01

0001 #ifndef RECOTRACKER_TRANSIENTRACKINGRECHIT_TRecHit5DParamConstraint_H
0002 #define RECOTRACKER_TRANSIENTRACKINGRECHIT_TRecHit5DParamConstraint_H
0003 
0004 #include "DataFormats/TrackerRecHit2D/interface/trackerHitRTTI.h"
0005 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0006 #include "DataFormats/GeometryCommonDetAlgo/interface/ErrorFrameTransformer.h"
0007 #include "DataFormats/CLHEP/interface/Migration.h"
0008 
0009 class TRecHit5DParamConstraint final : public TrackingRecHit {
0010 public:
0011   TRecHit5DParamConstraint(const TrajectoryStateOnSurface& tsos)
0012       : TrackingRecHit(0, int(trackerHitRTTI::notFromCluster)), tsos_(tsos) {}
0013 
0014   TRecHit5DParamConstraint(const GeomDet& idet, const TrajectoryStateOnSurface& tsos)
0015       : TrackingRecHit(idet, int(trackerHitRTTI::notFromCluster)), tsos_(tsos) {}
0016 
0017   TRecHit5DParamConstraint(const TRecHit5DParamConstraint& other) = default;
0018   TRecHit5DParamConstraint(TRecHit5DParamConstraint&& other) = default;
0019 
0020   ~TRecHit5DParamConstraint() override {}
0021 
0022   int dimension() const override { return 5; }
0023 
0024   AlgebraicMatrix projectionMatrix() const override {
0025     AlgebraicMatrix projectionMatrix(5, 5, 1);
0026     return projectionMatrix;
0027   }
0028 
0029   AlgebraicVector parameters() const override { return asHepVector(tsos_.localParameters().vector()); }
0030 
0031   AlgebraicSymMatrix parametersError() const override { return asHepMatrix(tsos_.localError().matrix()); }
0032 
0033   LocalPoint localPosition() const override { return tsos_.localPosition(); }
0034 
0035   LocalError localPositionError() const override { return tsos_.localError().positionError(); }
0036 
0037   int charge() const { return tsos_.charge(); }
0038   const TrajectoryStateOnSurface& trajectoryState() const { return tsos_; }
0039 
0040   bool canImproveWithTrack() const override { return false; }
0041 
0042   std::vector<const TrackingRecHit*> recHits() const override { return std::vector<const TrackingRecHit*>(); }
0043   std::vector<TrackingRecHit*> recHits() override { return std::vector<TrackingRecHit*>(); }
0044 
0045   // verify if same tsos
0046   bool sharesInput(const TrackingRecHit*, SharedInputType) const override { return false; }
0047 
0048   const Surface* surface() const override { return &tsos_.surface(); }
0049 
0050   GlobalPoint globalPosition() const override { return surface()->toGlobal(localPosition()); }
0051   GlobalError globalPositionError() const override {
0052     return ErrorFrameTransformer().transform(localPositionError(), *surface());
0053   }
0054   float errorGlobalR() const override { return std::sqrt(globalPositionError().rerr(globalPosition())); }
0055   float errorGlobalZ() const override { return std::sqrt(globalPositionError().czz()); }
0056   float errorGlobalRPhi() const override {
0057     return globalPosition().perp() * sqrt(globalPositionError().phierr(globalPosition()));
0058   }
0059 
0060   /// ????
0061   virtual RecHitPointer clone(const TrajectoryStateOnSurface& tsos) const {
0062     return RecHitPointer(new TRecHit5DParamConstraint(tsos));
0063   }
0064 
0065   static RecHitPointer build(const TrajectoryStateOnSurface& tsos) {
0066     return RecHitPointer(new TRecHit5DParamConstraint(tsos));
0067   }
0068 
0069 private:
0070   const TrajectoryStateOnSurface tsos_;
0071 
0072   TRecHit5DParamConstraint* clone() const override { return new TRecHit5DParamConstraint(*this); }
0073 };
0074 
0075 #endif