Belle II Software  release-05-01-25
TOPGeoHoneycombPanel.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Marko Staric *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <top/dbobjects/TOPGeoHoneycombPanel.h>
12 #include <math.h>
13 #include <iostream>
14 
15 using namespace std;
16 
17 namespace Belle2 {
23  void TOPGeoHoneycombPanel::appendContour(std::vector<std::pair<double, double> >& contour,
24  double y0,
25  bool fromLeftToRight) const
26  {
27  if (m_N <= 0) return;
28 
29  typedef std::pair<double, double> Pair;
30 
31  double R = getRadius();
32  double yc = getMaxThickness() - getMinThickness() - R;
33  double x0 = sqrt(R * R - yc * yc);
34  if (!fromLeftToRight) x0 = -x0;
35  double dx = 2.0 * x0 / m_N;
36  double x = -x0;
37  contour.push_back(Pair(x, y0));
38  for (int i = 1; i < m_N; i++) {
39  x += dx;
40  double y = y0 + sqrt(R * R - x * x) + yc;
41  contour.push_back(Pair(x, y));
42  }
43  contour.push_back(Pair(x0, y0));
44 
45  }
46 
47 
48  bool TOPGeoHoneycombPanel::isConsistent() const
49  {
50  if (m_width <= 0) return false;
51  if (m_length <= 0) return false;
52  if (m_minThickness <= 0) return false;
53  if (m_maxThickness < m_minThickness) return false;
54  if (m_radius <= 0) return false;
55  if (m_edgeWidth <= 0) return false;
56  if (m_material.empty()) return false;
57  if (m_edgeMaterial.empty()) return false;
58  return true;
59  }
60 
61 
62  void TOPGeoHoneycombPanel::print(const std::string& title) const
63  {
64  TOPGeoBase::print(title);
65 
66  cout << " width = " << getWidth() << " " << s_unitName;
67  cout << ", length = " << getLength() << " " << s_unitName;
68  cout << ", thickness: min = " << getMinThickness() << " " << s_unitName;
69  cout << ", max = " << getMaxThickness() << " " << s_unitName;
70  cout << ", radius = " << getRadius() << " " << s_unitName << endl;
71 
72  cout << " edge width = " << getEdgeWidth() << " " << s_unitName;
73  cout << ", y = " << getY() << " " << s_unitName;
74  cout << ", N = " << m_N << endl;
75 
76  cout << " materials: body = " << getMaterial();
77  cout << ", edge = " << getEdgeMaterial() << endl;
78  }
79 
81 } // end Belle2 namespace
Belle2::Pair
std::pair< double, double > Pair
Shorthand for std::pair<double, double>
Definition: TOPGeoBarSegment.cc:59
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19