Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:49:38

0001 #ifndef DTRecHit_DTRecSegment4D_h
0002 #define DTRecHit_DTRecSegment4D_h
0003 
0004 /** \class DTRecSegment4D
0005  *
0006  * 4-parameter RecHits for MuonBarrel DT (x,y, dx/dz, dy/dz)
0007  *
0008  * \author Stefano Lacaprara - INFN Legnaro <stefano.lacaprara@pd.infn.it>
0009  * \author Riccardo Bellan - INFN TO <riccardo.bellan@cern.ch>
0010  *
0011  */
0012 
0013 /* Base Class Headers */
0014 #include "DataFormats/TrackingRecHit/interface/RecSegment.h"
0015 
0016 /* Collaborating Class Declarations */
0017 #include "DataFormats/DTRecHit/interface/DTSLRecSegment2D.h"
0018 #include "DataFormats/DTRecHit/interface/DTChamberRecSegment2D.h"
0019 
0020 /* C++ Headers */
0021 #include <iosfwd>
0022 
0023 class DTRecSegment4D : public RecSegment {
0024 public:
0025   friend class DTSegmentUpdator;
0026   /// Empty constructor
0027   DTRecSegment4D() : theProjection(none), theDimension(0) {}
0028 
0029   /// Construct from phi and Z projections
0030   DTRecSegment4D(const DTChamberRecSegment2D& phiSeg,
0031                  const DTSLRecSegment2D& zedSeg,
0032                  const LocalPoint& posZInCh,
0033                  const LocalVector& dirZInCh);
0034 
0035   /// Construct from phi projection
0036   DTRecSegment4D(const DTChamberRecSegment2D& phiSeg);
0037 
0038   /// Construct from Z projection
0039   DTRecSegment4D(const DTSLRecSegment2D& zedSeg, const LocalPoint& posZInCh, const LocalVector& dirZInCh);
0040 
0041   /// Destructor
0042   ~DTRecSegment4D() override;
0043 
0044   //--- Base class interface
0045 
0046   DTRecSegment4D* clone() const override { return new DTRecSegment4D(*this); }
0047 
0048   /// Parameters of the segment, for the track fit.
0049   /// For a 4D segment: (dx/dy,dy/dz,x,y)
0050   /// For a 2D, phi-only segment: (dx/dz,x)
0051   /// For a 2D, Z-only segment: (dy/dz,y)
0052   AlgebraicVector parameters() const override;
0053 
0054   /// Covariance matrix fo parameters()
0055   AlgebraicSymMatrix parametersError() const override;
0056 
0057   /// The projection matrix relates the trajectory state parameters to the segment parameters().
0058   AlgebraicMatrix projectionMatrix() const override;
0059 
0060   /// Local position in Chamber frame
0061   LocalPoint localPosition() const override { return thePosition; }
0062 
0063   /// Local position error in Chamber frame
0064   LocalError localPositionError() const override;
0065 
0066   /// Local direction in Chamber frame
0067   LocalVector localDirection() const override { return theDirection; }
0068 
0069   /// Local direction error in the Chamber frame
0070   LocalError localDirectionError() const override;
0071 
0072   // Chi2 of the segment fit
0073   double chi2() const override;
0074 
0075   // Degrees of freedom of the segment fit
0076   int degreesOfFreedom() const override;
0077 
0078   // Dimension (in parameter space)
0079   int dimension() const override { return theDimension; }
0080 
0081   // Access to component RecHits (if any)
0082   std::vector<const TrackingRecHit*> recHits() const override;
0083 
0084   // Non-const access to component RecHits (if any)
0085   std::vector<TrackingRecHit*> recHits() override;
0086 
0087   //--- Extension of the interface
0088 
0089   /// Does it have the Phi projection?
0090   bool hasPhi() const { return (theProjection == full || theProjection == phi); }
0091 
0092   /// Does it have the Z projection?
0093   bool hasZed() const { return (theProjection == full || theProjection == Z); }
0094 
0095   /// The superPhi segment: 0 if no phi projection available
0096   const DTChamberRecSegment2D* phiSegment() const { return hasPhi() ? &thePhiSeg : nullptr; }
0097 
0098   /// The Z segment: 0 if not zed projection available
0099   const DTSLRecSegment2D* zSegment() const { return hasZed() ? &theZedSeg : nullptr; }
0100 
0101   /// Set position
0102   void setPosition(LocalPoint pos) { thePosition = pos; }
0103 
0104   /// Set direction
0105   void setDirection(LocalVector dir) { theDirection = dir; }
0106 
0107   /// Set covariance matrix
0108   void setCovMatrix(const AlgebraicSymMatrix& mat) { theCovMatrix = mat; }
0109 
0110   /// The (specific) DetId of the chamber on which the segment resides
0111   virtual DTChamberId chamberId() const;
0112 
0113 private:
0114   /// Which projections are actually there
0115   enum Projection { full, phi, Z, none };
0116   Projection theProjection;
0117 
0118   /// the superPhi segment
0119   DTChamberRecSegment2D* phiSegment() { return &thePhiSeg; }
0120 
0121   /// the Z segment
0122   DTSLRecSegment2D* zSegment() { return &theZedSeg; }
0123 
0124   LocalPoint thePosition;    // in chamber frame
0125   LocalVector theDirection;  // in chamber frame
0126 
0127   void setCovMatrixForZed(const LocalPoint& posZInCh);
0128 
0129   // the covariance matrix, has the following meaning
0130   // mat[0][0]=sigma (dx/dz)
0131   // mat[1][1]=sigma (dy/dz)
0132   // mat[2][2]=sigma (x)
0133   // mat[3][3]=sigma (y)
0134   // mat[0][2]=cov(dx/dz,x)
0135   // mat[1][3]=cov(dy/dz,y)
0136   AlgebraicSymMatrix theCovMatrix;
0137 
0138   DTChamberRecSegment2D thePhiSeg;
0139   DTSLRecSegment2D theZedSeg;
0140 
0141   int theDimension;  // the dimension of this rechit
0142 };
0143 
0144 std::ostream& operator<<(std::ostream& os, const DTRecSegment4D& seg);
0145 
0146 #endif  // DTRecHit_DTRecSegment4D_h