00001 #ifndef DTSegment_DTSegmentCand_h
00002 #define DTSegment_DTSegmentCand_h
00003
00017
00018
00019
00020 #include "RecoLocalMuon/DTSegment/src/DTHitPairForFit.h"
00021
00022
00023 #include <vector>
00024 #include <set>
00025 #include <iostream>
00026
00027
00028
00029
00030
00031 class DTSLRecSegment2D;
00032 class DTChamberRecSegment2D;
00033 class DTChamber;
00034 class DTSuperLayer;
00035
00036 class DTSegmentCand{
00037
00038 public:
00039 struct AssPointLessZ ;
00040 typedef std::pair<DTHitPairForFit*, DTEnums::DTCellSide> AssPoint;
00041 typedef std::set<AssPoint, AssPointLessZ> AssPointCont;
00042
00044 DTSegmentCand(AssPointCont& hits,
00045 const DTSuperLayer* sl) ;
00046
00047 DTSegmentCand(AssPointCont hits,
00048 LocalPoint& position,
00049 LocalVector& direction,
00050 double chi2,
00051 AlgebraicSymMatrix covMat,
00052 const DTSuperLayer* sl);
00053
00055 ~DTSegmentCand() ;
00056
00057
00058 bool good() const ;
00059
00060 unsigned int nHits() const { return theHits.size(); }
00061
00063 double chi2() const {return theChi2; }
00064
00066 double chi2ndof() const {return theChi2/(nHits()-2.); }
00067
00069 bool operator==(const DTSegmentCand& seg);
00070
00072 bool operator<(const DTSegmentCand& seg);
00073
00074
00075
00076
00077
00078 LocalPoint position() const { return thePosition; }
00079
00080
00081 LocalVector direction() const { return theDirection;}
00082
00084 AlgebraicSymMatrix covMatrix() const {return theCovMatrix; }
00085
00086 unsigned int NDOF() const { return nHits()-2; }
00087
00089 void setPosition(LocalPoint& pos) { thePosition=pos; }
00090
00092 void setDirection(LocalVector& dir) { theDirection = dir ; }
00093
00095 void add(DTHitPairForFit* hit, DTEnums::DTCellSide code) ;
00096
00098 void removeHit(AssPoint hit) ;
00099
00101 void setChi2(double& chi2) { theChi2 = chi2 ;}
00102
00104 int nSharedHitPairs(const DTSegmentCand& seg) const;
00105
00108 AssPointCont conflictingHitPairs(const DTSegmentCand& seg) const;
00109
00111 void setCovMatrix(AlgebraicSymMatrix& cov) { theCovMatrix = cov; }
00112
00114 int nLayers() const ;
00115
00117 AssPointCont hits() const { return theHits;}
00118
00120
00121 operator DTSLRecSegment2D*() const;
00122
00123
00125 operator DTChamberRecSegment2D*() const;
00126
00127
00128 struct AssPointLessZ :
00129 public std::binary_function<const AssPoint&, const AssPoint&, bool> {
00130 public:
00131 bool operator()(const AssPoint& pt1,
00132 const AssPoint& pt2) const ;
00133 };
00134 protected:
00135
00136 private:
00137 const DTSuperLayer* theSL;
00138 LocalPoint thePosition;
00139 LocalVector theDirection;
00140 double theChi2;
00141
00145 AlgebraicSymMatrix theCovMatrix;
00146
00147
00148 AssPointCont theHits;
00149
00150 static double chi2max;
00151 static unsigned int nHitsMin;
00152 };
00153
00154 std::ostream& operator<<(std::ostream& out, const DTSegmentCand& seg) ;
00155 std::ostream& operator<<(std::ostream& out, const DTSegmentCand::AssPoint& hit) ;
00156 #endif // DTSegment_DTSegmentCand_h