Belle II Software development
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
13using namespace std;
14
15namespace 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
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 getWidth() const
Returns panel width.
int m_N
number of flat surfaces to approximate curved surface
double getMaxThickness() const
Returns panel maximal thickness.
std::string m_material
material name
std::string m_edgeMaterial
material name of reinforced edge
const std::string & getEdgeMaterial() const
Returns material name of reinforced edge.
float m_radius
radius of curved surface
double getMinThickness() const
Returns panel minimal thickness.
float m_minThickness
minimal thickness
double getY() const
Returns y position of the flat surface in local (bar) frame.
const std::string & getMaterial() const
Returns material name.
double getRadius() const
Returns radius of curved surface.
float m_maxThickness
maximal thickness
float m_edgeWidth
width of the reinforced edge
double getEdgeWidth() const
Returns width of the reinforced edge.
double getLength() const
Returns panel length.
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
bool isConsistent() const override
Check for consistency of data members.
void appendContour(std::vector< std::pair< double, double > > &contour, double y0, bool fromLeftToRight) const
Appends curved surface to contour.
virtual void print(const std::string &title="QBB honeycomb panel geometry parameters") const override
Print the content of the class.
virtual void print(const std::string &title) const
Print the content of the class.
Definition: TOPGeoBase.cc:28
std::pair< double, double > Pair
Shorthand for std::pair<double, double>
static std::string s_unitName
conversion unit name
Definition: TOPGeoBase.h:87
Abstract base class for different kinds of events.
STL namespace.