00001 #include "Alignment/CommonAlignment/interface/Alignable.h" 00002 #include "Alignment/CommonAlignment/interface/SurveyDet.h" 00003 #include "Alignment/CommonAlignment/interface/SurveyResidual.h" 00004 #include "Alignment/SurveyAnalysis/interface/SurveyParameters.h" 00005 00006 #include "Alignment/SurveyAnalysis/interface/SurveyAlignmentPoints.h" 00007 00008 SurveyAlignmentPoints::SurveyAlignmentPoints(const align::Alignables& sensors, 00009 const std::vector<align::StructureType>& levels): 00010 SurveyAlignment(sensors, levels) 00011 { 00012 } 00013 00014 void SurveyAlignmentPoints::findAlignPars(bool bias) 00015 { 00016 unsigned int nSensor = theSensors.size(); 00017 00018 for (unsigned int i = 0; i < nSensor; ++i) 00019 { 00020 Alignable* ali = theSensors[i]; 00021 00022 AlgebraicSymMatrix sumJVJT(6, 0); // 6 by 6 symmetric matrix init to 0 00023 AlgebraicVector sumJVe(6, 0); // init to 0 00024 00025 for (unsigned int l = 0; l < theLevels.size(); ++l) 00026 { 00027 SurveyResidual res(*ali, theLevels[l], bias); 00028 00029 if ( !res.valid() ) continue; 00030 00031 align::LocalVectors residuals = res.pointsResidual(); 00032 00033 unsigned int nPoints = residuals.size(); 00034 00035 for (unsigned int j = 0; j < nPoints; ++j) 00036 { 00037 AlgebraicMatrix J = ali->survey()->derivatives(j); 00038 AlgebraicSymMatrix V(3, 1); // identity for now 00039 AlgebraicVector e(3); // local residual 00040 00041 const align::LocalVector& lr = residuals[j]; 00042 00043 e(1) = lr.x(); e(2) = lr.y(); e(3) = lr.z(); 00044 V /= 1e-4 * 1e-4; 00045 sumJVe += J * (V * e); 00046 sumJVJT += V.similarity(J); 00047 } 00048 } 00049 00050 int dummy; 00051 sumJVJT.invert(dummy); // sumJVJT = sumJVJT^-1 00052 sumJVe = -sumJVJT * sumJVe; 00053 00054 ali->setAlignmentParameters( new SurveyParameters(ali, sumJVe, sumJVJT) ); 00055 } 00056 }