CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/Alignment/CommonAlignmentParametrization/src/BowedSurfaceAlignmentDerivatives.cc

Go to the documentation of this file.
00001 
00007 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00008 
00009 #include "Alignment/CommonAlignmentParametrization/interface/KarimakiAlignmentDerivatives.h"
00010 #include "Alignment/CommonAlignmentParametrization/interface/BowedSurfaceAlignmentDerivatives.h"
00011 #include <math.h>
00012 
00013 AlgebraicMatrix 
00014 BowedSurfaceAlignmentDerivatives::operator()(const TrajectoryStateOnSurface &tsos,
00015                                              double uWidth, double vLength,
00016                                              bool doSplit, double ySplit) const
00017 { 
00018 
00019   AlgebraicMatrix result(N_PARAM, 2);
00020 
00021   // track parameters on surface:
00022   const AlgebraicVector5 tsosPar(tsos.localParameters().mixedFormatVector());
00023   // [1] dxdz : direction tangent in local xz-plane
00024   // [2] dydz : direction tangent in local yz-plane
00025   // [3] x    : local x-coordinate
00026   // [4] y    : local y-coordinate
00027   double myY = tsosPar[4];
00028   double myLengthV = vLength;
00029   if (doSplit) { // re-'calibrate' y length and transform myY to be w.r.t. surface middle
00030     // Some signs depend on whether we are in surface part below or above ySplit:
00031     const double sign = (tsosPar[4] < ySplit ? +1. : -1.); 
00032     const double yMiddle = ySplit * 0.5 - sign * vLength * .25; // middle of surface
00033     myY = tsosPar[4] - yMiddle;
00034     myLengthV = vLength * 0.5 + sign * ySplit;
00035   }
00036 
00037   const AlgebraicMatrix karimaki(KarimakiAlignmentDerivatives()(tsos)); // it's just 6x2...
00038   // copy u, v, w from Karimaki - they are independent of splitting
00039   result[dx][0] = karimaki[0][0];
00040   result[dx][1] = karimaki[0][1];
00041   result[dy][0] = karimaki[1][0];
00042   result[dy][1] = karimaki[1][1];
00043   result[dz][0] = karimaki[2][0];
00044   result[dz][1] = karimaki[2][1];
00045   const double aScale = gammaScale(uWidth, myLengthV);
00046   result[drotZ][0] = myY / aScale; // Since karimaki[5][0] == vx;
00047   result[drotZ][1] = karimaki[5][1] / aScale;
00048 
00049   double uRel = 2. * tsosPar[3] / uWidth;  // relative u (-1 .. +1)
00050   double vRel = 2. * myY / myLengthV;       // relative v (-1 .. +1)
00051   // 'range check':
00052   const double cutOff = 1.5;
00053   if (uRel < -cutOff) { uRel = -cutOff; } else if (uRel > cutOff) { uRel = cutOff; }
00054   if (vRel < -cutOff) { vRel = -cutOff; } else if (vRel > cutOff) { vRel = cutOff; }
00055 
00056   // Legendre polynomials renormalized to LPn(1)-LPn(0)=1 (n>0)
00057   const double uLP0 = 1.0;
00058   const double uLP1 = uRel;
00059   const double uLP2 = uRel * uRel - 1./3.;
00060   const double vLP0 = 1.0;
00061   const double vLP1 = vRel;
00062   const double vLP2 = vRel * vRel - 1./3.;
00063 
00064   // 1st order (slopes, replacing angles beta, alpha)
00065   result[dslopeX][0] = tsosPar[1] * uLP1 * vLP0;
00066   result[dslopeX][1] = tsosPar[2] * uLP1 * vLP0;
00067   result[dslopeY][0] = tsosPar[1] * uLP0 * vLP1;
00068   result[dslopeY][1] = tsosPar[2] * uLP0 * vLP1;
00069   
00070   // 2nd order (sagitta)
00071   result[dsagittaX ][0] = tsosPar[1] * uLP2 * vLP0;
00072   result[dsagittaX ][1] = tsosPar[2] * uLP2 * vLP0;
00073   result[dsagittaXY][0] = tsosPar[1] * uLP1 * vLP1;
00074   result[dsagittaXY][1] = tsosPar[2] * uLP1 * vLP1;
00075   result[dsagittaY ][0] = tsosPar[1] * uLP0 * vLP2;
00076   result[dsagittaY ][1] = tsosPar[2] * uLP0 * vLP2;
00077    
00078   return result;
00079 }
00080 
00081 //------------------------------------------------------------------------------
00082 double BowedSurfaceAlignmentDerivatives::gammaScale(double width, double splitLength)
00083 {
00084 //   return 0.5 * std::sqrt(width*width + splitLength*splitLength);
00085 //   return 0.5 * (std::fabs(width) + std::fabs(splitLength));
00086   return 0.5 * (width + splitLength);
00087 }