Belle II Software  release-08-01-10
TOPGeoHoneycombPanel.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/TOPGeoHoneycombPanel.h>
10 #include <math.h>
11 #include <iostream>
12 
13 using namespace std;
14 
15 namespace Belle2 {
21  void TOPGeoHoneycombPanel::appendContour(std::vector<std::pair<double, double> >& contour,
22  double y0,
23  bool fromLeftToRight) const
24  {
25  if (m_N <= 0) return;
26 
27  typedef std::pair<double, double> Pair;
28 
29  double R = getRadius();
30  double yc = getMaxThickness() - getMinThickness() - R;
31  double x0 = sqrt(R * R - yc * yc);
32  if (!fromLeftToRight) x0 = -x0;
33  double dx = 2.0 * x0 / m_N;
34  double x = -x0;
35  contour.push_back(Pair(x, y0));
36  for (int i = 1; i < m_N; i++) {
37  x += dx;
38  double y = y0 + sqrt(R * R - x * x) + yc;
39  contour.push_back(Pair(x, y));
40  }
41  contour.push_back(Pair(x0, y0));
42 
43  }
44 
45 
46  bool TOPGeoHoneycombPanel::isConsistent() const
47  {
48  if (m_width <= 0) return false;
49  if (m_length <= 0) return false;
50  if (m_minThickness <= 0) return false;
51  if (m_maxThickness < m_minThickness) return false;
52  if (m_radius <= 0) return false;
53  if (m_edgeWidth <= 0) return false;
54  if (m_material.empty()) return false;
55  if (m_edgeMaterial.empty()) return false;
56  return true;
57  }
58 
59 
60  void TOPGeoHoneycombPanel::print(const std::string& title) const
61  {
62  TOPGeoBase::print(title);
63 
64  cout << " width = " << getWidth() << " " << s_unitName;
65  cout << ", length = " << getLength() << " " << s_unitName;
66  cout << ", thickness: min = " << getMinThickness() << " " << s_unitName;
67  cout << ", max = " << getMaxThickness() << " " << s_unitName;
68  cout << ", radius = " << getRadius() << " " << s_unitName << endl;
69 
70  cout << " edge width = " << getEdgeWidth() << " " << s_unitName;
71  cout << ", y = " << getY() << " " << s_unitName;
72  cout << ", N = " << m_N << endl;
73 
74  cout << " materials: body = " << getMaterial();
75  cout << ", edge = " << getEdgeMaterial() << endl;
76  }
77 
79 } // end Belle2 namespace
double R
typedef autogenerated by FFTW
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
std::pair< double, double > Pair
Shorthand for std::pair<double, double>
Abstract base class for different kinds of events.