CMS 3D CMS Logo

MuonTrackCSCChamberResidual.cc
Go to the documentation of this file.
1 /*
2  * $Id: MuonTrackCSCChamberResidual.cc,v 1.3 2011/11/02 19:58:38 khotilov Exp $
3  */
4 
6 //#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
7 
10  DetId chamberId,
11  AlignableDetOrUnitPtr chamberAlignable)
12  : MuonChamberResidual(globalGeometry, navigator, chamberId, chamberAlignable) {
14  align::GlobalVector zDirection(0., 0., 1.);
15  m_sign = m_globalGeometry->idToDet(m_chamberId)->toLocal(zDirection).z() > 0. ? 1. : -1.;
16 }
17 
19  const reco::MuonSegmentMatch *seg) {
20  CSCDetId id(trk->id.rawId());
21 
22  CSCSegmentRef segmentCSC = seg->cscSegmentRef;
23  if (segmentCSC.get() != nullptr) {
24  const CSCSegment *segment = segmentCSC.get();
25  m_numHits = segment->nRecHits();
26  m_ndof = segment->degreesOfFreedom();
27  m_chi2 = segment->chi2();
28  //std::cout<<"csc seg position = "<<segment->localPosition()<<" numhits="<<m_numHits<<" id: "<<id<<std::endl;
29  }
30 
31  align::LocalPoint l_seg(seg->x, seg->y, 0.);
32  align::LocalPoint l_trk(trk->x, trk->y, 0.);
33  //align::GlobalPoint g_seg = m_globalGeometry->idToDet(chamber)->toGlobal(l_seg);
34  //align::GlobalPoint g_trk = m_globalGeometry->idToDet(chamber)->toGlobal(l_trk);
35 
36  /*
37  double dphi = g_trk.phi() - g_seg.phi();
38  while (dphi > M_PI) dphi -= 2.*M_PI;
39  while (dphi < -M_PI) dphi += 2.*M_PI;
40  m_residual = - m_sign * g_trk.perp() * dphi; // coming from global, need to adjust the sign
41  std::cout<<"cscres="<<m_residual<<" dx="<<trk->x-seg->x<<" diff="<<trk->x-seg->x - m_residual<<std::endl;
42  */
43  m_residual = trk->x - seg->x;
44  m_residual_error = sqrt(pow(trk->xErr, 2) + pow(seg->xErr, 2));
45  m_resslope = trk->dXdZ - seg->dXdZ;
46  m_resslope_error = sqrt(pow(trk->dXdZErr, 2) + pow(seg->dXdZErr, 2));
47 
48  m_trackx = trk->x;
49  m_tracky = trk->y;
50  m_trackdxdz = trk->dXdZ;
51  m_trackdydz = trk->dYdZ;
52 
53  m_segx = seg->x;
54  m_segy = seg->y;
55  m_segdxdz = seg->dXdZ;
56  m_segdydz = seg->dYdZ;
57 
58  //double yresidual_error = sqrt( pow(trk->yErr, 2) + pow(seg->yErr, 2) );
59  //double yresslope_error = sqrt( pow(trk->dYdZErr, 2) + pow(seg->dYdZErr, 2) );
60  //std::cout<<"csc res "<<m_residual<<"+-"<<m_residual_error<<" "<<m_resslope<<"+-"<<m_resslope_error<<" "<<trk->y-seg->y<<"+-"<<yresidual_error<<" "<<trk->dYdZ - seg->dYdZ<<"+-"<<yresslope_error<<std::endl;
61  //std::cout<<"csc trk "<<m_trackx<<" "<<m_tracky<<" "<<m_trackdxdz<<" "<<m_trackdydz<<std::endl;
62  //std::cout<<"csc seg "<<m_segx<<" "<<m_segy<<" "<<m_segdxdz<<" "<<m_segdydz<<std::endl;
63 }
Vector3DBase< Scalar, GlobalTag >
MuonChamberResidual::m_resslope_error
double m_resslope_error
Definition: MuonChamberResidual.h:107
MuonChamberResidual::m_chamberId
DetId m_chamberId
Definition: MuonChamberResidual.h:90
MuonTrackCSCChamberResidual::setSegmentResidual
void setSegmentResidual(const reco::MuonChamberMatch *, const reco::MuonSegmentMatch *) override
Definition: MuonTrackCSCChamberResidual.cc:18
MuonChamberResidual::m_segy
double m_segy
Definition: MuonChamberResidual.h:115
MuonChamberResidual::m_segdxdz
double m_segdxdz
Definition: MuonChamberResidual.h:112
reco::MuonChamberMatch::x
float x
Definition: MuonChamberMatch.h:19
HLT_FULL_cff.navigator
navigator
Definition: HLT_FULL_cff.py:13108
MuonChamberResidual::m_segx
double m_segx
Definition: MuonChamberResidual.h:114
MuonChamberResidual::m_residual
double m_residual
Definition: MuonChamberResidual.h:104
MuonChamberResidual::m_chi2
double m_chi2
Definition: MuonChamberResidual.h:102
reco::MuonChamberMatch::dYdZ
float dYdZ
Definition: MuonChamberMatch.h:24
reco::MuonSegmentMatch::y
float y
Definition: MuonSegmentMatch.h:35
AlignableDetOrUnitPtr
Definition: AlignableDetOrUnitPtr.h:30
reco::MuonSegmentMatch::xErr
float xErr
Definition: MuonSegmentMatch.h:36
reco::MuonChamberMatch::dXdZErr
float dXdZErr
Definition: MuonChamberMatch.h:25
edm::Ref< CSCSegmentCollection >
reco::MuonSegmentMatch::cscSegmentRef
CSCSegmentRef cscSegmentRef
Definition: MuonSegmentMatch.h:51
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
CSCSegment::nRecHits
int nRecHits() const
Definition: CSCSegment.h:68
DetId
Definition: DetId.h:17
reco::MuonSegmentMatch
Definition: MuonSegmentMatch.h:12
MuonChamberResidual::m_segdydz
double m_segdydz
Definition: MuonChamberResidual.h:113
CSCSegment::degreesOfFreedom
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
Definition: CSCSegment.h:62
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
edm::ESHandle< GlobalTrackingGeometry >
MuonTrackCSCChamberResidual::MuonTrackCSCChamberResidual
MuonTrackCSCChamberResidual(edm::ESHandle< GlobalTrackingGeometry > globalGeometry, AlignableNavigator *navigator, DetId chamberId, AlignableDetOrUnitPtr chamberAlignable)
Definition: MuonTrackCSCChamberResidual.cc:8
Point3DBase
Definition: Point3DBase.h:10
GeomDet::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
AlignableNavigator
Definition: AlignableNavigator.h:25
reco::MuonSegmentMatch::dYdZ
float dYdZ
Definition: MuonSegmentMatch.h:39
CSCSegment
Definition: CSCSegment.h:21
reco::MuonChamberMatch::dXdZ
float dXdZ
Definition: MuonChamberMatch.h:23
reco::MuonChamberMatch::id
DetId id
Definition: MuonChamberMatch.h:27
MuonChamberResidual::m_trackdydz
double m_trackdydz
Definition: MuonChamberResidual.h:109
MuonChamberResidual::m_type
int m_type
Definition: MuonChamberResidual.h:100
CSCDetId
Definition: CSCDetId.h:26
MuonChamberResidual::m_ndof
int m_ndof
Definition: MuonChamberResidual.h:103
MuonChamberResidual
Definition: MuonChamberResidual.h:26
MuonChamberResidual::m_trackx
double m_trackx
Definition: MuonChamberResidual.h:110
MuonChamberResidual::m_sign
double m_sign
Definition: MuonChamberResidual.h:101
reco::MuonChamberMatch::xErr
float xErr
Definition: MuonChamberMatch.h:21
MuonChamberResidual::kCSC
Definition: MuonChamberResidual.h:28
reco::MuonChamberMatch
Definition: MuonChamberMatch.h:10
MuonChamberResidual::m_resslope
double m_resslope
Definition: MuonChamberResidual.h:106
reco::MuonSegmentMatch::dXdZ
float dXdZ
Definition: MuonSegmentMatch.h:38
MuonChamberResidual::m_tracky
double m_tracky
Definition: MuonChamberResidual.h:111
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
MuonChamberResidual::m_globalGeometry
edm::ESHandle< GlobalTrackingGeometry > m_globalGeometry
Definition: MuonChamberResidual.h:88
MuonTrackCSCChamberResidual.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
MuonChamberResidual::m_numHits
int m_numHits
Definition: MuonChamberResidual.h:93
GlobalTrackingGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: GlobalTrackingGeometry.cc:44
reco::MuonChamberMatch::y
float y
Definition: MuonChamberMatch.h:20
MuonChamberResidual::m_residual_error
double m_residual_error
Definition: MuonChamberResidual.h:105
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
CSCSegment::chi2
double chi2() const override
Chi2 of the segment fit.
Definition: CSCSegment.h:58
reco::MuonSegmentMatch::dXdZErr
float dXdZErr
Definition: MuonSegmentMatch.h:40
MuonChamberResidual::m_trackdxdz
double m_trackdxdz
Definition: MuonChamberResidual.h:108
reco::MuonSegmentMatch::x
float x
Definition: MuonSegmentMatch.h:34