CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonDT2ChamberResidual.cc
Go to the documentation of this file.
1 /*
2  * $Id: $
3  */
4 
6 
8  DetId chamberId, const AlignableDetOrUnitPtr& chamberAlignable)
9  : MuonHitsChamberResidual(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 
17 {
18  DetId id = hit->geographicalId();
19 
20  align::LocalPoint hitChamberPos = m_chamberAlignable->surface().toLocal(m_globalGeometry->idToDet(id)->toGlobal(hit->localPosition()));
21  align::LocalPoint tsosChamberPos = m_chamberAlignable->surface().toLocal(m_globalGeometry->idToDet(id)->toGlobal(tsos->localPosition()));
22 
23  double residual = tsosChamberPos.y() - hitChamberPos.y(); // residual is track minus hit
24  double weight = 1. / hit->localPositionError().xx(); // weight linear fit by hit-only local error (yes, xx: layer x is chamber y)
25  double layerPosition = tsosChamberPos.z(); // the layer's position in the chamber's coordinate system
26  double layerHitPos = hitChamberPos.z();
27 
28  m_numHits++;
29 
30  // "x" is the layerPosition, "y" is the residual (this is a linear fit to residual versus layerPosition)
32  m_residual_x += weight * layerPosition;
33  m_residual_y += weight * residual;
34  m_residual_xx += weight * layerPosition * layerPosition;
35  m_residual_xy += weight * layerPosition * residual;
36 
37  // "x" is the layerPosition, "y" is chamberx (this is a linear fit to chamberx versus layerPosition)
38  m_trackx_1 += weight;
39  m_trackx_x += weight * layerPosition;
40  m_trackx_y += weight * tsosChamberPos.x();
41  m_trackx_xx += weight * layerPosition * layerPosition;
42  m_trackx_xy += weight * layerPosition * tsosChamberPos.x();
43 
44  // "x" is the layerPosition, "y" is chambery (this is a linear fit to chambery versus layerPosition)
45  m_tracky_1 += weight;
46  m_tracky_x += weight * layerPosition;
47  m_tracky_y += weight * tsosChamberPos.y();
48  m_tracky_xx += weight * layerPosition * layerPosition;
49  m_tracky_xy += weight * layerPosition * tsosChamberPos.y();
50 
51  m_hitx_1 += weight;
52  m_hitx_x += weight * layerHitPos;
53  m_hitx_y += weight * hitChamberPos.x();
54  m_hitx_xx += weight * layerHitPos * layerHitPos;
55  m_hitx_xy += weight * layerHitPos * hitChamberPos.x();
56 
57  m_hity_1 += weight;
58  m_hity_x += weight * layerHitPos;
59  m_hity_y += weight * hitChamberPos.y();
60  m_hity_xx += weight * layerHitPos * layerHitPos;
61  m_hity_xy += weight * layerHitPos * hitChamberPos.y();
62 
63  m_localIDs.push_back(id);
64  m_localResids.push_back(tsos->localPosition().x() - hit->localPosition().x());
65  m_individual_x.push_back(layerPosition);
66  m_individual_y.push_back(residual);
67  m_individual_weight.push_back(weight);
68 
69  if (m_numHits>1) segment_fit();
70 }
float xx() const
Definition: LocalError.h:24
std::vector< double > m_individual_y
T y() const
Definition: PV3DBase.h:63
std::vector< double > m_individual_x
std::vector< DetId > m_localIDs
align::RotationType toLocal(const align::RotationType &) const
Return in local frame a rotation given in global frame.
std::vector< double > m_localResids
T z() const
Definition: PV3DBase.h:64
MuonDT2ChamberResidual(edm::ESHandle< GlobalTrackingGeometry > globalGeometry, AlignableNavigator *navigator, DetId chamberId, const AlignableDetOrUnitPtr &chamberAlignable)
virtual void addResidual(const TrajectoryStateOnSurface *tsos, const TransientTrackingRecHit *hit)
AlignableDetOrUnitPtr m_chamberAlignable
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
Definition: DetId.h:18
virtual LocalError localPositionError() const =0
edm::ESHandle< GlobalTrackingGeometry > m_globalGeometry
DetId geographicalId() const
int weight
Definition: histoStyle.py:50
T x() const
Definition: PV3DBase.h:62
virtual LocalPoint localPosition() const =0
std::vector< double > m_individual_weight
double residual() const