Commit 074594be authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Detector: store the three angles as vector

parent f2bb7238
......@@ -12,7 +12,7 @@ Detector::Detector() {}
Detector::Detector(const Configuration& config) : Detector() {
// Get information from the conditions file:
auto m_displacement = config.get<ROOT::Math::XYZPoint>("position", ROOT::Math::XYZPoint());
auto orientation = config.get<ROOT::Math::XYZVector>("orientation", ROOT::Math::XYZVector());
auto m_orientation = config.get<ROOT::Math::XYZVector>("orientation", ROOT::Math::XYZVector());
// Number of pixels
auto npixels = config.get<ROOT::Math::DisplacementVector2D<Cartesian2D<int>>>("number_of_pixels");
// Size of the pixels
......@@ -24,9 +24,6 @@ Detector::Detector(const Configuration& config) : Detector() {
m_nPixelsY = npixels.y();
m_pitchX = pitch.x() / 1000.;
m_pitchY = pitch.y() / 1000.;
m_rotationX = orientation.x();
m_rotationY = orientation.y();
m_rotationZ = orientation.z();
m_timingOffset = config.get<double>("time_offset", 0.0);
this->initialise();
......@@ -34,7 +31,7 @@ Detector::Detector(const Configuration& config) : Detector() {
LOG(TRACE) << "Initialized \"" << m_detectorType << "\": " << m_nPixelsX << "x" << m_nPixelsY << " px, pitch of "
<< m_pitchX << "/" << m_pitchY << "mm";
LOG(TRACE) << " Position: " << display_vector(m_displacement, {"mm", "um"});
LOG(TRACE) << " Orientation: " << m_rotationX << "," << m_rotationY << "," << m_rotationZ;
LOG(TRACE) << " Orientation: " << display_vector(m_orientation, {"deg"});
if(m_timingOffset > 0.) {
LOG(TRACE) << "Timing offset: " << m_timingOffset;
}
......@@ -104,8 +101,8 @@ void Detector::initialise() {
// Make the local to global transform, built from a displacement and
// rotation
m_translations = new Translation3D(m_displacement.X(), m_displacement.Y(), m_displacement.Z());
m_rotations = new Rotation3D(ROOT::Math::RotationZ(m_rotationZ) * ROOT::Math::RotationY(m_rotationY) *
ROOT::Math::RotationX(m_rotationX));
m_rotations = new Rotation3D(ROOT::Math::RotationZ(m_orientation.Z()) * ROOT::Math::RotationY(m_orientation.Y()) *
ROOT::Math::RotationX(m_orientation.X()));
m_localToGlobal = new Transform3D(*m_rotations, *m_translations);
m_globalToLocal = new Transform3D();
......@@ -137,10 +134,8 @@ Configuration Detector::getConfiguration() {
Configuration config(name());
config.set("type", m_detectorType);
auto position = ROOT::Math::XYZPoint(m_displacement.X(), m_displacement.Y(), m_displacement.Z());
config.set("position", position);
auto orientation = ROOT::Math::XYZVector(m_rotationX, m_rotationY, m_rotationZ);
config.set("orientation", orientation);
config.set("position", m_displacement);
config.set("orientation", m_orientation);
auto npixels = ROOT::Math::DisplacementVector2D<Cartesian2D<int>>(m_nPixelsX, m_nPixelsY);
config.set("number_of_pixels", npixels);
......
......@@ -58,12 +58,12 @@ namespace corryvreckan {
ROOT::Math::XYZPoint displacement() { return m_displacement; }
// Functions to set and retrieve basic rotation parameters
void rotationX(double rx) { m_rotationX = rx; }
void rotationY(double ry) { m_rotationY = ry; }
void rotationZ(double rz) { m_rotationZ = rz; }
double rotationX() { return m_rotationX; }
double rotationY() { return m_rotationY; }
double rotationZ() { return m_rotationZ; }
void rotationX(double rx) { m_orientation.SetX(rx); }
void rotationY(double ry) { m_orientation.SetY(ry); }
void rotationZ(double rz) { m_orientation.SetZ(rz); }
double rotationX() { return m_orientation.X(); }
double rotationY() { return m_orientation.Y(); }
double rotationZ() { return m_orientation.Z(); }
// Functions to set and check channel masking
void setMaskFile(std::string file);
......@@ -112,9 +112,7 @@ namespace corryvreckan {
// Displacement and rotation in x,y,z
ROOT::Math::XYZPoint m_displacement;
double m_rotationX;
double m_rotationY;
double m_rotationZ;
ROOT::Math::XYZVector m_orientation;
// Rotation and translation objects
Translation3D* m_translations;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment