File indexing completed on 2024-07-18 23:17:57
0001 #ifndef DTSegment_DTSegmentCand_h
0002 #define DTSegment_DTSegmentCand_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include "RecoLocalMuon/DTSegment/src/DTHitPairForFit.h"
0019
0020
0021 #include <vector>
0022 #include <set>
0023 #include <iostream>
0024
0025
0026
0027
0028
0029 class DTSLRecSegment2D;
0030 class DTChamberRecSegment2D;
0031 class DTChamber;
0032 class DTSuperLayer;
0033
0034 class DTSegmentCand {
0035 public:
0036 struct AssPointLessZ;
0037 typedef std::pair<std::shared_ptr<DTHitPairForFit>, DTEnums::DTCellSide> AssPoint;
0038 typedef std::set<AssPoint, AssPointLessZ> AssPointCont;
0039
0040
0041 DTSegmentCand(AssPointCont& hits, const DTSuperLayer* sl);
0042
0043 DTSegmentCand(const AssPointCont& hits,
0044 LocalPoint& position,
0045 LocalVector& direction,
0046 double chi2,
0047 const AlgebraicSymMatrix& covMat,
0048 const DTSuperLayer* sl);
0049
0050
0051 virtual ~DTSegmentCand();
0052
0053
0054 virtual bool good() const;
0055
0056 virtual bool hitsShareLayer() const;
0057
0058 virtual unsigned int nHits() const { return theHits.size(); }
0059
0060
0061 virtual double chi2() const { return theChi2; }
0062
0063
0064 virtual double chi2ndof() const { return theChi2 / (nHits() - 2.); }
0065
0066
0067 virtual double t0() const { return thet0; }
0068
0069
0070 virtual bool operator==(const DTSegmentCand& seg) const;
0071
0072
0073 virtual bool operator<(const DTSegmentCand& seg) const;
0074
0075
0076 const DTSuperLayer* superLayer() const { return theSL; }
0077
0078
0079 virtual LocalPoint position() const { return thePosition; }
0080
0081
0082 virtual LocalVector direction() const { return theDirection; }
0083
0084
0085 virtual AlgebraicSymMatrix covMatrix() const { return theCovMatrix; }
0086
0087 virtual unsigned int NDOF() const { return nHits() - 2; }
0088
0089
0090 virtual void setPosition(LocalPoint& pos) { thePosition = pos; }
0091
0092
0093 virtual void setDirection(LocalVector& dir) { theDirection = dir; }
0094
0095
0096 virtual void add(AssPoint newHit);
0097 virtual void add(std::shared_ptr<DTHitPairForFit> hit, DTEnums::DTCellSide code);
0098
0099
0100 virtual void removeHit(AssPoint hit);
0101
0102
0103 virtual void setChi2(double& chi2) { theChi2 = chi2; }
0104
0105
0106 virtual void sett0(double& t0) { thet0 = t0; }
0107
0108
0109 virtual int nSharedHitPairs(const DTSegmentCand& seg) const;
0110
0111
0112
0113 virtual AssPointCont conflictingHitPairs(const DTSegmentCand& seg) const;
0114
0115
0116 virtual void setCovMatrix(AlgebraicSymMatrix& cov) { theCovMatrix = cov; }
0117
0118
0119 virtual int nLayers() const;
0120
0121
0122 virtual const AssPointCont& hits() const { return theHits; }
0123
0124
0125
0126 operator DTSLRecSegment2D*() const;
0127
0128
0129 operator DTChamberRecSegment2D*() const;
0130
0131 struct AssPointLessZ {
0132 public:
0133 bool operator()(const AssPoint& pt1, const AssPoint& pt2) const;
0134 };
0135
0136 private:
0137 const DTSuperLayer* theSL;
0138 LocalPoint thePosition;
0139 LocalVector theDirection;
0140 double theChi2;
0141 double thet0;
0142
0143
0144
0145
0146 AlgebraicSymMatrix theCovMatrix;
0147
0148 AssPointCont theHits;
0149
0150 protected:
0151 static const double chi2max;
0152 static const unsigned int nHitsMin;
0153 };
0154
0155 std::ostream& operator<<(std::ostream& out, const DTSegmentCand& seg);
0156 std::ostream& operator<<(std::ostream& out, const DTSegmentCand::AssPoint& hit);
0157 #endif