CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/Alignment/SurveyAnalysis/src/SurveyAlignmentSensor.cc

Go to the documentation of this file.
00001 #include "Alignment/CommonAlignment/interface/Alignable.h"
00002 #include "Alignment/CommonAlignment/interface/SurveyResidual.h"
00003 #include "Alignment/SurveyAnalysis/interface/SurveyParameters.h"
00004 
00005 #include "Alignment/SurveyAnalysis/interface/SurveyAlignmentSensor.h"
00006 
00007 SurveyAlignmentSensor::SurveyAlignmentSensor(const align::Alignables& sensors,
00008                                              const std::vector<align::StructureType>& levels):
00009   SurveyAlignment(sensors, levels)
00010 {
00011 }
00012 
00013 void SurveyAlignmentSensor::findAlignPars(bool bias)
00014 {
00015   unsigned int nSensor = theSensors.size();
00016 
00017   for (unsigned int i = 0; i < nSensor; ++i)
00018   {
00019     Alignable* ali = theSensors[i];
00020 
00021     AlgebraicVector par(6, 0);
00022     AlgebraicSymMatrix cov(6, 0);
00023 
00024     for (unsigned int l = 0; l < theLevels.size(); ++l)
00025     {
00026       SurveyResidual res(*ali, theLevels[l], bias);
00027 
00028       if ( !res.valid() ) continue;
00029 
00030       AlgebraicSymMatrix invCov = res.inverseCovariance();
00031 
00032       par += invCov * res.sensorResidual();
00033       cov += invCov;
00034     }
00035 
00036     int dummy;
00037     cov.invert(dummy); // cov = cov^-1
00038     par = -cov * par;
00039 
00040     ali->setAlignmentParameters( new SurveyParameters(ali, par, cov) );
00041   }
00042 }