CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Static Protected Attributes | Private Attributes
DTSegmentCand Class Reference

#include <DTSegmentCand.h>

Inheritance diagram for DTSegmentCand:
DTSegmentExtendedCand

Classes

struct  AssPointLessZ
 

Public Types

typedef std::pair
< std::shared_ptr
< DTHitPairForFit >
, DTEnums::DTCellSide
AssPoint
 
typedef std::set< AssPoint,
AssPointLessZ
AssPointCont
 

Public Member Functions

virtual void add (AssPoint newHit)
 add hits to the hit list. More...
 
virtual void add (std::shared_ptr< DTHitPairForFit > hit, DTEnums::DTCellSide code)
 
virtual double chi2 () const
 the chi2 (NOT chi2/NDOF) of the fit More...
 
virtual double chi2ndof () const
 the chi2/NDOF of the fit More...
 
virtual AssPointCont conflictingHitPairs (const DTSegmentCand &seg) const
 
virtual AlgebraicSymMatrix covMatrix () const
 the covariance matrix More...
 
virtual LocalVector direction () const
 
 DTSegmentCand (AssPointCont &hits, const DTSuperLayer *sl)
 Constructor. More...
 
 DTSegmentCand (const AssPointCont &hits, LocalPoint &position, LocalVector &direction, double chi2, const AlgebraicSymMatrix &covMat, const DTSuperLayer *sl)
 
virtual bool good () const
 
virtual const AssPointConthits () const
 the used hits More...
 
virtual bool hitsShareLayer () const
 
virtual unsigned int NDOF () const
 
virtual unsigned int nHits () const
 
virtual int nLayers () const
 number of different layers with hits More...
 
virtual int nSharedHitPairs (const DTSegmentCand &seg) const
 number of shared hit pair with other segment candidate More...
 
 operator DTChamberRecSegment2D * () const
 convert this DTSegmentCand into a DTChamberRecSegment2D More...
 
 operator DTSLRecSegment2D * () const
 convert this DTSegmentCand into a DTRecSegment2D More...
 
virtual bool operator< (const DTSegmentCand &seg)
 less operator based on nHits and chi2 More...
 
virtual bool operator== (const DTSegmentCand &seg)
 equality operator based on position, direction, chi2 and nHits More...
 
virtual LocalPoint position () const
 
virtual void removeHit (AssPoint hit)
 remove hit from the candidate More...
 
virtual void setChi2 (double &chi2)
 set chi2 More...
 
virtual void setCovMatrix (AlgebraicSymMatrix &cov)
 set the cov matrix More...
 
virtual void setDirection (LocalVector &dir)
 set direction More...
 
virtual void setPosition (LocalPoint &pos)
 set position More...
 
virtual void sett0 (double &t0)
 set t0 More...
 
const DTSuperLayersuperLayer () const
 the super layer on which relies More...
 
virtual double t0 () const
 the t0 of the segment More...
 
virtual ~DTSegmentCand ()
 Destructor. More...
 

Static Protected Attributes

static const double chi2max = 20.
 
static const unsigned int nHitsMin = 3
 

Private Attributes

double theChi2
 
AlgebraicSymMatrix theCovMatrix
 
LocalVector theDirection
 
AssPointCont theHits
 
LocalPoint thePosition
 
const DTSuperLayertheSL
 
double thet0
 

Detailed Description

A Candidate for a DT segment. It's used by the algorithm to build segments and store relative information. It must be transformed into a DTSegment for further use.

Author
Stefano Lacaprara - INFN Legnaro stefa.nosp@m.no.l.nosp@m.acapr.nosp@m.ara@.nosp@m.pd.in.nosp@m.fn.i.nosp@m.t
Riccardo Bellan - INFN TO ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 34 of file DTSegmentCand.h.

Member Typedef Documentation

typedef std::pair<std::shared_ptr<DTHitPairForFit>, DTEnums::DTCellSide> DTSegmentCand::AssPoint

Definition at line 36 of file DTSegmentCand.h.

Definition at line 38 of file DTSegmentCand.h.

Constructor & Destructor Documentation

DTSegmentCand::DTSegmentCand ( AssPointCont hits,
const DTSuperLayer sl 
)

Constructor.

Definition at line 23 of file DTSegmentCand.cc.

23 : theSL(sl), theChi2(-1.), theHits(hits) {}
virtual const AssPointCont & hits() const
the used hits
AssPointCont theHits
const DTSuperLayer * theSL
DTSegmentCand::DTSegmentCand ( const AssPointCont hits,
LocalPoint position,
LocalVector direction,
double  chi2,
const AlgebraicSymMatrix covMat,
const DTSuperLayer sl 
)

Definition at line 25 of file DTSegmentCand.cc.

31  : theSL(sl), thePosition(position), theDirection(direction), theChi2(chi2), theCovMatrix(covMat), theHits(hits) {}
virtual const AssPointCont & hits() const
the used hits
AlgebraicSymMatrix theCovMatrix
AssPointCont theHits
virtual double chi2() const
the chi2 (NOT chi2/NDOF) of the fit
Definition: DTSegmentCand.h:61
const DTSuperLayer * theSL
LocalPoint thePosition
LocalVector theDirection
DTSegmentCand::~DTSegmentCand ( )
virtual

Destructor.

Definition at line 34 of file DTSegmentCand.cc.

34 {}

Member Function Documentation

void DTSegmentCand::add ( AssPoint  newHit)
virtual

add hits to the hit list.

Definition at line 58 of file DTSegmentCand.cc.

References theHits.

Referenced by DTMeantimerPatternReco::addHits(), and counter.Counter::register().

58 { theHits.insert(newHit); }
AssPointCont theHits
void DTSegmentCand::add ( std::shared_ptr< DTHitPairForFit hit,
DTEnums::DTCellSide  code 
)
virtual

Definition at line 60 of file DTSegmentCand.cc.

References theHits.

Referenced by counter.Counter::register().

60  {
61  AssPoint newHit(hit, code);
62  theHits.insert(newHit);
63 }
std::pair< std::shared_ptr< DTHitPairForFit >, DTEnums::DTCellSide > AssPoint
Definition: DTSegmentCand.h:36
AssPointCont theHits
virtual double DTSegmentCand::chi2 ( void  ) const
inlinevirtual

the chi2 (NOT chi2/NDOF) of the fit

Definition at line 61 of file DTSegmentCand.h.

References theChi2.

Referenced by DTMeantimerPatternReco::addHits(), DTMeantimerPatternReco::fitWithT0(), good(), operator<(), operator<<(), operator==(), and setChi2().

61 { return theChi2; }
virtual double DTSegmentCand::chi2ndof ( ) const
inlinevirtual

the chi2/NDOF of the fit

Definition at line 64 of file DTSegmentCand.h.

References nHits(), and theChi2.

Referenced by DTMeantimerPatternReco::checkDoubleCandidates().

64 { return theChi2 / (nHits() - 2.); }
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:58
DTSegmentCand::AssPointCont DTSegmentCand::conflictingHitPairs ( const DTSegmentCand seg) const
virtual

return the hits shared with other segment and with confliction L/R assignment

Definition at line 82 of file DTSegmentCand.cc.

References mps_fire::result, and theHits.

82  {
84  const AssPointCont& hits2 = seg.theHits;
85 
86  // if (nSharedHitPairs(seg)==0) return result;
87 
88  AssPointCont::const_iterator hitBegin2 = hits2.begin(), hitEnd2 = hits2.end();
89  for (AssPointCont::const_iterator hit = theHits.begin(), hitEnd = theHits.end(); hit != hitEnd; ++hit) {
90  for (AssPointCont::const_iterator hit2 = hitBegin2; hit2 != hitEnd2; ++hit2) {
91  if ((*(*hit).first) == (*(*hit2).first) && (*hit).second != (*hit2).second) {
92  result.insert(*hit);
93  continue;
94  }
95  }
96  }
97  return result;
98 }
tuple result
Definition: mps_fire.py:311
AssPointCont theHits
std::set< AssPoint, AssPointLessZ > AssPointCont
Definition: DTSegmentCand.h:38
virtual AlgebraicSymMatrix DTSegmentCand::covMatrix ( ) const
inlinevirtual

the covariance matrix

Definition at line 85 of file DTSegmentCand.h.

References theCovMatrix.

85 { return theCovMatrix; }
AlgebraicSymMatrix theCovMatrix
virtual LocalVector DTSegmentCand::direction ( ) const
inlinevirtual

Definition at line 82 of file DTSegmentCand.h.

References theDirection.

Referenced by operator<<(), and operator==().

82 { return theDirection; }
LocalVector theDirection
bool DTSegmentCand::good ( ) const
virtual

Reimplemented in DTSegmentExtendedCand.

Definition at line 100 of file DTSegmentCand.cc.

References chi2(), chi2max, hitsShareLayer(), NDOF(), nHits(), and nHitsMin.

Referenced by DTMeantimerPatternReco::addHits(), and DTCombinatorialPatternReco::buildSegments().

100  {
101  // std::cout << NDOF() << " " << chi2()/NDOF() << " " << nHits() << std::endl;
102  if (NDOF() == 0)
103  return false;
104  if (chi2() / NDOF() > chi2max || nHits() < nHitsMin)
105  return false;
106 
107  if (nHits() == nHitsMin && hitsShareLayer())
108  return false;
109 
110  return true;
111 }
virtual unsigned int NDOF() const
Definition: DTSegmentCand.h:87
static const unsigned int nHitsMin
virtual bool hitsShareLayer() const
static const double chi2max
virtual double chi2() const
the chi2 (NOT chi2/NDOF) of the fit
Definition: DTSegmentCand.h:61
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:58
virtual const AssPointCont& DTSegmentCand::hits ( void  ) const
inlinevirtual

the used hits

Definition at line 122 of file DTSegmentCand.h.

References theHits.

Referenced by DTSegmentUpdator::fit(), and nSharedHitPairs().

122 { return theHits; }
AssPointCont theHits
bool DTSegmentCand::hitsShareLayer ( ) const
virtual

Definition at line 113 of file DTSegmentCand.cc.

References mps_fire::i, dqmiolumiharvest::j, and theHits.

Referenced by good().

113  {
114  const unsigned int hitsSize = theHits.size();
115  // we don't expect so many 1D hits, if such a segment arrives just drop it
116  if (hitsSize > 20)
117  return false;
118 
119  int layerN[hitsSize];
120  unsigned int i = 0;
121  for (DTSegmentCand::AssPointCont::iterator assHit = theHits.begin(); assHit != theHits.end(); ++assHit) {
122  layerN[i] = (*assHit).first->id().layerId().layer() + 10 * (*assHit).first->id().superlayerId().superlayer();
123  for (unsigned int j = 0; j < i; j++) {
124  if (layerN[i] == layerN[j])
125  return true;
126  }
127  i++;
128  }
129 
130  return false;
131 }
AssPointCont theHits
virtual unsigned int DTSegmentCand::NDOF ( ) const
inlinevirtual

Definition at line 87 of file DTSegmentCand.h.

References nHits().

Referenced by good().

87 { return nHits() - 2; }
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:58
virtual unsigned int DTSegmentCand::nHits ( void  ) const
inlinevirtual
int DTSegmentCand::nLayers ( ) const
virtual

number of different layers with hits

Definition at line 133 of file DTSegmentCand.cc.

133  {
134  // TODO
135  return 0;
136 }
int DTSegmentCand::nSharedHitPairs ( const DTSegmentCand seg) const
virtual

number of shared hit pair with other segment candidate

Definition at line 67 of file DTSegmentCand.cc.

References hits(), mps_fire::result, and theHits.

67  {
68  int result = 0;
69 
70  for (AssPointCont::const_iterator hit = theHits.begin(); hit != theHits.end(); ++hit) {
71  for (AssPointCont::const_iterator hit2 = seg.hits().begin(); hit2 != seg.hits().end(); ++hit2) {
72  // if(result) return result ; // TODO, uncomm this line or move it in another func
73  if ((*(*hit).first) == (*(*hit2).first)) {
74  ++result;
75  continue;
76  }
77  }
78  }
79  return result;
80 }
virtual const AssPointCont & hits() const
the used hits
tuple result
Definition: mps_fire.py:311
AssPointCont theHits
DTSegmentCand::operator DTChamberRecSegment2D * ( ) const

convert this DTSegmentCand into a DTChamberRecSegment2D

Definition at line 161 of file DTSegmentCand.cc.

References HLT_FULL_cff::chi2, funct::cos(), phase1PixelTopology::layer, position, PV3DBase< T, PVType, FrameType >::theta(), toLocal(), and PV3DBase< T, PVType, FrameType >::z().

161  {
162  // input position and direction are in sl frame, while must be stored in
163  // chamber one: so I have to extrapolate the position (along the direction) to
164  // the chamber reference plane.
165 
168 
169  LocalPoint pos = posInCh + dirInCh * posInCh.z() / cos(dirInCh.theta());
170 
171  double seg2DChi2 = chi2();
172  AlgebraicSymMatrix seg2DCovMatrix = covMatrix();
173 
174  std::vector<DTRecHit1D> hits1D;
175  for (DTSegmentCand::AssPointCont::iterator assHit = theHits.begin(); assHit != theHits.end(); ++assHit) {
176  GlobalPoint hitGlobalPos = theSL->toGlobal((*assHit).first->localPosition((*assHit).second));
177 
178  LocalPoint hitPosInLayer = theSL->chamber()
179  ->superLayer((*assHit).first->id().superlayerId())
180  ->layer((*assHit).first->id().layerId())
181  ->toLocal(hitGlobalPos);
182 
183  DTRecHit1D hit(((*assHit).first)->id(),
184  (*assHit).second,
185  ((*assHit).first)->digiTime(),
186  hitPosInLayer,
187  ((*assHit).first)->localPositionError());
188  hits1D.push_back(hit);
189  }
190 
191  return new DTChamberRecSegment2D(theSL->chamber()->id(), pos, dirInCh, seg2DCovMatrix, seg2DChi2, hits1D);
192 
193  // chamber and Phi SLs' frame are oriented in the same way, only a transaltion,
194  // so the covariance matrix is the same!
195 }
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return the superlayer corresponding to the given id.
Definition: DTChamber.cc:53
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
virtual AlgebraicSymMatrix covMatrix() const
the covariance matrix
Definition: DTSegmentCand.h:85
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
constexpr std::array< uint8_t, layerIndexSize > layer
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
AssPointCont theHits
DTChamberId id() const
Return the DTChamberId of this chamber.
Definition: DTChamber.cc:32
T z() const
Definition: PV3DBase.h:61
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual double chi2() const
the chi2 (NOT chi2/NDOF) of the fit
Definition: DTSegmentCand.h:61
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
const DTSuperLayer * theSL
virtual LocalPoint position() const
Definition: DTSegmentCand.h:79
const DTChamber * chamber() const
Definition: DTSuperLayer.cc:52
CLHEP::HepSymMatrix AlgebraicSymMatrix
virtual LocalVector direction() const
Definition: DTSegmentCand.h:82
DTSegmentCand::operator DTSLRecSegment2D * ( ) const

convert this DTSegmentCand into a DTRecSegment2D

Definition at line 138 of file DTSegmentCand.cc.

References HLT_FULL_cff::chi2, position, and toLocal().

138  {
139  LocalPoint seg2Dposition = position();
140  LocalVector seg2DDirection = direction();
141  double seg2DChi2 = chi2();
142  AlgebraicSymMatrix seg2DCovMatrix = covMatrix();
143 
144  std::vector<DTRecHit1D> hits1D;
145  for (DTSegmentCand::AssPointCont::iterator assHit = theHits.begin(); assHit != theHits.end(); ++assHit) {
146  GlobalPoint hitGlobalPos = theSL->toGlobal((*assHit).first->localPosition((*assHit).second));
147 
148  LocalPoint hitPosInLayer = theSL->layer((*assHit).first->id().layerId())->toLocal(hitGlobalPos);
149 
150  DTRecHit1D hit(((*assHit).first)->id(),
151  (*assHit).second,
152  ((*assHit).first)->digiTime(),
153  hitPosInLayer,
154  ((*assHit).first)->localPositionError());
155  hits1D.push_back(hit);
156  }
157 
158  return new DTSLRecSegment2D(theSL->id(), seg2Dposition, seg2DDirection, seg2DCovMatrix, seg2DChi2, hits1D);
159 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
virtual AlgebraicSymMatrix covMatrix() const
the covariance matrix
Definition: DTSegmentCand.h:85
const DTLayer * layer(const DTLayerId &id) const
Return the layer corresponding to the given id.
Definition: DTSuperLayer.cc:54
DTSuperLayerId id() const
Return the DetId of this SL.
Definition: DTSuperLayer.cc:34
AssPointCont theHits
virtual double chi2() const
the chi2 (NOT chi2/NDOF) of the fit
Definition: DTSegmentCand.h:61
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
const DTSuperLayer * theSL
virtual LocalPoint position() const
Definition: DTSegmentCand.h:79
CLHEP::HepSymMatrix AlgebraicSymMatrix
virtual LocalVector direction() const
Definition: DTSegmentCand.h:82
bool DTSegmentCand::operator< ( const DTSegmentCand seg)
virtual

less operator based on nHits and chi2

Definition at line 52 of file DTSegmentCand.cc.

References chi2(), and nHits().

52  {
53  if (nHits() == seg.nHits())
54  return (chi2() > seg.chi2());
55  return (nHits() < seg.nHits());
56 }
virtual double chi2() const
the chi2 (NOT chi2/NDOF) of the fit
Definition: DTSegmentCand.h:61
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:58
bool DTSegmentCand::operator== ( const DTSegmentCand seg)
virtual

equality operator based on position, direction, chi2 and nHits

Definition at line 37 of file DTSegmentCand.cc.

References chi2(), direction(), geometryDiff::epsilon, nHits(), position(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

37  {
38  static const double epsilon = 0.00001;
39  if (nHits() != seg.nHits())
40  return false;
41  if (fabs(chi2() - seg.chi2()) > epsilon)
42  return false;
43  if (fabs(position().x() - seg.position().x()) > epsilon || fabs(position().y() - seg.position().y()) > epsilon ||
44  fabs(position().z() - seg.position().z()) > epsilon)
45  return false;
46  if (fabs(direction().x() - seg.direction().x()) > epsilon || fabs(direction().y() - seg.direction().y()) > epsilon ||
47  fabs(direction().z() - seg.direction().z()) > epsilon)
48  return false;
49  return true;
50 }
T y() const
Definition: PV3DBase.h:60
T z() const
Definition: PV3DBase.h:61
virtual double chi2() const
the chi2 (NOT chi2/NDOF) of the fit
Definition: DTSegmentCand.h:61
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:58
virtual LocalPoint position() const
Definition: DTSegmentCand.h:79
T x() const
Definition: PV3DBase.h:59
virtual LocalVector direction() const
Definition: DTSegmentCand.h:82
virtual LocalPoint DTSegmentCand::position ( ) const
inlinevirtual

Definition at line 79 of file DTSegmentCand.h.

References thePosition.

Referenced by operator<<(), and operator==().

79 { return thePosition; }
LocalPoint thePosition
void DTSegmentCand::removeHit ( AssPoint  hit)
virtual

remove hit from the candidate

Definition at line 65 of file DTSegmentCand.cc.

References theHits.

Referenced by DTMeantimerPatternReco::addHits(), and DTSegmentCleaner::solveConflict().

65 { theHits.erase(badHit); }
AssPointCont theHits
virtual void DTSegmentCand::setChi2 ( double &  chi2)
inlinevirtual

set chi2

Definition at line 103 of file DTSegmentCand.h.

References chi2(), and theChi2.

Referenced by DTSegmentUpdator::fit().

103 { theChi2 = chi2; }
virtual double chi2() const
the chi2 (NOT chi2/NDOF) of the fit
Definition: DTSegmentCand.h:61
virtual void DTSegmentCand::setCovMatrix ( AlgebraicSymMatrix cov)
inlinevirtual

set the cov matrix

Definition at line 116 of file DTSegmentCand.h.

References theCovMatrix.

Referenced by DTSegmentUpdator::fit().

116 { theCovMatrix = cov; }
AlgebraicSymMatrix theCovMatrix
virtual void DTSegmentCand::setDirection ( LocalVector dir)
inlinevirtual

set direction

Definition at line 93 of file DTSegmentCand.h.

References DeadROC_duringRun::dir, and theDirection.

Referenced by DTSegmentUpdator::fit().

93 { theDirection = dir; }
LocalVector theDirection
virtual void DTSegmentCand::setPosition ( LocalPoint pos)
inlinevirtual

set position

Definition at line 90 of file DTSegmentCand.h.

References thePosition.

Referenced by DTSegmentUpdator::fit().

90 { thePosition = pos; }
LocalPoint thePosition
virtual void DTSegmentCand::sett0 ( double &  t0)
inlinevirtual

set t0

Definition at line 106 of file DTSegmentCand.h.

References t0(), and thet0.

Referenced by DTSegmentUpdator::fit().

106 { thet0 = t0; }
virtual double t0() const
the t0 of the segment
Definition: DTSegmentCand.h:67
const DTSuperLayer* DTSegmentCand::superLayer ( ) const
inline

the super layer on which relies

Definition at line 76 of file DTSegmentCand.h.

References theSL.

Referenced by DTCombinatorialExtendedPatternReco::extendCandidates().

76 { return theSL; }
const DTSuperLayer * theSL
virtual double DTSegmentCand::t0 ( ) const
inlinevirtual

the t0 of the segment

Definition at line 67 of file DTSegmentCand.h.

References thet0.

Referenced by DTMeantimerPatternReco::addHits(), DTMeantimerPatternReco::fitWithT0(), operator<<(), and sett0().

67 { return thet0; }

Member Data Documentation

const double DTSegmentCand::chi2max = 20.
staticprotected

Definition at line 151 of file DTSegmentCand.h.

Referenced by good().

const unsigned int DTSegmentCand::nHitsMin = 3
staticprotected

Definition at line 152 of file DTSegmentCand.h.

Referenced by good().

double DTSegmentCand::theChi2
private

Definition at line 140 of file DTSegmentCand.h.

Referenced by chi2(), chi2ndof(), and setChi2().

AlgebraicSymMatrix DTSegmentCand::theCovMatrix
private

mat[1][1]=sigma (dx/dz) mat[2][2]=sigma (x) mat[1][2]=cov(dx/dz,x)

Definition at line 146 of file DTSegmentCand.h.

Referenced by covMatrix(), and setCovMatrix().

LocalVector DTSegmentCand::theDirection
private

Definition at line 139 of file DTSegmentCand.h.

Referenced by direction(), and setDirection().

AssPointCont DTSegmentCand::theHits
private
LocalPoint DTSegmentCand::thePosition
private

Definition at line 138 of file DTSegmentCand.h.

Referenced by position(), and setPosition().

const DTSuperLayer* DTSegmentCand::theSL
private

Definition at line 137 of file DTSegmentCand.h.

Referenced by superLayer().

double DTSegmentCand::thet0
private

Definition at line 141 of file DTSegmentCand.h.

Referenced by sett0(), and t0().