Go to the documentation of this file.00001
00006 #include "Alignment/MuonAlignmentAlgorithms/interface/MuonHitsChamberResidual.h"
00007
00008 MuonHitsChamberResidual::MuonHitsChamberResidual(edm::ESHandle<GlobalTrackingGeometry> globalGeometry,
00009 AlignableNavigator *navigator,
00010 DetId chamberId,
00011 AlignableDetOrUnitPtr chamberAlignable)
00012 : MuonChamberResidual(globalGeometry, navigator, chamberId, chamberAlignable)
00013 , m_residual_1(0.)
00014 , m_residual_x(0.) , m_residual_y(0.)
00015 , m_residual_xx(0.) , m_residual_xy(0.)
00016 , m_trackx_1(0.)
00017 , m_trackx_x(0.) , m_trackx_y(0.)
00018 , m_trackx_xx(0.) , m_trackx_xy(0.)
00019 , m_tracky_1(0.)
00020 , m_tracky_x(0.) , m_tracky_y(0.)
00021 , m_tracky_xx(0.) , m_tracky_xy(0.)
00022 , m_hitx_1(0.)
00023 , m_hitx_x(0.) , m_hitx_y(0.)
00024 , m_hitx_xx(0.) , m_hitx_xy(0.)
00025 , m_hity_1(0.)
00026 , m_hity_x(0.) , m_hity_y(0.)
00027 , m_hity_xx(0.) , m_hity_xy(0.)
00028 {}
00029
00030
00031 void MuonHitsChamberResidual::segment_fit()
00032 {
00033 assert(m_numHits > 1);
00034
00035 double delta = m_residual_1 * m_residual_xx - m_residual_x * m_residual_x;
00036 m_residual = (m_residual_xx * m_residual_y - m_residual_x * m_residual_xy) / delta;
00037
00038 delta = m_residual_1 * m_residual_xx - m_residual_x * m_residual_x;
00039 m_residual_error = sqrt(m_residual_xx / delta);
00040
00041 delta = m_residual_1 * m_residual_xx - m_residual_x * m_residual_x;
00042 m_resslope = (m_residual_1 * m_residual_xy - m_residual_x * m_residual_y) / delta;
00043
00044 delta = m_residual_1 * m_residual_xx - m_residual_x * m_residual_x;
00045 m_resslope_error = sqrt(m_residual_1 / delta);
00046
00047 m_ndof = m_individual_x.size() - 2;
00048
00049 m_chi2 = 0.;
00050 double a = m_residual;
00051 double b = m_resslope;
00052 std::vector< double >::const_iterator x = m_individual_x.begin();
00053 std::vector< double >::const_iterator y = m_individual_y.begin();
00054 std::vector< double >::const_iterator w = m_individual_weight.begin();
00055 for (; x != m_individual_x.end(); ++x, ++y, ++w) m_chi2 += pow((*y) - a - b * (*x), 2) * (*w);
00056
00057 delta = m_trackx_1 * m_trackx_xx - m_trackx_x * m_trackx_x;
00058 m_trackdxdz = (m_trackx_1 * m_trackx_xy - m_trackx_x * m_trackx_y) / delta;
00059
00060 delta = m_tracky_1 * m_tracky_xx - m_tracky_x * m_tracky_x;
00061 m_trackdydz = (m_tracky_1 * m_tracky_xy - m_tracky_x * m_tracky_y) / delta;
00062
00063 delta = m_trackx_1 * m_trackx_xx - m_trackx_x * m_trackx_x;
00064 m_trackx = (m_trackx_xx * m_trackx_y - m_trackx_x * m_trackx_xy) / delta;
00065
00066 delta = m_tracky_1 * m_tracky_xx - m_tracky_x * m_tracky_x;
00067 m_tracky = (m_tracky_xx * m_tracky_y - m_tracky_x * m_tracky_xy) / delta;
00068
00069 delta = m_hitx_1 * m_hitx_xx - m_hitx_x * m_hitx_x;
00070 m_segdxdz = (m_hitx_1 * m_hitx_xy - m_hitx_x * m_hitx_y) / delta;
00071
00072 delta = m_hity_1 * m_hity_xx - m_hity_x * m_hity_x;
00073 m_segdydz = (m_hity_1 * m_hity_xy - m_hity_x * m_hity_y) / delta;
00074
00075 delta = m_hitx_1 * m_hitx_xx - m_hitx_x * m_hitx_x;
00076 m_segx = (m_hitx_xx * m_hitx_y - m_hitx_x * m_hitx_xy) / delta;
00077
00078 delta = m_hity_1 * m_hity_xx - m_hity_x * m_hity_x;
00079 m_segy = (m_hity_xx * m_hity_y - m_hity_x * m_hity_xy) / delta;
00080 }
00081