CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTHitPairForFit Class Reference

#include <DTHitPairForFit.h>

List of all members.

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 DTWireIdid () 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

Detailed Description

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.

Date:
2009/11/27 11:59:48
Revision:
1.7
Author:
Stefano Lacaprara - INFN Legnaro <stefano.lacaprara@pd.infn.it>
Riccardo Bellan - INFN TO <riccardo.bellan@cern.ch>

Definition at line 33 of file DTHitPairForFit.h.


Constructor & Destructor Documentation

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

Destructor.

Definition at line 45 of file DTHitPairForFit.cc.

                                  {
}

Member Function Documentation

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]

Definition at line 57 of file DTHitPairForFit.h.

References theError.

{ return theError; }
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().

                                                                 {
  return  (id() == hit.id() && fabs(digiTime() - hit.digiTime()) < 0.1 );
}
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; }

Member Data Documentation

Definition at line 82 of file DTHitPairForFit.h.

Referenced by digiTime().

Definition at line 80 of file DTHitPairForFit.h.

Referenced by localPositionError().

Definition at line 78 of file DTHitPairForFit.h.

Referenced by leftPos().

Definition at line 79 of file DTHitPairForFit.h.

Referenced by rightPos().

Definition at line 81 of file DTHitPairForFit.h.

Referenced by id().