Belle II Software  release-08-01-10
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 <TVector3.h>
14 #include <TRotation.h>
15 #include <iostream>
16 
17 namespace Belle2 {
27  public:
28 
33  {}
34 
45  ARICHPositionElement(double x, double y, double z,
46  double alpha, double beta, double gamma, const std::string& name = "ARICHAlignment"):
47  ARICHGeoBase(name),
48  m_x(x), m_y(y), m_z(z),
49  m_alpha(alpha), m_beta(beta), m_gamma(gamma)
50  {}
51 
53  {}
54 
59  void setX(double x) {m_x = x;}
60 
65  void setY(double y) {m_y = y;}
66 
71  void setZ(double z) {m_z = z;}
72 
78  void setRPhi(double r, double phi)
79  {
80  m_x = r * cos(phi / Unit::rad);
81  m_y = r * sin(phi / Unit::rad);
82  }
83 
88  void setAlpha(double alpha) {m_alpha = alpha;}
89 
90 
95  void setBeta(double beta) {m_beta = beta;}
96 
97 
102  void setGamma(double gamma) {m_gamma = gamma;}
103 
113  void addShift(double dx, double dy, double dz, double dalpha, double dbeta, double dgamma)
114  {
115  m_x += dx;
116  m_y += dy;
117  m_z += dz;
118  m_alpha += dalpha;
119  m_beta += dbeta;
120  m_gamma += dgamma;
121  };
122 
127  double getX() const {return m_x / s_unit;}
128 
133  double getY() const {return m_y / s_unit;}
134 
139  double getZ() const {return m_z / s_unit;}
140 
145  double getAlpha() const {return m_alpha;}
146 
151  double getBeta() const {return m_beta;}
152 
157  double getGamma() const {return m_gamma;}
158 
163  TRotation getRotation() const
164  {
165  TRotation rot;
166  rot.RotateX(m_alpha).RotateY(m_beta).RotateZ(m_gamma);
167  return rot;
168  }
169 
174  TVector3 getTranslation() const {return TVector3(m_x, m_y, m_z);}
175 
180  bool isConsistent() const override {return true;}
181 
186  void print(const std::string& title = "Parmeters of position element") const override
187  {
188  std::cout << title << std::endl;
189  std::cout << "translations (x,y,z): " << m_x << " " << m_y << " " << m_z << std::endl;
190  std::cout << "rotations (x,y,z axis): " << m_alpha << " " << m_beta << " " << m_gamma << std::endl;
191 
192  }
193 
194  private:
195 
196  float m_x = 0;
197  float m_y = 0;
198  float m_z = 0;
199  float m_alpha = 0;
200  float m_beta = 0;
201  float m_gamma = 0;
205  };
206 
208 } // 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.
TRotation getRotation() const
Returns rotation matrix.
double getAlpha() const
Returns rotation angle around x.
ARICHPositionElement()
Default constructor.
void setAlpha(double alpha)
Sets rotation around x.
TVector3 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.