Belle II Software development
ARICHPositionElement.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <arich/dbobjects/ARICHGeoBase.h>
12#include <framework/gearbox/Unit.h>
13#include <Math/Vector3D.h>
14#include <Math/Rotation3D.h>
15#include <Math/RotationX.h>
16#include <Math/RotationY.h>
17#include <Math/RotationZ.h>
18#include <iostream>
19
20namespace Belle2 {
30 public:
31
36 {}
37
48 ARICHPositionElement(double x, double y, double z,
49 double alpha, double beta, double gamma, const std::string& name = "ARICHAlignment"):
50 ARICHGeoBase(name),
51 m_x(x), m_y(y), m_z(z),
52 m_alpha(alpha), m_beta(beta), m_gamma(gamma)
53 {}
54
56 {}
57
62 void setX(double x) {m_x = x;}
63
68 void setY(double y) {m_y = y;}
69
74 void setZ(double z) {m_z = z;}
75
81 void setRPhi(double r, double phi)
82 {
83 m_x = r * cos(phi / Unit::rad);
84 m_y = r * sin(phi / Unit::rad);
85 }
86
91 void setAlpha(double alpha) {m_alpha = alpha;}
92
93
98 void setBeta(double beta) {m_beta = beta;}
99
100
105 void setGamma(double gamma) {m_gamma = gamma;}
106
116 void addShift(double dx, double dy, double dz, double dalpha, double dbeta, double dgamma)
117 {
118 m_x += dx;
119 m_y += dy;
120 m_z += dz;
121 m_alpha += dalpha;
122 m_beta += dbeta;
123 m_gamma += dgamma;
124 };
125
130 double getX() const {return m_x / s_unit;}
131
136 double getY() const {return m_y / s_unit;}
137
142 double getZ() const {return m_z / s_unit;}
143
148 double getAlpha() const {return m_alpha;}
149
154 double getBeta() const {return m_beta;}
155
160 double getGamma() const {return m_gamma;}
161
166 ROOT::Math::Rotation3D getRotation() const
167 {
168 ROOT::Math::Rotation3D rot;
169 ROOT::Math::RotationX rotX(m_alpha);
170 ROOT::Math::RotationY rotY(m_beta);
171 ROOT::Math::RotationZ rotZ(m_gamma);
172 rot *= rotZ * rotY * rotX;
173 return rot;
174 }
175
180 ROOT::Math::XYZVector getTranslation() const {return ROOT::Math::XYZVector(m_x, m_y, m_z);}
181
186 bool isConsistent() const override {return true;}
187
192 void print(const std::string& title = "Parmeters of position element") const override
193 {
194 std::cout << title << std::endl;
195 std::cout << "translations (x,y,z): " << m_x << " " << m_y << " " << m_z << std::endl;
196 std::cout << "rotations (x,y,z axis): " << m_alpha << " " << m_beta << " " << m_gamma << std::endl;
197
198 }
199
200 private:
201
202 float m_x = 0;
203 float m_y = 0;
204 float m_z = 0;
205 float m_alpha = 0;
206 float m_beta = 0;
207 float m_gamma = 0;
211 };
212
214} // end namespace Belle2
Base class for geometry parameters.
Definition: ARICHGeoBase.h:24
static double s_unit
conversion unit for length
Definition: ARICHGeoBase.h:83
Position element for ARICH.
float m_beta
rotation angle around y
void setRPhi(double r, double phi)
Sets x,y from r,phi.
bool isConsistent() const override
Check for consistency of data members.
ARICHPositionElement(double x, double y, double z, double alpha, double beta, double gamma, const std::string &name="ARICHAlignment")
Full constructor.
double getGamma() const
Returns rotation angle around z.
double getX() const
Returns translation in x.
void setBeta(double beta)
Sets rotation around y.
ClassDefOverride(ARICHPositionElement, 1)
ClassDef.
void setZ(double z)
Sets translation in z.
double getAlpha() const
Returns rotation angle around x.
ARICHPositionElement()
Default constructor.
void setAlpha(double alpha)
Sets rotation around x.
ROOT::Math::Rotation3D getRotation() const
Returns rotation matrix.
ROOT::Math::XYZVector getTranslation() const
Returns translation vector (always in basf2 units!)
void setY(double y)
Sets translation in y.
void setGamma(double gamma)
Sets rotation around z.
double getZ() const
Returns translation in z.
void setX(double x)
Sets translation in x.
double getY() const
Returns translation in y.
float m_alpha
rotation angle around x
float m_gamma
rotation angle around z
void print(const std::string &title="Parmeters of position element") const override
Print the content of the class.
void addShift(double dx, double dy, double dz, double dalpha, double dbeta, double dgamma)
Shift the existing values of parameters.
double getBeta() const
Returns rotation angle around y.
static const double rad
Standard of [angle].
Definition: Unit.h:50
Abstract base class for different kinds of events.