CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/Alignment/MuonAlignmentAlgorithms/src/MuonTrackDT2ChamberResidual.cc

Go to the documentation of this file.
00001 /* 
00002  * $Id: MuonTrackDT2ChamberResidual.cc,v 1.1 2011/10/12 23:32:08 khotilov Exp $
00003  */
00004 
00005 #include "Alignment/MuonAlignmentAlgorithms/interface/MuonTrackDT2ChamberResidual.h"
00006 
00007 MuonTrackDT2ChamberResidual::MuonTrackDT2ChamberResidual(edm::ESHandle<GlobalTrackingGeometry> globalGeometry, AlignableNavigator *navigator,
00008                                                          DetId chamberId, AlignableDetOrUnitPtr chamberAlignable)
00009   : MuonChamberResidual(globalGeometry, navigator, chamberId, chamberAlignable)
00010 {
00011   m_type = MuonChamberResidual::kDT2; 
00012   align::GlobalVector zDirection(0., 0., 1.);
00013   m_sign = m_globalGeometry->idToDet(m_chamberId)->toLocal(zDirection).y() > 0. ? 1. : -1.; 
00014 }
00015 
00016 
00017 void MuonTrackDT2ChamberResidual::setSegmentResidual(const reco::MuonChamberMatch *trk, const reco::MuonSegmentMatch *seg)
00018 {
00019   DTRecSegment4DRef segmentDT = seg->dtSegmentRef;
00020   if (segmentDT.get() != 0)
00021   {
00022     const DTRecSegment4D* segment = segmentDT.get();
00023     assert(segment->hasZed());
00024     const DTSLRecSegment2D* zSeg = (*segment).zSegment();
00025     m_numHits = zSeg->recHits().size();
00026     m_ndof = zSeg->degreesOfFreedom();
00027     m_chi2 = zSeg->chi2();
00028     //std::cout<<"z seg position = "<<zSeg->localPosition()<<"  numhits="<<m_numHits<<std::endl;
00029   }
00030   
00031   m_residual = trk->y - seg->y;
00032   m_residual_error = sqrt( pow(trk->yErr, 2) + pow(seg->yErr, 2) );
00033   m_resslope = trk->dYdZ - seg->dYdZ;
00034   m_resslope_error = sqrt( pow(trk->dYdZErr, 2) + pow(seg->dYdZErr, 2) );
00035   
00036   m_trackx = trk->x;
00037   m_tracky = trk->y;
00038   m_trackdxdz = trk->dXdZ;
00039   m_trackdydz = trk->dYdZ;
00040 
00041   m_segx = seg->x;
00042   m_segy = seg->y;
00043   m_segdxdz = seg->dXdZ;
00044   m_segdydz = seg->dYdZ;
00045 
00046   //std::cout<<"d2 res "<<m_residual<<"+-"<<m_residual_error<<"  "<<m_resslope<<"+-"<<m_resslope_error<<std::endl;
00047   //std::cout<<"d2 trk "<<m_trackx<<" "<<m_tracky<<" "<<m_trackdxdz<<" "<<m_trackdydz<<std::endl;
00048   //std::cout<<"d2 seg "<<m_segx<<" "<<m_segy<<" "<<m_segdxdz<<" "<<m_segdydz<<std::endl;
00049 }