CMS 3D CMS Logo

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

#include <DTRecHitSegmentResidual.h>

Public Member Functions

float compute (const DTGeometry *, const DTRecHit1D &, const DTRecSegment4D &)
 
 DTRecHitSegmentResidual ()
 
 ~DTRecHitSegmentResidual ()
 

Detailed Description

Definition at line 12 of file DTRecHitSegmentResidual.h.

Constructor & Destructor Documentation

DTRecHitSegmentResidual::DTRecHitSegmentResidual ( )
inline

Definition at line 14 of file DTRecHitSegmentResidual.h.

14 {}
DTRecHitSegmentResidual::~DTRecHitSegmentResidual ( )
inline

Definition at line 15 of file DTRecHitSegmentResidual.h.

15 {}

Member Function Documentation

float DTRecHitSegmentResidual::compute ( const DTGeometry dtGeom,
const DTRecHit1D recHit1D,
const DTRecSegment4D segment 
)

Definition at line 17 of file DTRecHitSegmentResidual.cc.

References DTGeometry::chamber(), DTSuperLayerId::chamberId(), funct::cos(), DTGeometry::layer(), DTWireId::layerId(), DTRecSegment4D::localDirection(), DTRecSegment4D::localPosition(), DTRecHit1D::localPosition(), DTLayer::specificTopology(), DTSuperLayerId::superlayer(), PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toGlobal(), GeomDet::toLocal(), DTWireId::wire(), DTRecHit1D::wireId(), DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by DTResidualCalibration::analyze().

17  {
18 
19  const DTWireId wireId = recHit1D.wireId();
20 
21  // Get the layer and the wire position
22  const DTLayer* layer = dtGeom->layer(wireId);
23  float wireX = layer->specificTopology().wirePosition(wireId.wire());
24 
25  // Extrapolate the segment to the z of the wire
26  // Get wire position in chamber RF
27  // (y and z must be those of the hit to be coherent in the transf. of RF in case of rotations of the layer alignment)
28  LocalPoint wirePosInLay(wireX,recHit1D.localPosition().y(),recHit1D.localPosition().z());
29  GlobalPoint wirePosGlob = layer->toGlobal(wirePosInLay);
30  const DTChamber* chamber = dtGeom->chamber(wireId.layerId().chamberId());
31  LocalPoint wirePosInChamber = chamber->toLocal(wirePosGlob);
32 
33  // Segment position at Wire z in chamber local frame
34  LocalPoint segPosAtZWire = segment.localPosition() + segment.localDirection()*wirePosInChamber.z()/cos(segment.localDirection().theta());
35 
36  // Compute the distance of the segment from the wire
37  int sl = wireId.superlayer();
38  float segmDistance = -1;
39  if(sl == 1 || sl == 3) segmDistance = fabs(wirePosInChamber.x() - segPosAtZWire.x());
40  else if(sl == 2) segmDistance = fabs(segPosAtZWire.y() - wirePosInChamber.y());
41 
42  // Compute the distance of the recHit from the wire
43  float recHitWireDist = fabs( recHit1D.localPosition().x() - wireX );
44 
45  // Compute the residuals
46  float residualOnDistance = recHitWireDist - segmDistance;
47 
48  return residualOnDistance;
49 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
DTChamberId chamberId() const
Return the corresponding ChamberId.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Definition: DTGeometry.cc:110
virtual LocalVector localDirection() const
Local direction in Chamber frame.
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual LocalPoint localPosition() const
Local position in Chamber frame.
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:60
int wire() const
Return the wire number.
Definition: DTWireId.h:56
int superlayer() const
Return the superlayer number (deprecated method name)
const DTChamber * chamber(DTChamberId id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:100
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:62
T x() const
Definition: PV3DBase.h:62
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:107