CMS 3D CMS Logo

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