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 (AssPointCont hits, LocalPoint &position, LocalVector &direction, double chi2, 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 double chi2max =20.
 
static 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.

Date:
2010/01/21 15:33:32
Revision:
1.9
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 36 of file DTSegmentCand.h.

Member Typedef Documentation

Definition at line 39 of file DTSegmentCand.h.

Definition at line 41 of file DTSegmentCand.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 25 of file DTSegmentCand.cc.

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

Definition at line 30 of file DTSegmentCand.cc.

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

Destructor.

Definition at line 41 of file DTSegmentCand.cc.

41  {
42 }

Member Function Documentation

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

add hits to the hit list.

Definition at line 63 of file DTSegmentCand.cc.

References theHits.

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

the chi2 (NOT chi2/NDOF) of the fit

Definition at line 65 of file DTSegmentCand.h.

References theChi2.

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

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

the chi2/NDOF of the fit

Definition at line 68 of file DTSegmentCand.h.

References nHits(), and theChi2.

Referenced by DTMeantimerPatternReco::checkDoubleCandidates().

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

References query::result, and theHits.

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

the covariance matrix

Definition at line 86 of file DTSegmentCand.h.

References theCovMatrix.

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

Definition at line 83 of file DTSegmentCand.h.

References theDirection.

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

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

Reimplemented in DTSegmentExtendedCand.

Definition at line 110 of file DTSegmentCand.cc.

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

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

111 {
112  if(NDOF() == 0) return false;
113  if(chi2()/NDOF() > chi2max || nHits() < nHitsMin) return false;
114 
115  if(nHits() == nHitsMin && hitsShareLayer()) return false ;
116 
117  return true;
118 }
static unsigned int nHitsMin
virtual unsigned int NDOF() const
Definition: DTSegmentCand.h:88
virtual bool hitsShareLayer() const
virtual double chi2() const
the chi2 (NOT chi2/NDOF) of the fit
Definition: DTSegmentCand.h:65
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:62
static double chi2max
virtual AssPointCont DTSegmentCand::hits ( ) const
inlinevirtual

the used hits

Definition at line 119 of file DTSegmentCand.h.

References theHits.

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

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

Definition at line 120 of file DTSegmentCand.cc.

References i, j, and theHits.

Referenced by good().

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

Definition at line 88 of file DTSegmentCand.h.

References nHits().

Referenced by good().

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

number of different layers with hits

Definition at line 140 of file DTSegmentCand.cc.

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

number of shared hit pair with other segment candidate

Definition at line 71 of file DTSegmentCand.cc.

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

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

convert this DTSegmentCand into a DTChamberRecSegment2D

Definition at line 175 of file DTSegmentCand.cc.

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

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

convert this DTSegmentCand into a DTRecSegment2D

Definition at line 145 of file DTSegmentCand.cc.

References position, and toLocal().

145  {
146 
147  LocalPoint seg2Dposition = position();
148  LocalVector seg2DDirection = direction();
149  double seg2DChi2 = chi2();
150  AlgebraicSymMatrix seg2DCovMatrix = covMatrix();
151 
152  std::vector<DTRecHit1D> hits1D;
153  for(DTSegmentCand::AssPointCont::iterator assHit=theHits.begin();
154  assHit!=theHits.end(); ++assHit) {
155 
156  GlobalPoint hitGlobalPos =
157  theSL->toGlobal( (*assHit).first->localPosition((*assHit).second) );
158 
159  LocalPoint hitPosInLayer =
160  theSL->layer( (*assHit).first->id().layerId() )->toLocal(hitGlobalPos);
161 
162  DTRecHit1D hit( ((*assHit).first)->id(),
163  (*assHit).second,
164  ((*assHit).first)->digiTime(),
165  hitPosInLayer,
166  ((*assHit).first)->localPositionError() );
167  hits1D.push_back(hit);
168  }
169 
170  return new DTSLRecSegment2D(theSL->id(),
171  seg2Dposition,seg2DDirection,seg2DCovMatrix,
172  seg2DChi2,hits1D);
173 }
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:86
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
DTSuperLayerId id() const
Return the DetId of this SL.
Definition: DTSuperLayer.cc:38
AssPointCont theHits
const DTLayer * layer(DTLayerId id) const
Return the layer corresponding to the given id.
Definition: DTSuperLayer.cc:70
virtual double chi2() const
the chi2 (NOT chi2/NDOF) of the fit
Definition: DTSegmentCand.h:65
const DTSuperLayer * theSL
virtual LocalPoint position() const
Definition: DTSegmentCand.h:80
CLHEP::HepSymMatrix AlgebraicSymMatrix
virtual LocalVector direction() const
Definition: DTSegmentCand.h:83
bool DTSegmentCand::operator< ( const DTSegmentCand seg)
virtual

less operator based on nHits and chi2

Definition at line 58 of file DTSegmentCand.cc.

References chi2(), and nHits().

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

equality operator based on position, direction, chi2 and nHits

Definition at line 45 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().

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

Definition at line 80 of file DTSegmentCand.h.

References thePosition.

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

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

remove hit from the candidate

Definition at line 67 of file DTSegmentCand.cc.

References theHits.

Referenced by DTSegmentCleaner::solveConflict().

67  {
68  theHits.erase(badHit);
69 }
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 DTMeantimerPatternReco::addHits(), and DTSegmentUpdator::fit().

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

set the cov matrix

Definition at line 113 of file DTSegmentCand.h.

References theCovMatrix.

Referenced by DTSegmentUpdator::fit().

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

set direction

Definition at line 94 of file DTSegmentCand.h.

References dir, and theDirection.

Referenced by DTSegmentUpdator::fit().

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

set position

Definition at line 91 of file DTSegmentCand.h.

References pos, and thePosition.

Referenced by DTSegmentUpdator::fit().

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

the super layer on which relies

Definition at line 77 of file DTSegmentCand.h.

References theSL.

Referenced by DTCombinatorialExtendedPatternReco::extendCandidates().

77 {return theSL;}
const DTSuperLayer * theSL

Member Data Documentation

double DTSegmentCand::chi2max =20.
staticprotected

Definition at line 151 of file DTSegmentCand.h.

Referenced by good().

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 145 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().