00001 #ifndef CSCRecHit_CSCSegment_h 00002 #define CSCRecHit_CSCSegment_h 00003 00015 #include <DataFormats/TrackingRecHit/interface/RecSegment.h> 00016 #include <DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h> 00017 00018 #include <iosfwd> 00019 00020 class CSCDetId; 00021 00022 class CSCSegment : public RecSegment { 00023 00024 public: 00025 00027 CSCSegment() : theChi2(0.), aME11a_duplicate(false) {} 00028 00030 CSCSegment(std::vector<const CSCRecHit2D*> proto_segment, LocalPoint origin, 00031 LocalVector direction, AlgebraicSymMatrix errors, double chi2); 00032 00034 virtual ~CSCSegment(); 00035 00036 //--- Base class interface 00037 CSCSegment* clone() const { return new CSCSegment(*this); } 00038 00039 LocalPoint localPosition() const { return theOrigin; } 00040 LocalError localPositionError() const ; 00041 00042 LocalVector localDirection() const { return theLocalDirection; } 00043 LocalError localDirectionError() const ; 00044 00046 AlgebraicVector parameters() const; 00047 00049 AlgebraicSymMatrix parametersError() const { return theCovMatrix; } 00050 00052 virtual AlgebraicMatrix projectionMatrix() const; 00053 00054 virtual std::vector<const TrackingRecHit*> recHits() const; 00055 00056 virtual std::vector<TrackingRecHit*> recHits(); 00057 00058 double chi2() const { return theChi2; }; 00059 00060 virtual int dimension() const { return 4; } 00061 00062 virtual int degreesOfFreedom() const { return 2*nRecHits() - 4;} 00063 00064 //--- Extension of the interface 00065 00066 const std::vector<CSCRecHit2D>& specificRecHits() const { return theCSCRecHits; } 00067 00068 int nRecHits() const { return theCSCRecHits.size(); } 00069 00070 CSCDetId cscDetId() const { return geographicalId(); } 00071 00072 void setDuplicateSegments(std::vector<CSCSegment*>& duplicates); 00073 00074 bool isME11a_duplicate() const { return (theDuplicateSegments.size() > 0 ? true : false); } 00075 // a copy of the duplicated segments (ME1/1a only) 00076 const std::vector< CSCSegment> & duplicateSegments() const { return theDuplicateSegments; } 00077 00078 bool testSharesAllInSpecificRecHits( const std::vector<CSCRecHit2D>& specificRecHits_1, 00079 const std::vector<CSCRecHit2D>& specificRecHits_2, 00080 CSCRecHit2D::SharedInputType) const; 00081 00082 //bool sharesRecHits(CSCSegment & anotherSegment, CSCRecHit2D::SharedInputType); 00083 // checks if ALL the rechits share the specific input (allWires, allStrips or all) 00084 bool sharesRecHits(const CSCSegment & anotherSegment, CSCRecHit2D::SharedInputType sharesInput) const; 00085 // checks if ALL the rechits share SOME wire AND SOME strip input 00086 bool sharesRecHits(const CSCSegment & anotherSegment) const; 00087 00088 float time() const; 00089 00090 void print() const; 00091 00092 private: 00093 00094 std::vector<CSCRecHit2D> theCSCRecHits; 00095 LocalPoint theOrigin; // in chamber frame - the GeomDet local coordinate system 00096 LocalVector theLocalDirection; // in chamber frame - the GeomDet local coordinate system 00097 AlgebraicSymMatrix theCovMatrix; // the covariance matrix 00098 double theChi2; 00099 bool aME11a_duplicate; 00100 std::vector<CSCSegment> theDuplicateSegments;// ME1/1a only 00101 }; 00102 00103 std::ostream& operator<<(std::ostream& os, const CSCSegment& seg); 00104 00105 #endif // CSCRecHit_CSCSegment_h