#include <DTSegmentCand.h>
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. | |
virtual double | chi2 () const |
the chi2 (NOT chi2/NDOF) of the fit | |
virtual double | chi2ndof () const |
the chi2/NDOF of the fit | |
virtual AssPointCont | conflictingHitPairs (const DTSegmentCand &seg) const |
virtual AlgebraicSymMatrix | covMatrix () const |
the covariance matrix | |
virtual LocalVector | direction () const |
DTSegmentCand (AssPointCont hits, LocalPoint &position, LocalVector &direction, double chi2, AlgebraicSymMatrix covMat, const DTSuperLayer *sl) | |
DTSegmentCand (AssPointCont &hits, const DTSuperLayer *sl) | |
Constructor. | |
virtual bool | good () const |
virtual AssPointCont | hits () const |
the used hits | |
virtual bool | hitsShareLayer () const |
virtual unsigned int | NDOF () const |
virtual unsigned int | nHits () const |
virtual int | nLayers () const |
number of different layers with hits | |
virtual int | nSharedHitPairs (const DTSegmentCand &seg) const |
number of shared hit pair with other segment candidate | |
operator DTChamberRecSegment2D * () const | |
convert this DTSegmentCand into a DTChamberRecSegment2D | |
operator DTSLRecSegment2D * () const | |
convert this DTSegmentCand into a DTRecSegment2D | |
virtual bool | operator< (const DTSegmentCand &seg) |
less operator based on nHits and chi2 | |
virtual bool | operator== (const DTSegmentCand &seg) |
equality operator based on position, direction, chi2 and nHits | |
virtual LocalPoint | position () const |
virtual void | removeHit (AssPoint hit) |
remove hit from the candidate | |
virtual void | setChi2 (double &chi2) |
set chi2 | |
virtual void | setCovMatrix (AlgebraicSymMatrix &cov) |
set the cov matrix | |
virtual void | setDirection (LocalVector &dir) |
set direction | |
virtual void | setPosition (LocalPoint &pos) |
set position | |
const DTSuperLayer * | superLayer () const |
the super layer on which relies | |
virtual | ~DTSegmentCand () |
Destructor. | |
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 DTSuperLayer * | theSL |
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.
Definition at line 36 of file DTSegmentCand.h.
typedef std::pair<DTHitPairForFit*, DTEnums::DTCellSide> DTSegmentCand::AssPoint |
Definition at line 39 of file DTSegmentCand.h.
typedef std::set<AssPoint, AssPointLessZ> DTSegmentCand::AssPointCont |
Definition at line 41 of file DTSegmentCand.h.
DTSegmentCand::DTSegmentCand | ( | AssPointCont & | hits, |
const DTSuperLayer * | sl | ||
) |
DTSegmentCand::DTSegmentCand | ( | AssPointCont | hits, |
LocalPoint & | position, | ||
LocalVector & | direction, | ||
double | chi2, | ||
AlgebraicSymMatrix | covMat, | ||
const DTSuperLayer * | sl | ||
) |
Definition at line 30 of file DTSegmentCand.cc.
: theSL(sl), thePosition(position), theDirection(direction), theChi2(chi2), theCovMatrix( covMat), theHits(hits) { }
DTSegmentCand::~DTSegmentCand | ( | ) | [virtual] |
void DTSegmentCand::add | ( | DTHitPairForFit * | hit, |
DTEnums::DTCellSide | code | ||
) | [virtual] |
virtual double DTSegmentCand::chi2 | ( | void | ) | const [inline, virtual] |
the chi2 (NOT chi2/NDOF) of the fit
Definition at line 65 of file DTSegmentCand.h.
References theChi2.
Referenced by good(), operator DTChamberRecSegment2D *(), operator DTSLRecSegment2D *(), operator<(), operator<<(), operator==(), and setChi2().
{return theChi2; }
virtual double DTSegmentCand::chi2ndof | ( | ) | const [inline, virtual] |
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.
{ AssPointCont result; const AssPointCont & hits2 = seg.theHits; // if (nSharedHitPairs(seg)==0) return result; AssPointCont::const_iterator hitBegin2 = hits2.begin(), hitEnd2 = hits2.end(); for (AssPointCont::const_iterator hit = theHits.begin(), hitEnd = theHits.end(); hit != hitEnd ; ++hit) { for (AssPointCont::const_iterator hit2 = hitBegin2; hit2 != hitEnd2; ++hit2) { if ((*(*hit).first)==(*(*hit2).first) && (*hit).second != (*hit2).second) { result.insert(*hit); continue; } } } return result; }
virtual AlgebraicSymMatrix DTSegmentCand::covMatrix | ( | ) | const [inline, virtual] |
the covariance matrix
Definition at line 86 of file DTSegmentCand.h.
References theCovMatrix.
Referenced by operator DTChamberRecSegment2D *(), and operator DTSLRecSegment2D *().
{return theCovMatrix; }
virtual LocalVector DTSegmentCand::direction | ( | ) | const [inline, virtual] |
Definition at line 83 of file DTSegmentCand.h.
References theDirection.
Referenced by operator DTChamberRecSegment2D *(), operator DTSLRecSegment2D *(), operator<<(), and operator==().
{ return 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().
virtual AssPointCont DTSegmentCand::hits | ( | ) | const [inline, virtual] |
the used hits
Definition at line 119 of file DTSegmentCand.h.
References theHits.
Referenced by DTSegmentUpdator::fit(), and nSharedHitPairs().
{ return theHits;}
bool DTSegmentCand::hitsShareLayer | ( | ) | const [virtual] |
Definition at line 120 of file DTSegmentCand.cc.
Referenced by good().
{ std::vector<int> layerN; for(DTSegmentCand::AssPointCont::iterator assHit=theHits.begin(); assHit!=theHits.end(); ++assHit) { layerN.push_back((*assHit).first->id().layerId().layer()); //std::cout << (*assHit).first->id().layerId().layer() << std::endl; } for(int i=0;i<(int)layerN.size();i++){ for(int j=i+1;j<(int)layerN.size();j++){ if(layerN[i] == layerN[j]) return true; } } return false; }
virtual unsigned int DTSegmentCand::NDOF | ( | ) | const [inline, virtual] |
Definition at line 88 of file DTSegmentCand.h.
References nHits().
Referenced by good().
{ return nHits()-2; }
virtual unsigned int DTSegmentCand::nHits | ( | void | ) | const [inline, virtual] |
Reimplemented in DTSegmentExtendedCand.
Definition at line 62 of file DTSegmentCand.h.
References theHits.
Referenced by chi2ndof(), DTSegmentExtendedCand::good(), good(), NDOF(), DTSegmentExtendedCand::nHits(), operator<(), operator<<(), and operator==().
{ return theHits.size(); }
int DTSegmentCand::nLayers | ( | ) | const [virtual] |
number of different layers with hits
Definition at line 140 of file DTSegmentCand.cc.
{ // TODO return 0; }
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.
{ int result=0; AssPointCont hitsCont = seg.hits(); for (AssPointCont::const_iterator hit=theHits.begin(); hit!=theHits.end() ; ++hit) { for (AssPointCont::const_iterator hit2=hitsCont.begin(); hit2!=hitsCont.end() ; ++hit2) { // if(result) return result ; // TODO, uncomm this line or move it in another func if ((*(*hit).first)==(*(*hit2).first)) { ++result; continue; } } } return result; }
DTSegmentCand::operator DTChamberRecSegment2D * | ( | ) | const |
convert this DTSegmentCand into a DTChamberRecSegment2D
Definition at line 175 of file DTSegmentCand.cc.
References DTSuperLayer::chamber(), chi2(), funct::cos(), covMatrix(), direction(), DTChamber::id(), pos, position(), DTChamber::superLayer(), theHits, theSL, PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toGlobal(), toLocal(), GeomDet::toLocal(), and PV3DBase< T, PVType, FrameType >::z().
{ // input position and direction are in sl frame, while must be stored in // chamber one: so I have to extrapolate the position (along the direction) to // the chamber reference plane. LocalPoint posInCh = theSL->chamber()->toLocal(theSL->toGlobal( position() )); LocalVector dirInCh= theSL->chamber()->toLocal(theSL->toGlobal( direction() )); LocalPoint pos=posInCh + dirInCh * posInCh.z()/cos(dirInCh.theta()); double seg2DChi2 = chi2(); AlgebraicSymMatrix seg2DCovMatrix = covMatrix(); std::vector<DTRecHit1D> hits1D; for(DTSegmentCand::AssPointCont::iterator assHit=theHits.begin(); assHit!=theHits.end(); ++assHit) { GlobalPoint hitGlobalPos = theSL->toGlobal( (*assHit).first->localPosition((*assHit).second) ); LocalPoint hitPosInLayer = theSL->chamber() ->superLayer((*assHit).first->id().superlayerId()) ->layer( (*assHit).first->id().layerId() )->toLocal(hitGlobalPos); DTRecHit1D hit( ((*assHit).first)->id(), (*assHit).second, ((*assHit).first)->digiTime(), hitPosInLayer, ((*assHit).first)->localPositionError() ); hits1D.push_back(hit); } return new DTChamberRecSegment2D(theSL->chamber()->id(), pos,dirInCh,seg2DCovMatrix, seg2DChi2,hits1D); // chamber and Phi SLs' frame are oriented in the same way, only a transaltion, // so the covariance matrix is the same! }
DTSegmentCand::operator DTSLRecSegment2D * | ( | ) | const |
convert this DTSegmentCand into a DTRecSegment2D
Definition at line 145 of file DTSegmentCand.cc.
References chi2(), covMatrix(), direction(), DTSuperLayer::id(), DTSuperLayer::layer(), position(), theHits, theSL, GeomDet::toGlobal(), and toLocal().
{ LocalPoint seg2Dposition = position(); LocalVector seg2DDirection = direction(); double seg2DChi2 = chi2(); AlgebraicSymMatrix seg2DCovMatrix = covMatrix(); std::vector<DTRecHit1D> hits1D; for(DTSegmentCand::AssPointCont::iterator assHit=theHits.begin(); assHit!=theHits.end(); ++assHit) { GlobalPoint hitGlobalPos = theSL->toGlobal( (*assHit).first->localPosition((*assHit).second) ); LocalPoint hitPosInLayer = theSL->layer( (*assHit).first->id().layerId() )->toLocal(hitGlobalPos); DTRecHit1D hit( ((*assHit).first)->id(), (*assHit).second, ((*assHit).first)->digiTime(), hitPosInLayer, ((*assHit).first)->localPositionError() ); hits1D.push_back(hit); } return new DTSLRecSegment2D(theSL->id(), seg2Dposition,seg2DDirection,seg2DCovMatrix, seg2DChi2,hits1D); }
bool DTSegmentCand::operator< | ( | const DTSegmentCand & | seg | ) | [virtual] |
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().
{ static const double epsilon=0.00001; if (nHits()!=seg.nHits()) return false; if (fabs(chi2()-seg.chi2())>epsilon) return false; if (fabs(position().x()-seg.position().x())>epsilon || fabs(position().y()-seg.position().y())>epsilon || fabs(position().z()-seg.position().z())>epsilon) return false; if (fabs(direction().x()-seg.direction().x())>epsilon || fabs(direction().y()-seg.direction().y())>epsilon || fabs(direction().z()-seg.direction().z())>epsilon) return false; return true; }
virtual LocalPoint DTSegmentCand::position | ( | ) | const [inline, virtual] |
Definition at line 80 of file DTSegmentCand.h.
References thePosition.
Referenced by operator DTChamberRecSegment2D *(), operator DTSLRecSegment2D *(), operator<<(), and operator==().
{ return 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().
{ theHits.erase(badHit); }
virtual void DTSegmentCand::setChi2 | ( | double & | chi2 | ) | [inline, virtual] |
set chi2
Definition at line 103 of file DTSegmentCand.h.
References chi2(), and theChi2.
Referenced by CSCNeutronReader::addHits(), and DTSegmentUpdator::fit().
virtual void DTSegmentCand::setCovMatrix | ( | AlgebraicSymMatrix & | cov | ) | [inline, virtual] |
set the cov matrix
Definition at line 113 of file DTSegmentCand.h.
References theCovMatrix.
Referenced by DTSegmentUpdator::fit().
{ theCovMatrix = cov; }
virtual void DTSegmentCand::setDirection | ( | LocalVector & | dir | ) | [inline, virtual] |
set direction
Definition at line 94 of file DTSegmentCand.h.
References dir, and theDirection.
Referenced by DTSegmentUpdator::fit().
{ theDirection = dir ; }
virtual void DTSegmentCand::setPosition | ( | LocalPoint & | pos | ) | [inline, virtual] |
set position
Definition at line 91 of file DTSegmentCand.h.
References pos, and thePosition.
Referenced by DTSegmentUpdator::fit().
{ thePosition=pos; }
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().
{return theSL;}
double DTSegmentCand::chi2max = 20. [static, protected] |
Definition at line 151 of file DTSegmentCand.h.
Referenced by good().
unsigned int DTSegmentCand::nHitsMin = 3 [static, protected] |
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().
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] |
Definition at line 148 of file DTSegmentCand.h.
Referenced by add(), conflictingHitPairs(), hits(), hitsShareLayer(), nHits(), nSharedHitPairs(), operator DTChamberRecSegment2D *(), operator DTSLRecSegment2D *(), and removeHit().
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 operator DTChamberRecSegment2D *(), operator DTSLRecSegment2D *(), and superLayer().