CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DataFormats/DTRecHit/interface/DTRecSegment2D.h

Go to the documentation of this file.
00001 #ifndef TrackingRecHit_DTRecSegment2D_h
00002 #define TrackingRecHit_DTRecSegment2D_h
00003 
00028 /* Base Class Headers */
00029 #include "DataFormats/TrackingRecHit/interface/RecSegment.h"
00030 
00031 /* Collaborating Class Declarations */
00032 #include "DataFormats/GeometrySurface/interface/LocalError.h"
00033 #include "DataFormats/GeometryVector/interface/LocalVector.h"
00034 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
00035 
00036 #include "DataFormats/DTRecHit/interface/DTRecHit1D.h"
00037 /* C++ Headers */
00038 #include <iosfwd>
00039 
00040 /* Fwd declaration */
00041 class DTSegmentUpdator;
00042 
00043 /* ====================================================================== */
00044 
00045 /* Class DTRecSegment2D Interface */
00046 
00047 class DTRecSegment2D : public RecSegment{
00048 
00049  public:
00050 
00053   DTRecSegment2D(): theChi2(0.0), theT0(0.), theVdrift(0.) {}
00054   
00056   DTRecSegment2D(DetId id, const std::vector<DTRecHit1D>& hits) ;
00057   
00059   DTRecSegment2D(DetId id, 
00060                  LocalPoint &position, LocalVector &direction,
00061                  AlgebraicSymMatrix & covMatrix, double chi2, 
00062                  std::vector<DTRecHit1D> &hits1D);
00063 
00065   virtual ~DTRecSegment2D() {};
00066 
00067   /* Operations */ 
00068 
00069   virtual DTRecSegment2D* clone() const { return new DTRecSegment2D(*this);}
00070 
00071 
00073   virtual AlgebraicVector parameters() const {
00074     return param( localPosition(), localDirection());
00075   }
00076 
00077   // The parameter error matrix 
00078   virtual AlgebraicSymMatrix parametersError() const;
00079 
00083   virtual AlgebraicMatrix projectionMatrix() const {
00084     if ( !isInitialized) initialize();
00085     return theProjectionMatrix;
00086   }
00087     
00089   virtual int dimension() const { return 2;}
00090     
00092   virtual LocalPoint localPosition() const {return thePosition; }
00093   
00095   virtual LocalError localPositionError() const ;
00096   
00098   virtual LocalVector localDirection() const { return theDirection; }
00099 
00101   virtual LocalError localDirectionError() const;
00102 
00104   virtual double chi2() const { return theChi2; }
00105     
00107   virtual int degreesOfFreedom() const ;
00108 
00109   // Access to component RecHits (if any)
00110   virtual std::vector<const TrackingRecHit*> recHits() const ;
00111 
00112   // Non-const access to component RecHits (if any)
00113   virtual std::vector<TrackingRecHit*> recHits() ;
00114 
00116   std::vector<DTRecHit1D> specificRecHits() const ;
00117   
00119   AlgebraicSymMatrix covMatrix() const {return theCovMatrix;}
00120 
00122   double t0() const {return theT0;}
00123   bool ist0Valid() const {return (theT0 > -998.) ? true : false;}
00124 
00127   double vDrift() const {return theVdrift;}
00128 
00129  protected:
00130   friend class DTSegmentUpdator;
00131   void setPosition(const LocalPoint& pos);
00132   void setDirection(const LocalVector& dir);
00133   void setCovMatrix(const AlgebraicSymMatrix& cov);
00134   void setChi2(const double& chi2);
00135   void update(std::vector<DTRecHit1D> & updatedRecHits);
00136   void setT0(const double& t0);
00137   void setVdrift(const double& vdrift);
00138 
00139   LocalPoint  thePosition;  // in SL frame
00140   LocalVector theDirection; // in SL frame
00141   
00145   AlgebraicSymMatrix theCovMatrix; // the covariance matrix
00146 
00147   double theChi2;           // chi2 of the fit
00148   double theT0;             // T0 as coming from the fit
00149   double theVdrift;             // vDrift as coming from the fit
00150 
00151   std::vector<DTRecHit1D> theHits; // the hits with defined R/L
00152   
00153 
00154  private:
00155 
00156   static bool isInitialized;
00157   static AlgebraicMatrix theProjectionMatrix;
00158   
00159   void initialize() const {
00160     isInitialized=true;
00161     theProjectionMatrix = AlgebraicMatrix( 2, 5, 0);
00162     theProjectionMatrix[0][1]=1;
00163     theProjectionMatrix[1][3]=1;
00164   }
00165   
00166   AlgebraicVector param( const LocalPoint& lp, const LocalVector& lv) const {
00167     AlgebraicVector result(2);
00168     result[1]=lp.x();
00169     result[0]=lv.x()/lv.z();
00170     return result;
00171   }
00172 
00173 };
00174 std::ostream& operator<<(std::ostream& os, const DTRecSegment2D& seg);
00175 #endif // TrackingRecHit_DTRecSegment2D_h
00176