Belle II Software  release-05-01-25
ARICHPositionElement.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Luka Santelj *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <arich/dbobjects/ARICHGeoBase.h>
14 #include <framework/gearbox/Unit.h>
15 #include <TVector3.h>
16 #include <TRotation.h>
17 #include <iostream>
18 
19 namespace Belle2 {
28  class ARICHPositionElement: public ARICHGeoBase {
29  public:
30 
35  {}
36 
47  ARICHPositionElement(double x, double y, double z,
48  double alpha, double beta, double gamma, const std::string& name = "ARICHAlignment"):
49  ARICHGeoBase(name),
50  m_x(x), m_y(y), m_z(z),
51  m_alpha(alpha), m_beta(beta), m_gamma(gamma)
52  {}
53 
55  {}
56 
61  void setX(double x) {m_x = x;}
62 
67  void setY(double y) {m_y = y;}
68 
73  void setZ(double z) {m_z = z;}
74 
80  void setRPhi(double r, double phi)
81  {
82  m_x = r * cos(phi / Unit::rad);
83  m_y = r * sin(phi / Unit::rad);
84  }
85 
90  void setAlpha(double alpha) {m_alpha = alpha;}
91 
92 
97  void setBeta(double beta) {m_beta = beta;}
98 
99 
104  void setGamma(double gamma) {m_gamma = gamma;}
105 
115  void addShift(double dx, double dy, double dz, double dalpha, double dbeta, double dgamma)
116  {
117  m_x += dx;
118  m_y += dy;
119  m_z += dz;
120  m_alpha += dalpha;
121  m_beta += dbeta;
122  m_gamma += dgamma;
123  };
124 
129  double getX() const {return m_x / s_unit;}
130 
135  double getY() const {return m_y / s_unit;}
136 
141  double getZ() const {return m_z / s_unit;}
142 
147  double getAlpha() const {return m_alpha;}
148 
153  double getBeta() const {return m_beta;}
154 
159  double getGamma() const {return m_gamma;}
160 
165  TRotation getRotation() const
166  {
167  TRotation rot;
168  rot.RotateX(m_alpha).RotateY(m_beta).RotateZ(m_gamma);
169  return rot;
170  }
171 
176  TVector3 getTranslation() const {return TVector3(m_x, m_y, m_z);}
177 
182  bool isConsistent() const override {return true;}
183 
188  void print(const std::string& title = "Parmeters of position element") const override
189  {
190  std::cout << title << std::endl;
191  std::cout << "translations (x,y,z): " << m_x << " " << m_y << " " << m_z << std::endl;
192  std::cout << "rotations (x,y,z axis): " << m_alpha << " " << m_beta << " " << m_gamma << std::endl;
193 
194  }
195 
196  private:
197 
198  float m_x = 0;
199  float m_y = 0;
200  float m_z = 0;
201  float m_alpha = 0;
202  float m_beta = 0;
203  float m_gamma = 0;
207  };
208 
210 } // end namespace Belle2
Belle2::ARICHPositionElement
Position element for ARICH.
Definition: ARICHPositionElement.h:36
Belle2::ARICHPositionElement::setY
void setY(double y)
Sets translation in y.
Definition: ARICHPositionElement.h:75
Belle2::ARICHPositionElement::print
void print(const std::string &title="Parmeters of position element") const override
Print the content of the class.
Definition: ARICHPositionElement.h:196
Belle2::ARICHPositionElement::getTranslation
TVector3 getTranslation() const
Returns translation vector (always in Basf2 units!)
Definition: ARICHPositionElement.h:184
Belle2::ARICHPositionElement::getAlpha
double getAlpha() const
Returns rotation angle around x.
Definition: ARICHPositionElement.h:155
Belle2::ARICHPositionElement::getZ
double getZ() const
Returns translation in z.
Definition: ARICHPositionElement.h:149
Belle2::ARICHPositionElement::getY
double getY() const
Returns translation in y.
Definition: ARICHPositionElement.h:143
Belle2::ARICHPositionElement::setGamma
void setGamma(double gamma)
Sets rotation around z.
Definition: ARICHPositionElement.h:112
Belle2::ARICHPositionElement::isConsistent
bool isConsistent() const override
Check for consistency of data members.
Definition: ARICHPositionElement.h:190
Belle2::ARICHPositionElement::m_x
float m_x
translation in x
Definition: ARICHPositionElement.h:206
Belle2::ARICHGeoBase
Base class for geometry parameters.
Definition: ARICHGeoBase.h:34
Belle2::ARICHPositionElement::setAlpha
void setAlpha(double alpha)
Sets rotation around x.
Definition: ARICHPositionElement.h:98
Belle2::ARICHPositionElement::ARICHPositionElement
ARICHPositionElement()
Default constructor.
Definition: ARICHPositionElement.h:42
Belle2::ARICHPositionElement::m_y
float m_y
translation in y
Definition: ARICHPositionElement.h:207
Belle2::ARICHPositionElement::getGamma
double getGamma() const
Returns rotation angle around z.
Definition: ARICHPositionElement.h:167
Belle2::Unit::rad
static const double rad
Standard of [angle].
Definition: Unit.h:60
Belle2::ARICHPositionElement::setBeta
void setBeta(double beta)
Sets rotation around y.
Definition: ARICHPositionElement.h:105
Belle2::ARICHPositionElement::m_gamma
float m_gamma
rotation angle around z
Definition: ARICHPositionElement.h:211
Belle2::ARICHGeoBase::s_unit
static double s_unit
conversion unit for length
Definition: ARICHGeoBase.h:93
Belle2::ARICHPositionElement::ClassDefOverride
ClassDefOverride(ARICHPositionElement, 1)
ClassDef.
Belle2::ARICHPositionElement::m_z
float m_z
translation in z
Definition: ARICHPositionElement.h:208
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ARICHPositionElement::setRPhi
void setRPhi(double r, double phi)
Sets x,y from r,phi.
Definition: ARICHPositionElement.h:88
Belle2::ARICHPositionElement::setZ
void setZ(double z)
Sets translation in z.
Definition: ARICHPositionElement.h:81
Belle2::ARICHPositionElement::getRotation
TRotation getRotation() const
Returns rotation matrix.
Definition: ARICHPositionElement.h:173
Belle2::ARICHPositionElement::getBeta
double getBeta() const
Returns rotation angle around y.
Definition: ARICHPositionElement.h:161
Belle2::ARICHPositionElement::addShift
void addShift(double dx, double dy, double dz, double dalpha, double dbeta, double dgamma)
Shift the existing values of parameters.
Definition: ARICHPositionElement.h:123
Belle2::ARICHPositionElement::setX
void setX(double x)
Sets translation in x.
Definition: ARICHPositionElement.h:69
Belle2::ARICHPositionElement::getX
double getX() const
Returns translation in x.
Definition: ARICHPositionElement.h:137
Belle2::ARICHPositionElement::m_alpha
float m_alpha
rotation angle around x
Definition: ARICHPositionElement.h:209
Belle2::ARICHPositionElement::m_beta
float m_beta
rotation angle around y
Definition: ARICHPositionElement.h:210