CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
DTHitPairForFit Class Reference

#include <DTHitPairForFit.h>

Public Member Functions

float digiTime () const
 Returns the time of the corresponding digi. More...
 
 DTHitPairForFit (const DTRecHit1DPair &pair, const DTSuperLayer &sl, const edm::ESHandle< DTGeometry > &dtGeom)
 Constructor. More...
 
const DTWireIdid () const
 Returns the Id of the wire on which the rechit rely. More...
 
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. More...
 
LocalPoint localPosition (DTEnums::DTCellSide s) const
 Returns the local position in the layer. More...
 
LocalError localPositionError () const
 
bool operator< (const DTHitPairForFit &hit) const
 define the order by increasing z More...
 
bool operator== (const DTHitPairForFit &hit) const
 
LocalPoint rightPos () const
 Returns the position in the layer r.f. of the right rechit. More...
 
 ~DTHitPairForFit ()
 Destructor. More...
 

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/06/05 14:14:20
Revision:
1.6
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 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().

24  {
25 
26  theWireId = pair.wireId();
27  theDigiTime = pair.digiTime();
28 
29  const DTLayer* layer = dtGeom->layer(theWireId.layerId());
30 
31  // transform the Local position in Layer-rf in a SL local position
32  theLeftPos =
34  theRightPos =
36 
37  // TODO how do I transform an error from local to global?
39  // theError =
40  // layer->surface().toLocal(sl.surface().toGlobal(pair.componentRecHit(DTEnums::Left)->localPositionError()));
41 
42 }
float digiTime() const
Return the digi time (ns) used to build the rechits.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
LocalPoint theRightPos
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:64
const DTRecHit1D * componentRecHit(DTEnums::DTCellSide lrSide) const
Return the left/right DTRecHit1D.
LocalPoint theLeftPos
LocalError theError
virtual LocalError localPositionError() const
Return the 3-dimensional error on the local position.
Definition: DTRecHit1D.h:68
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:62
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:64
DTWireId wireId() const
DTHitPairForFit::~DTHitPairForFit ( )

Destructor.

Definition at line 45 of file DTHitPairForFit.cc.

45  {
46 }

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

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

60 { 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, runTheMatrix::ret, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::z().

60  {
61 
62 
63  pair<bool,bool> ret;
64  LocalPoint segPosAtZLeft = posIni+dirIni*(theLeftPos.z() -posIni.z())/dirIni.z();
65  LocalPoint segPosAtZRight = posIni+dirIni*(theRightPos.z()-posIni.z())/dirIni.z();
66  float dxLeft = fabs(theLeftPos.x() - segPosAtZLeft.x());
67  float dxRight = fabs(theRightPos.x() - segPosAtZRight.x());
68  float exx = sqrt(theError.xx());
69  // if both below 3 sigma, return both
70  // if both at 10 sigma or above, return none
71  // if one is below N sigma and one above, for 10>=N>=3, match only that one, otherwise none
72  if (std::max(dxLeft, dxRight) < 3*exx) {
73  ret = make_pair(true,true);
74  } else if (std::min(dxLeft, dxRight) >= 10*exx) {
75  ret = make_pair(false,false);
76  } else {
77  float sigmasL = floorf(dxLeft/exx), sigmasR = floorf(dxRight/exx);
78  ret.first = ( sigmasL < sigmasR );
79  ret.second = ( sigmasR < sigmasL );
80  }
81  return ret;
82 }
float xx() const
Definition: LocalError.h:19
LocalPoint theRightPos
#define min(a, b)
Definition: mlp_lapack.h:161
LocalPoint theLeftPos
const T & max(const T &a, const T &b)
T sqrt(T t)
Definition: SSEVec.h:28
T z() const
Definition: PV3DBase.h:58
LocalError theError
T x() const
Definition: PV3DBase.h:56
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<<().

51 { return theLeftPos; }
LocalPoint theLeftPos
LocalPoint DTHitPairForFit::localPosition ( DTEnums::DTCellSide  s) const

Returns the local position in the layer.

Definition at line 49 of file DTHitPairForFit.cc.

References edm::hlt::Exception, DTEnums::Left, and DTEnums::Right.

Referenced by operator<().

49  {
50  if (s==DTEnums::Left) return theLeftPos;
51  else if (s==DTEnums::Right) return theRightPos;
52  else{
53  throw cms::Exception("DTHitPairForFit")<<" localPosition called with undef LR code"<<endl;
54  return LocalPoint();
55  }
56 }
LocalPoint theRightPos
LocalPoint theLeftPos
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
string s
Definition: asciidump.py:422
LocalError DTHitPairForFit::localPositionError ( ) const
inline

Definition at line 57 of file DTHitPairForFit.h.

References theError.

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

84  {
85  //SL if same layer use x() for strict ordering
86  if (id()==hit.id())
87  return (theLeftPos.x() < hit.localPosition(DTEnums::Left).x());
88  return (id() < hit.id());
89 }
LocalPoint localPosition(DTEnums::DTCellSide s) const
Returns the local position in the layer.
const DTWireId & id() const
Returns the Id of the wire on which the rechit rely.
LocalPoint theLeftPos
T x() const
Definition: PV3DBase.h:56
bool DTHitPairForFit::operator== ( const DTHitPairForFit hit) const

Definition at line 91 of file DTHitPairForFit.cc.

References digiTime(), and id().

91  {
92  return (id() == hit.id() && fabs(digiTime() - hit.digiTime()) < 0.1 );
93 }
const DTWireId & id() const
Returns the Id of the wire on which the rechit rely.
float digiTime() const
Returns the time of the corresponding digi.
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<<().

54 { return theRightPos; }
LocalPoint theRightPos

Member Data Documentation

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