Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#include "DataFormats/GeometrySurface/interface/BoundPlane.h"

#include "Alignment/CommonAlignment/interface/AlignableSurface.h"

using namespace align;

AlignableSurface::AlignableSurface(const BoundPlane& surface)
    : GloballyPositioned<Scalar>(surface.position(), surface.rotation()),
      theWidth(surface.bounds().width()),
      theLength(surface.bounds().length()) {}

AlignableSurface::AlignableSurface(const PositionType& pos, const RotationType& rot)
    : GloballyPositioned<Scalar>(pos, rot), theWidth(Scalar()), theLength(Scalar()) {}

GlobalPoints AlignableSurface::toGlobal(const LocalPoints& localPoints) const {
  GlobalPoints globalPoints;

  unsigned int nPoint = localPoints.size();

  globalPoints.reserve(nPoint);

  for (unsigned int j = 0; j < nPoint; ++j) {
    globalPoints.push_back(toGlobal(localPoints[j]));
  }

  return globalPoints;
}

RotationType AlignableSurface::toGlobal(const RotationType& rot) const {
  return rotation().multiplyInverse(rot * rotation());
}

EulerAngles AlignableSurface::toGlobal(const EulerAngles& angles) const { return toAngles(toGlobal(toMatrix(angles))); }

RotationType AlignableSurface::toLocal(const RotationType& rot) const {
  return rotation() * rot * rotation().transposed();
}

EulerAngles AlignableSurface::toLocal(const EulerAngles& angles) const { return toAngles(toLocal(toMatrix(angles))); }