Belle II Software  release-08-01-10
ARICHGeoMasterVolume.cc
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 #include <arich/dbobjects/ARICHGeoMasterVolume.h>
10 #include <iostream>
11 
12 using namespace std;
13 using namespace Belle2;
14 
15 
16 
17 TVector3 ARICHGeoMasterVolume::pointToGlobal(const TVector3& point) const
18 {
19  return (*m_rotation) * point + (*m_translation);
20 }
21 
22 TVector3 ARICHGeoMasterVolume::momentumToGlobal(const TVector3& momentum) const
23 {
24  return (*m_rotation) * momentum;
25 }
26 
27 TVector3 ARICHGeoMasterVolume::pointToLocal(const TVector3& point) const
28 {
29  return (*m_rotationInverse) * (point - (*m_translation));
30 }
31 
32 TVector3 ARICHGeoMasterVolume::momentumToLocal(const TVector3& momentum) const
33 {
34  return (*m_rotationInverse) * momentum;
35 }
36 
37 void ARICHGeoMasterVolume::setPlacement(double x, double y, double z, double rx, double ry, double rz)
38 {
39 
40  m_x = x; m_y = y; m_z = z; m_rx = rx; m_ry = ry; m_rz = rz;
41 
42  TVector3 translation(x, y, z);
43 
44  m_rotation = new TRotation();
45  m_rotation->RotateX(rx);
46  m_rotation->RotateY(ry);
47  m_rotation->RotateZ(rz);
48 
49  m_rotationInverse = new TRotation(m_rotation->Inverse());
50  m_translation = new TVector3(x, y, z);
51 
52 }
53 
54 
55 
56 bool ARICHGeoMasterVolume::isConsistent() const
57 {
58  if (m_innerR > m_outerR) return false;
59  if (m_length <= 0 || m_innerR < 0) return false;
60  if (m_material.empty()) return false;
61  return true;
62 }
63 
64 
65 void ARICHGeoMasterVolume::print(const std::string& title) const
66 {
67  ARICHGeoBase::print(title);
68 
69  cout << " Tube inner radius: " << getInnerRadius() << " " << s_unitName << endl;
70  cout << " Tube outer radius: " << getOuterRadius() << " " << s_unitName << endl;
71  cout << " Tube length: " << getLength() << " " << s_unitName << endl;
72 
73  cout << "Positioning parameters (in Belle II global frame)" << endl;
74  ARICHGeoBase::printPlacement(m_x, m_y, m_z, m_rx, m_ry, m_rz);
75 
76 }
Abstract base class for different kinds of events.