CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BowedSurfaceAlignmentDerivatives.cc
Go to the documentation of this file.
1 
8 
11 #include <math.h>
12 
15  double uWidth, double vLength,
16  bool doSplit, double ySplit) const
17 {
18 
20 
21  // track parameters on surface:
22  const AlgebraicVector5 tsosPar(tsos.localParameters().mixedFormatVector());
23  // [1] dxdz : direction tangent in local xz-plane
24  // [2] dydz : direction tangent in local yz-plane
25  // [3] x : local x-coordinate
26  // [4] y : local y-coordinate
27  double myY = tsosPar[4];
28  double myLengthV = vLength;
29  if (doSplit) { // re-'calibrate' y length and transform myY to be w.r.t. surface middle
30  // Some signs depend on whether we are in surface part below or above ySplit:
31  const double sign = (tsosPar[4] < ySplit ? +1. : -1.);
32  const double yMiddle = ySplit * 0.5 - sign * vLength * .25; // middle of surface
33  myY = tsosPar[4] - yMiddle;
34  myLengthV = vLength * 0.5 + sign * ySplit;
35  }
36 
37  const AlgebraicMatrix karimaki(KarimakiAlignmentDerivatives()(tsos)); // it's just 6x2...
38  // copy u, v, w from Karimaki - they are independent of splitting
39  result[dx][0] = karimaki[0][0];
40  result[dx][1] = karimaki[0][1];
41  result[dy][0] = karimaki[1][0];
42  result[dy][1] = karimaki[1][1];
43  result[dz][0] = karimaki[2][0];
44  result[dz][1] = karimaki[2][1];
45  const double aScale = gammaScale(uWidth, myLengthV);
46  result[drotZ][0] = myY / aScale; // Since karimaki[5][0] == vx;
47  result[drotZ][1] = karimaki[5][1] / aScale;
48 
49  double uRel = 2. * tsosPar[3] / uWidth; // relative u (-1 .. +1)
50  double vRel = 2. * myY / myLengthV; // relative v (-1 .. +1)
51  // 'range check':
52  const double cutOff = 1.5;
53  if (uRel < -cutOff) { uRel = -cutOff; } else if (uRel > cutOff) { uRel = cutOff; }
54  if (vRel < -cutOff) { vRel = -cutOff; } else if (vRel > cutOff) { vRel = cutOff; }
55 
56  // Legendre polynomials renormalized to LPn(1)-LPn(0)=1 (n>0)
57  const double uLP0 = 1.0;
58  const double uLP1 = uRel;
59  const double uLP2 = uRel * uRel - 1./3.;
60  const double vLP0 = 1.0;
61  const double vLP1 = vRel;
62  const double vLP2 = vRel * vRel - 1./3.;
63 
64  // 1st order (slopes, replacing angles beta, alpha)
65  result[dslopeX][0] = tsosPar[1] * uLP1 * vLP0;
66  result[dslopeX][1] = tsosPar[2] * uLP1 * vLP0;
67  result[dslopeY][0] = tsosPar[1] * uLP0 * vLP1;
68  result[dslopeY][1] = tsosPar[2] * uLP0 * vLP1;
69 
70  // 2nd order (sagitta)
71  result[dsagittaX ][0] = tsosPar[1] * uLP2 * vLP0;
72  result[dsagittaX ][1] = tsosPar[2] * uLP2 * vLP0;
73  result[dsagittaXY][0] = tsosPar[1] * uLP1 * vLP1;
74  result[dsagittaXY][1] = tsosPar[2] * uLP1 * vLP1;
75  result[dsagittaY ][0] = tsosPar[1] * uLP0 * vLP2;
76  result[dsagittaY ][1] = tsosPar[2] * uLP0 * vLP2;
77 
78  return result;
79 }
80 
81 //------------------------------------------------------------------------------
82 double BowedSurfaceAlignmentDerivatives::gammaScale(double width, double splitLength)
83 {
84 // return 0.5 * std::sqrt(width*width + splitLength*splitLength);
85 // return 0.5 * (std::fabs(width) + std::fabs(splitLength));
86  return 0.5 * (width + splitLength);
87 }
const LocalTrajectoryParameters & localParameters() const
AlgebraicMatrix operator()(const TrajectoryStateOnSurface &tsos, double uWidth, double vLength, bool doSplit=false, double ySplit=0.) const
Returns 9x2 jacobian matrix.
CLHEP::HepMatrix AlgebraicMatrix
tuple result
Definition: query.py:137
static double gammaScale(double width, double splitLength)
ROOT::Math::SVector< double, 5 > AlgebraicVector5
AlgebraicVector5 mixedFormatVector() const