Belle II Software  release-08-01-10
ARICHGeoMirrors.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/ARICHGeoMirrors.h>
10 #include <math.h>
11 #include <iostream>
12 #include <iomanip>
13 
14 using namespace std;
15 using namespace Belle2;
16 
17 
18 void ARICHGeoMirrors::initializeDefault()
19 {
20  double rmir = m_radius - m_plateThickness / 2.;
21  for (unsigned i = 0; i < m_nMirrors; i++) {
22  TVector3 norm(cos(i * 2.*M_PI / m_nMirrors + m_startAngle),
23  sin(i * 2.*M_PI / m_nMirrors + m_startAngle), 0);
24  m_normVector.push_back(norm);
25  m_point.push_back(rmir * norm);
26  m_installed.push_back(true);
27  }
28 }
29 
30 bool ARICHGeoMirrors::isConsistent() const
31 {
32  if (m_nMirrors == 0) { B2INFO("ARICHGeoMirrors: no mirrors will be placed"); return true;}
33 
34  if (m_radius <= 0) return false;
35  if (m_plateThickness <= 0 || m_plateWidth <= 0 || m_plateLength <= 0) return false;
36  if (m_plateWidth == 0) return false;
37  if (m_radius == 0) return false;
38  if (m_point.size() != m_nMirrors) return false;
39  if (m_normVector.size() != m_nMirrors) return false;
40  if (m_installed.size() != m_nMirrors) return false;
41  if (m_material.empty()) return false;
42  if (!m_surface.hasProperties())
43  B2INFO("ARICHGeoMirrors: no optical properties are specified for mirrors! (no photons will be reflected)");
44  return true;
45 }
46 
47 
48 void ARICHGeoMirrors::print(const std::string& title) const
49 {
50  ARICHGeoBase::print(title);
51  cout << " mirror plate:" << endl;
52  cout << " thickness: " << getPlateThickness() << " " << s_unitName << ", width: " << getPlateWidth() << " " << s_unitName <<
53  ", length: "
54  << getPlateLength() << " " << s_unitName << endl;
55  cout << " material: " << getMaterial() << endl;
56  cout << " number of plates: " << getNMirrors() << endl;
57  cout << " nominal phi angle of 1st plate: " << getStartAngle() << endl;
58  cout << " nominal radius at which plates are placed: " << getRadius() << " " << s_unitName << endl;
59  cout << " nominal Z position of plates: " << getZPosition() << " " << s_unitName << endl;
60 
61  cout << " installed plates " << endl;
62 
63  cout << " ID: ";
64  for (unsigned imir = 1; imir < getNMirrors() + 1; imir++) {
65  cout << setw(3) << imir << " ";
66  }
67  cout << endl;
68  cout << " flag: ";
69  for (unsigned imir = 1; imir < getNMirrors() + 1; imir++) {
70  cout << setw(3) << isInstalled(imir) << " ";
71  }
72  cout << endl;
73 
74  ARICHGeoBase::printSurface(m_surface);
75 }
Abstract base class for different kinds of events.