CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/Alignment/KalmanAlignmentAlgorithm/src/KalmanAlignmentUpdator.cc

Go to the documentation of this file.
00001 
00002 #include "Alignment/KalmanAlignmentAlgorithm/interface/KalmanAlignmentUpdator.h"
00003 #include "Alignment/KalmanAlignmentAlgorithm/interface/KalmanAlignmentUserVariables.h"
00004 #include "Alignment/CommonAlignment/interface/AlignmentParameters.h"
00005 
00006 
00007 void KalmanAlignmentUpdator::updateUserVariables( const std::vector< Alignable* > & alignables ) const
00008 {
00009   std::vector< Alignable* > updated;
00010   std::vector< Alignable* >::const_iterator itAlignable = alignables.begin();
00011 
00012   while ( itAlignable != alignables.end() )
00013   {
00014     AlignmentParameters* alignmentParameters = ( *itAlignable )->alignmentParameters();
00015 
00016     if ( std::find(updated.begin(),updated.end(),*itAlignable) == updated.end() && alignmentParameters != 0 )
00017     {
00018       KalmanAlignmentUserVariables* userVariables =
00019         dynamic_cast< KalmanAlignmentUserVariables* >( alignmentParameters->userVariables() );
00020 
00021       if ( userVariables != 0 ) userVariables->update();
00022 
00023       updated.push_back( *itAlignable );
00024     }
00025 
00026     ++itAlignable;
00027   }
00028 }
00029 
00030 
00031 const std::vector< Alignable* >
00032 KalmanAlignmentUpdator::alignablesFromAlignableDets( std::vector< AlignableDetOrUnitPtr >& alignableDets,
00033                                                      AlignmentParameterStore* store ) const
00034 {
00035   std::vector< Alignable* > alignables;
00036 
00037   std::vector< AlignableDetOrUnitPtr >::const_iterator itAD;
00038   for ( itAD = alignableDets.begin(); itAD != alignableDets.end(); ++itAD )
00039   {
00040     Alignable* ali = store->alignableFromAlignableDet( *itAD );
00041     alignables.push_back( ali );
00042   }
00043 
00044   return alignables;
00045 }
00046 
00047 
00048 unsigned int
00049 KalmanAlignmentUpdator::nDifferentAlignables( const std::vector<Alignable*>& ali ) const
00050 {
00051   std::set< Alignable* > list;
00052   list.insert( ali.begin(), ali.end() );
00053   unsigned int ndiff = list.size();
00054   return ndiff;
00055 }