CMS 3D CMS Logo

MuonDT13ChamberResidual.cc
Go to the documentation of this file.
1 /*
2  * $Id: $
3  */
4 
6 
9  DetId chamberId,
10  AlignableDetOrUnitPtr chamberAlignable)
11  : MuonHitsChamberResidual(globalGeometry, navigator, chamberId, chamberAlignable) {
13  double rphiAngle = atan2(m_globalGeometry->idToDet(m_chamberId)->position().y(),
15  M_PI / 2.;
16  align::GlobalVector rphiDirection(cos(rphiAngle), sin(rphiAngle), 0.);
17  m_sign = m_globalGeometry->idToDet(m_chamberId)->toLocal(rphiDirection).x() > 0. ? 1. : -1.;
18 }
19 
20 // void MuonDT13ChamberResidual::addResidual(const TrajectoryStateOnSurface *tsos, const TransientTrackingRecHit *hit)
21 
23  const TrajectoryStateOnSurface *tsos,
24  const TrackingRecHit *hit,
25  double chamber_width,
26  double chamber_length) {
27  bool m_debug = false;
28 
29  m_chamber_width = chamber_width;
30  m_chamber_length = chamber_length;
31 
32  DetId id = hit->geographicalId();
33 
34  align::LocalPoint hitChamberPos =
36  align::LocalPoint tsosChamberPos =
38 
39  if (m_debug) {
40  std::cout << " MuonDT13ChamberResidual hitChamberPos x: " << hitChamberPos.x()
41  << " tsosChamberPos x: " << tsosChamberPos.x() << std::endl;
42  std::cout << " hitChamberPos y: " << hitChamberPos.y()
43  << " tsosChamberPos y: " << tsosChamberPos.y() << std::endl;
44  std::cout << " hitChamberPos z: " << hitChamberPos.z()
45  << " tsosChamberPos z: " << tsosChamberPos.z() << std::endl;
46  }
47 
48  double residual = tsosChamberPos.x() - hitChamberPos.x(); // residual is hit minus hit
49  double weight = 1. / hit->localPositionError().xx(); // weight linear fit by hit-only local error
50  double layerPosition = tsosChamberPos.z(); // the layer's position in the chamber's coordinate system
51  double layerHitPos = hitChamberPos.z();
52 
53  m_numHits++;
54 
55  // "x" is the layerPosition, "y" is the residual (this is a linear fit to residual versus layerPosition)
57  m_residual_x += weight * layerPosition;
59  m_residual_xx += weight * layerPosition * layerPosition;
60  m_residual_xy += weight * layerPosition * residual;
61 
62  // "x" is the layerPosition, "y" is chamberx (this is a linear fit to chamberx versus layerPosition)
63  m_trackx_1 += weight;
64  m_trackx_x += weight * layerPosition;
65  m_trackx_y += weight * tsosChamberPos.x();
66  m_trackx_xx += weight * layerPosition * layerPosition;
67  m_trackx_xy += weight * layerPosition * tsosChamberPos.x();
68 
69  // "x" is the layerPosition, "y" is chambery (this is a linear fit to chambery versus layerPosition)
70  m_tracky_1 += weight;
71  m_tracky_x += weight * layerPosition;
72  m_tracky_y += weight * tsosChamberPos.y();
73  m_tracky_xx += weight * layerPosition * layerPosition;
74  m_tracky_xy += weight * layerPosition * tsosChamberPos.y();
75 
76  m_hitx_1 += weight;
77  m_hitx_x += weight * layerHitPos;
78  m_hitx_y += weight * hitChamberPos.x();
79  m_hitx_xx += weight * layerHitPos * layerHitPos;
80  m_hitx_xy += weight * layerHitPos * hitChamberPos.x();
81 
82  m_hity_1 += weight;
83  m_hity_x += weight * layerHitPos;
84  m_hity_y += weight * hitChamberPos.y();
85  m_hity_xx += weight * layerHitPos * layerPosition;
86  m_hity_xy += weight * layerHitPos * hitChamberPos.y();
87 
88  m_localIDs.push_back(id);
89  // m_localResids.push_back(tsos->localPosition().x() - hit->localPosition().x()); //FIXME looks like this line is not used anywhere, moreover it is wrong for segment-based reconstruction, I changed it to the follwoing line
90  m_localResids.push_back(residual);
91  m_individual_x.push_back(layerPosition);
92  m_individual_y.push_back(residual);
93  m_individual_weight.push_back(weight);
94 
95  if (m_numHits > 1)
96  segment_fit();
97 }
Vector3DBase< Scalar, GlobalTag >
GeomDet::position
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
MuonHitsChamberResidual::m_chamber_length
double m_chamber_length
Definition: MuonHitsChamberResidual.h:33
MuonHitsChamberResidual::m_trackx_xx
double m_trackx_xx
Definition: MuonHitsChamberResidual.h:42
MuonChamberResidual::m_chamberId
DetId m_chamberId
Definition: MuonChamberResidual.h:90
MuonHitsChamberResidual::m_trackx_y
double m_trackx_y
Definition: MuonHitsChamberResidual.h:41
MuonHitsChamberResidual::segment_fit
void segment_fit()
Definition: MuonHitsChamberResidual.cc:41
MuonChamberResidual::m_localIDs
std::vector< DetId > m_localIDs
Definition: MuonChamberResidual.h:94
MuonHitsChamberResidual::m_trackx_x
double m_trackx_x
Definition: MuonHitsChamberResidual.h:40
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
MuonHitsChamberResidual::m_hitx_xx
double m_hitx_xx
Definition: MuonHitsChamberResidual.h:52
mps_merge.weight
weight
Definition: mps_merge.py:88
gather_cfg.cout
cout
Definition: gather_cfg.py:144
AlignableSurface::toLocal
align::RotationType toLocal(const align::RotationType &) const
Return in local frame a rotation given in global frame.
Definition: AlignableSurface.cc:35
MuonHitsChamberResidual::m_tracky_x
double m_tracky_x
Definition: MuonHitsChamberResidual.h:45
AlignableDetOrUnitPtr
Definition: AlignableDetOrUnitPtr.h:30
MuonHitsChamberResidual::m_residual_xx
double m_residual_xx
Definition: MuonHitsChamberResidual.h:37
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetId
Definition: DetId.h:17
MuonChamberResidual::residual
double residual() const
Definition: MuonChamberResidual.h:54
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
MuonHitsChamberResidual::m_hity_x
double m_hity_x
Definition: MuonHitsChamberResidual.h:55
HLT_2018_cff.navigator
navigator
Definition: HLT_2018_cff.py:11734
MuonHitsChamberResidual::m_hitx_1
double m_hitx_1
Definition: MuonHitsChamberResidual.h:49
edm::ESHandle< GlobalTrackingGeometry >
MuonHitsChamberResidual::m_residual_1
double m_residual_1
Definition: MuonHitsChamberResidual.h:34
Alignable::surface
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
MuonHitsChamberResidual::m_tracky_1
double m_tracky_1
Definition: MuonHitsChamberResidual.h:44
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
MuonHitsChamberResidual::m_residual_x
double m_residual_x
Definition: MuonHitsChamberResidual.h:35
TrajectoryStateOnSurface::localPosition
LocalPoint localPosition() const
Definition: TrajectoryStateOnSurface.h:74
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
MuonDT13ChamberResidual::MuonDT13ChamberResidual
MuonDT13ChamberResidual(edm::ESHandle< GlobalTrackingGeometry > globalGeometry, AlignableNavigator *navigator, DetId chamberId, AlignableDetOrUnitPtr chamberAlignable)
Definition: MuonDT13ChamberResidual.cc:7
MuonHitsChamberResidual::m_hitx_xy
double m_hitx_xy
Definition: MuonHitsChamberResidual.h:53
MuonChamberResidual::m_type
int m_type
Definition: MuonChamberResidual.h:100
MuonHitsChamberResidual::m_hity_xy
double m_hity_xy
Definition: MuonHitsChamberResidual.h:58
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
MuonHitsChamberResidual::m_tracky_y
double m_tracky_y
Definition: MuonHitsChamberResidual.h:46
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
MuonChamberResidual::m_sign
double m_sign
Definition: MuonChamberResidual.h:101
MuonChamberResidual::m_individual_weight
std::vector< double > m_individual_weight
Definition: MuonChamberResidual.h:98
MuonChamberResidual::m_individual_x
std::vector< double > m_individual_x
Definition: MuonChamberResidual.h:96
MuonHitsChamberResidual::m_residual_xy
double m_residual_xy
Definition: MuonHitsChamberResidual.h:38
TrackingRecHit
Definition: TrackingRecHit.h:21
MuonDT13ChamberResidual.h
MuonHitsChamberResidual
Definition: MuonHitsChamberResidual.h:22
MuonChamberResidual::m_individual_y
std::vector< double > m_individual_y
Definition: MuonChamberResidual.h:97
MuonChamberResidual::m_globalGeometry
edm::ESHandle< GlobalTrackingGeometry > m_globalGeometry
Definition: MuonChamberResidual.h:88
MuonHitsChamberResidual::m_trackx_xy
double m_trackx_xy
Definition: MuonHitsChamberResidual.h:43
MuonHitsChamberResidual::m_hity_y
double m_hity_y
Definition: MuonHitsChamberResidual.h:56
MuonHitsChamberResidual::m_hitx_y
double m_hitx_y
Definition: MuonHitsChamberResidual.h:51
MuonChamberResidual::m_localResids
std::vector< double > m_localResids
Definition: MuonChamberResidual.h:95
MuonChamberResidual::m_numHits
int m_numHits
Definition: MuonChamberResidual.h:93
MuonHitsChamberResidual::m_hity_1
double m_hity_1
Definition: MuonHitsChamberResidual.h:54
GlobalTrackingGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: GlobalTrackingGeometry.cc:44
MuonHitsChamberResidual::m_tracky_xy
double m_tracky_xy
Definition: MuonHitsChamberResidual.h:48
MuonChamberResidual::m_chamberAlignable
AlignableDetOrUnitPtr m_chamberAlignable
Definition: MuonChamberResidual.h:91
MuonHitsChamberResidual::m_residual_y
double m_residual_y
Definition: MuonHitsChamberResidual.h:36
MuonHitsChamberResidual::m_chamber_width
double m_chamber_width
Definition: MuonHitsChamberResidual.h:32
MuonHitsChamberResidual::m_tracky_xx
double m_tracky_xx
Definition: MuonHitsChamberResidual.h:47
MuonHitsChamberResidual::m_hitx_x
double m_hitx_x
Definition: MuonHitsChamberResidual.h:50
MuonChamberResidual::kDT13
Definition: MuonChamberResidual.h:28
MuonHitsChamberResidual::m_hity_xx
double m_hity_xx
Definition: MuonHitsChamberResidual.h:57
weight
Definition: weight.py:1
hit
Definition: SiStripHitEffFromCalibTree.cc:88
MuonDT13ChamberResidual::addResidual
void addResidual(edm::ESHandle< Propagator > prop, const TrajectoryStateOnSurface *tsos, const TrackingRecHit *hit, double, double) override
Definition: MuonDT13ChamberResidual.cc:22
MuonHitsChamberResidual::m_trackx_1
double m_trackx_1
Definition: MuonHitsChamberResidual.h:39