Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:48

0001 /** \class MuonHitsChamberResidual
0002  *  $Id: $
0003  *  \author V. Khotilovich - Texas A&M University <khotilov@cern.ch>
0004  */
0005 
0006 #include "Alignment/MuonAlignmentAlgorithms/interface/MuonHitsChamberResidual.h"
0007 
0008 MuonHitsChamberResidual::MuonHitsChamberResidual(edm::ESHandle<GlobalTrackingGeometry> globalGeometry,
0009                                                  AlignableNavigator* navigator,
0010                                                  DetId chamberId,
0011                                                  const AlignableDetOrUnitPtr& chamberAlignable)
0012     : MuonChamberResidual(globalGeometry, navigator, chamberId, chamberAlignable),
0013       m_chamber_width(0.),
0014       m_chamber_length(0.),
0015       m_residual_1(0.),
0016       m_residual_x(0.),
0017       m_residual_y(0.),
0018       m_residual_xx(0.),
0019       m_residual_xy(0.),
0020       m_trackx_1(0.),
0021       m_trackx_x(0.),
0022       m_trackx_y(0.),
0023       m_trackx_xx(0.),
0024       m_trackx_xy(0.),
0025       m_tracky_1(0.),
0026       m_tracky_x(0.),
0027       m_tracky_y(0.),
0028       m_tracky_xx(0.),
0029       m_tracky_xy(0.),
0030       m_hitx_1(0.),
0031       m_hitx_x(0.),
0032       m_hitx_y(0.),
0033       m_hitx_xx(0.),
0034       m_hitx_xy(0.),
0035       m_hity_1(0.),
0036       m_hity_x(0.),
0037       m_hity_y(0.),
0038       m_hity_xx(0.),
0039       m_hity_xy(0.) {}
0040 
0041 void MuonHitsChamberResidual::segment_fit() {
0042   assert(m_numHits > 1);
0043 
0044   double delta = m_residual_1 * m_residual_xx - m_residual_x * m_residual_x;
0045   m_residual = (m_residual_xx * m_residual_y - m_residual_x * m_residual_xy) / delta;
0046 
0047   delta = m_residual_1 * m_residual_xx - m_residual_x * m_residual_x;
0048   m_residual_error = sqrt(m_residual_xx / delta);
0049 
0050   delta = m_residual_1 * m_residual_xx - m_residual_x * m_residual_x;
0051   m_resslope = (m_residual_1 * m_residual_xy - m_residual_x * m_residual_y) / delta;
0052 
0053   delta = m_residual_1 * m_residual_xx - m_residual_x * m_residual_x;
0054   m_resslope_error = sqrt(m_residual_1 / delta);
0055 
0056   m_ndof = m_individual_x.size() - 2;
0057 
0058   m_chi2 = 0.;
0059   double a = m_residual;
0060   double b = m_resslope;
0061   std::vector<double>::const_iterator x = m_individual_x.begin();
0062   std::vector<double>::const_iterator y = m_individual_y.begin();
0063   std::vector<double>::const_iterator w = m_individual_weight.begin();
0064   for (; x != m_individual_x.end(); ++x, ++y, ++w)
0065     m_chi2 += pow((*y) - a - b * (*x), 2) * (*w);
0066 
0067   delta = m_trackx_1 * m_trackx_xx - m_trackx_x * m_trackx_x;
0068   m_trackdxdz = (m_trackx_1 * m_trackx_xy - m_trackx_x * m_trackx_y) / delta;
0069 
0070   delta = m_tracky_1 * m_tracky_xx - m_tracky_x * m_tracky_x;
0071   m_trackdydz = (m_tracky_1 * m_tracky_xy - m_tracky_x * m_tracky_y) / delta;
0072 
0073   delta = m_trackx_1 * m_trackx_xx - m_trackx_x * m_trackx_x;
0074   m_trackx = (m_trackx_xx * m_trackx_y - m_trackx_x * m_trackx_xy) / delta;
0075 
0076   delta = m_tracky_1 * m_tracky_xx - m_tracky_x * m_tracky_x;
0077   m_tracky = (m_tracky_xx * m_tracky_y - m_tracky_x * m_tracky_xy) / delta;
0078 
0079   delta = m_hitx_1 * m_hitx_xx - m_hitx_x * m_hitx_x;
0080   m_segdxdz = (m_hitx_1 * m_hitx_xy - m_hitx_x * m_hitx_y) / delta;
0081 
0082   delta = m_hity_1 * m_hity_xx - m_hity_x * m_hity_x;
0083   m_segdydz = (m_hity_1 * m_hity_xy - m_hity_x * m_hity_y) / delta;
0084 
0085   delta = m_hitx_1 * m_hitx_xx - m_hitx_x * m_hitx_x;
0086   m_segx = (m_hitx_xx * m_hitx_y - m_hitx_x * m_hitx_xy) / delta;
0087 
0088   delta = m_hity_1 * m_hity_xx - m_hity_x * m_hity_x;
0089   m_segy = (m_hity_xx * m_hity_y - m_hity_x * m_hity_xy) / delta;
0090 
0091   m_ChambW = m_chamber_width;
0092   m_Chambl = m_chamber_length;
0093 }