15 theSurface( ali.surface() ),
16 theSelector( ali.alignmentParameters()->selector() )
37 <<
"The type " << type <<
" does not have a survey residual defined!\n" 38 <<
"You have probably set the highest hierarchy. Choose a lower level.";
46 <<
"You are finding an unbiased residual of an alignable " 48 <<
") which has no sister. Abort!";
56 std::vector<Scalar> pars;
58 pars.reserve(AlignParams::kSize);
76 for (
unsigned int j = 0; j < nominalVs.size(); ++j)
93 for (
unsigned int j = 0; j < pars.size(); ++j) deltaRW(j + 1) = pars[j];
104 residuals.reserve(nPoint);
106 for (
unsigned int j = 0; j < nPoint; ++j)
119 <<
"Mismatched number of dof between ErrorMatrix and Selector.";
122 std::vector<unsigned int> indices;
124 indices.reserve(ErrorMatrix::kRows);
126 for (
unsigned int i = 0;
i < ErrorMatrix::kRows; ++
i)
131 for (
unsigned int i = 0; i < indices.size(); ++
i)
132 for (
unsigned int j = 0; j <=
i; ++j)
133 invCov.fast(i + 1, j + 1) =
theCovariance(indices[i], indices[j]);
135 int fail(0); invCov.invert(fail);
140 <<
"Cannot invert survey error " << invCov;
154 unsigned int nComp =
comp.size();
156 for (
unsigned int i = 0;
i < nComp; ++
i)
160 if (dau != ali || bias)
172 std::vector<const PositionType*> nominalSisPos;
173 std::vector<const PositionType*> currentSisPos;
175 nominalSisPos.reserve(nSister);
176 currentSisPos.reserve(nSister);
178 for (
unsigned int i = 0;
i < nSister; ++
i)
186 <<
"No survey info is found for Alignable " 190 nominalSisPos.push_back( &survey->
position() );
204 for (
unsigned int i = 0;
i < nSister; ++
i)
211 for (
unsigned int j = 0; j < nominalSisPoints.size(); ++j)
213 nominalSisVs.push_back(nominalSisPoints[j] - *nominalSisPos[
i]);
214 currentSisVs.push_back(currentSisPoints[j] - *currentSisPos[i]);
229 <<
"No survey info is found for Alignable " 236 for (
unsigned int j = 0; j < nominalPoints.size(); ++j)
241 theCurrentVs.push_back(currentPoints[j] - currentMomPos);
254 jac(0, 0) = deltaR.
xx(); jac(0, 1) = deltaR.
xy(); jac(0, 2) = deltaR.
xz();
255 jac(1, 0) = deltaR.
yx(); jac(1, 1) = deltaR.
yy(); jac(1, 2) = deltaR.
yz();
256 jac(2, 0) = deltaR.
zx(); jac(2, 1) = deltaR.
zy(); jac(2, 2) = deltaR.
zz();
257 jac(3, 3) = deltaR.
xx(); jac(3, 4) = deltaR.
xy(); jac(3, 5) = deltaR.
xz();
258 jac(4, 3) = deltaR.
yx(); jac(4, 4) = deltaR.
yy(); jac(4, 5) = deltaR.
yz();
259 jac(5, 3) = deltaR.
zx(); jac(5, 4) = deltaR.
zy(); jac(5, 5) = deltaR.
zz();
261 theCovariance += ROOT::Math::Similarity( jac,
a->survey()->errors() );
std::vector< const Alignable * > theSisters
ROOT::Math::SMatrix< double, N, M > type
const SurveyDet * survey() const
Return survey info.
const RotationType & globalRotation() const
Return the global orientation of the object.
void calculate(const Alignable &)
Find the nominal and current vectors.
virtual const Alignables & components() const =0
Return vector of all direct components.
RotationType diffRot(const GlobalVectors ¤t, const GlobalVectors &nominal)
std::vector< GlobalPoint > GlobalPoints
uint32_t rawId() const
get the raw id
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.
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
align::GlobalVectors theNominalVs
SurveyResidual(const Alignable &, align::StructureType, bool bias=false)
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
void findSisters(const Alignable *, bool bias)
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
double deltaR(double eta1, double eta2, double phi1, double phi2)
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