Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:44:44

0001 /** \file BowedSurfaceAlignmentDerivatives.cc
0002  *
0003  *  $Date: 2007/05/02 21:01:53 $
0004  *  $Revision: 1.7 $
0005  */
0006 
0007 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0008 
0009 #include "Alignment/CommonAlignmentParametrization/interface/BowedSurfaceAlignmentDerivatives.h"
0010 #include "Alignment/CommonAlignmentParametrization/interface/KarimakiAlignmentDerivatives.h"
0011 #include <cmath>
0012 
0013 AlgebraicMatrix BowedSurfaceAlignmentDerivatives::operator()(
0014     const TrajectoryStateOnSurface &tsos, double uWidth, double vLength, bool doSplit, double ySplit) const {
0015   AlgebraicMatrix result(N_PARAM, 2);
0016 
0017   // track parameters on surface:
0018   const AlgebraicVector5 tsosPar(tsos.localParameters().mixedFormatVector());
0019   // [1] dxdz : direction tangent in local xz-plane
0020   // [2] dydz : direction tangent in local yz-plane
0021   // [3] x    : local x-coordinate
0022   // [4] y    : local y-coordinate
0023   double myY = tsosPar[4];
0024   double myLengthV = vLength;
0025   if (doSplit) {  // re-'calibrate' y length and transform myY to be w.r.t.
0026                   // surface middle
0027     // Some signs depend on whether we are in surface part below or above
0028     // ySplit:
0029     const double sign = (tsosPar[4] < ySplit ? +1. : -1.);
0030     const double yMiddle = ySplit * 0.5 - sign * vLength * .25;  // middle of surface
0031     myY = tsosPar[4] - yMiddle;
0032     myLengthV = vLength * 0.5 + sign * ySplit;
0033   }
0034 
0035   const AlgebraicMatrix karimaki(KarimakiAlignmentDerivatives()(tsos));  // it's just 6x2...
0036   // copy u, v, w from Karimaki - they are independent of splitting
0037   result[dx][0] = karimaki[0][0];
0038   result[dx][1] = karimaki[0][1];
0039   result[dy][0] = karimaki[1][0];
0040   result[dy][1] = karimaki[1][1];
0041   result[dz][0] = karimaki[2][0];
0042   result[dz][1] = karimaki[2][1];
0043   const double aScale = gammaScale(uWidth, myLengthV);
0044   result[drotZ][0] = myY / aScale;  // Since karimaki[5][0] == vx;
0045   result[drotZ][1] = karimaki[5][1] / aScale;
0046 
0047   double uRel = 2. * tsosPar[3] / uWidth;  // relative u (-1 .. +1)
0048   double vRel = 2. * myY / myLengthV;      // relative v (-1 .. +1)
0049   // 'range check':
0050   const double cutOff = 1.5;
0051   if (uRel < -cutOff) {
0052     uRel = -cutOff;
0053   } else if (uRel > cutOff) {
0054     uRel = cutOff;
0055   }
0056   if (vRel < -cutOff) {
0057     vRel = -cutOff;
0058   } else if (vRel > cutOff) {
0059     vRel = cutOff;
0060   }
0061 
0062   // Legendre polynomials renormalized to LPn(1)-LPn(0)=1 (n>0)
0063   const double uLP0 = 1.0;
0064   const double uLP1 = uRel;
0065   const double uLP2 = uRel * uRel - 1. / 3.;
0066   const double vLP0 = 1.0;
0067   const double vLP1 = vRel;
0068   const double vLP2 = vRel * vRel - 1. / 3.;
0069 
0070   // 1st order (slopes, replacing angles beta, alpha)
0071   result[dslopeX][0] = tsosPar[1] * uLP1 * vLP0;
0072   result[dslopeX][1] = tsosPar[2] * uLP1 * vLP0;
0073   result[dslopeY][0] = tsosPar[1] * uLP0 * vLP1;
0074   result[dslopeY][1] = tsosPar[2] * uLP0 * vLP1;
0075 
0076   // 2nd order (sagitta)
0077   result[dsagittaX][0] = tsosPar[1] * uLP2 * vLP0;
0078   result[dsagittaX][1] = tsosPar[2] * uLP2 * vLP0;
0079   result[dsagittaXY][0] = tsosPar[1] * uLP1 * vLP1;
0080   result[dsagittaXY][1] = tsosPar[2] * uLP1 * vLP1;
0081   result[dsagittaY][0] = tsosPar[1] * uLP0 * vLP2;
0082   result[dsagittaY][1] = tsosPar[2] * uLP0 * vLP2;
0083 
0084   return result;
0085 }
0086 
0087 //------------------------------------------------------------------------------
0088 double BowedSurfaceAlignmentDerivatives::gammaScale(double width, double splitLength) {
0089   //   return 0.5 * std::sqrt(width*width + splitLength*splitLength);
0090   //   return 0.5 * (std::fabs(width) + std::fabs(splitLength));
0091   return 0.5 * (width + splitLength);
0092 }