Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:45:36

0001 /*
0002  * $Id: $
0003  */
0004 
0005 #include "Alignment/MuonAlignmentAlgorithms/interface/MuonTrackDT13ChamberResidual.h"
0006 
0007 MuonTrackDT13ChamberResidual::MuonTrackDT13ChamberResidual(edm::ESHandle<GlobalTrackingGeometry> globalGeometry,
0008                                                            AlignableNavigator *navigator,
0009                                                            DetId chamberId,
0010                                                            AlignableDetOrUnitPtr chamberAlignable)
0011     : MuonChamberResidual(globalGeometry, navigator, chamberId, chamberAlignable) {
0012   m_type = MuonChamberResidual::kDT13;
0013   double rphiAngle = atan2(m_globalGeometry->idToDet(m_chamberId)->position().y(),
0014                            m_globalGeometry->idToDet(m_chamberId)->position().x()) +
0015                      M_PI / 2.;
0016   align::GlobalVector rphiDirection(cos(rphiAngle), sin(rphiAngle), 0.);
0017   m_sign = m_globalGeometry->idToDet(m_chamberId)->toLocal(rphiDirection).x() > 0. ? 1. : -1.;
0018 }
0019 
0020 void MuonTrackDT13ChamberResidual::setSegmentResidual(const reco::MuonChamberMatch *trk,
0021                                                       const reco::MuonSegmentMatch *seg) {
0022   DTRecSegment4DRef segmentDT = seg->dtSegmentRef;
0023   if (segmentDT.get() != nullptr) {
0024     const DTRecSegment4D *segment = segmentDT.get();
0025     assert(segment->hasPhi());
0026     const DTChamberRecSegment2D *phiSeg = segment->phiSegment();
0027     m_numHits = phiSeg->recHits().size();
0028     m_ndof = phiSeg->degreesOfFreedom();
0029     m_chi2 = phiSeg->chi2();
0030     //std::cout<<"phi seg position = "<<phiSeg->localPosition()<<"  numhits="<<m_numHits<<std::endl;
0031   }
0032 
0033   m_residual = trk->x - seg->x;
0034   m_residual_error = sqrt(pow(trk->xErr, 2) + pow(seg->xErr, 2));
0035   m_resslope = trk->dXdZ - seg->dXdZ;
0036   m_resslope_error = sqrt(pow(trk->dXdZErr, 2) + pow(seg->dXdZErr, 2));
0037 
0038   m_trackx = trk->x;
0039   m_tracky = trk->y;
0040   m_trackdxdz = trk->dXdZ;
0041   m_trackdydz = trk->dYdZ;
0042 
0043   m_segx = seg->x;
0044   m_segy = seg->y;
0045   m_segdxdz = seg->dXdZ;
0046   m_segdydz = seg->dYdZ;
0047 
0048   //std::cout<<"d13 res "<<m_residual<<"+-"<<m_residual_error<<"  "<<m_resslope<<"+-"<<m_resslope_error<<std::endl;
0049   //std::cout<<"d13 trk "<<m_trackx<<" "<<m_tracky<<" "<<m_trackdxdz<<" "<<m_trackdydz<<std::endl;
0050   //std::cout<<"d13 seg "<<m_segx<<" "<<m_segy<<" "<<m_segdxdz<<" "<<m_segdydz<<std::endl;
0051 }