CMS 3D CMS Logo

BowedSurfaceAlignmentParameters.cc
Go to the documentation of this file.
1 
10 
12 
19 
20 // This class's header
22 
23 #include <iostream>
24 //_________________________________________________________________________________________________
26  : AlignmentParameters(ali, AlgebraicVector(N_PARAM), AlgebraicSymMatrix(N_PARAM, 0)) {}
27 
28 //_________________________________________________________________________________________________
31  const AlgebraicSymMatrix &covMatrix)
32  : AlignmentParameters(alignable, parameters, covMatrix) {
33  if (parameters.num_row() != N_PARAM) {
34  throw cms::Exception("BadParameters") << "in BowedSurfaceAlignmentParameters(): " << parameters.num_row()
35  << " instead of " << N_PARAM << " parameters.";
36  }
37 }
38 
39 //_________________________________________________________________________________________________
42  const AlgebraicSymMatrix &covMatrix,
43  const std::vector<bool> &selection)
44  : AlignmentParameters(alignable, parameters, covMatrix, selection) {
45  if (parameters.num_row() != N_PARAM) {
46  throw cms::Exception("BadParameters") << "in BowedSurfaceAlignmentParameters(): " << parameters.num_row()
47  << " instead of " << N_PARAM << " parameters.";
48  }
49 }
50 
51 //_________________________________________________________________________________________________
53  const AlgebraicSymMatrix &covMatrix) const {
55  new BowedSurfaceAlignmentParameters(this->alignable(), parameters, covMatrix, selector());
56 
57  if (this->userVariables())
58  rbap->setUserVariables(this->userVariables()->clone());
59  rbap->setValid(this->isValid());
60 
61  return rbap;
62 }
63 
64 //_________________________________________________________________________________________________
66  const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const {
67  return this->clone(this->expandVector(parameters, this->selector()),
68  this->expandSymMatrix(covMatrix, this->selector()));
69 }
70 
71 //_________________________________________________________________________________________________
73  const AlignableDetOrUnitPtr &alidet) const {
74  const Alignable *ali = this->alignable(); // Alignable of these parameters
75 
76  if (ali == alidet) {
77  const AlignableSurface &surf = ali->surface();
78  return BowedDerivs()(tsos, surf.width(), surf.length());
79  } else {
80  // We could give this a meaning by applying frame-to-frame derivatives
81  // to the first six parameters (be careful that alpha and beta changed
82  // their scale and switched their place compared to RigidBody!) and
83  // keep the remaining three untouched in local meaning.
84  // In this way we could do higher level alignment and determine 'average'
85  // surface structures for the components.
86  throw cms::Exception("MisMatch") << "BowedSurfaceAlignmentParameters::derivatives: The hit alignable "
87  "must match the "
88  << "aligned one (i.e. bowed surface parameters cannot be used for "
89  "composed alignables)\n";
90  return AlgebraicMatrix(N_PARAM, 2); // please compiler
91  }
92 }
93 
94 //_________________________________________________________________________________________________
96  // align::LocalVector uses double while LocalVector uses float only!
97  const AlgebraicVector &params = theData->parameters();
99 }
100 
101 //_________________________________________________________________________________________________
103  const AlgebraicVector &params = theData->parameters();
104  const Alignable *alignable = this->alignable();
105  const AlignableSurface &surface = alignable->surface();
106 
107  align::EulerAngles eulerAngles(3);
108  // Note that dslopeX <-> -beta and dslopeY <-> alpha:
109  // Should we use atan of these values? Anyway it is small...
110  eulerAngles[0] = params[dslopeY] * 2. / surface.length();
111  eulerAngles[1] = -params[dslopeX] * 2. / surface.width();
112  const double aScale = BowedDerivs::gammaScale(surface.width(), surface.length());
113  eulerAngles[2] = params[drotZ] / aScale;
114 
115  return eulerAngles;
116 }
117 
118 //_________________________________________________________________________________________________
120  Alignable *alignable = this->alignable();
121  if (!alignable) {
122  throw cms::Exception("BadParameters") << "BowedSurfaceAlignmentParameters::apply: parameters without "
123  "alignable";
124  }
125 
126  // Get translation in local frame, transform to global and apply:
128 
129  // Rotation in local frame
130  const align::EulerAngles angles(this->rotation());
131  // original code:
132  // alignable->rotateInLocalFrame( align::toMatrix(angles) );
133  // correct for rounding errors:
137 
138  // only update the surface deformations if they were selected for alignment
140  const auto &params = theData->parameters();
142 
143  // FIXME: true to propagate down?
144  // Needed for hierarchy with common deformation parameter,
145  // but that is not possible now anyway.
146  alignable->addSurfaceDeformation(&deform, false);
147  }
148 }
149 
150 //_________________________________________________________________________________________________
152 
153 //_________________________________________________________________________________________________
155  std::cout << "Contents of BowedSurfaceAlignmentParameters:"
156  << "\nParameters: " << theData->parameters() << "\nCovariance: " << theData->covariance() << std::endl;
157 }
Vector3DBase
Definition: Vector3DBase.h:8
BowedSurfaceAlignmentParameters::apply
void apply() override
apply parameters to alignable
Definition: BowedSurfaceAlignmentParameters.cc:119
AlignmentParameters::expandVector
AlgebraicVector expandVector(const AlgebraicVector &m, const std::vector< bool > &sel) const
Definition: AlignmentParameters.cc:215
BowedSurfaceAlignmentParameters::dx
Definition: BowedSurfaceAlignmentParameters.h:32
TkRotation< Scalar >
TrajectoryStateOnSurface.h
BowedSurfaceAlignmentParameters::dsagittaXY
Definition: BowedSurfaceAlignmentParameters.h:39
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
AlignmentParametersFactory.h
BowedSurfaceAlignmentDerivatives::gammaScale
static double gammaScale(double width, double splitLength)
Definition: BowedSurfaceAlignmentDerivatives.cc:88
AlignmentParameters::theData
DataContainer theData
Definition: AlignmentParameters.h:123
MessageLogger.h
BowedSurfaceDeformation
Definition: BowedSurfaceDeformation.h:20
BowedSurfaceAlignmentParameters::dslopeX
Definition: BowedSurfaceAlignmentParameters.h:35
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
Alignable::rotateInGlobalFrame
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
BowedSurfaceAlignmentParameters::dsagittaY
Definition: BowedSurfaceAlignmentParameters.h:40
Alignable
Definition: Alignable.h:27
gather_cfg.cout
cout
Definition: gather_cfg.py:144
BowedSurfaceAlignmentParameters::print
void print() const
print parameters to screen
Definition: BowedSurfaceAlignmentParameters.cc:154
BowedSurfaceAlignmentParameters::translation
align::LocalVector translation() const
Get translation parameters in double precision.
Definition: BowedSurfaceAlignmentParameters.cc:95
AlignmentParameters::userVariables
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
Definition: AlignmentParameters.cc:101
BowedSurfaceAlignmentParameters::dsagittaX
Definition: BowedSurfaceAlignmentParameters.h:38
BowedSurfaceAlignmentParameters::N_PARAM
Definition: BowedSurfaceAlignmentParameters.h:41
AlignableSurface::length
align::Scalar length() const
Definition: AlignableSurface.h:32
AlignableDetOrUnitPtr
Definition: AlignableDetOrUnitPtr.h:30
AlignmentParameters::isValid
bool isValid(void) const
Get validity flag.
Definition: AlignmentParameters.cc:134
KarimakiAlignmentDerivatives.h
AlignmentParameters
Definition: AlignmentParameters.h:35
BowedSurfaceAlignmentParameters::drotZ
Definition: BowedSurfaceAlignmentParameters.h:37
BowedSurfaceAlignmentParameters::dy
Definition: BowedSurfaceAlignmentParameters.h:33
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
BowedSurfaceAlignmentParameters::dz
Definition: BowedSurfaceAlignmentParameters.h:34
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
BowedSurfaceAlignmentParameters::dslopeY
Definition: BowedSurfaceAlignmentParameters.h:36
corrVsCorr.selection
selection
main part
Definition: corrVsCorr.py:100
align::rectify
void rectify(RotationType &)
Correct a rotation matrix for rounding errors.
Definition: Utilities.cc:185
AlignableSurface::toGlobal
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
Definition: AlignableSurface.cc:15
Alignable::surface
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
BowedSurfaceAlignmentParameters::clone
BowedSurfaceAlignmentParameters * clone(const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const override
Clone all parameters (for update of parameters)
Definition: BowedSurfaceAlignmentParameters.cc:52
BowedSurfaceAlignmentParameters::BowedDerivs
BowedSurfaceAlignmentDerivatives BowedDerivs
Give parameters a name.
Definition: BowedSurfaceAlignmentParameters.h:30
BowedSurfaceAlignmentParameters::rotation
align::EulerAngles rotation() const
Get rotation parameters.
Definition: BowedSurfaceAlignmentParameters.cc:102
AlignableDetOrUnitPtr.h
BowedSurfaceAlignmentParameters::derivatives
AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &aliDet) const override
Get all derivatives.
Definition: BowedSurfaceAlignmentParameters.cc:72
AlignmentParametersFactory::kBowedSurface
Definition: AlignmentParametersFactory.h:27
BowedSurfaceAlignmentParameters.h
Definitions.h
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
align::LocalVector
Vector3DBase< Scalar, LocalTag > LocalVector
Definition: Definitions.h:32
AlignmentParameters::expandSymMatrix
AlgebraicSymMatrix expandSymMatrix(const AlgebraicSymMatrix &m, const std::vector< bool > &sel) const
Definition: AlignmentParameters.cc:190
align::EulerAngles
AlgebraicVector EulerAngles
Definition: Definitions.h:34
Alignable::move
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
BowedSurfaceAlignmentParameters
Definition: BowedSurfaceAlignmentParameters.h:27
BowedSurfaceAlignmentParameters::cloneFromSelected
BowedSurfaceAlignmentParameters * cloneFromSelected(const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const override
Clone selected parameters (for update of parameters)
Definition: BowedSurfaceAlignmentParameters.cc:65
BowedSurfaceAlignmentParameters::BowedSurfaceAlignmentParameters
BowedSurfaceAlignmentParameters(Alignable *alignable)
Constructor with empty parameters/covariance.
Definition: BowedSurfaceAlignmentParameters.cc:25
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
particleFlowDisplacedVertex_cfi.angles
angles
Definition: particleFlowDisplacedVertex_cfi.py:84
AlignmentParameters::setValid
void setValid(bool v)
Set validity flag.
Definition: AlignmentParameters.cc:137
AlignableSurface
Definition: AlignableSurface.h:20
AlignableSurface::width
align::Scalar width() const
Definition: AlignableSurface.h:30
Exception
Definition: hltDiff.cc:246
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
Alignable.h
Exception.h
align::toMatrix
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:34
AlignmentParameters::alignable
Alignable * alignable(void) const
Get pointer to corresponding alignable.
Definition: AlignmentParameters.cc:104
AlignmentParameters::selector
const std::vector< bool > & selector(void) const
Get alignment parameter selector vector.
Definition: AlignmentParameters.cc:48
AlignmentParameters::parameters
const AlgebraicVector & parameters(void) const
Get alignment parameters.
Definition: AlignmentParameters.cc:64
BowedSurfaceDeformation.h
Alignable::addSurfaceDeformation
virtual void addSurfaceDeformation(const SurfaceDeformation *deformation, bool propagateDown)=0
BowedSurfaceAlignmentParameters::type
int type() const override
tell type (AlignmentParametersFactory::ParametersType - but no circular dependency)
Definition: BowedSurfaceAlignmentParameters.cc:151
AlignmentParameters::setUserVariables
void setUserVariables(AlignmentUserVariables *auv)
Set pointer to user variables.
Definition: AlignmentParameters.cc:94