CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTRecHitSegmentResidual.cc
Go to the documentation of this file.
1 
2 /*
3  * See header file for a description of this class.
4  *
5  * $Date: 2011/02/22 18:43:20 $
6  * $Revision: 1.1 $
7  */
8 
10 
11 //Geometry
14 
15 //RecHit
18 
19 float DTRecHitSegmentResidual::compute(const DTGeometry* dtGeom, const DTRecHit1D& recHit1D, const DTRecSegment4D& segment) {
20 
21  const DTWireId wireId = recHit1D.wireId();
22 
23  // Get the layer and the wire position
24  const DTLayer* layer = dtGeom->layer(wireId);
25  float wireX = layer->specificTopology().wirePosition(wireId.wire());
26 
27  // Extrapolate the segment to the z of the wire
28  // Get wire position in chamber RF
29  // (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)
30  LocalPoint wirePosInLay(wireX,recHit1D.localPosition().y(),recHit1D.localPosition().z());
31  GlobalPoint wirePosGlob = layer->toGlobal(wirePosInLay);
32  const DTChamber* chamber = dtGeom->chamber(wireId.layerId().chamberId());
33  LocalPoint wirePosInChamber = chamber->toLocal(wirePosGlob);
34 
35  // Segment position at Wire z in chamber local frame
36  LocalPoint segPosAtZWire = segment.localPosition() + segment.localDirection()*wirePosInChamber.z()/cos(segment.localDirection().theta());
37 
38  // Compute the distance of the segment from the wire
39  int sl = wireId.superlayer();
40  float segmDistance = -1;
41  if(sl == 1 || sl == 3) segmDistance = fabs(wirePosInChamber.x() - segPosAtZWire.x());
42  else if(sl == 2) segmDistance = fabs(segPosAtZWire.y() - wirePosInChamber.y());
43 
44  // Compute the distance of the recHit from the wire
45  float recHitWireDist = fabs( recHit1D.localPosition().x() - wireX );
46 
47  // Compute the residuals
48  float residualOnDistance = recHitWireDist - segmDistance;
49 
50  return residualOnDistance;
51 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:88
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:62
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:74
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Definition: DTGeometry.cc:115
virtual LocalVector localDirection() const
Local direction in Chamber frame.
const DTTopology & specificTopology() const
Definition: DTLayer.cc:44
T z() const
Definition: PV3DBase.h:63
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:62
int wire() const
Return the wire number.
Definition: DTWireId.h:58
int superlayer() const
Return the superlayer number (deprecated method name)
float compute(const DTGeometry *, const DTRecHit1D &, const DTRecSegment4D &)
const DTChamber * chamber(DTChamberId id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:105
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:64
T x() const
Definition: PV3DBase.h:61
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:109