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)
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) {
249 theCovariance += ROOT::Math::Similarity(jac,
a->survey()->errors());
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
std::vector< const Alignable * > theSisters
Alignable * mother() const
Return pointer to container alignable (if any)
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
AlgebraicVector sensorResidual() const
void calculate(const Alignable &)
Find the nominal and current vectors.
const Alignables & deepComponents() const
RotationType diffRot(const GlobalVectors ¤t, const GlobalVectors &nominal)
std::vector< GlobalPoint > GlobalPoints
const std::vector< bool > & theSelector
align::GlobalVectors theCurrentVs
const PositionType & globalPosition() const
Return the global position of the object.
const SurveyDet * survey() const
Return survey info.
align::GlobalVectors theNominalVs
AlgebraicSymMatrix inverseCovariance() const
Get inverse of survey covariance wrt given structure type in constructor.
SurveyResidual(const Alignable &, align::StructureType, bool bias=false)
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
const align::PositionType & position() const
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.
const BasicVectorType & basicVector() const
align::LocalVectors pointsResidual() const
void findSisters(const Alignable *, bool bias)
ROOT::Math::SMatrix< double, N, M > type
CLHEP::HepVector AlgebraicVector
AlgebraicVector EulerAngles
const DetId & geomDetId() const
constexpr uint32_t rawId() const
get the raw id
std::vector< GlobalVector > GlobalVectors
std::vector< LocalVector > LocalVectors
const Alignable * theMother
align::RotationType toLocal(const align::RotationType &) const
Return in local frame a rotation given in global frame.
CLHEP::HepSymMatrix AlgebraicSymMatrix
const RotationType & globalRotation() const
Return the global orientation of the object.
const align::LocalPoints & localPoints() const
PositionType motherPosition(const std::vector< const PositionType *> &dauPos)
Find mother's position from the average of its daughters' positions.
const AlignableSurface & theSurface
align::GlobalPoints globalPoints() const
align::ErrorMatrix theCovariance