CMS 3D CMS Logo

SurveyAlignmentPoints.cc
Go to the documentation of this file.
5 
7 
9  const std::vector<align::StructureType>& levels)
10  : SurveyAlignment(sensors, levels) {}
11 
13  unsigned int nSensor = theSensors.size();
14 
15  for (unsigned int i = 0; i < nSensor; ++i) {
16  Alignable* ali = theSensors[i];
17 
18  AlgebraicSymMatrix sumJVJT(6, 0); // 6 by 6 symmetric matrix init to 0
19  AlgebraicVector sumJVe(6, 0); // init to 0
20 
21  for (unsigned int l = 0; l < theLevels.size(); ++l) {
22  SurveyResidual res(*ali, theLevels[l], bias);
23 
24  if (!res.valid())
25  continue;
26 
27  align::LocalVectors residuals = res.pointsResidual();
28 
29  unsigned int nPoints = residuals.size();
30 
31  for (unsigned int j = 0; j < nPoints; ++j) {
32  AlgebraicMatrix J = ali->survey()->derivatives(j);
33  AlgebraicSymMatrix V(3, 1); // identity for now
34  AlgebraicVector e(3); // local residual
35 
36  const align::LocalVector& lr = residuals[j];
37 
38  e(1) = lr.x();
39  e(2) = lr.y();
40  e(3) = lr.z();
41  V /= 1e-4 * 1e-4;
42  sumJVe += J * (V * e);
43  sumJVJT += V.similarity(J);
44  }
45  }
46 
47  int dummy;
48  sumJVJT.invert(dummy); // sumJVJT = sumJVJT^-1
49  sumJVe = -sumJVJT * sumJVe;
50 
51  ali->setAlignmentParameters(new SurveyParameters(ali, sumJVe, sumJVJT));
52  }
53 }
const align::Alignables & theSensors
const std::vector< align::StructureType > & theLevels
void findAlignPars(bool bias=false) override
Find the alignment parameters for all sensors.
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:225
T y() const
Definition: PV3DBase.h:63
AlgebraicMatrix derivatives(unsigned int index) const
Definition: SurveyDet.cc:24
Definition: Electron.h:6
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:127
CLHEP::HepMatrix AlgebraicMatrix
T z() const
Definition: PV3DBase.h:64
CLHEP::HepVector AlgebraicVector
align::LocalVectors pointsResidual() const
std::vector< Alignable * > Alignables
Definition: Utilities.h:32
std::vector< LocalVector > LocalVectors
Definition: Utilities.h:31
CLHEP::HepSymMatrix AlgebraicSymMatrix
T x() const
Definition: PV3DBase.h:62
bool valid() const
SurveyAlignmentPoints(const align::Alignables &sensors, const std::vector< align::StructureType > &levels)
Constructor to set the sensors and residual levels in base class.