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 Types | Private Member Functions | Private Attributes
ParametersToParametersDerivatives Class Reference

#include <ParametersToParametersDerivatives.h>

Public Member Functions

bool isOK () const
 Indicate whether able to provide the derivatives. More...
 
double operator() (unsigned int indParMother, unsigned int indParComp) const
 
 ParametersToParametersDerivatives (const Alignable &component, const Alignable &mother)
 

Private Types

typedef ROOT::Math::SMatrix
< double,
6, 9, ROOT::Math::MatRepStd
< double, 6, 9 > > 
AlgebraicMatrix69
 

Private Member Functions

AlgebraicMatrix69 dBowed_dRigid (const AlgebraicMatrix66 &f2f, double halfWidth, double halfLength) const
 
bool init (const Alignable &component, int typeComponent, const Alignable &mother, int typeMother)
 init by choosing the correct detailed init method depending on parameter types More...
 
bool init2BowedRigid (const Alignable &component, const Alignable &mother)
 init for component with TwoBowedSurfaces and mother with RigidBody parameters More...
 
bool initBowedRigid (const Alignable &component, const Alignable &mother)
 init for component with BowedSurface and mother with RigidBody parameters More...
 
bool initRigidRigid (const Alignable &component, const Alignable &mother)
 init for component and mother both with RigidBody parameters More...
 

Private Attributes

TMatrixD derivatives_
 can we provide the desired? More...
 
bool isOK_
 data members More...
 

Detailed Description

Class for calculating derivatives for hierarchies between different kind of alignment parameters (note that not all combinations might be supported!), needed e.g. to formulate constraints to remove the additional degrees of freedom introduced if larger structure and their components are aligned simultaneously.

Date:
2010/12/14 01:08:25
Revision:
1.2

(last update by

Author:
flucke

)

Definition at line 21 of file ParametersToParametersDerivatives.h.

Member Typedef Documentation

typedef ROOT::Math::SMatrix<double,6,9,ROOT::Math::MatRepStd<double,6,9> > ParametersToParametersDerivatives::AlgebraicMatrix69
private

Definition at line 47 of file ParametersToParametersDerivatives.h.

Constructor & Destructor Documentation

ParametersToParametersDerivatives::ParametersToParametersDerivatives ( const Alignable component,
const Alignable mother 
)

Definition at line 24 of file ParametersToParametersDerivatives.cc.

References Alignable::alignmentParameters(), init, and AlignmentParameters::type().

25  : isOK_(component.alignmentParameters() && mother.alignmentParameters())
26 {
27  if (isOK_) {
28  isOK_ = this->init(component, component.alignmentParameters()->type(),
29  mother, mother .alignmentParameters()->type());
30  }
31 }
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:57
virtual int type() const =0
tell type (AlignmentParametersFactory::ParametersType - but no circular dependency) ...
bool init(const Alignable &component, int typeComponent, const Alignable &mother, int typeMother)
init by choosing the correct detailed init method depending on parameter types

Member Function Documentation

ParametersToParametersDerivatives::AlgebraicMatrix69 ParametersToParametersDerivatives::dBowed_dRigid ( const AlgebraicMatrix66 f2f,
double  halfWidth,
double  halfLength 
) const
private

Definition at line 146 of file ParametersToParametersDerivatives.cc.

Referenced by init2BowedRigid(), and initBowedRigid().

148 {
149  typedef BowedSurfaceAlignmentDerivatives BowedDerivs;
150  const double gammaScale = BowedDerivs::gammaScale(2.*halfWidth, 2.*halfLength);
151 
152  // 1st index (column) is parameter of the mother (<6),
153  // 2nd index (row) that of component (<9):
154  AlgebraicMatrix69 derivs;
155 
156  for (unsigned int iRow = 0; iRow < 6; ++iRow) { // 6 rigid body parameters of mother
157  // First copy the common rigid body part, e.g.:
158  // - (0,0): du_comp/du_moth
159  // - (0,1): dv_comp/du_moth
160  // - (1,2): dw_comp/dv_moth
161  for (unsigned int iCol = 0; iCol < 3; ++iCol) { // 3 movements of component
162  derivs(iRow, iCol) = f2f(iRow, iCol);
163  }
164 
165  // Now we have to take care of order and scales for rotation-like parameters:
166  // slopeX -> halfWidth * beta
167  derivs(iRow, 3) = halfWidth * f2f(iRow, 4); // = dslopeX_c/dpar_m = hw * db_c/dpar_m
168  // slopeY -> halfLength * alpha
169  derivs(iRow, 4) = halfLength * f2f(iRow, 3); // = dslopeY_c/dpar_m = hl * da_c/dpar_m
170  // rotZ -> gammaScale * gamma
171  derivs(iRow, 5) = gammaScale * f2f(iRow, 5); // = drotZ_c/dpar_m = gscale * dg_c/dpar_m
172 
173  // Finally, movements and rotations have no influence on surface internals:
174  for (unsigned int iCol = 6; iCol < 9; ++iCol) { // 3 sagittae of component
175  derivs(iRow, iCol) = 0.;
176  }
177  }
178 
179  return derivs;
180 }
ROOT::Math::SMatrix< double, 6, 9, ROOT::Math::MatRepStd< double, 6, 9 > > AlgebraicMatrix69
bool ParametersToParametersDerivatives::init ( const Alignable component,
int  typeComponent,
const Alignable mother,
int  typeMother 
)
private

init by choosing the correct detailed init method depending on parameter types

Definition at line 34 of file ParametersToParametersDerivatives.cc.

References init2BowedRigid(), initBowedRigid(), initRigidRigid(), AlignmentParametersFactory::kBowedSurface, AlignmentParametersFactory::kRigidBody, AlignmentParametersFactory::kRigidBody4D, AlignmentParametersFactory::kTwoBowedSurfaces, AlignmentParametersFactory::parametersType(), and AlignmentParametersFactory::parametersTypeName().

36 {
37  using namespace AlignmentParametersFactory; // for kRigidBody etc.
38  if ((typeMother == kRigidBody || typeMother == kRigidBody4D) &&
39  (typeComponent == kRigidBody || typeComponent == kRigidBody4D)) {
40  return this->initRigidRigid(component, mother);
41  } else if ((typeMother == kRigidBody || typeMother == kRigidBody4D) &&
42  typeComponent == kBowedSurface) {
43  return this->initBowedRigid(component, mother);
44  } else if ((typeMother == kRigidBody || typeMother == kRigidBody4D) &&
45  typeComponent == kTwoBowedSurfaces) {
46  return this->init2BowedRigid(component, mother);
47  } else {
48  // missing: mother with bows and component without, i.e. having 'common' bow parameters
49  edm::LogError("Alignment") << "@SUB=ParametersToParametersDerivatives::init"
50  << "Mother " << parametersTypeName(parametersType(typeMother))
51  << ", component " << parametersTypeName(parametersType(typeComponent))
52  << ": not supported.";
53  return false;
54  }
55 
56 }
bool initRigidRigid(const Alignable &component, const Alignable &mother)
init for component and mother both with RigidBody parameters
std::string parametersTypeName(ParametersType parType)
convert ParametersType to string understood by parametersType(string &amp;typeString) ...
bool initBowedRigid(const Alignable &component, const Alignable &mother)
init for component with BowedSurface and mother with RigidBody parameters
ParametersType parametersType(const std::string &typeString)
convert string to ParametersType - exception if not known
bool init2BowedRigid(const Alignable &component, const Alignable &mother)
init for component with TwoBowedSurfaces and mother with RigidBody parameters
bool ParametersToParametersDerivatives::init2BowedRigid ( const Alignable component,
const Alignable mother 
)
private

init for component with TwoBowedSurfaces and mother with RigidBody parameters

Definition at line 92 of file ParametersToParametersDerivatives.cc.

References Alignable::alignmentParameters(), dBowed_dRigid(), derivatives_, Alignable::globalPosition(), Alignable::globalRotation(), AlignableSurface::length(), Alignable::surface(), AlignableSurface::toGlobal(), AlignableSurface::width(), and TwoBowedSurfacesAlignmentParameters::ySplit().

Referenced by init().

94 {
95  // component is two bowed surfaces, mother rigid body
97  dynamic_cast<TwoBowedSurfacesAlignmentParameters*>(component.alignmentParameters());
98 
99  if (!aliPar) {
100  edm::LogError("Alignment") << "@SUB=ParametersToParametersDerivatives::init2BowedRigid"
101  << "dynamic_cast to TwoBowedSurfacesAlignmentParameters failed.";
102  return false;
103  }
104 
105  // We treat the two surfaces as independent objects, i.e.
106  // 1) get the global position of each surface, depending on the ySplit value,
107  const double ySplit = aliPar->ySplit();
108  const double halfWidth = 0.5 * component.surface().width();
109  const double halfLength = 0.5 * component.surface().length();
110  const double halfLength1 = 0.5 * (halfLength + ySplit);
111  const double halfLength2 = 0.5 * (halfLength - ySplit);
112  const double yM1 = 0.5 * (ySplit - halfLength); // y_mean of surface 1
113  const double yM2 = yM1 + halfLength; // y_mean of surface 2
114  // The sensor positions and orientations could be adjusted using
115  // TwoBowedSurfacesDeformation attached to the component,
116  // but that should be 2nd order effect.
117  const align::GlobalPoint posSurf1(component.surface().toGlobal(align::LocalPoint(0.,yM1,0.)));
118  const align::GlobalPoint posSurf2(component.surface().toGlobal(align::LocalPoint(0.,yM2,0.)));
119 
120  // 2) get derivatives for both,
121  FrameToFrameDerivative f2fMaker;
122  const AlgebraicMatrix66 f2fSurf1(f2fMaker.getDerivative(component.globalRotation(),
123  mother.globalRotation(),
124  posSurf1, mother.globalPosition()));
125  const AlgebraicMatrix66 f2fSurf2(f2fMaker.getDerivative(component.globalRotation(),
126  mother.globalRotation(),
127  posSurf2, mother.globalPosition()));
128  const AlgebraicMatrix69 derivs1(this->dBowed_dRigid(f2fSurf1, halfWidth, halfLength1));
129  const AlgebraicMatrix69 derivs2(this->dBowed_dRigid(f2fSurf2, halfWidth, halfLength2));
130 
131  // 3) fill the common matrix by merging the two.
132  typedef ROOT::Math::SMatrix<double,6,18,ROOT::Math::MatRepStd<double,6,18> > AlgebraicMatrix6_18;
133  AlgebraicMatrix6_18 derivs;
134  derivs.Place_at(derivs1, 0, 0); // left half
135  derivs.Place_at(derivs2, 0, 9); // right half
136 
137  // copy to TMatrix
138  derivatives_.ResizeTo(6, 18);
139  derivatives_.SetMatrixArray(derivs.begin());
140 
141  return true;
142 }
align::Scalar width() const
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:132
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:57
AlgebraicMatrix69 dBowed_dRigid(const AlgebraicMatrix66 &f2f, double halfWidth, double halfLength) const
ROOT::Math::SMatrix< double, 6, 9, ROOT::Math::MatRepStd< double, 6, 9 > > AlgebraicMatrix69
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
align::Scalar length() const
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:129
TMatrixD derivatives_
can we provide the desired?
bool ParametersToParametersDerivatives::initBowedRigid ( const Alignable component,
const Alignable mother 
)
private

init for component with BowedSurface and mother with RigidBody parameters

Definition at line 74 of file ParametersToParametersDerivatives.cc.

References dBowed_dRigid(), derivatives_, FrameToFrameDerivative::frameToFrameDerivative(), AlignableSurface::length(), m, Alignable::surface(), and AlignableSurface::width().

Referenced by init().

76 {
77  // component is bowed surface, mother rigid body
78  FrameToFrameDerivative f2fMaker;
79  const AlgebraicMatrix66 f2f(asSMatrix<6,6>(f2fMaker.frameToFrameDerivative(&component,&mother)));
80  const double halfWidth = 0.5 * component.surface().width();
81  const double halfLength = 0.5 * component.surface().length();
82  const AlgebraicMatrix69 m(this->dBowed_dRigid(f2f, halfWidth, halfLength));
83 
84  // copy to TMatrix
85  derivatives_.ResizeTo(6,9);
86  derivatives_.SetMatrixArray(m.begin());
87 
88  return true;
89 }
align::Scalar width() const
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
AlgebraicMatrix69 dBowed_dRigid(const AlgebraicMatrix66 &f2f, double halfWidth, double halfLength) const
ROOT::Math::SMatrix< double, 6, 9, ROOT::Math::MatRepStd< double, 6, 9 > > AlgebraicMatrix69
AlgebraicMatrix frameToFrameDerivative(const Alignable *object, const Alignable *composedObject) const
Return the derivative DeltaFrame(object)/DeltaFrame(composedobject)
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
align::Scalar length() const
TMatrixD derivatives_
can we provide the desired?
bool ParametersToParametersDerivatives::initRigidRigid ( const Alignable component,
const Alignable mother 
)
private

init for component and mother both with RigidBody parameters

Definition at line 59 of file ParametersToParametersDerivatives.cc.

References derivatives_, FrameToFrameDerivative::frameToFrameDerivative(), and m.

Referenced by init().

61 {
62  // simply frame to frame!
63  FrameToFrameDerivative f2fDerivMaker;
64  AlgebraicMatrix66 m(asSMatrix<6,6>(f2fDerivMaker.frameToFrameDerivative(&component, &mother)));
65 
66  // copy to TMatrix
67  derivatives_.ResizeTo(6,6);
68  derivatives_.SetMatrixArray(m.begin());
69 
70  return true;
71 }
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
AlgebraicMatrix frameToFrameDerivative(const Alignable *object, const Alignable *composedObject) const
Return the derivative DeltaFrame(object)/DeltaFrame(composedobject)
TMatrixD derivatives_
can we provide the desired?
bool ParametersToParametersDerivatives::isOK ( ) const
inline

Indicate whether able to provide the derivatives.

Definition at line 27 of file ParametersToParametersDerivatives.h.

References isOK_.

Referenced by AlignmentParameterStore::hierarchyConstraints().

double ParametersToParametersDerivatives::operator() ( unsigned int  indParMother,
unsigned int  indParComp 
) const

Return the derivative DeltaParam(object)/DeltaParam(composedobject), indices start with 0. But check isOK() first!

Definition at line 183 of file ParametersToParametersDerivatives.cc.

References derivatives_.

185 {
186  // Do range checks?
187  return derivatives_(indParMother, indParComp);
188 }
TMatrixD derivatives_
can we provide the desired?

Member Data Documentation

TMatrixD ParametersToParametersDerivatives::derivatives_
private

can we provide the desired?

Definition at line 53 of file ParametersToParametersDerivatives.h.

Referenced by init2BowedRigid(), initBowedRigid(), initRigidRigid(), and operator()().

bool ParametersToParametersDerivatives::isOK_
private

data members

Definition at line 52 of file ParametersToParametersDerivatives.h.

Referenced by isOK().