CMS 3D CMS Logo

MuonTrackDT2ChamberResidual.cc
Go to the documentation of this file.
1 /*
2  * $Id: $
3  */
4 
6 
8  DetId chamberId, AlignableDetOrUnitPtr chamberAlignable)
9  : MuonChamberResidual(globalGeometry, navigator, chamberId, chamberAlignable)
10 {
12  align::GlobalVector zDirection(0., 0., 1.);
13  m_sign = m_globalGeometry->idToDet(m_chamberId)->toLocal(zDirection).y() > 0. ? 1. : -1.;
14 }
15 
16 
18 {
19  DTRecSegment4DRef segmentDT = seg->dtSegmentRef;
20  if (segmentDT.get() != 0)
21  {
22  const DTRecSegment4D* segment = segmentDT.get();
23  assert(segment->hasZed());
24  const DTSLRecSegment2D* zSeg = (*segment).zSegment();
25  m_numHits = zSeg->recHits().size();
26  m_ndof = zSeg->degreesOfFreedom();
27  m_chi2 = zSeg->chi2();
28  //std::cout<<"z seg position = "<<zSeg->localPosition()<<" numhits="<<m_numHits<<std::endl;
29  }
30 
31  m_residual = trk->y - seg->y;
32  m_residual_error = sqrt( pow(trk->yErr, 2) + pow(seg->yErr, 2) );
33  m_resslope = trk->dYdZ - seg->dYdZ;
34  m_resslope_error = sqrt( pow(trk->dYdZErr, 2) + pow(seg->dYdZErr, 2) );
35 
36  m_trackx = trk->x;
37  m_tracky = trk->y;
38  m_trackdxdz = trk->dXdZ;
39  m_trackdydz = trk->dYdZ;
40 
41  m_segx = seg->x;
42  m_segy = seg->y;
43  m_segdxdz = seg->dXdZ;
44  m_segdydz = seg->dYdZ;
45 
46  //std::cout<<"d2 res "<<m_residual<<"+-"<<m_residual_error<<" "<<m_resslope<<"+-"<<m_resslope_error<<std::endl;
47  //std::cout<<"d2 trk "<<m_trackx<<" "<<m_tracky<<" "<<m_trackdxdz<<" "<<m_trackdydz<<std::endl;
48  //std::cout<<"d2 seg "<<m_segx<<" "<<m_segy<<" "<<m_segdxdz<<" "<<m_segdydz<<std::endl;
49 }
MuonTrackDT2ChamberResidual(edm::ESHandle< GlobalTrackingGeometry > globalGeometry, AlignableNavigator *navigator, DetId chamberId, AlignableDetOrUnitPtr chamberAlignable)
DTRecSegment4DRef dtSegmentRef
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:69
virtual const GeomDet * idToDet(DetId) const
T sqrt(T t)
Definition: SSEVec.h:18
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
bool hasZed() const
Does it have the Z projection?
Definition: DetId.h:18
edm::ESHandle< GlobalTrackingGeometry > m_globalGeometry
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
virtual void setSegmentResidual(const reco::MuonChamberMatch *, const reco::MuonSegmentMatch *)