Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:12

0001 #ifndef Alignment_CommonAlignmentParametrization_FrameToFrameDerivative_h
0002 #define Alignment_CommonAlignmentParametrization_FrameToFrameDerivative_h
0003 
0004 #include "CondFormats/Alignment/interface/Definitions.h"
0005 #include "DataFormats/Math/interface/AlgebraicROOTObjects.h"
0006 
0007 /// \class FrameToFrameDerivative
0008 ///
0009 /// Class for calculating the jacobian d_object/d_composedObject
0010 /// for the rigid body parametrisation of both, i.e. the derivatives
0011 /// expressing the influence of u, v, w, alpha, beta, gamma of the
0012 /// composedObject on u, v, w, alpha, beta, gamma of its component 'object'.
0013 ///
0014 ///  $Date: 2007/10/08 15:56:00 $
0015 ///  $Revision: 1.6 $
0016 /// (last update by $Author: cklae $)
0017 
0018 class Alignable;
0019 
0020 class FrameToFrameDerivative {
0021 public:
0022   /// Return the derivative DeltaFrame(object)/DeltaFrame(composedObject),
0023   /// i.e. a 6x6 matrix:
0024   ///
0025   /// / du/du_c du/dv_c du/dw_c du/da_c du/db_c du/dg_c |
0026   /// | dv/du_c dv/dv_c dv/dw_c dv/da_c dv/db_c dv/dg_c |
0027   /// | dw/du_c dw/dv_c dw/dw_c dw/da_c dw/db_c dw/dg_c |
0028   /// | da/du_c da/dv_c da/dw_c da/da_c da/db_c da/dg_c |
0029   /// | db/du_c db/dv_c db/dw_c db/da_c db/db_c db/dg_c |
0030   /// \ dg/du_c dg/dv_c dg/dw_c dg/da_c dg/db_c dg/dg_c /
0031   ///
0032   /// where u, v, w, a, b, g are shifts and rotations of the object
0033   /// and u_c, v_c, w_c, a_c, b_c, g_c those of the composed object.
0034 
0035   AlgebraicMatrix frameToFrameDerivative(const Alignable *object, const Alignable *composedObject) const;
0036 
0037   /// Calculates derivatives DeltaFrame(object)/DeltaFrame(composedobject)
0038   /// using their positions and orientations, see method
0039   /// frameToFrameDerivative(..) for definition. As a new method it gets a new
0040   /// interface avoiding CLHEP that should anyway be replaced by SMatrix at some
0041   /// point...
0042   AlgebraicMatrix66 getDerivative(const align::RotationType &objectRot,
0043                                   const align::RotationType &composeRot,
0044                                   const align::GlobalPoint &objectPos,
0045                                   const align::GlobalPoint &composePos) const;
0046 
0047 private:
0048   /// Helper to transform from RotationType to AlgebraicMatrix
0049   inline static AlgebraicMatrix transform(const align::RotationType &);
0050 
0051   /// Calculates derivatives using the orientation Matrixes and the origin
0052   /// difference vector
0053   AlgebraicMatrix getDerivative(const align::RotationType &objectRot,
0054                                 const align::RotationType &composeRot,
0055                                 const align::GlobalVector &posVec) const;
0056 
0057   /// Gets linear approximated euler Angles
0058   AlgebraicVector linearEulerAngles(const AlgebraicMatrix &rotDelta) const;
0059 
0060   /// Calculates the derivative DPos/DPos
0061   AlgebraicMatrix derivativePosPos(const AlgebraicMatrix &RotDet, const AlgebraicMatrix &RotRot) const;
0062 
0063   /// Calculates the derivative DPos/DRot
0064   AlgebraicMatrix derivativePosRot(const AlgebraicMatrix &RotDet,
0065                                    const AlgebraicMatrix &RotRot,
0066                                    const AlgebraicVector &S) const;
0067 
0068   /// Calculates the derivative DRot/DRot
0069   AlgebraicMatrix derivativeRotRot(const AlgebraicMatrix &RotDet, const AlgebraicMatrix &RotRot) const;
0070 };
0071 
0072 AlgebraicMatrix FrameToFrameDerivative::transform(const align::RotationType &rot) {
0073   AlgebraicMatrix R(3, 3);
0074 
0075   R(1, 1) = rot.xx();
0076   R(1, 2) = rot.xy();
0077   R(1, 3) = rot.xz();
0078   R(2, 1) = rot.yx();
0079   R(2, 2) = rot.yy();
0080   R(2, 3) = rot.yz();
0081   R(3, 1) = rot.zx();
0082   R(3, 2) = rot.zy();
0083   R(3, 3) = rot.zz();
0084 
0085   return R;
0086 }
0087 
0088 #endif