#include <DTHitPairForFit.h>
Public Member Functions | |
float | digiTime () const |
Returns the time of the corresponding digi. | |
DTHitPairForFit (const DTRecHit1DPair &pair, const DTSuperLayer &sl, const edm::ESHandle< DTGeometry > &dtGeom) | |
Constructor. | |
const DTWireId & | id () const |
Returns the Id of the wire on which the rechit rely. | |
std::pair< bool, bool > | isCompatible (const LocalPoint &posIni, const LocalVector &dirIni) const |
LocalPoint | leftPos () const |
Returns the position in the layer r.f. of the left rechit. | |
LocalPoint | localPosition (DTEnums::DTCellSide s) const |
Returns the local position in the layer. | |
LocalError | localPositionError () const |
bool | operator< (const DTHitPairForFit &hit) const |
define the order by increasing z | |
bool | operator== (const DTHitPairForFit &hit) const |
LocalPoint | rightPos () const |
Returns the position in the layer r.f. of the right rechit. | |
~DTHitPairForFit () | |
Destructor. | |
Private Attributes | |
float | theDigiTime |
LocalError | theError |
LocalPoint | theLeftPos |
LocalPoint | theRightPos |
DTWireId | theWireId |
Hit pair used for the segments fit
This class is useful for segment fitting, which is done in SL or Chamber reference frame, while the DT hits live on the layer.
Definition at line 33 of file DTHitPairForFit.h.
DTHitPairForFit::DTHitPairForFit | ( | const DTRecHit1DPair & | pair, |
const DTSuperLayer & | sl, | ||
const edm::ESHandle< DTGeometry > & | dtGeom | ||
) |
Constructor.
Definition at line 22 of file DTHitPairForFit.cc.
References DTRecHit1DPair::componentRecHit(), DTRecHit1DPair::digiTime(), DTEnums::Left, DTRecHit1D::localPosition(), DTRecHit1D::localPositionError(), DTEnums::Right, GeomDet::toGlobal(), GeomDet::toLocal(), and DTRecHit1DPair::wireId().
{ theWireId = pair.wireId(); theDigiTime = pair.digiTime(); const DTLayer* layer = dtGeom->layer(theWireId.layerId()); // transform the Local position in Layer-rf in a SL local position theLeftPos = sl.toLocal(layer->toGlobal(pair.componentRecHit(DTEnums::Left)->localPosition())); theRightPos = sl.toLocal(layer->toGlobal(pair.componentRecHit(DTEnums::Right)->localPosition())); // TODO how do I transform an error from local to global? theError = pair.componentRecHit(DTEnums::Left)->localPositionError(); // theError = // layer->surface().toLocal(sl.surface().toGlobal(pair.componentRecHit(DTEnums::Left)->localPositionError())); }
DTHitPairForFit::~DTHitPairForFit | ( | ) |
float DTHitPairForFit::digiTime | ( | ) | const [inline] |
Returns the time of the corresponding digi.
Definition at line 63 of file DTHitPairForFit.h.
References theDigiTime.
Referenced by operator==().
{return theDigiTime;}
const DTWireId& DTHitPairForFit::id | ( | void | ) | const [inline] |
Returns the Id of the wire on which the rechit rely.
Definition at line 60 of file DTHitPairForFit.h.
References theWireId.
Referenced by operator<(), and operator==().
{ return theWireId; }
pair< bool, bool > DTHitPairForFit::isCompatible | ( | const LocalPoint & | posIni, |
const LocalVector & | dirIni | ||
) | const |
check for compatibility of the hit pair with a given position and direction: the first bool of the returned pair is for the left hit, the second for the right one
Definition at line 59 of file DTHitPairForFit.cc.
References max(), min, run_regression::ret, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::z().
{ pair<bool,bool> ret; LocalPoint segPosAtZLeft = posIni+dirIni*(theLeftPos.z() -posIni.z())/dirIni.z(); LocalPoint segPosAtZRight = posIni+dirIni*(theRightPos.z()-posIni.z())/dirIni.z(); float dxLeft = fabs(theLeftPos.x() - segPosAtZLeft.x()); float dxRight = fabs(theRightPos.x() - segPosAtZRight.x()); float exx = sqrt(theError.xx()); // if both below 3 sigma, return both // if both at 10 sigma or above, return none // if one is below N sigma and one above, for 10>=N>=3, match only that one, otherwise none if (std::max(dxLeft, dxRight) < 3*exx) { ret = make_pair(true,true); } else if (std::min(dxLeft, dxRight) >= 10*exx) { ret = make_pair(false,false); } else { float sigmasL = floorf(dxLeft/exx), sigmasR = floorf(dxRight/exx); ret.first = ( sigmasL < sigmasR ); ret.second = ( sigmasR < sigmasL ); } return ret; }
LocalPoint DTHitPairForFit::leftPos | ( | ) | const [inline] |
Returns the position in the layer r.f. of the left rechit.
Definition at line 51 of file DTHitPairForFit.h.
References theLeftPos.
Referenced by operator<<().
{ return theLeftPos; }
LocalPoint DTHitPairForFit::localPosition | ( | DTEnums::DTCellSide | s | ) | const |
Returns the local position in the layer.
Definition at line 49 of file DTHitPairForFit.cc.
References Exception, DTEnums::Left, and DTEnums::Right.
Referenced by operator<().
{ if (s==DTEnums::Left) return theLeftPos; else if (s==DTEnums::Right) return theRightPos; else{ throw cms::Exception("DTHitPairForFit")<<" localPosition called with undef LR code"<<endl; return LocalPoint(); } }
LocalError DTHitPairForFit::localPositionError | ( | ) | const [inline] |
bool DTHitPairForFit::operator< | ( | const DTHitPairForFit & | hit | ) | const |
define the order by increasing z
Definition at line 84 of file DTHitPairForFit.cc.
References id(), DTEnums::Left, localPosition(), and PV3DBase< T, PVType, FrameType >::x().
{ //SL if same layer use x() for strict ordering if (id()==hit.id()) return (theLeftPos.x() < hit.localPosition(DTEnums::Left).x()); return (id() < hit.id()); }
bool DTHitPairForFit::operator== | ( | const DTHitPairForFit & | hit | ) | const |
Definition at line 91 of file DTHitPairForFit.cc.
References digiTime(), and id().
LocalPoint DTHitPairForFit::rightPos | ( | ) | const [inline] |
Returns the position in the layer r.f. of the right rechit.
Definition at line 54 of file DTHitPairForFit.h.
References theRightPos.
Referenced by operator<<().
{ return theRightPos; }
float DTHitPairForFit::theDigiTime [private] |
Definition at line 82 of file DTHitPairForFit.h.
Referenced by digiTime().
LocalError DTHitPairForFit::theError [private] |
Definition at line 80 of file DTHitPairForFit.h.
Referenced by localPositionError().
LocalPoint DTHitPairForFit::theLeftPos [private] |
Definition at line 78 of file DTHitPairForFit.h.
Referenced by leftPos().
LocalPoint DTHitPairForFit::theRightPos [private] |
Definition at line 79 of file DTHitPairForFit.h.
Referenced by rightPos().
DTWireId DTHitPairForFit::theWireId [private] |
Definition at line 81 of file DTHitPairForFit.h.
Referenced by id().