CMS 3D CMS Logo

MuonTrackDT13ChamberResidual.cc
Go to the documentation of this file.
1 /*
2  * $Id: $
3  */
4 
6 
7 
9  DetId chamberId, AlignableDetOrUnitPtr chamberAlignable)
10  : MuonChamberResidual(globalGeometry, navigator, chamberId, chamberAlignable)
11 {
13  double rphiAngle = atan2(m_globalGeometry->idToDet(m_chamberId)->position().y(), m_globalGeometry->idToDet(m_chamberId)->position().x()) + M_PI/2.;
14  align::GlobalVector rphiDirection(cos(rphiAngle), sin(rphiAngle), 0.);
15  m_sign = m_globalGeometry->idToDet(m_chamberId)->toLocal(rphiDirection).x() > 0. ? 1. : -1.;
16 }
17 
18 
20 {
21  DTRecSegment4DRef segmentDT = seg->dtSegmentRef;
22  if (segmentDT.get() != 0)
23  {
24  const DTRecSegment4D* segment = segmentDT.get();
25  assert(segment->hasPhi());
26  const DTChamberRecSegment2D* phiSeg = segment->phiSegment();
27  m_numHits = phiSeg->recHits().size();
28  m_ndof = phiSeg->degreesOfFreedom();
29  m_chi2 = phiSeg->chi2();
30  //std::cout<<"phi seg position = "<<phiSeg->localPosition()<<" numhits="<<m_numHits<<std::endl;
31  }
32 
33  m_residual = trk->x - seg->x;
34  m_residual_error = sqrt( pow(trk->xErr, 2) + pow(seg->xErr, 2) );
35  m_resslope = trk->dXdZ - seg->dXdZ;
36  m_resslope_error = sqrt( pow(trk->dXdZErr, 2) + pow(seg->dXdZErr, 2) );
37 
38  m_trackx = trk->x;
39  m_tracky = trk->y;
40  m_trackdxdz = trk->dXdZ;
41  m_trackdydz = trk->dYdZ;
42 
43  m_segx = seg->x;
44  m_segy = seg->y;
45  m_segdxdz = seg->dXdZ;
46  m_segdydz = seg->dYdZ;
47 
48  //std::cout<<"d13 res "<<m_residual<<"+-"<<m_residual_error<<" "<<m_resslope<<"+-"<<m_resslope_error<<std::endl;
49  //std::cout<<"d13 trk "<<m_trackx<<" "<<m_tracky<<" "<<m_trackdxdz<<" "<<m_trackdydz<<std::endl;
50  //std::cout<<"d13 seg "<<m_segx<<" "<<m_segy<<" "<<m_segdxdz<<" "<<m_segdydz<<std::endl;
51 }
DTRecSegment4DRef dtSegmentRef
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
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
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:48
T sqrt(T t)
Definition: SSEVec.h:18
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
bool hasPhi() const
Does it have the Phi projection?
#define M_PI
Definition: DetId.h:18
MuonTrackDT13ChamberResidual(edm::ESHandle< GlobalTrackingGeometry > globalGeometry, AlignableNavigator *navigator, DetId chamberId, AlignableDetOrUnitPtr chamberAlignable)
edm::ESHandle< GlobalTrackingGeometry > m_globalGeometry
virtual void setSegmentResidual(const reco::MuonChamberMatch *, const reco::MuonSegmentMatch *)
T x() const
Definition: PV3DBase.h:62
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40