CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Static Private Member Functions
FrameToFrameDerivative Class Reference

#include <FrameToFrameDerivative.h>

Public Member Functions

AlgebraicMatrix frameToFrameDerivative (const Alignable *object, const Alignable *composedObject) const
 
AlgebraicMatrix66 getDerivative (const align::RotationType &objectRot, const align::RotationType &composeRot, const align::GlobalPoint &objectPos, const align::GlobalPoint &composePos) const
 

Private Member Functions

AlgebraicMatrix derivativePosPos (const AlgebraicMatrix &RotDet, const AlgebraicMatrix &RotRot) const
 Calculates the derivative DPos/DPos. More...
 
AlgebraicMatrix derivativePosRot (const AlgebraicMatrix &RotDet, const AlgebraicMatrix &RotRot, const AlgebraicVector &S) const
 Calculates the derivative DPos/DRot. More...
 
AlgebraicMatrix derivativeRotRot (const AlgebraicMatrix &RotDet, const AlgebraicMatrix &RotRot) const
 Calculates the derivative DRot/DRot. More...
 
AlgebraicMatrix getDerivative (const align::RotationType &objectRot, const align::RotationType &composeRot, const align::GlobalVector &posVec) const
 Calculates derivatives using the orientation Matrixes and the origin difference vector. More...
 
AlgebraicVector linearEulerAngles (const AlgebraicMatrix &rotDelta) const
 Gets linear approximated euler Angles. More...
 

Static Private Member Functions

static AlgebraicMatrix transform (const align::RotationType &)
 Helper to transform from RotationType to AlgebraicMatrix. More...
 

Detailed Description

Class for calculating the jacobian d_object/d_composedObject for the rigid body parametrisation of both, i.e. the derivatives expressing the influence of u, v, w, alpha, beta, gamma of the composedObject on u, v, w, alpha, beta, gamma of its component 'object'.

Date:
2007/10/08 15:56:00
Revision:
1.6

(last update by

Author:
cklae

)

Definition at line 20 of file FrameToFrameDerivative.h.

Member Function Documentation

AlgebraicMatrix FrameToFrameDerivative::derivativePosPos ( const AlgebraicMatrix RotDet,
const AlgebraicMatrix RotRot 
) const
private

Calculates the derivative DPos/DPos.

Definition at line 105 of file FrameToFrameDerivative.cc.

Referenced by getDerivative().

107 {
108 
109  return RotDet * RotRot.T();
110 
111 }
AlgebraicMatrix FrameToFrameDerivative::derivativePosRot ( const AlgebraicMatrix RotDet,
const AlgebraicMatrix RotRot,
const AlgebraicVector S 
) const
private

Calculates the derivative DPos/DRot.

Definition at line 116 of file FrameToFrameDerivative.cc.

References S().

Referenced by getDerivative().

119 {
120 
121  AlgebraicVector dEulerA(3);
122  AlgebraicVector dEulerB(3);
123  AlgebraicVector dEulerC(3);
124  AlgebraicMatrix RotDa(3,3);
125  AlgebraicMatrix RotDb(3,3);
126  AlgebraicMatrix RotDc(3,3);
127 
128  RotDa[1][2] = 1; RotDa[2][1] = -1;
129  RotDb[0][2] = -1; RotDb[2][0] = 1; // New beta sign
130  RotDc[0][1] = 1; RotDc[1][0] = -1;
131 
132  dEulerA = RotDet*( RotRot.T()*RotDa*RotRot*S );
133  dEulerB = RotDet*( RotRot.T()*RotDb*RotRot*S );
134  dEulerC = RotDet*( RotRot.T()*RotDc*RotRot*S );
135 
136  AlgebraicMatrix eulerDeriv(3,3);
137  eulerDeriv[0][0] = dEulerA[0];
138  eulerDeriv[1][0] = dEulerA[1];
139  eulerDeriv[2][0] = dEulerA[2];
140  eulerDeriv[0][1] = dEulerB[0];
141  eulerDeriv[1][1] = dEulerB[1];
142  eulerDeriv[2][1] = dEulerB[2];
143  eulerDeriv[0][2] = dEulerC[0];
144  eulerDeriv[1][2] = dEulerC[1];
145  eulerDeriv[2][2] = dEulerC[2];
146 
147  return eulerDeriv;
148 
149 }
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepVector AlgebraicVector
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99
AlgebraicMatrix FrameToFrameDerivative::derivativeRotRot ( const AlgebraicMatrix RotDet,
const AlgebraicMatrix RotRot 
) const
private

Calculates the derivative DRot/DRot.

Definition at line 154 of file FrameToFrameDerivative.cc.

References linearEulerAngles().

Referenced by getDerivative().

156 {
157 
158  AlgebraicVector dEulerA(3);
159  AlgebraicVector dEulerB(3);
160  AlgebraicVector dEulerC(3);
161  AlgebraicMatrix RotDa(3,3);
162  AlgebraicMatrix RotDb(3,3);
163  AlgebraicMatrix RotDc(3,3);
164 
165  RotDa[1][2] = 1; RotDa[2][1] = -1;
166  RotDb[0][2] = -1; RotDb[2][0] = 1; // New beta sign
167  RotDc[0][1] = 1; RotDc[1][0] = -1;
168 
169  dEulerA = linearEulerAngles( RotDet*RotRot.T()*RotDa*RotRot*RotDet.T() );
170  dEulerB = linearEulerAngles( RotDet*RotRot.T()*RotDb*RotRot*RotDet.T() );
171  dEulerC = linearEulerAngles( RotDet*RotRot.T()*RotDc*RotRot*RotDet.T() );
172 
173  AlgebraicMatrix eulerDeriv(3,3);
174 
175  eulerDeriv[0][0] = dEulerA[0];
176  eulerDeriv[1][0] = dEulerA[1];
177  eulerDeriv[2][0] = dEulerA[2];
178  eulerDeriv[0][1] = dEulerB[0];
179  eulerDeriv[1][1] = dEulerB[1];
180  eulerDeriv[2][1] = dEulerB[2];
181  eulerDeriv[0][2] = dEulerC[0];
182  eulerDeriv[1][2] = dEulerC[1];
183  eulerDeriv[2][2] = dEulerC[2];
184 
185  return eulerDeriv;
186 
187 }
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepVector AlgebraicVector
AlgebraicVector linearEulerAngles(const AlgebraicMatrix &rotDelta) const
Gets linear approximated euler Angles.
AlgebraicMatrix FrameToFrameDerivative::frameToFrameDerivative ( const Alignable object,
const Alignable composedObject 
) const

Return the derivative DeltaFrame(object)/DeltaFrame(composedObject), i.e. a 6x6 matrix:

/ du/du_c du/dv_c du/dw_c du/da_c du/db_c du/dg_c | | dv/du_c dv/dv_c dv/dw_c dv/da_c dv/db_c dv/dg_c | | dw/du_c dw/dv_c dw/dw_c dw/da_c dw/db_c dw/dg_c | | da/du_c da/dv_c da/dw_c da/da_c da/db_c da/dg_c | | db/du_c db/dv_c db/dw_c db/da_c db/db_c db/dg_c | \ dg/du_c dg/dv_c dg/dw_c dg/da_c dg/db_c dg/dg_c /

where u, v, w, a, b, g are shifts and rotations of the object and u_c, v_c, w_c, a_c, b_c, g_c those of the composed object.

Definition at line 16 of file FrameToFrameDerivative.cc.

References getDerivative(), Alignable::globalPosition(), and Alignable::globalRotation().

Referenced by RigidBodyAlignmentParameters4D::derivatives(), RigidBodyAlignmentParameters::derivatives(), MillePedeMonitor::fillFrameToFrame(), ParametersToParametersDerivatives::initBowedRigid(), and ParametersToParametersDerivatives::initRigidRigid().

18 {
19 
20  return getDerivative( object->globalRotation(),
21  composedObject->globalRotation(),
22  composedObject->globalPosition() - object->globalPosition() );
23 
24 }
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:137
AlgebraicMatrix66 getDerivative(const align::RotationType &objectRot, const align::RotationType &composeRot, const align::GlobalPoint &objectPos, const align::GlobalPoint &composePos) const
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:134
AlgebraicMatrix66 FrameToFrameDerivative::getDerivative ( const align::RotationType objectRot,
const align::RotationType composeRot,
const align::GlobalPoint objectPos,
const align::GlobalPoint composePos 
) const

Calculates derivatives DeltaFrame(object)/DeltaFrame(composedobject) using their positions and orientations, see method frameToFrameDerivative(..) for definition. As a new method it gets a new interface avoiding CLHEP that should anyway be replaced by SMatrix at some point...

Definition at line 28 of file FrameToFrameDerivative.cc.

Referenced by frameToFrameDerivative().

32 {
33  return asSMatrix<6,6>(this->getDerivative(objectRot, composeRot, composePos - objectPos));
34 }
AlgebraicMatrix66 getDerivative(const align::RotationType &objectRot, const align::RotationType &composeRot, const align::GlobalPoint &objectPos, const align::GlobalPoint &composePos) const
AlgebraicMatrix FrameToFrameDerivative::getDerivative ( const align::RotationType objectRot,
const align::RotationType composeRot,
const align::GlobalVector posVec 
) const
private

Calculates derivatives using the orientation Matrixes and the origin difference vector.

Definition at line 38 of file FrameToFrameDerivative.cc.

References funct::derivative(), derivativePosPos(), derivativePosRot(), derivativeRotRot(), transform(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

41 {
42 
43  AlgebraicMatrix rotDet = transform(objectRot);
44  AlgebraicMatrix rotCompO = transform(composeRot);
45 
46  AlgebraicVector diffVec(3);
47 
48  diffVec(1) = posVec.x();
49  diffVec(2) = posVec.y();
50  diffVec(3) = posVec.z();
51 
53 
54  AlgebraicMatrix derivAA(3,3);
55  AlgebraicMatrix derivAB(3,3);
56  AlgebraicMatrix derivBB(3,3);
57 
58  derivAA = derivativePosPos( rotDet, rotCompO );
59  derivAB = derivativePosRot( rotDet, rotCompO, diffVec );
60  derivBB = derivativeRotRot( rotDet, rotCompO );
61 
62  derivative[0][0] = derivAA[0][0];
63  derivative[0][1] = derivAA[0][1];
64  derivative[0][2] = derivAA[0][2];
65  derivative[0][3] = derivAB[0][0];
66  derivative[0][4] = derivAB[0][1];
67  derivative[0][5] = derivAB[0][2];
68  derivative[1][0] = derivAA[1][0];
69  derivative[1][1] = derivAA[1][1];
70  derivative[1][2] = derivAA[1][2];
71  derivative[1][3] = derivAB[1][0];
72  derivative[1][4] = derivAB[1][1];
73  derivative[1][5] = derivAB[1][2];
74  derivative[2][0] = derivAA[2][0];
75  derivative[2][1] = derivAA[2][1];
76  derivative[2][2] = derivAA[2][2];
77  derivative[2][3] = derivAB[2][0];
78  derivative[2][4] = derivAB[2][1];
79  derivative[2][5] = derivAB[2][2];
80  derivative[3][0] = 0;
81  derivative[3][1] = 0;
82  derivative[3][2] = 0;
83  derivative[3][3] = derivBB[0][0];
84  derivative[3][4] = derivBB[0][1];
85  derivative[3][5] = derivBB[0][2];
86  derivative[4][0] = 0;
87  derivative[4][1] = 0;
88  derivative[4][2] = 0;
89  derivative[4][3] = derivBB[1][0];
90  derivative[4][4] = derivBB[1][1];
91  derivative[4][5] = derivBB[1][2];
92  derivative[5][0] = 0;
93  derivative[5][1] = 0;
94  derivative[5][2] = 0;
95  derivative[5][3] = derivBB[2][0];
96  derivative[5][4] = derivBB[2][1];
97  derivative[5][5] = derivBB[2][2];
98 
99  return derivative;
100 }
Derivative< X, A >::type derivative(const A &_)
Definition: Derivative.h:18
T y() const
Definition: PV3DBase.h:63
static AlgebraicMatrix transform(const align::RotationType &)
Helper to transform from RotationType to AlgebraicMatrix.
CLHEP::HepMatrix AlgebraicMatrix
T z() const
Definition: PV3DBase.h:64
CLHEP::HepVector AlgebraicVector
AlgebraicMatrix derivativeRotRot(const AlgebraicMatrix &RotDet, const AlgebraicMatrix &RotRot) const
Calculates the derivative DRot/DRot.
AlgebraicMatrix derivativePosRot(const AlgebraicMatrix &RotDet, const AlgebraicMatrix &RotRot, const AlgebraicVector &S) const
Calculates the derivative DPos/DRot.
T x() const
Definition: PV3DBase.h:62
AlgebraicMatrix derivativePosPos(const AlgebraicMatrix &RotDet, const AlgebraicMatrix &RotRot) const
Calculates the derivative DPos/DPos.
AlgebraicVector FrameToFrameDerivative::linearEulerAngles ( const AlgebraicMatrix rotDelta) const
private

Gets linear approximated euler Angles.

Definition at line 193 of file FrameToFrameDerivative.cc.

References funct::C.

Referenced by derivativeRotRot().

194 {
195 
196  AlgebraicMatrix eulerAB(3,3);
197  AlgebraicVector aB(3);
198  eulerAB[0][1] = 1;
199  eulerAB[1][0] = -1; // New beta sign
200  aB[2] = 1;
201 
202  AlgebraicMatrix eulerC(3,3);
203  AlgebraicVector C(3);
204  eulerC[2][0] = 1;
205  C[1] = 1;
206 
207  AlgebraicVector eulerAngles(3);
208  eulerAngles = eulerAB*rotDelta*aB + eulerC*rotDelta*C;
209  return eulerAngles;
210 
211 }
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepVector AlgebraicVector
AlgebraicMatrix FrameToFrameDerivative::transform ( const align::RotationType rot)
inlinestaticprivate

Helper to transform from RotationType to AlgebraicMatrix.

Definition at line 77 of file FrameToFrameDerivative.h.

References dttmaxenums::R, TkRotation< T >::xx(), TkRotation< T >::xy(), TkRotation< T >::xz(), TkRotation< T >::yx(), TkRotation< T >::yy(), TkRotation< T >::yz(), TkRotation< T >::zx(), TkRotation< T >::zy(), and TkRotation< T >::zz().

Referenced by Vispa.Views.LineDecayView.DecayLine::boundingRect(), Vispa.Views.LineDecayView.DecayLine::containsPoint(), getDerivative(), and Vispa.Views.LineDecayView.DecayLine::paint().

78 {
79  AlgebraicMatrix R(3, 3);
80 
81  R(1, 1) = rot.xx(); R(1, 2) = rot.xy(); R(1, 3) = rot.xz();
82  R(2, 1) = rot.yx(); R(2, 2) = rot.yy(); R(2, 3) = rot.yz();
83  R(3, 1) = rot.zx(); R(3, 2) = rot.zy(); R(3, 3) = rot.zz();
84 
85  return R;
86 }
T xx() const
T yx() const
T zx() const
T xy() const
T zz() const
CLHEP::HepMatrix AlgebraicMatrix
T zy() const
T yy() const
T xz() const
T yz() const