CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonCSCChamberResidual.cc
Go to the documentation of this file.
3 
5  DetId id = hit->geographicalId();
6  const CSCGeometry *cscGeometry = dynamic_cast<const CSCGeometry*>(m_globalGeometry->slaveGeometry(id));
7  assert(cscGeometry);
8 
9  LocalPoint hitChamberPos = m_chamberAlignable->surface().toLocal(m_globalGeometry->idToDet(id)->toGlobal(hit->localPosition()));
10  LocalPoint tsosChamberPos = m_chamberAlignable->surface().toLocal(m_globalGeometry->idToDet(id)->toGlobal(tsos->localPosition()));
11 
12  int strip = cscGeometry->layer(id)->geometry()->nearestStrip(hit->localPosition());
13  double angle = cscGeometry->layer(id)->geometry()->stripAngle(strip) - M_PI/2.;
14  double sinAngle = sin(angle);
15  double cosAngle = cos(angle);
16 
17  double residual = cosAngle * (tsosChamberPos.x() - hitChamberPos.x()) + sinAngle * (tsosChamberPos.y() - hitChamberPos.y()); // yes, that's +sin()
18 
19  double xx = hit->localPositionError().xx();
20  double xy = hit->localPositionError().xy();
21  double yy = hit->localPositionError().yy();
22  double weight = 1. / (xx*cosAngle*cosAngle + 2.*xy*sinAngle*cosAngle + yy*sinAngle*sinAngle);
23 
24  double layerPosition = tsosChamberPos.z(); // the layer's position in the chamber's coordinate system
25 
26  m_numHits++;
27 
28  // "x" is the layerPosition, "y" is the residual (this is a linear fit to residual versus layerPosition)
30  m_residual_x += weight * layerPosition;
31  m_residual_y += weight * residual;
32  m_residual_xx += weight * layerPosition * layerPosition;
33  m_residual_xy += weight * layerPosition * residual;
34 
35  // "x" is the layerPosition, "y" is chamberx (this is a linear fit to chamberx versus layerPosition)
36  m_trackx_1 += weight;
37  m_trackx_x += weight * layerPosition;
38  m_trackx_y += weight * tsosChamberPos.x();
39  m_trackx_xx += weight * layerPosition * layerPosition;
40  m_trackx_xy += weight * layerPosition * tsosChamberPos.x();
41 
42  // "x" is the layerPosition, "y" is chambery (this is a linear fit to chambery versus layerPosition)
43  m_tracky_1 += weight;
44  m_tracky_x += weight * layerPosition;
45  m_tracky_y += weight * tsosChamberPos.y();
46  m_tracky_xx += weight * layerPosition * layerPosition;
47  m_tracky_xy += weight * layerPosition * tsosChamberPos.y();
48 
49  m_localIDs.push_back(id);
50  m_localResids.push_back(residual);
51  m_individual_x.push_back(layerPosition);
52  m_individual_y.push_back(residual);
53  m_individual_weight.push_back(weight);
54 }
float xx() const
Definition: LocalError.h:19
std::vector< double > m_individual_y
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T y() const
Definition: PV3DBase.h:57
float xy() const
Definition: LocalError.h:20
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.
float yy() const
Definition: LocalError.h:21
std::vector< double > m_localResids
T z() const
Definition: PV3DBase.h:58
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
AlignableDetOrUnitPtr m_chamberAlignable
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
int nearestStrip(const LocalPoint &lp) const
Basic2DVector< T > xy() const
Definition: DetId.h:20
#define M_PI
Definition: BFit3D.cc:3
virtual LocalError localPositionError() const =0
void addResidual(const TrajectoryStateOnSurface *tsos, const TransientTrackingRecHit *hit)
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:123
edm::ESHandle< GlobalTrackingGeometry > m_globalGeometry
DetId geographicalId() const
T x() const
Definition: PV3DBase.h:56
virtual LocalPoint localPosition() const =0
std::vector< double > m_individual_weight
float stripAngle(int strip) const
double residual() const
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11