Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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