Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:39:02

0001 #ifndef GEMRecHit_GEMCSCSegment_h
0002 #define GEMRecHit_GEMCSCSegment_h
0003 
0004 /** \class GEMCSCSegment
0005  *
0006  *  Based on CSCSegment class
0007  *  Describes a reconstructed track segment in the GEM + CSC chambers. 
0008  *  This is 4-dimensional since it has an origin (x,y) and a direction (x,y)
0009  *  in the local coordinate system of the (csc) chamber.
0010  *
0011  *  \author R. Radogna
0012  */
0013 
0014 #include "DataFormats/TrackingRecHit/interface/RecSegment.h"
0015 
0016 #include "DataFormats/GEMRecHit/interface/GEMRecHitCollection.h"
0017 #include "DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h"
0018 #include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h"
0019 
0020 #include <iosfwd>
0021 
0022 class CSCDetId;
0023 
0024 class GEMCSCSegment final : public RecSegment {
0025 public:
0026   /// Default constructor
0027   GEMCSCSegment() : theChi2(0.) {}
0028 
0029   /// Constructor
0030   GEMCSCSegment(const CSCSegment* csc_segment,
0031                 const std::vector<const GEMRecHit*> gem_rhs,
0032                 LocalPoint origin,
0033                 LocalVector direction,
0034                 AlgebraicSymMatrix errors,
0035                 double chi2);
0036 
0037   /// Destructor
0038   ~GEMCSCSegment() override;
0039 
0040   //--- Base class interface
0041   GEMCSCSegment* clone() const override { return new GEMCSCSegment(*this); }
0042 
0043   LocalPoint localPosition() const override { return theOrigin; }
0044   LocalError localPositionError() const override;
0045 
0046   LocalVector localDirection() const override { return theLocalDirection; }
0047   LocalError localDirectionError() const override;
0048 
0049   /// Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y )
0050   AlgebraicVector parameters() const override;
0051 
0052   /// Covariance matrix of parameters()
0053   AlgebraicSymMatrix parametersError() const override { return theCovMatrix; }
0054 
0055   /// The projection matrix relates the trajectory state parameters to the segment parameters().
0056   AlgebraicMatrix projectionMatrix() const override;
0057 
0058   double chi2() const override { return theChi2; };
0059 
0060   int dimension() const override { return 4; }
0061 
0062   int degreesOfFreedom() const override { return 2 * nRecHits() - 4; }
0063 
0064   int nRecHits() const { return (theGEMRecHits.size() + theCSCSegment.specificRecHits().size()); }
0065 
0066   //--- Return the constituents in different ways
0067   const CSCSegment cscSegment() const { return theCSCSegment; }
0068   const std::vector<GEMRecHit>& gemRecHits() const { return theGEMRecHits; }
0069   const std::vector<CSCRecHit2D>& cscRecHits() const { return theCSCSegment.specificRecHits(); }
0070   std::vector<const TrackingRecHit*> recHits() const override;
0071   std::vector<TrackingRecHit*> recHits() override;
0072 
0073   CSCDetId cscDetId() const { return geographicalId(); }
0074 
0075   void print() const;
0076 
0077 private:
0078   std::vector<GEMRecHit> theGEMRecHits;  // store GEM Rechits
0079   CSCSegment theCSCSegment;              // store CSC RecHits and store CSC Segment
0080                                          // eventually we have to disentangle if later on we decide
0081                                          // not to have a one-to-one relationship anymore
0082                                          // i.e. if we allow the GEMCSC segment to modify the
0083                                          // (selection of the rechits of the) CSC segment
0084   LocalPoint theOrigin;                  // in chamber frame - the GeomDet local coordinate system
0085   LocalVector theLocalDirection;         // in chamber frame - the GeomDet local coordinate system
0086   AlgebraicSymMatrix theCovMatrix;       // the covariance matrix
0087   double theChi2;
0088 };
0089 
0090 std::ostream& operator<<(std::ostream& os, const GEMCSCSegment& seg);
0091 
0092 #endif