CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
35 public:
36  struct AssPointLessZ;
37  typedef std::pair<std::shared_ptr<DTHitPairForFit>, DTEnums::DTCellSide> AssPoint;
38  typedef std::set<AssPoint, AssPointLessZ> AssPointCont;
39 
42 
46  double chi2,
47  const AlgebraicSymMatrix& covMat,
48  const DTSuperLayer* sl);
49 
51  virtual ~DTSegmentCand();
52 
53  /* Operations */
54  virtual bool good() const;
55 
56  virtual bool hitsShareLayer() const;
57 
58  virtual unsigned int nHits() const { return theHits.size(); }
59 
61  virtual double chi2() const { return theChi2; }
62 
64  virtual double chi2ndof() const { return theChi2 / (nHits() - 2.); }
65 
67  virtual double t0() const { return thet0; }
68 
70  virtual bool operator==(const DTSegmentCand& seg);
71 
73  virtual bool operator<(const DTSegmentCand& seg);
74 
76  const DTSuperLayer* superLayer() const { return theSL; }
77 
78  // in SL frame
79  virtual LocalPoint position() const { return thePosition; }
80 
81  // in SL frame
82  virtual LocalVector direction() const { return theDirection; }
83 
85  virtual AlgebraicSymMatrix covMatrix() const { return theCovMatrix; }
86 
87  virtual unsigned int NDOF() const { return nHits() - 2; }
88 
90  virtual void setPosition(LocalPoint& pos) { thePosition = pos; }
91 
94 
96  virtual void add(AssPoint newHit);
97  virtual void add(std::shared_ptr<DTHitPairForFit> hit, DTEnums::DTCellSide code);
98 
100  virtual void removeHit(AssPoint hit);
101 
103  virtual void setChi2(double& chi2) { theChi2 = chi2; }
104 
106  virtual void sett0(double& t0) { thet0 = t0; }
107 
109  virtual int nSharedHitPairs(const DTSegmentCand& seg) const;
110 
113  virtual AssPointCont conflictingHitPairs(const DTSegmentCand& seg) const;
114 
116  virtual void setCovMatrix(AlgebraicSymMatrix& cov) { theCovMatrix = cov; }
117 
119  virtual int nLayers() const;
120 
122  virtual const AssPointCont& hits() const { return theHits; }
123 
125  // DTSLRecSegment2D* convert() const;
126  operator DTSLRecSegment2D*() const;
127 
129  operator DTChamberRecSegment2D*() const;
130 
131  struct AssPointLessZ {
132  public:
133  bool operator()(const AssPoint& pt1, const AssPoint& pt2) const;
134  };
135 
136 private:
137  const DTSuperLayer* theSL; // the SL
138  LocalPoint thePosition; // in SL frame
139  LocalVector theDirection; // in SL frame
140  double theChi2; // chi2 of the fit
141  double thet0; // the t0 offset
142 
146  AlgebraicSymMatrix theCovMatrix; // the covariance matrix
147 
148  AssPointCont theHits; // the used hits
149 
150 protected:
151  static const double chi2max; // to be tuned!!
152  static const unsigned int nHitsMin; // to be tuned!!
153 };
154 
155 std::ostream& operator<<(std::ostream& out, const DTSegmentCand& seg);
156 std::ostream& operator<<(std::ostream& out, const DTSegmentCand::AssPoint& hit);
157 #endif // DTSegment_DTSegmentCand_h
std::pair< std::shared_ptr< DTHitPairForFit >, DTEnums::DTCellSide > AssPoint
Definition: DTSegmentCand.h:36
virtual double chi2ndof() const
the chi2/NDOF of the fit
Definition: DTSegmentCand.h:64
virtual AlgebraicSymMatrix covMatrix() const
the covariance matrix
Definition: DTSegmentCand.h:85
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
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
virtual bool good() const
virtual unsigned int NDOF() const
Definition: DTSegmentCand.h:87
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:61
const DTSuperLayer * superLayer() const
the super layer on which relies
Definition: DTSegmentCand.h:76
const DTSuperLayer * theSL
virtual AssPointCont conflictingHitPairs(const DTSegmentCand &seg) const
std::set< AssPoint, AssPointLessZ > AssPointCont
Definition: DTSegmentCand.h:38
virtual void sett0(double &t0)
set t0
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:58
virtual double t0() const
the t0 of the segment
Definition: DTSegmentCand.h:67
virtual LocalPoint position() const
Definition: DTSegmentCand.h:79
LocalPoint thePosition
virtual void setDirection(LocalVector &dir)
set direction
Definition: DTSegmentCand.h:93
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
virtual void setPosition(LocalPoint &pos)
set position
Definition: DTSegmentCand.h:90
virtual LocalVector direction() const
Definition: DTSegmentCand.h:82