00001 #include "Alignment/MuonAlignmentAlgorithms/interface/MuonDT13ChamberResidual.h" 00002 00003 void MuonDT13ChamberResidual::addResidual(const TrajectoryStateOnSurface *tsos, const TransientTrackingRecHit *hit) { 00004 DetId id = hit->geographicalId(); 00005 00006 LocalPoint hitChamberPos = m_chamberAlignable->surface().toLocal(m_globalGeometry->idToDet(id)->toGlobal(hit->localPosition())); 00007 LocalPoint tsosChamberPos = m_chamberAlignable->surface().toLocal(m_globalGeometry->idToDet(id)->toGlobal(tsos->localPosition())); 00008 00009 double residual = tsosChamberPos.x() - hitChamberPos.x(); // residual is track minus hit 00010 double weight = 1. / hit->localPositionError().xx(); // weight linear fit by hit-only local error 00011 double layerPosition = tsosChamberPos.z(); // the layer's position in the chamber's coordinate system 00012 00013 m_numHits++; 00014 00015 // "x" is the layerPosition, "y" is the residual (this is a linear fit to residual versus layerPosition) 00016 m_residual_1 += weight; 00017 m_residual_x += weight * layerPosition; 00018 m_residual_y += weight * residual; 00019 m_residual_xx += weight * layerPosition * layerPosition; 00020 m_residual_xy += weight * layerPosition * residual; 00021 00022 // "x" is the layerPosition, "y" is chamberx (this is a linear fit to chamberx versus layerPosition) 00023 m_trackx_1 += weight; 00024 m_trackx_x += weight * layerPosition; 00025 m_trackx_y += weight * tsosChamberPos.x(); 00026 m_trackx_xx += weight * layerPosition * layerPosition; 00027 m_trackx_xy += weight * layerPosition * tsosChamberPos.x(); 00028 00029 // "x" is the layerPosition, "y" is chambery (this is a linear fit to chambery versus layerPosition) 00030 m_tracky_1 += weight; 00031 m_tracky_x += weight * layerPosition; 00032 m_tracky_y += weight * tsosChamberPos.y(); 00033 m_tracky_xx += weight * layerPosition * layerPosition; 00034 m_tracky_xy += weight * layerPosition * tsosChamberPos.y(); 00035 00036 m_localIDs.push_back(id); 00037 m_localResids.push_back(tsos->localPosition().x() - hit->localPosition().x()); 00038 m_individual_x.push_back(layerPosition); 00039 m_individual_y.push_back(residual); 00040 m_individual_weight.push_back(weight); 00041 }