Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "CalibMuon/DTCalibration/interface/DTRecHitSegmentResidual.h"
00010
00011
00012 #include "Geometry/DTGeometry/interface/DTGeometry.h"
00013 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00014
00015
00016 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
00017 #include "DataFormats/DTRecHit/interface/DTRecHitCollection.h"
00018
00019 float DTRecHitSegmentResidual::compute(const DTGeometry* dtGeom, const DTRecHit1D& recHit1D, const DTRecSegment4D& segment) {
00020
00021 const DTWireId wireId = recHit1D.wireId();
00022
00023
00024 const DTLayer* layer = dtGeom->layer(wireId);
00025 float wireX = layer->specificTopology().wirePosition(wireId.wire());
00026
00027
00028
00029
00030 LocalPoint wirePosInLay(wireX,recHit1D.localPosition().y(),recHit1D.localPosition().z());
00031 GlobalPoint wirePosGlob = layer->toGlobal(wirePosInLay);
00032 const DTChamber* chamber = dtGeom->chamber(wireId.layerId().chamberId());
00033 LocalPoint wirePosInChamber = chamber->toLocal(wirePosGlob);
00034
00035
00036 LocalPoint segPosAtZWire = segment.localPosition() + segment.localDirection()*wirePosInChamber.z()/cos(segment.localDirection().theta());
00037
00038
00039 int sl = wireId.superlayer();
00040 float segmDistance = -1;
00041 if(sl == 1 || sl == 3) segmDistance = fabs(wirePosInChamber.x() - segPosAtZWire.x());
00042 else if(sl == 2) segmDistance = fabs(segPosAtZWire.y() - wirePosInChamber.y());
00043
00044
00045 float recHitWireDist = fabs( recHit1D.localPosition().x() - wireX );
00046
00047
00048 float residualOnDistance = recHitWireDist - segmDistance;
00049
00050 return residualOnDistance;
00051 }