Belle II Software  release-08-01-10
TOPGeoMirrorSegment.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 <top/dbobjects/TOPGeoMirrorSegment.h>
10 #include <math.h>
11 #include <iostream>
12 
13 using namespace std;
14 
15 namespace Belle2 {
21  double TOPGeoMirrorSegment::getZc() const
22  {
23  double dx = fabs(getXc()) - getWidth() / 2;
24  double dy = fabs(getYc()) - getThickness() / 2;
25  double z = getOuterRadius();
26  if (dx > 0) z = sqrt(z * z - dx * dx);
27  if (dy > 0) z = sqrt(z * z - dy * dy);
28 
29  return getFullLength() / 2 - z;
30  }
31 
32 
33  bool TOPGeoMirrorSegment::isConsistent() const
34  {
35  if (m_radius <= 0) return false;
36  if (m_coatingThickness <= 0) return false;
37  if (m_coatingMaterial.empty()) return false;
38  if (m_coatingSurface.getName().empty() and !m_coatingSurface.hasProperties()) return false;
39  if (!TOPGeoBarSegment::isConsistent()) return false;
40  return true;
41  }
42 
43 
44  void TOPGeoMirrorSegment::print(const std::string& title) const
45  {
46  TOPGeoBarSegment::print(title);
47  cout << " Radius of curvature: " << getRadius() << " " << s_unitName << endl;
48  cout << " Center of curvature: (" << getXc() << ", " << getYc()
49  << ") " << s_unitName << endl;
50  cout << " Reflective coating: " << getCoatingMaterial() << ", thickness: " <<
51  getCoatingThickness() << " " << s_unitName << endl;
52  printSurface(m_coatingSurface);
53 
54  }
55 
57 } // end Belle2 namespace
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Abstract base class for different kinds of events.