CMS 3D CMS Logo

DTHitPairForFit Class Reference

Hit pair used for the segments fit. More...

#include <RecoLocalMuon/DTSegment/src/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.
DTWireId id () const
 Returns the Id of the wire on which the rechit rely.
std::pair< bool, boolisCompatible (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
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 Member Functions

bool isCompatible (const LocalPoint &posIni, const LocalVector &dirIni, DTEnums::DTCellSide code) const

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
2007/03/10 16:14:43
Revision
1.5
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(), DTWireId::layerId(), DTEnums::Left, DTRecHit1D::localPosition(), DTRecHit1D::localPositionError(), DTEnums::Right, theDigiTime, theError, theLeftPos, theRightPos, theWireId, GeomDet::toGlobal(), GeomDet::toLocal(), and DTRecHit1DPair::wireId().

00024                                                                         {
00025 
00026   theWireId = pair.wireId();
00027   theDigiTime = pair.digiTime();
00028   
00029   const DTLayer* layer = dtGeom->layer(theWireId.layerId());
00030 
00031   // transform the Local position in Layer-rf in a SL local position
00032   theLeftPos =
00033     sl.toLocal(layer->toGlobal(pair.componentRecHit(DTEnums::Left)->localPosition()));
00034   theRightPos =
00035     sl.toLocal(layer->toGlobal(pair.componentRecHit(DTEnums::Right)->localPosition()));
00036 
00037   // TODO how do I transform an error from local to global?
00038   theError = pair.componentRecHit(DTEnums::Left)->localPositionError();
00039   // theError =
00040   //   layer->surface().toLocal(sl.surface().toGlobal(pair.componentRecHit(DTEnums::Left)->localPositionError()));
00041   
00042 }

DTHitPairForFit::~DTHitPairForFit (  ) 

Destructor.

Definition at line 45 of file DTHitPairForFit.cc.

00045                                   {
00046 }


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

00063 {return theDigiTime;}

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

00060 { return theWireId; }

bool DTHitPairForFit::isCompatible ( const LocalPoint posIni,
const LocalVector dirIni,
DTEnums::DTCellSide  code 
) const [private]

Definition at line 65 of file DTHitPairForFit.cc.

References err, localPosition(), localPositionError(), funct::sqrt(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), and PV3DBase< T, PVType, FrameType >::z().

00067                                                                  {
00068   // all is in SL frame
00069   LocalPoint pos= localPosition(code);
00070   LocalError err= localPositionError();
00071 
00072   const float errorScale=10.; // to be tuned!!
00073 
00074   LocalPoint segPosAtZ=
00075     posIni+dirIni*(pos.z()-posIni.z())/dirIni.z();
00076 
00077   // cout << "segPosAtZ     " << segPosAtZ << endl;
00078   // cout << "segPosInLayer " << pos<< endl;
00079   // cout << "errInLayer (" << err.xx() << "," << 
00080   //    err.xy() << "," << err.yy() << ")" << endl;
00081 
00082   float dx=pos.x()-segPosAtZ.x();
00083   // cout << "Dx " << dx << " vs " << sqrt(err.xx())*errorScale << endl;
00084 
00085   return fabs(dx)<sqrt(err.xx())*errorScale;
00086 
00087 }

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 DTEnums::Left, and DTEnums::Right.

00060                                                                {
00061   return std::pair<bool,bool>(isCompatible(posIni, dirIni, DTEnums::Left),
00062                               isCompatible(posIni, dirIni, DTEnums::Right));
00063 }

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

00051 { 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 lat::endl(), Exception, DTEnums::Left, DTEnums::Right, theLeftPos, and theRightPos.

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

00049                                                                    {
00050   if (s==DTEnums::Left) return theLeftPos;
00051   else if (s==DTEnums::Right) return theRightPos;
00052   else{ 
00053     throw cms::Exception("DTHitPairForFit")<<" localPosition called with undef LR code"<<endl;
00054     return LocalPoint();
00055   }
00056 }

LocalError DTHitPairForFit::localPositionError (  )  const [inline]

Definition at line 57 of file DTHitPairForFit.h.

References theError.

Referenced by isCompatible().

00057 { return theError; }

bool DTHitPairForFit::operator< ( const DTHitPairForFit hit  )  const

define the order by increasing z

Definition at line 89 of file DTHitPairForFit.cc.

References id(), DTEnums::Left, localPosition(), theLeftPos, and PV3DBase< T, PVType, FrameType >::x().

00089                                                                 {
00090   //SL if same layer use x() for strict ordering
00091   if (id()==hit.id()) 
00092     return (theLeftPos.x() < hit.localPosition(DTEnums::Left).x());
00093   return (id() < hit.id());
00094 }

bool DTHitPairForFit::operator== ( const DTHitPairForFit hit  )  const

Definition at line 96 of file DTHitPairForFit.cc.

References digiTime(), and id().

00096                                                                  {
00097   return  (id() == hit.id() && fabs(digiTime() - hit.digiTime()) < 0.1 );
00098 }

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

00054 { return theRightPos; }


Member Data Documentation

float DTHitPairForFit::theDigiTime [private]

Definition at line 82 of file DTHitPairForFit.h.

Referenced by digiTime(), and DTHitPairForFit().

LocalError DTHitPairForFit::theError [private]

Definition at line 80 of file DTHitPairForFit.h.

Referenced by DTHitPairForFit(), and localPositionError().

LocalPoint DTHitPairForFit::theLeftPos [private]

Definition at line 78 of file DTHitPairForFit.h.

Referenced by DTHitPairForFit(), leftPos(), localPosition(), and operator<().

LocalPoint DTHitPairForFit::theRightPos [private]

Definition at line 79 of file DTHitPairForFit.h.

Referenced by DTHitPairForFit(), localPosition(), and rightPos().

DTWireId DTHitPairForFit::theWireId [private]

Definition at line 81 of file DTHitPairForFit.h.

Referenced by DTHitPairForFit(), and id().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:18:54 2009 for CMSSW by  doxygen 1.5.4