CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/Alignment/CommonAlignmentParametrization/src/RigidBodyAlignmentParameters4D.cc

Go to the documentation of this file.
00001 
00008 #include "FWCore/Utilities/interface/Exception.h"
00009 
00010 #include "Alignment/CommonAlignment/interface/Alignable.h"
00011 #include "Alignment/CommonAlignment/interface/AlignableDetOrUnitPtr.h"
00012 #include "Alignment/CommonAlignmentParametrization/interface/FrameToFrameDerivative.h"
00013 #include "Alignment/CommonAlignmentParametrization/interface/SegmentAlignmentDerivatives4D.h"
00014 #include "Alignment/CommonAlignmentParametrization/interface/AlignmentParametersFactory.h"
00015 #include "CondFormats/Alignment/interface/Definitions.h"
00016 
00017 // This class's header 
00018 #include "Alignment/CommonAlignmentParametrization/interface/RigidBodyAlignmentParameters4D.h"
00019 
00020 //__________________________________________________________________________________________________
00021 AlgebraicMatrix 
00022 RigidBodyAlignmentParameters4D::derivatives( const TrajectoryStateOnSurface &tsos,
00023                                            const AlignableDetOrUnitPtr &alidet ) const
00024 {
00025   const Alignable *ali = this->alignable(); // Alignable of these parameters
00026 
00027   if (ali == alidet) { // same alignable => same frame
00028     return SegmentAlignmentDerivatives4D()(tsos);
00029   } else { // different alignable => transform into correct frame
00030     const AlgebraicMatrix deriv = SegmentAlignmentDerivatives4D()(tsos);
00031     FrameToFrameDerivative ftfd;
00032     return ftfd.frameToFrameDerivative(alidet, ali) * deriv;
00033   }
00034 }
00035 
00036 //__________________________________________________________________________________________________
00037 RigidBodyAlignmentParameters4D*
00038 RigidBodyAlignmentParameters4D::clone( const AlgebraicVector& parameters,
00039                                      const AlgebraicSymMatrix& covMatrix ) const
00040 {
00041   RigidBodyAlignmentParameters4D* rbap =
00042     new RigidBodyAlignmentParameters4D( alignable(), parameters, covMatrix, selector());
00043 
00044   if (userVariables()) rbap->setUserVariables(userVariables()->clone());
00045   rbap->setValid(isValid());
00046 
00047   return rbap;
00048 }
00049 
00050 //__________________________________________________________________________________________________
00051 RigidBodyAlignmentParameters4D*
00052 RigidBodyAlignmentParameters4D::cloneFromSelected( const AlgebraicVector& parameters,
00053                                                  const AlgebraicSymMatrix& covMatrix ) const
00054 {
00055   RigidBodyAlignmentParameters4D* rbap =
00056     new RigidBodyAlignmentParameters4D(alignable(), expandVector( parameters, selector()),
00057                                      expandSymMatrix(covMatrix, selector()), selector());
00058 
00059   if ( userVariables() ) rbap->setUserVariables(userVariables()->clone());
00060   rbap->setValid(isValid());
00061 
00062   return rbap;
00063 }
00064 
00065 
00066 
00067 //__________________________________________________________________________________________________
00068 int RigidBodyAlignmentParameters4D::type() const
00069 {
00070   return AlignmentParametersFactory::kRigidBody4D;
00071 }
00072