12 : theMother(nullptr), theSurface(ali.surface()), theSelector(ali.alignmentParameters()->selector()) {
30 throw cms::Exception(
"ConfigError") <<
"The type " << type <<
" does not have a survey residual defined!\n"
31 <<
"You have probably set the highest hierarchy. Choose a lower level.";
37 throw cms::Exception(
"ConfigError") <<
"You are finding an unbiased residual of an alignable "
38 <<
" (id = " << ali.
geomDetId().
rawId() <<
") which has no sister. Abort!";
45 std::vector<Scalar> pars;
47 pars.reserve(AlignParams::kSize);
54 pars.push_back(deltaR.
x());
56 pars.push_back(deltaR.
y());
58 pars.push_back(deltaR.
z());
67 for (
unsigned int j = 0;
j < nominalVs.size(); ++
j) {
77 pars.push_back(deltaW(1));
79 pars.push_back(deltaW(2));
81 pars.push_back(deltaW(3));
86 for (
unsigned int j = 0;
j < pars.size(); ++
j)
87 deltaRW(
j + 1) = pars[
j];
97 residuals.reserve(nPoint);
99 for (
unsigned int j = 0;
j < nPoint; ++
j) {
108 throw cms::Exception(
"LogicError") <<
"Mismatched number of dof between ErrorMatrix and Selector.";
111 std::vector<unsigned int>
indices;
113 indices.reserve(ErrorMatrix::kRows);
115 for (
unsigned int i = 0;
i < ErrorMatrix::kRows; ++
i)
117 indices.push_back(i);
121 for (
unsigned int i = 0; i < indices.size(); ++
i)
122 for (
unsigned int j = 0;
j <=
i; ++
j)
129 throw cms::Exception(
"ConfigError") <<
"Cannot invert survey error " << invCov;
141 unsigned int nComp =
comp.size();
143 for (
unsigned int i = 0;
i < nComp; ++
i) {
146 if (dau != ali || bias)
157 std::vector<const PositionType*> nominalSisPos;
158 std::vector<const PositionType*> currentSisPos;
160 nominalSisPos.reserve(nSister);
161 currentSisPos.reserve(nSister);
163 for (
unsigned int i = 0;
i < nSister; ++
i) {
168 throw cms::Exception(
"ConfigError") <<
"No survey info is found for Alignable "
172 nominalSisPos.push_back(&survey->
position());
186 for (
unsigned int i = 0;
i < nSister; ++
i) {
192 for (
unsigned int j = 0;
j < nominalSisPoints.size(); ++
j) {
193 nominalSisVs.push_back(nominalSisPoints[
j] - *nominalSisPos[
i]);
194 currentSisVs.push_back(currentSisPoints[
j] - *currentSisPos[i]);
207 throw cms::Exception(
"ConfigError") <<
"No survey info is found for Alignable "
214 for (
unsigned int j = 0;
j < nominalPoints.size(); ++
j) {
230 jac(0, 0) = deltaR.
xx();
231 jac(0, 1) = deltaR.
xy();
232 jac(0, 2) = deltaR.
xz();
233 jac(1, 0) = deltaR.
yx();
234 jac(1, 1) = deltaR.
yy();
235 jac(1, 2) = deltaR.
yz();
236 jac(2, 0) = deltaR.
zx();
237 jac(2, 1) = deltaR.
zy();
238 jac(2, 2) = deltaR.
zz();
239 jac(3, 3) = deltaR.
xx();
240 jac(3, 4) = deltaR.
xy();
241 jac(3, 5) = deltaR.
xz();
242 jac(4, 3) = deltaR.
yx();
243 jac(4, 4) = deltaR.
yy();
244 jac(4, 5) = deltaR.
yz();
245 jac(5, 3) = deltaR.
zx();
246 jac(5, 4) = deltaR.
zy();
247 jac(5, 5) = deltaR.
zz();
249 theCovariance += ROOT::Math::Similarity(jac,
a->survey()->errors());
std::vector< const Alignable * > theSisters
const SurveyDet * survey() const
Return survey info.
constexpr uint32_t rawId() const
get the raw id
const RotationType & globalRotation() const
Return the global orientation of the object.
void calculate(const Alignable &)
Find the nominal and current vectors.
RotationType diffRot(const GlobalVectors ¤t, const GlobalVectors &nominal)
std::vector< GlobalPoint > GlobalPoints
const align::PositionType & position() const
const std::vector< bool > & theSelector
align::GlobalVectors theCurrentVs
align::RotationType toLocal(const align::RotationType &) const
Return in local frame a rotation given in global frame.
align::GlobalVectors theNominalVs
SurveyResidual(const Alignable &, align::StructureType, bool bias=false)
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
virtual const Alignables & components() const =0
Return vector of all direct components.
void findSisters(const Alignable *, bool bias)
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
ROOT::Math::SMatrix< double, N, M > type
CLHEP::HepVector AlgebraicVector
AlgebraicVector EulerAngles
const Alignables & deepComponents() const
align::LocalVectors pointsResidual() const
AlgebraicSymMatrix inverseCovariance() const
Get inverse of survey covariance wrt given structure type in constructor.
std::vector< GlobalVector > GlobalVectors
std::vector< LocalVector > LocalVectors
const Alignable * theMother
align::GlobalPoints globalPoints() const
AlgebraicVector sensorResidual() const
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
CLHEP::HepSymMatrix AlgebraicSymMatrix
const PositionType & globalPosition() const
Return the global position of the object.
PositionType motherPosition(const std::vector< const PositionType * > &dauPos)
Find mother's position from the average of its daughters' positions.
const AlignableSurface & theSurface
const BasicVectorType & basicVector() const
const align::LocalPoints & localPoints() const
Alignable * mother() const
Return pointer to container alignable (if any)
const DetId & geomDetId() const
align::ErrorMatrix theCovariance