Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:01

0001 #ifndef RECOTRACKER_TRANSIENTRACKINGRECHIT_TRecHit1DMomConstraint_H
0002 #define RECOTRACKER_TRANSIENTRACKINGRECHIT_TRecHit1DMomConstraint_H
0003 
0004 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
0005 #include "DataFormats/GeometryCommonDetAlgo/interface/ErrorFrameTransformer.h"
0006 
0007 class TRecHit1DMomConstraint final : public TransientTrackingRecHit {
0008 public:
0009   ~TRecHit1DMomConstraint() override {}
0010 
0011   AlgebraicVector parameters() const override {
0012     AlgebraicVector result(1);
0013     result[0] = charge_ / fabs(mom_);
0014     return result;
0015   }
0016 
0017   AlgebraicSymMatrix parametersError() const override {
0018     AlgebraicSymMatrix m(1);
0019     m[0][0] = err_ / (mom_ * mom_);  //parametersErrors are squared
0020     m[0][0] *= m[0][0];
0021     return m;
0022   }
0023 
0024   AlgebraicMatrix projectionMatrix() const override {
0025     AlgebraicMatrix theProjectionMatrix;
0026     theProjectionMatrix = AlgebraicMatrix(1, 5, 0);
0027     theProjectionMatrix[0][0] = 1;
0028     return theProjectionMatrix;
0029   }
0030   int dimension() const override { return 1; }
0031 
0032   LocalPoint localPosition() const override { return LocalPoint(0, 0, 0); }
0033   LocalError localPositionError() const override { return LocalError(0, 0, 0); }
0034 
0035   double mom() const { return mom_; }
0036   double err() const { return err_; }
0037   int charge() const { return charge_; }
0038 
0039   const TrackingRecHit* hit() const override { return nullptr; }  //fixme return invalid
0040   TrackingRecHit* cloneHit() const override { return nullptr; }
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   bool sharesInput(const TrackingRecHit*, SharedInputType) const override { return false; }
0045 
0046   bool canImproveWithTrack() const override { return false; }
0047 
0048   virtual RecHitPointer clone(const TrajectoryStateOnSurface& ts) const { return RecHitPointer(clone()); }
0049 
0050   const GeomDetUnit* detUnit() const override { return nullptr; }
0051 
0052   static RecHitPointer build(const int charge,
0053                              const double mom,
0054                              const double err,  //not sqared!!!
0055                              const Surface* surface) {
0056     return RecHitPointer(new TRecHit1DMomConstraint(charge, mom, err, surface));
0057   }
0058 
0059   const Surface* surface() const override { return surface_; }
0060 
0061   GlobalPoint globalPosition() const override { return GlobalPoint(); }
0062   GlobalError globalPositionError() const override { return GlobalError(); }
0063   float errorGlobalR() const override { return 0; }
0064   float errorGlobalZ() const override { return 0; }
0065   float errorGlobalRPhi() const override { return 0; }
0066 
0067 private:
0068   const int charge_;
0069   const double mom_;
0070   const double err_;
0071   const Surface* surface_;
0072   /// Creates the TrackingRecHit internally, avoids redundent cloning
0073   TRecHit1DMomConstraint(const int charge,
0074                          const double mom,
0075                          const double err,  //notsquared
0076                          const Surface* surface)
0077       : charge_(charge), mom_(mom), err_(err), surface_(surface) {}
0078 
0079   TRecHit1DMomConstraint(const TRecHit1DMomConstraint& other) = default;
0080 
0081   TRecHit1DMomConstraint* clone() const override { return new TRecHit1DMomConstraint(*this); }
0082 };
0083 
0084 #endif