Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:00

0001 #ifndef CSCRecHit_CSCSegment_h
0002 #define CSCRecHit_CSCSegment_h
0003 
0004 /** \class CSCSegment
0005  *  Describes a reconstructed track segment in the 6 layers of a CSC chamber. 
0006  *  This is 4-dimensional since it has an origin (x,y) and a direction (x,y)
0007  *  in the local coordinate system of the chamber.
0008  *
0009  *  \author Matteo Sani
0010  *  \author Rick Wilkinson
0011  *  \author Tim Cox
0012  */
0013 
0014 #include <DataFormats/TrackingRecHit/interface/RecSegment.h>
0015 #include <DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h>
0016 
0017 #include <iosfwd>
0018 
0019 class CSCDetId;
0020 
0021 class CSCSegment final : public RecSegment {
0022 public:
0023   /// Default constructor
0024   CSCSegment() : theChi2(0.), aME11a_duplicate(false) {}
0025 
0026   /// Constructor
0027   CSCSegment(const std::vector<const CSCRecHit2D*>& proto_segment,
0028              LocalPoint origin,
0029              LocalVector direction,
0030              const AlgebraicSymMatrix& errors,
0031              double chi2);
0032 
0033   /// Destructor
0034   ~CSCSegment() override;
0035 
0036   //--- Base class interface
0037   CSCSegment* clone() const override { return new CSCSegment(*this); }
0038 
0039   LocalPoint localPosition() const override { return theOrigin; }
0040   LocalError localPositionError() const override;
0041 
0042   LocalVector localDirection() const override { return theLocalDirection; }
0043   LocalError localDirectionError() const override;
0044 
0045   /// Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y )
0046   AlgebraicVector parameters() const override;
0047 
0048   /// Covariance matrix of parameters()
0049   AlgebraicSymMatrix parametersError() const override { return theCovMatrix; }
0050 
0051   /// The projection matrix relates the trajectory state parameters to the segment parameters().
0052   AlgebraicMatrix projectionMatrix() const override;
0053 
0054   std::vector<const TrackingRecHit*> recHits() const override;
0055 
0056   std::vector<TrackingRecHit*> recHits() 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   //--- Extension of the interface
0065 
0066   const std::vector<CSCRecHit2D>& specificRecHits() const { return theCSCRecHits; }
0067 
0068   int nRecHits() const { return theCSCRecHits.size(); }
0069 
0070   CSCDetId cscDetId() const { return geographicalId(); }
0071 
0072   void setDuplicateSegments(std::vector<CSCSegment*>& duplicates);
0073 
0074   bool isME11a_duplicate() const { return (!theDuplicateSegments.empty() ? true : false); }
0075   // a copy of the duplicated segments (ME1/1a only)
0076   const std::vector<CSCSegment>& duplicateSegments() const { return theDuplicateSegments; }
0077 
0078   bool testSharesAllInSpecificRecHits(const std::vector<CSCRecHit2D>& specificRecHits_1,
0079                                       const std::vector<CSCRecHit2D>& specificRecHits_2,
0080                                       CSCRecHit2D::SharedInputType) const;
0081 
0082   //bool sharesRecHits(CSCSegment  & anotherSegment, CSCRecHit2D::SharedInputType);
0083   // checks if ALL the rechits share the specific input (allWires, allStrips or all)
0084   bool sharesRecHits(const CSCSegment& anotherSegment, CSCRecHit2D::SharedInputType sharesInput) const;
0085   // checks if ALL the rechits share SOME wire AND SOME strip input
0086   bool sharesRecHits(const CSCSegment& anotherSegment) const;
0087 
0088   float time() const;
0089 
0090   void print() const;
0091 
0092 private:
0093   std::vector<CSCRecHit2D> theCSCRecHits;
0094   LocalPoint theOrigin;             // in chamber frame - the GeomDet local coordinate system
0095   LocalVector theLocalDirection;    // in chamber frame - the GeomDet local coordinate system
0096   AlgebraicSymMatrix theCovMatrix;  // the covariance matrix
0097   double theChi2;
0098   bool aME11a_duplicate;
0099   std::vector<CSCSegment> theDuplicateSegments;  // ME1/1a only
0100 };
0101 
0102 std::ostream& operator<<(std::ostream& os, const CSCSegment& seg);
0103 
0104 #endif  // CSCRecHit_CSCSegment_h