CMS 3D CMS Logo

DTSegmentCand.h
Go to the documentation of this file.
1 #ifndef DTSegment_DTSegmentCand_h
2 #define DTSegment_DTSegmentCand_h
3 
15 /* Base Class Headers */
16 
17 /* Collaborating Class Declarations */
19 
20 /* C++ Headers */
21 #include <vector>
22 #include <set>
23 #include <iostream>
24 
25 /* ====================================================================== */
26 
27 /* Class DTSegmentCand Interface */
28 
29 class DTSLRecSegment2D;
31 class DTChamber;
32 class DTSuperLayer;
33 
34 
36 
37  public:
38  struct AssPointLessZ ;
39  typedef std::pair<std::shared_ptr<DTHitPairForFit>, DTEnums::DTCellSide> AssPoint;
40  typedef std::set<AssPoint, AssPointLessZ> AssPointCont;
41 
43  DTSegmentCand(AssPointCont& hits,
44  const DTSuperLayer* sl) ;
45 
46  DTSegmentCand(const AssPointCont& hits,
49  double chi2,
50  const AlgebraicSymMatrix& covMat,
51  const DTSuperLayer* sl);
52 
54  virtual ~DTSegmentCand() ;
55 
56 /* Operations */
57  virtual bool good() const ;
58 
59  virtual bool hitsShareLayer() const;
60 
61  virtual unsigned int nHits() const { return theHits.size(); }
62 
64  virtual double chi2() const { return theChi2; }
65 
67  virtual double chi2ndof() const { return theChi2/(nHits()-2.); }
68 
70  virtual double t0() const { return thet0; }
71 
73  virtual bool operator==(const DTSegmentCand& seg);
74 
76  virtual bool operator<(const DTSegmentCand& seg);
77 
79  const DTSuperLayer* superLayer() const {return theSL;}
80 
81  // in SL frame
82  virtual LocalPoint position() const { return thePosition; }
83 
84  // in SL frame
85  virtual LocalVector direction() const { return theDirection;}
86 
88  virtual AlgebraicSymMatrix covMatrix() const {return theCovMatrix; }
89 
90  virtual unsigned int NDOF() const { return nHits()-2; }
91 
93  virtual void setPosition(LocalPoint& pos) { thePosition=pos; }
94 
97 
99  virtual void add(AssPoint newHit) ;
100  virtual void add(std::shared_ptr<DTHitPairForFit> hit, DTEnums::DTCellSide code) ;
101 
103  virtual void removeHit(AssPoint hit) ;
104 
106  virtual void setChi2(double& chi2) { theChi2 = chi2; }
107 
109  virtual void sett0(double& t0) { thet0 = t0; }
110 
112  virtual int nSharedHitPairs(const DTSegmentCand& seg) const;
113 
116  virtual AssPointCont conflictingHitPairs(const DTSegmentCand& seg) const;
117 
119  virtual void setCovMatrix(AlgebraicSymMatrix& cov) { theCovMatrix = cov; }
120 
122  virtual int nLayers() const ;
123 
125  virtual const AssPointCont& hits() const { return theHits;}
126 
128  // DTSLRecSegment2D* convert() const;
129  operator DTSLRecSegment2D*() const;
130 
131 
133  operator DTChamberRecSegment2D*() const;
134 
135  struct AssPointLessZ {
136  public:
137  bool operator()(const AssPoint& pt1,
138  const AssPoint& pt2) const ;
139  };
140 
141  private:
142  const DTSuperLayer* theSL; // the SL
143  LocalPoint thePosition; // in SL frame
144  LocalVector theDirection; // in SL frame
145  double theChi2; // chi2 of the fit
146  double thet0; // the t0 offset
147 
151  AlgebraicSymMatrix theCovMatrix; // the covariance matrix
152 
153  AssPointCont theHits; // the used hits
154 
155  protected:
156  static const double chi2max; // to be tuned!!
157  static const unsigned int nHitsMin; // to be tuned!!
158 };
159 
160 std::ostream& operator<<(std::ostream& out, const DTSegmentCand& seg) ;
161 std::ostream& operator<<(std::ostream& out, const DTSegmentCand::AssPoint& hit) ;
162 #endif // DTSegment_DTSegmentCand_h
std::pair< std::shared_ptr< DTHitPairForFit >, DTEnums::DTCellSide > AssPoint
Definition: DTSegmentCand.h:38
virtual double chi2ndof() const
the chi2/NDOF of the fit
Definition: DTSegmentCand.h:67
virtual AlgebraicSymMatrix covMatrix() const
the covariance matrix
Definition: DTSegmentCand.h:88
virtual const AssPointCont & hits() const
the used hits
DTCellSide
Which side of the DT cell.
Definition: DTEnums.h:15
virtual void setChi2(double &chi2)
set chi2
virtual bool good() const
virtual unsigned int NDOF() const
Definition: DTSegmentCand.h:90
static const unsigned int nHitsMin
DTSegmentCand(AssPointCont &hits, const DTSuperLayer *sl)
Constructor.
AlgebraicSymMatrix theCovMatrix
virtual bool operator==(const DTSegmentCand &seg)
equality operator based on position, direction, chi2 and nHits
virtual bool hitsShareLayer() const
virtual void add(AssPoint newHit)
add hits to the hit list.
virtual bool operator<(const DTSegmentCand &seg)
less operator based on nHits and chi2
AssPointCont theHits
virtual void setCovMatrix(AlgebraicSymMatrix &cov)
set the cov matrix
static const double chi2max
bool operator()(const AssPoint &pt1, const AssPoint &pt2) const
virtual int nLayers() const
number of different layers with hits
virtual double chi2() const
the chi2 (NOT chi2/NDOF) of the fit
Definition: DTSegmentCand.h:64
const DTSuperLayer * superLayer() const
the super layer on which relies
Definition: DTSegmentCand.h:79
const DTSuperLayer * theSL
virtual AssPointCont conflictingHitPairs(const DTSegmentCand &seg) const
std::set< AssPoint, AssPointLessZ > AssPointCont
Definition: DTSegmentCand.h:40
virtual void sett0(double &t0)
set t0
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:61
virtual double t0() const
the t0 of the segment
Definition: DTSegmentCand.h:70
virtual LocalPoint position() const
Definition: DTSegmentCand.h:82
LocalPoint thePosition
virtual void setDirection(LocalVector &dir)
set direction
Definition: DTSegmentCand.h:96
virtual void removeHit(AssPoint hit)
remove hit from the candidate
CLHEP::HepSymMatrix AlgebraicSymMatrix
virtual ~DTSegmentCand()
Destructor.
virtual int nSharedHitPairs(const DTSegmentCand &seg) const
number of shared hit pair with other segment candidate
LocalVector theDirection
dbl *** dir
Definition: mlp_gen.cc:35
virtual void setPosition(LocalPoint &pos)
set position
Definition: DTSegmentCand.h:93
virtual LocalVector direction() const
Definition: DTSegmentCand.h:85
std::ostream & operator<<(std::ostream &out, const DTSegmentCand &seg)