CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 #ifndef DTRecHit_DTRecSegment4D_h
00002 #define DTRecHit_DTRecSegment4D_h
00003 
00015 /* Base Class Headers */
00016 #include "DataFormats/TrackingRecHit/interface/RecSegment.h"
00017 
00018 /* Collaborating Class Declarations */
00019 #include "DataFormats/DTRecHit/interface/DTSLRecSegment2D.h"
00020 #include "DataFormats/DTRecHit/interface/DTChamberRecSegment2D.h"
00021 
00022 /* C++ Headers */
00023 #include <iosfwd>
00024 
00025 class DTRecSegment4D : public RecSegment {
00026 
00027  public:
00028   friend class DTSegmentUpdator;
00030   DTRecSegment4D() : theProjection(none), theDimension(0) {}
00031   
00033   DTRecSegment4D(const DTChamberRecSegment2D& phiSeg, const DTSLRecSegment2D& zedSeg, const LocalPoint& posZInCh, const LocalVector& dirZInCh);
00034 
00036   DTRecSegment4D(const DTChamberRecSegment2D& phiSeg);
00037 
00039   DTRecSegment4D(const DTSLRecSegment2D& zedSeg, const LocalPoint& posZInCh, const LocalVector& dirZInCh);
00040 
00042   ~DTRecSegment4D() ;
00043 
00044   //--- Base class interface
00045 
00046   virtual DTRecSegment4D* clone() const { return new DTRecSegment4D(*this);}
00047 
00052   AlgebraicVector parameters() const ;
00053 
00055   AlgebraicSymMatrix parametersError() const ;
00056 
00058   virtual AlgebraicMatrix projectionMatrix() const;
00059 
00061   virtual LocalPoint localPosition() const { return thePosition;}
00062 
00064   virtual LocalError localPositionError() const ;
00065 
00067   virtual LocalVector localDirection() const { return theDirection; }
00068 
00070   virtual LocalError localDirectionError() const ;
00071 
00072   // Chi2 of the segment fit
00073   virtual double chi2() const ;
00074   
00075   // Degrees of freedom of the segment fit
00076   virtual int degreesOfFreedom() const ;
00077 
00078   // Dimension (in parameter space)
00079   virtual int dimension() const { return theDimension; }
00080 
00081   // Access to component RecHits (if any)
00082   virtual std::vector<const TrackingRecHit*> recHits() const ;
00083 
00084   // Non-const access to component RecHits (if any)
00085   virtual std::vector<TrackingRecHit*> recHits() ;
00086 
00087 
00088   //--- Extension of the interface
00089 
00090   
00092   bool hasPhi() const {return (theProjection==full || theProjection==phi);}
00093   
00095   bool hasZed() const {return (theProjection==full || theProjection==Z);}
00096   
00098   const DTChamberRecSegment2D *phiSegment() const {
00099     return hasPhi()? &thePhiSeg: 0;
00100   }
00101     
00103   const DTSLRecSegment2D *zSegment() const {
00104     return hasZed()? &theZedSeg : 0;
00105   }
00106     
00108   void setPosition(LocalPoint pos) { thePosition = pos; }
00109 
00111   void setDirection(LocalVector dir) { theDirection = dir; }
00112 
00114   void setCovMatrix(AlgebraicSymMatrix mat) { theCovMatrix = mat; }
00115 
00117   virtual DTChamberId chamberId() const;
00118     
00119  private:
00121   enum Projection {full, phi, Z, none};
00122   Projection theProjection;
00123 
00125   DTChamberRecSegment2D *phiSegment() {return &thePhiSeg;}
00126     
00128   DTSLRecSegment2D *zSegment() {return &theZedSeg;}
00129 
00130   LocalPoint thePosition;   // in chamber frame
00131   LocalVector theDirection; // in chamber frame
00132 
00133   void setCovMatrixForZed(const LocalPoint& posZInCh);
00134     
00135   // the covariance matrix, has the following meaning
00136   // mat[0][0]=sigma (dx/dz)
00137   // mat[1][1]=sigma (dy/dz)
00138   // mat[2][2]=sigma (x)
00139   // mat[3][3]=sigma (y)
00140   // mat[0][2]=cov(dx/dz,x)
00141   // mat[1][3]=cov(dy/dz,y)
00142   AlgebraicSymMatrix theCovMatrix; 
00143 
00144   DTChamberRecSegment2D thePhiSeg;
00145   DTSLRecSegment2D theZedSeg;
00146 
00147   int theDimension; // the dimension of this rechit
00148 
00149 };
00150 
00151 std::ostream& operator<<(std::ostream& os, const DTRecSegment4D& seg);
00152 
00153 #endif // DTRecHit_DTRecSegment4D_h
00154