Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:14

0001 #ifndef TrackingRecHit_DTRecSegment2D_h
0002 #define TrackingRecHit_DTRecSegment2D_h
0003 
0004 /** \class DTRecSegment2D
0005  *
0006  * Base class for 2-parameters segments measuring position and direction in X
0007  * projection.
0008  *  
0009  * Implements the AbstractDetMeasurement part of the interface
0010  * for 2D RecHits in terms of localPosition() and localPositionError() and
0011  * Direction. This segment is measuring the position and the direction in just
0012  * one projection, the "X". Typical use case is a segment reconstructed only in
0013  * X projection.
0014  * To be used as base class for all 2D positional-directional segments.
0015  * The coordinate measured is assumend to be the local "x" and "dx/dz"
0016  *
0017  * 2D Segments for the muon barrel system.
0018  * 2D means that this segment has information about position and direction in
0019  * one projection (r-phi or r-theta/zeta).
0020  *
0021  * \author Stefano Lacaprara - INFN Legnaro <stefano.lacaprara@pd.infn.it>
0022  * \author Riccardo Bellan - INFN TO <riccardo.bellan@cern.ch>
0023  *
0024  */
0025 
0026 /* Base Class Headers */
0027 #include "DataFormats/TrackingRecHit/interface/RecSegment.h"
0028 
0029 /* Collaborating Class Declarations */
0030 #include "DataFormats/GeometrySurface/interface/LocalError.h"
0031 #include "DataFormats/GeometryVector/interface/LocalVector.h"
0032 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0033 
0034 #include "DataFormats/DTRecHit/interface/DTRecHit1D.h"
0035 /* C++ Headers */
0036 #include <iosfwd>
0037 
0038 /* Fwd declaration */
0039 class DTSegmentUpdator;
0040 
0041 /* ====================================================================== */
0042 
0043 /* Class DTRecSegment2D Interface */
0044 
0045 class DTRecSegment2D : public RecSegment {
0046 public:
0047   /// Constructor
0048   /// empty c'tor needed by POOL (I guess)
0049   DTRecSegment2D() : theChi2(0.0), theT0(0.), theVdrift(0.) {}
0050 
0051   /// c'tor from hits
0052   DTRecSegment2D(DetId id, const std::vector<DTRecHit1D>& hits);
0053 
0054   /// complete constructor
0055   DTRecSegment2D(DetId id,
0056                  LocalPoint& position,
0057                  LocalVector& direction,
0058                  AlgebraicSymMatrix& covMatrix,
0059                  double chi2,
0060                  std::vector<DTRecHit1D>& hits1D);
0061 
0062   /// Destructor
0063   ~DTRecSegment2D() override;
0064 
0065   /* Operations */
0066 
0067   DTRecSegment2D* clone() const override { return new DTRecSegment2D(*this); }
0068 
0069   /// the vector of parameters (dx/dz,x)
0070   AlgebraicVector parameters() const override { return param(localPosition(), localDirection()); }
0071 
0072   // The parameter error matrix
0073   AlgebraicSymMatrix parametersError() const override;
0074 
0075   /** return the projection matrix, which must project a parameter vector,
0076    * whose components are (q/p, dx/dz, dy/dz, x, y), into the vector returned
0077    * by parameters() */
0078   AlgebraicMatrix projectionMatrix() const override { return theProjectionMatrix; }
0079 
0080   /// return 2. The dimension of the matrix
0081   int dimension() const override { return 2; }
0082 
0083   /// local position in SL frame
0084   LocalPoint localPosition() const override { return thePosition; }
0085 
0086   /// local position error in SL frame
0087   LocalError localPositionError() const override;
0088 
0089   /// the local direction in SL frame
0090   LocalVector localDirection() const override { return theDirection; }
0091 
0092   /// the local direction error (xx,xy,yy) in SL frame: only xx is not 0.
0093   LocalError localDirectionError() const override;
0094 
0095   /// the chi2 of the fit
0096   double chi2() const override { return theChi2; }
0097 
0098   /// return the DOF of the segment
0099   int degreesOfFreedom() const override;
0100 
0101   // Access to component RecHits (if any)
0102   std::vector<const TrackingRecHit*> recHits() const override;
0103 
0104   // Non-const access to component RecHits (if any)
0105   std::vector<TrackingRecHit*> recHits() override;
0106 
0107   /// Access to specific components
0108   std::vector<DTRecHit1D> specificRecHits() const;
0109 
0110   /// the Covariance Matrix
0111   AlgebraicSymMatrix covMatrix() const { return theCovMatrix; }
0112 
0113   /// Get the segment t0 (if recomputed, 0 is returned otherwise)
0114   double t0() const { return theT0; }
0115   bool ist0Valid() const { return (theT0 > -998.) ? true : false; }
0116 
0117   /// Get the vDirft as computed by the algo for the computation of the segment t0
0118   /// (if recomputed, 0 is returned otherwise)
0119   double vDrift() const { return theVdrift; }
0120 
0121 protected:
0122   friend class DTSegmentUpdator;
0123   void setPosition(const LocalPoint& pos);
0124   void setDirection(const LocalVector& dir);
0125   void setCovMatrix(const AlgebraicSymMatrix& cov);
0126   void setChi2(const double& chi2);
0127   void update(std::vector<DTRecHit1D>& updatedRecHits);
0128   void setT0(const double& t0);
0129   void setVdrift(const double& vdrift);
0130 
0131   LocalPoint thePosition;    // in SL frame
0132   LocalVector theDirection;  // in SL frame
0133 
0134   /// mat[0][0]=sigma (dx/dz)
0135   /// mat[1][1]=sigma (x)
0136   /// mat[0][1]=cov(dx/dz,x)
0137   AlgebraicSymMatrix theCovMatrix;  // the covariance matrix
0138 
0139   double theChi2;    // chi2 of the fit
0140   double theT0;      // T0 as coming from the fit
0141   double theVdrift;  // vDrift as coming from the fit
0142 
0143   std::vector<DTRecHit1D> theHits;  // the hits with defined R/L
0144 
0145 private:
0146   static const AlgebraicMatrix theProjectionMatrix;
0147 
0148   AlgebraicVector param(const LocalPoint& lp, const LocalVector& lv) const {
0149     AlgebraicVector result(2);
0150     result[1] = lp.x();
0151     result[0] = lv.x() / lv.z();
0152     return result;
0153   }
0154 };
0155 std::ostream& operator<<(std::ostream& os, const DTRecSegment2D& seg);
0156 #endif  // TrackingRecHit_DTRecSegment2D_h