CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/RecoTracker/TransientTrackingRecHit/interface/TRecHit2DPosConstraint.h

Go to the documentation of this file.
00001 #ifndef RECOTRACKER_TRANSIENTRACKINGRECHIT_TRecHit2DPosConstraint_H
00002 #define RECOTRACKER_TRANSIENTRACKINGRECHIT_TRecHit2DPosConstraint_H
00003 
00004 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
00005 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h"
00006 
00007 class GeomDetUnit;
00008 
00009 class TRecHit2DPosConstraint : public TransientTrackingRecHit {
00010 public:
00011 
00012   virtual ~TRecHit2DPosConstraint() {}
00013 
00014   virtual AlgebraicVector parameters() const {
00015     AlgebraicVector result(2);
00016     LocalPoint lp = localPosition();
00017     result[0] = lp.x();
00018     result[1] = lp.y();
00019     return result;
00020   }
00021   
00022   virtual AlgebraicSymMatrix parametersError() const {
00023     AlgebraicSymMatrix m(2);
00024     LocalError le( localPositionError());
00025     m[0][0] = le.xx();
00026     m[0][1] = le.xy();
00027     m[1][1] = le.yy();
00028     return m;
00029   }
00030 
00031   virtual AlgebraicMatrix projectionMatrix() const {
00032     AlgebraicMatrix theProjectionMatrix;
00033     theProjectionMatrix = AlgebraicMatrix( 2, 5, 0);
00034     theProjectionMatrix[0][3] = 1;
00035     theProjectionMatrix[1][4] = 1;
00036     return theProjectionMatrix;
00037   }
00038   virtual int dimension() const {return 2;}
00039 
00040   virtual LocalPoint localPosition() const {return pos_;}
00041   virtual LocalError localPositionError() const {return err_;}
00042 
00043   virtual const TrackingRecHit * hit() const {return 0;}//fixme return invalid
00044 
00045   virtual std::vector<const TrackingRecHit*> recHits() const {
00046     return hit()->recHits();
00047   }
00048   virtual std::vector<TrackingRecHit*> recHits() {
00049     return std::vector<TrackingRecHit*>();
00050   }
00051 
00052   virtual bool canImproveWithTrack() const {return false;}
00053 
00054   virtual RecHitPointer clone (const TrajectoryStateOnSurface& ts) const {return clone();}
00055 
00056   virtual const GeomDetUnit* detUnit() const {return 0;}
00057   virtual const GeomDet* det() const {return 0;}
00058 
00059   static RecHitPointer build( const LocalPoint& pos, const LocalError& err,
00060                               const Surface* surface) {
00061     return RecHitPointer( new TRecHit2DPosConstraint( pos, err, surface));
00062   }
00063 
00064   virtual const Surface * surface() const {return &(*surface_);}
00065 
00066 private:
00067   const LocalPoint pos_;
00068   const LocalError err_;
00069 //   const Surface* surface_;
00070   ConstReferenceCountingPointer<Surface> surface_;
00072   TRecHit2DPosConstraint(const LocalPoint& pos,
00073                          const LocalError& err,
00074                          const Surface* surface): 
00075     pos_(pos),err_(err),surface_(surface) {}
00076 
00077   TRecHit2DPosConstraint( const TRecHit2DPosConstraint& other ):
00078     pos_( other.localPosition() ),err_( other.localPositionError() ), surface_((other.surface())) {}
00079 
00080   virtual TRecHit2DPosConstraint * clone() const {
00081     return new TRecHit2DPosConstraint(*this);
00082   }
00083 
00084 };
00085 
00086 #endif