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
< 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 35 of file DTSegmentCand.h.

Member Typedef Documentation

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

Definition at line 38 of file DTSegmentCand.h.

Definition at line 40 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 }
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 28 of file DTSegmentCand.cc.

33  :
34 theSL(sl), thePosition(position), theDirection(direction), theChi2(chi2),
35  theCovMatrix( covMat), theHits(hits) {
36 }
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:64
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 ( AssPoint  newHit)
virtual

add hits to the hit list.

Definition at line 61 of file DTSegmentCand.cc.

References theHits.

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

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

Definition at line 65 of file DTSegmentCand.cc.

References theHits.

Referenced by counter.Counter::register().

65  {
66  AssPoint newHit(hit,code);
67  theHits.insert(newHit);
68 }
std::pair< std::shared_ptr< DTHitPairForFit >, DTEnums::DTCellSide > AssPoint
Definition: DTSegmentCand.h:38
AssPointCont theHits
virtual double DTSegmentCand::chi2 ( void  ) const
inlinevirtual

the chi2 (NOT chi2/NDOF) of the fit

Definition at line 64 of file DTSegmentCand.h.

References theChi2.

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

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

the chi2/NDOF of the fit

Definition at line 67 of file DTSegmentCand.h.

References nHits(), and theChi2.

Referenced by DTMeantimerPatternReco::checkDoubleCandidates().

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

References query::result, and theHits.

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

the covariance matrix

Definition at line 88 of file DTSegmentCand.h.

References theCovMatrix.

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

Definition at line 85 of file DTSegmentCand.h.

References theDirection.

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

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

Reimplemented in DTSegmentExtendedCand.

Definition at line 112 of file DTSegmentCand.cc.

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

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

113 {
114  // std::cout << NDOF() << " " << chi2()/NDOF() << " " << nHits() << std::endl;
115  if(NDOF() == 0) return false;
116  if(chi2()/NDOF() > chi2max || nHits() < nHitsMin) return false;
117 
118  if(nHits() == nHitsMin && hitsShareLayer()) return false ;
119 
120  return true;
121 }
virtual unsigned int NDOF() const
Definition: DTSegmentCand.h:90
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:64
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:61
volatile std::atomic< bool > shutdown_flag false
virtual const AssPointCont& DTSegmentCand::hits ( ) const
inlinevirtual

the used hits

Definition at line 125 of file DTSegmentCand.h.

References theHits.

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

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

Definition at line 123 of file DTSegmentCand.cc.

References i, j, and theHits.

Referenced by good().

124 {
125  int layerN[20];
126  int i=0;
127 
128  // we don't expect so many 1D hits, if such a segment arrives just drop it
129  if (theHits.size()>20) return false;
130 
131  for(DTSegmentCand::AssPointCont::iterator assHit=theHits.begin();
132  assHit!=theHits.end(); ++assHit) {
133  layerN[i]=(*assHit).first->id().layerId().layer()+10*(*assHit).first->id().superlayerId().superlayer();
134  i++;
135  }
136 
137  for(int i=0;i<(int)theHits.size();i++){
138  for(int j=0;j<i;j++){
139  if(layerN[i] == layerN[j]) return true;
140  }
141  }
142 
143  return false;
144 }
int i
Definition: DBlmapReader.cc:9
AssPointCont theHits
int j
Definition: DBlmapReader.cc:9
virtual unsigned int DTSegmentCand::NDOF ( ) const
inlinevirtual

Definition at line 90 of file DTSegmentCand.h.

References nHits().

Referenced by good().

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

number of different layers with hits

Definition at line 146 of file DTSegmentCand.cc.

146  {
147  // TODO
148  return 0;
149 }
int DTSegmentCand::nSharedHitPairs ( const DTSegmentCand seg) const
virtual

number of shared hit pair with other segment candidate

Definition at line 74 of file DTSegmentCand.cc.

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

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

convert this DTSegmentCand into a DTChamberRecSegment2D

Definition at line 181 of file DTSegmentCand.cc.

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

181  {
182 
183  // input position and direction are in sl frame, while must be stored in
184  // chamber one: so I have to extrapolate the position (along the direction) to
185  // the chamber reference plane.
186 
187  LocalPoint posInCh = theSL->chamber()->toLocal(theSL->toGlobal( position() ));
189 
190  LocalPoint pos=posInCh + dirInCh * posInCh.z()/cos(dirInCh.theta());
191 
192  double seg2DChi2 = chi2();
193  AlgebraicSymMatrix seg2DCovMatrix = covMatrix();
194 
195  std::vector<DTRecHit1D> hits1D;
196  for(DTSegmentCand::AssPointCont::iterator assHit=theHits.begin();
197  assHit!=theHits.end(); ++assHit) {
198 
199  GlobalPoint hitGlobalPos =
200  theSL->toGlobal( (*assHit).first->localPosition((*assHit).second) );
201 
202  LocalPoint hitPosInLayer =
203  theSL->chamber()
204  ->superLayer((*assHit).first->id().superlayerId())
205  ->layer( (*assHit).first->id().layerId() )->toLocal(hitGlobalPos);
206 
207  DTRecHit1D hit( ((*assHit).first)->id(),
208  (*assHit).second,
209  ((*assHit).first)->digiTime(),
210  hitPosInLayer,
211  ((*assHit).first)->localPositionError() );
212  hits1D.push_back(hit);
213  }
214 
215  return new DTChamberRecSegment2D(theSL->chamber()->id(),
216  pos,dirInCh,seg2DCovMatrix,
217  seg2DChi2,hits1D);
218 
219  // chamber and Phi SLs' frame are oriented in the same way, only a transaltion,
220  // so the covariance matrix is the same!
221 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
virtual AlgebraicSymMatrix covMatrix() const
the covariance matrix
Definition: DTSegmentCand.h:88
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
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:64
const DTSuperLayer * theSL
virtual LocalPoint position() const
Definition: DTSegmentCand.h:82
const DTChamber * chamber() const
Definition: DTSuperLayer.cc:64
CLHEP::HepSymMatrix AlgebraicSymMatrix
virtual LocalVector direction() const
Definition: DTSegmentCand.h:85
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 151 of file DTSegmentCand.cc.

References position, and toLocal().

151  {
152 
153  LocalPoint seg2Dposition = position();
154  LocalVector seg2DDirection = direction();
155  double seg2DChi2 = chi2();
156  AlgebraicSymMatrix seg2DCovMatrix = covMatrix();
157 
158  std::vector<DTRecHit1D> hits1D;
159  for(DTSegmentCand::AssPointCont::iterator assHit=theHits.begin();
160  assHit!=theHits.end(); ++assHit) {
161 
162  GlobalPoint hitGlobalPos =
163  theSL->toGlobal( (*assHit).first->localPosition((*assHit).second) );
164 
165  LocalPoint hitPosInLayer =
166  theSL->layer( (*assHit).first->id().layerId() )->toLocal(hitGlobalPos);
167 
168  DTRecHit1D hit( ((*assHit).first)->id(),
169  (*assHit).second,
170  ((*assHit).first)->digiTime(),
171  hitPosInLayer,
172  ((*assHit).first)->localPositionError() );
173  hits1D.push_back(hit);
174  }
175 
176  return new DTSLRecSegment2D(theSL->id(),
177  seg2Dposition,seg2DDirection,seg2DCovMatrix,
178  seg2DChi2,hits1D);
179 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
virtual AlgebraicSymMatrix covMatrix() const
the covariance matrix
Definition: DTSegmentCand.h:88
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:64
const DTSuperLayer * theSL
virtual LocalPoint position() const
Definition: DTSegmentCand.h:82
CLHEP::HepSymMatrix AlgebraicSymMatrix
virtual LocalVector direction() const
Definition: DTSegmentCand.h:85
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:64
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:61
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(), geometryDiff::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:64
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:61
virtual LocalPoint position() const
Definition: DTSegmentCand.h:82
T x() const
Definition: PV3DBase.h:62
virtual LocalVector direction() const
Definition: DTSegmentCand.h:85
virtual LocalPoint DTSegmentCand::position ( ) const
inlinevirtual

Definition at line 82 of file DTSegmentCand.h.

References thePosition.

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

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

remove hit from the candidate

Definition at line 70 of file DTSegmentCand.cc.

References theHits.

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

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

set chi2

Definition at line 106 of file DTSegmentCand.h.

References chi2(), and theChi2.

Referenced by DTSegmentUpdator::fit().

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

set the cov matrix

Definition at line 119 of file DTSegmentCand.h.

References theCovMatrix.

Referenced by DTSegmentUpdator::fit().

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

set direction

Definition at line 96 of file DTSegmentCand.h.

References dir, and theDirection.

Referenced by DTSegmentUpdator::fit().

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

set position

Definition at line 93 of file DTSegmentCand.h.

References thePosition.

Referenced by DTSegmentUpdator::fit().

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

set t0

Definition at line 109 of file DTSegmentCand.h.

References t0(), and thet0.

Referenced by DTSegmentUpdator::fit().

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

the super layer on which relies

Definition at line 79 of file DTSegmentCand.h.

References theSL.

Referenced by DTCombinatorialExtendedPatternReco::extendCandidates().

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

the t0 of the segment

Definition at line 70 of file DTSegmentCand.h.

References thet0.

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

70 { return thet0; }

Member Data Documentation

const double DTSegmentCand::chi2max =20.
staticprotected

Definition at line 157 of file DTSegmentCand.h.

Referenced by good().

const unsigned int DTSegmentCand::nHitsMin =3
staticprotected

Definition at line 158 of file DTSegmentCand.h.

Referenced by good().

double DTSegmentCand::theChi2
private

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

Referenced by covMatrix(), and setCovMatrix().

LocalVector DTSegmentCand::theDirection
private

Definition at line 145 of file DTSegmentCand.h.

Referenced by direction(), and setDirection().

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

Definition at line 144 of file DTSegmentCand.h.

Referenced by position(), and setPosition().

const DTSuperLayer* DTSegmentCand::theSL
private

Definition at line 143 of file DTSegmentCand.h.

Referenced by superLayer().

double DTSegmentCand::thet0
private

Definition at line 147 of file DTSegmentCand.h.

Referenced by sett0(), and t0().