CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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
< DTHitPairForFit
*, DTEnums::DTCellSide
AssPoint
 
typedef std::set< AssPoint,
AssPointLessZ
AssPointCont
 

Public Member Functions

virtual void add (DTHitPairForFit *hit, DTEnums::DTCellSide code)
 add hits to the hit list. More...
 
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 AssPointCont hits () 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...
 
const DTSuperLayersuperLayer () const
 the super layer on which relies 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
 

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

Definition at line 37 of file DTSegmentCand.h.

Definition at line 39 of file DTSegmentCand.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 23 of file DTSegmentCand.cc.

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

Definition at line 28 of file DTSegmentCand.cc.

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

Destructor.

Definition at line 39 of file DTSegmentCand.cc.

39  {
40 }

Member Function Documentation

void DTSegmentCand::add ( DTHitPairForFit hit,
DTEnums::DTCellSide  code 
)
virtual

add hits to the hit list.

Definition at line 61 of file DTSegmentCand.cc.

References theHits.

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

the chi2 (NOT chi2/NDOF) of the fit

Definition at line 63 of file DTSegmentCand.h.

References theChi2.

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

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

the chi2/NDOF of the fit

Definition at line 66 of file DTSegmentCand.h.

References nHits(), and theChi2.

Referenced by DTMeantimerPatternReco::checkDoubleCandidates().

66 {return theChi2/(nHits()-2.); }
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:60
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 88 of file DTSegmentCand.cc.

References query::result, and theHits.

88  {
90  const AssPointCont & hits2 = seg.theHits;
91 
92 // if (nSharedHitPairs(seg)==0) return result;
93 
94  AssPointCont::const_iterator hitBegin2 = hits2.begin(), hitEnd2 = hits2.end();
95  for (AssPointCont::const_iterator hit = theHits.begin(), hitEnd = theHits.end();
96  hit != hitEnd ; ++hit) {
97  for (AssPointCont::const_iterator hit2 = hitBegin2; hit2 != hitEnd2; ++hit2) {
98  if ((*(*hit).first)==(*(*hit2).first) &&
99  (*hit).second != (*hit2).second) {
100  result.insert(*hit);
101  continue;
102  }
103  }
104  }
105  return result;
106 }
AssPointCont theHits
tuple result
Definition: query.py:137
std::set< AssPoint, AssPointLessZ > AssPointCont
Definition: DTSegmentCand.h:39
virtual AlgebraicSymMatrix DTSegmentCand::covMatrix ( ) const
inlinevirtual

the covariance matrix

Definition at line 84 of file DTSegmentCand.h.

References theCovMatrix.

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

Definition at line 81 of file DTSegmentCand.h.

References theDirection.

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

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

Reimplemented in DTSegmentExtendedCand.

Definition at line 108 of file DTSegmentCand.cc.

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

Referenced by DTCombinatorialPatternReco::buildSegments(), and DTSegmentUpdator::fit().

109 {
110  if(NDOF() == 0) return false;
111  if(chi2()/NDOF() > chi2max || nHits() < nHitsMin) return false;
112 
113  if(nHits() == nHitsMin && hitsShareLayer()) return false ;
114 
115  return true;
116 }
virtual unsigned int NDOF() const
Definition: DTSegmentCand.h:86
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:63
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:60
volatile std::atomic< bool > shutdown_flag false
virtual AssPointCont DTSegmentCand::hits ( ) const
inlinevirtual

the used hits

Definition at line 117 of file DTSegmentCand.h.

References theHits.

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

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

Definition at line 118 of file DTSegmentCand.cc.

References i, j, and theHits.

Referenced by good().

119 {
120  std::vector<int> layerN;
121 
122  for(DTSegmentCand::AssPointCont::iterator assHit=theHits.begin();
123  assHit!=theHits.end(); ++assHit) {
124  layerN.push_back((*assHit).first->id().layerId().layer());
125 
126  //std::cout << (*assHit).first->id().layerId().layer() << std::endl;
127  }
128 
129  for(int i=0;i<(int)layerN.size();i++){
130  for(int j=i+1;j<(int)layerN.size();j++){
131  if(layerN[i] == layerN[j]) return true;
132  }
133  }
134 
135  return false;
136 }
int i
Definition: DBlmapReader.cc:9
AssPointCont theHits
int j
Definition: DBlmapReader.cc:9
virtual unsigned int DTSegmentCand::NDOF ( ) const
inlinevirtual

Definition at line 86 of file DTSegmentCand.h.

References nHits().

Referenced by good().

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

number of different layers with hits

Definition at line 138 of file DTSegmentCand.cc.

138  {
139  // TODO
140  return 0;
141 }
int DTSegmentCand::nSharedHitPairs ( const DTSegmentCand seg) const
virtual

number of shared hit pair with other segment candidate

Definition at line 69 of file DTSegmentCand.cc.

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

69  {
70  int result=0;
71  AssPointCont hitsCont = seg.hits();
72 
73  for (AssPointCont::const_iterator hit=theHits.begin();
74  hit!=theHits.end() ; ++hit) {
75  for (AssPointCont::const_iterator hit2=hitsCont.begin();
76  hit2!=hitsCont.end() ; ++hit2) {
77  // if(result) return result ; // TODO, uncomm this line or move it in another func
78  if ((*(*hit).first)==(*(*hit2).first)) {
79  ++result;
80  continue;
81  }
82  }
83  }
84  return result;
85 }
AssPointCont theHits
tuple result
Definition: query.py:137
virtual AssPointCont hits() const
the used hits
std::set< AssPoint, AssPointLessZ > AssPointCont
Definition: DTSegmentCand.h:39
DTSegmentCand::operator DTChamberRecSegment2D * ( ) const

convert this DTSegmentCand into a DTChamberRecSegment2D

Definition at line 173 of file DTSegmentCand.cc.

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

173  {
174 
175  // input position and direction are in sl frame, while must be stored in
176  // chamber one: so I have to extrapolate the position (along the direction) to
177  // the chamber reference plane.
178 
179  LocalPoint posInCh = theSL->chamber()->toLocal(theSL->toGlobal( position() ));
181 
182  LocalPoint pos=posInCh + dirInCh * posInCh.z()/cos(dirInCh.theta());
183 
184  double seg2DChi2 = chi2();
185  AlgebraicSymMatrix seg2DCovMatrix = covMatrix();
186 
187  std::vector<DTRecHit1D> hits1D;
188  for(DTSegmentCand::AssPointCont::iterator assHit=theHits.begin();
189  assHit!=theHits.end(); ++assHit) {
190 
191  GlobalPoint hitGlobalPos =
192  theSL->toGlobal( (*assHit).first->localPosition((*assHit).second) );
193 
194  LocalPoint hitPosInLayer =
195  theSL->chamber()
196  ->superLayer((*assHit).first->id().superlayerId())
197  ->layer( (*assHit).first->id().layerId() )->toLocal(hitGlobalPos);
198 
199  DTRecHit1D hit( ((*assHit).first)->id(),
200  (*assHit).second,
201  ((*assHit).first)->digiTime(),
202  hitPosInLayer,
203  ((*assHit).first)->localPositionError() );
204  hits1D.push_back(hit);
205  }
206 
207  return new DTChamberRecSegment2D(theSL->chamber()->id(),
208  pos,dirInCh,seg2DCovMatrix,
209  seg2DChi2,hits1D);
210 
211  // chamber and Phi SLs' frame are oriented in the same way, only a transaltion,
212  // so the covariance matrix is the same!
213 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
virtual AlgebraicSymMatrix covMatrix() const
the covariance matrix
Definition: DTSegmentCand.h:84
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
AssPointCont theHits
DTChamberId id() const
Return the DTChamberId of this chamber.
Definition: DTChamber.cc:33
T z() const
Definition: PV3DBase.h:64
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:63
const DTSuperLayer * theSL
virtual LocalPoint position() const
Definition: DTSegmentCand.h:78
const DTChamber * chamber() const
Definition: DTSuperLayer.cc:64
CLHEP::HepSymMatrix AlgebraicSymMatrix
virtual LocalVector direction() const
Definition: DTSegmentCand.h:81
const DTSuperLayer * superLayer(DTSuperLayerId id) const
Return the superlayer corresponding to the given id.
Definition: DTChamber.cc:65
DTSegmentCand::operator DTSLRecSegment2D * ( ) const

convert this DTSegmentCand into a DTRecSegment2D

Definition at line 143 of file DTSegmentCand.cc.

References position, and toLocal().

143  {
144 
145  LocalPoint seg2Dposition = position();
146  LocalVector seg2DDirection = direction();
147  double seg2DChi2 = chi2();
148  AlgebraicSymMatrix seg2DCovMatrix = covMatrix();
149 
150  std::vector<DTRecHit1D> hits1D;
151  for(DTSegmentCand::AssPointCont::iterator assHit=theHits.begin();
152  assHit!=theHits.end(); ++assHit) {
153 
154  GlobalPoint hitGlobalPos =
155  theSL->toGlobal( (*assHit).first->localPosition((*assHit).second) );
156 
157  LocalPoint hitPosInLayer =
158  theSL->layer( (*assHit).first->id().layerId() )->toLocal(hitGlobalPos);
159 
160  DTRecHit1D hit( ((*assHit).first)->id(),
161  (*assHit).second,
162  ((*assHit).first)->digiTime(),
163  hitPosInLayer,
164  ((*assHit).first)->localPositionError() );
165  hits1D.push_back(hit);
166  }
167 
168  return new DTSLRecSegment2D(theSL->id(),
169  seg2Dposition,seg2DDirection,seg2DCovMatrix,
170  seg2DChi2,hits1D);
171 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
virtual AlgebraicSymMatrix covMatrix() const
the covariance matrix
Definition: DTSegmentCand.h:84
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
DTSuperLayerId id() const
Return the DetId of this SL.
Definition: DTSuperLayer.cc:36
AssPointCont theHits
const DTLayer * layer(DTLayerId id) const
Return the layer corresponding to the given id.
Definition: DTSuperLayer.cc:68
virtual double chi2() const
the chi2 (NOT chi2/NDOF) of the fit
Definition: DTSegmentCand.h:63
const DTSuperLayer * theSL
virtual LocalPoint position() const
Definition: DTSegmentCand.h:78
CLHEP::HepSymMatrix AlgebraicSymMatrix
virtual LocalVector direction() const
Definition: DTSegmentCand.h:81
bool DTSegmentCand::operator< ( const DTSegmentCand seg)
virtual

less operator based on nHits and chi2

Definition at line 56 of file DTSegmentCand.cc.

References chi2(), and nHits().

56  {
57  if (nHits()==seg.nHits()) return (chi2()>seg.chi2());
58  return (nHits()<seg.nHits());
59 }
virtual double chi2() const
the chi2 (NOT chi2/NDOF) of the fit
Definition: DTSegmentCand.h:63
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:60
bool DTSegmentCand::operator== ( const DTSegmentCand seg)
virtual

equality operator based on position, direction, chi2 and nHits

Definition at line 43 of file DTSegmentCand.cc.

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

43  {
44  static const double epsilon=0.00001;
45  if (nHits()!=seg.nHits()) return false;
46  if (fabs(chi2()-seg.chi2())>epsilon) return false;
47  if (fabs(position().x()-seg.position().x())>epsilon ||
48  fabs(position().y()-seg.position().y())>epsilon ||
49  fabs(position().z()-seg.position().z())>epsilon) return false;
50  if (fabs(direction().x()-seg.direction().x())>epsilon ||
51  fabs(direction().y()-seg.direction().y())>epsilon ||
52  fabs(direction().z()-seg.direction().z())>epsilon) return false;
53  return true;
54 }
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
virtual double chi2() const
the chi2 (NOT chi2/NDOF) of the fit
Definition: DTSegmentCand.h:63
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:60
virtual LocalPoint position() const
Definition: DTSegmentCand.h:78
const double epsilon
T x() const
Definition: PV3DBase.h:62
virtual LocalVector direction() const
Definition: DTSegmentCand.h:81
virtual LocalPoint DTSegmentCand::position ( ) const
inlinevirtual

Definition at line 78 of file DTSegmentCand.h.

References thePosition.

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

78 { 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 DTSegmentCleaner::solveConflict().

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

set chi2

Definition at line 101 of file DTSegmentCand.h.

References chi2(), and theChi2.

Referenced by DTMeantimerPatternReco::addHits(), and DTSegmentUpdator::fit().

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

set the cov matrix

Definition at line 111 of file DTSegmentCand.h.

References theCovMatrix.

Referenced by DTSegmentUpdator::fit().

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

set direction

Definition at line 92 of file DTSegmentCand.h.

References dir, and theDirection.

Referenced by DTSegmentUpdator::fit().

92 { theDirection = dir ; }
LocalVector theDirection
dbl *** dir
Definition: mlp_gen.cc:35
virtual void DTSegmentCand::setPosition ( LocalPoint pos)
inlinevirtual

set position

Definition at line 89 of file DTSegmentCand.h.

References thePosition.

Referenced by DTSegmentUpdator::fit().

89 { thePosition=pos; }
LocalPoint thePosition
const DTSuperLayer* DTSegmentCand::superLayer ( ) const
inline

the super layer on which relies

Definition at line 75 of file DTSegmentCand.h.

References theSL.

Referenced by DTCombinatorialExtendedPatternReco::extendCandidates().

75 {return theSL;}
const DTSuperLayer * theSL

Member Data Documentation

const double DTSegmentCand::chi2max =20.
staticprotected

Definition at line 149 of file DTSegmentCand.h.

Referenced by good().

const unsigned int DTSegmentCand::nHitsMin =3
staticprotected

Definition at line 150 of file DTSegmentCand.h.

Referenced by good().

double DTSegmentCand::theChi2
private

Definition at line 138 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 143 of file DTSegmentCand.h.

Referenced by covMatrix(), and setCovMatrix().

LocalVector DTSegmentCand::theDirection
private

Definition at line 137 of file DTSegmentCand.h.

Referenced by direction(), and setDirection().

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

Definition at line 136 of file DTSegmentCand.h.

Referenced by position(), and setPosition().

const DTSuperLayer* DTSegmentCand::theSL
private

Definition at line 135 of file DTSegmentCand.h.

Referenced by superLayer().