Belle II Software  release-08-01-10
TOPGeoQBB.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/TOPGeoQBB.h>
10 #include <math.h>
11 #include <iostream>
12 
13 using namespace std;
14 
15 namespace Belle2 {
21  std::vector<std::pair<double, double> > TOPGeoQBB::getForwardContour() const
22  {
23  typedef std::pair<double, double> Pair;
24  std::vector<Pair> contour;
25 
26  double x1 = getWidth() / 2;
27  double x2 = x1 - m_sideRails.getThickness();
28  double x3 = getWidth() / 6;
29  double y1 = m_outerPanel.getY() + m_outerPanel.getMaxThickness();
30  double y2 = m_outerPanel.getY() + m_outerPanel.getMinThickness();
31  double y3 = y2 - m_sideRails.getHeight();
32  double y4 = m_innerPanel.getY() - m_innerPanel.getMaxThickness();
33  contour.push_back(Pair(-x1, y2));
34  contour.push_back(Pair(-x3, y1));
35  contour.push_back(Pair(x3, y1));
36  contour.push_back(Pair(x1, y2));
37  contour.push_back(Pair(x1, y3));
38  contour.push_back(Pair(x2, y4));
39  contour.push_back(Pair(-x2, y4));
40  contour.push_back(Pair(-x1, y3));
41 
42  return contour;
43  }
44 
45  void TOPGeoQBB::printForwardContour() const
46  {
47  auto contour = getForwardContour();
48  cout << "Forward contour [" << s_unitName << "]:" << endl;
49  for (auto& xy : contour) cout << xy.first << " " << xy.second << endl;
50  cout << endl;
51  }
52 
53 
54  std::vector<std::pair<double, double> > TOPGeoQBB::getInnerPanelContour() const
55  {
56  typedef std::pair<double, double> Pair;
57  std::vector<Pair> contour;
58 
59  double x1 = getPanelWidth() / 2;
60  double y1 = m_innerPanel.getY();
61  double y2 = y1 - m_innerPanel.getMaxThickness();
62  contour.push_back(Pair(-x1, y1));
63  contour.push_back(Pair(x1, y1));
64  contour.push_back(Pair(x1, y2));
65  m_innerPanel.appendContour(contour, y2, false);
66  contour.push_back(Pair(-x1, y2));
67 
68  return contour;
69  }
70 
71  void TOPGeoQBB::printInnerPanelContour() const
72  {
73  auto contour = getInnerPanelContour();
74  cout << "Inner panel contour [" << s_unitName << "]:" << endl;
75  for (auto& xy : contour) cout << xy.first << " " << xy.second << endl;
76  cout << endl;
77  }
78 
79 
80  std::vector<std::pair<double, double> > TOPGeoQBB::getOuterPanelContour() const
81  {
82  typedef std::pair<double, double> Pair;
83  std::vector<Pair> contour;
84 
85  double x1 = getPanelWidth() / 2;
86  double y1 = m_outerPanel.getY();
87  double y2 = y1 + m_outerPanel.getMinThickness();
88  contour.push_back(Pair(-x1, y2));
89  m_outerPanel.appendContour(contour, y2, true);
90  contour.push_back(Pair(x1, y2));
91  contour.push_back(Pair(x1, y1));
92  contour.push_back(Pair(-x1, y1));
93 
94  return contour;
95  }
96 
97  void TOPGeoQBB::printOuterPanelContour() const
98  {
99  auto contour = getOuterPanelContour();
100  cout << "Outer panel contour [" << s_unitName << "]:" << endl;
101  for (auto& xy : contour) cout << xy.first << " " << xy.second << endl;
102  cout << endl;
103  }
104 
105 
106  std::vector<std::pair<double, double> > TOPGeoQBB::getBackwardContour() const
107  {
108  typedef std::pair<double, double> Pair;
109  std::vector<Pair> contour;
110 
111  double x1 = getWidth() / 2;
112  double x2 = x1 - m_prismEnclosure.getHeight() * tan(m_prismEnclosure.getAngle());
113  double x3 = getWidth() / 6;
114  double y1 = m_outerPanel.getY() + m_outerPanel.getMaxThickness();
115  double y2 = m_outerPanel.getY() + m_outerPanel.getMinThickness();
116  double y3 = y2 - m_sideRails.getHeight();
117  double y4 = y3 - m_prismEnclosure.getHeight();
118  contour.push_back(Pair(-x1, y2));
119  contour.push_back(Pair(-x3, y1));
120  contour.push_back(Pair(x3, y1));
121  contour.push_back(Pair(x1, y2));
122  contour.push_back(Pair(x1, y3));
123  contour.push_back(Pair(x2, y4));
124  contour.push_back(Pair(-x2, y4));
125  contour.push_back(Pair(-x1, y3));
126 
127  return contour;
128  }
129 
130  void TOPGeoQBB::printBackwardContour() const
131  {
132  auto contour = getBackwardContour();
133  cout << "Backward contour [" << s_unitName << "]:" << endl;
134  for (auto& xy : contour) cout << xy.first << " " << xy.second << endl;
135  cout << endl;
136  }
137 
138 
139  std::vector<std::pair<double, double> > TOPGeoQBB::getPrismEnclosureContour() const
140  {
141  typedef std::pair<double, double> Pair;
142  std::vector<Pair> contour;
143 
144  double tanAngle = tan(m_prismEnclosure.getAngle());
145  double x1 = getWidth() / 2;
146  double x2 = x1 - m_prismEnclosure.getHeight() * tanAngle;
147  double x3 = x1 - m_prismEnclosure.getSideThickness();
148  double y1 = m_outerPanel.getY() + m_outerPanel.getMinThickness()
149  - m_sideRails.getHeight();
150  double y2 = y1 - m_prismEnclosure.getHeight();
151  double y3 = y2 + m_prismEnclosure.getBottomThickness();
152  double x4 = x1 - m_prismEnclosure.getSideThickness() - (y1 - y3) * tanAngle;
153  contour.push_back(Pair(x1, y1));
154  contour.push_back(Pair(x2, y2));
155  contour.push_back(Pair(-x2, y2));
156  contour.push_back(Pair(-x1, y1));
157  contour.push_back(Pair(-x3, y1));
158  contour.push_back(Pair(-x4, y3));
159  contour.push_back(Pair(x4, y3));
160  contour.push_back(Pair(x3, y1));
161 
162  return contour;
163  }
164 
165  void TOPGeoQBB::printPrismEnclosureContour() const
166  {
167  auto contour = getPrismEnclosureContour();
168  cout << "Prism enclosure contour [" << s_unitName << "]:" << endl;
169  for (auto& xy : contour) cout << xy.first << " " << xy.second << endl;
170  cout << endl;
171  }
172 
173 
174  std::vector<std::pair<double, double> > TOPGeoQBB::getBackPlateContour() const
175  {
176  typedef std::pair<double, double> Pair;
177  std::vector<Pair> contour;
178 
179  double x1 = getWidth() / 2;
180  double x2 = x1 - m_prismEnclosure.getHeight() * tan(m_prismEnclosure.getAngle());
181  double y1 = m_outerPanel.getY() + m_outerPanel.getMinThickness();
182  double y2 = y1 - m_sideRails.getHeight();
183  double y3 = y2 - m_prismEnclosure.getHeight();
184  contour.push_back(Pair(-x1, y1));
185  contour.push_back(Pair(x1, y1));
186  contour.push_back(Pair(x1, y2));
187  contour.push_back(Pair(x2, y3));
188  contour.push_back(Pair(-x2, y3));
189  contour.push_back(Pair(-x1, y2));
190 
191  return contour;
192  }
193 
194  void TOPGeoQBB::printBackPlateContour() const
195  {
196  auto contour = getBackPlateContour();
197  cout << "Prism enclosure back plate contour [" << s_unitName << "]:" << endl;
198  for (auto& xy : contour) cout << xy.first << " " << xy.second << endl;
199  cout << endl;
200  }
201 
202 
203  std::vector<std::pair<double, double> > TOPGeoQBB::getFrontPlateContour() const
204  {
205  typedef std::pair<double, double> Pair;
206  std::vector<Pair> contour;
207 
208  double x1 = getWidth() / 2;
209  double x2 = x1 - m_prismEnclosure.getHeight() * tan(m_prismEnclosure.getAngle());
210  double y1 = m_outerPanel.getY() + m_outerPanel.getMinThickness();
211  double y2 = y1 - m_sideRails.getHeight();
212  double y3 = y2 - m_prismEnclosure.getHeight();
213  contour.push_back(Pair(x1, y2));
214  contour.push_back(Pair(x2, y3));
215  contour.push_back(Pair(-x2, y3));
216  contour.push_back(Pair(-x1, y2));
217 
218  return contour;
219  }
220 
221  void TOPGeoQBB::printFrontPlateContour() const
222  {
223  auto contour = getFrontPlateContour();
224  cout << "Prism enclosure front plate contour [" << s_unitName << "]:" << endl;
225  for (auto& xy : contour) cout << xy.first << " " << xy.second << endl;
226  cout << endl;
227  }
228 
229 
230  bool TOPGeoQBB::isConsistent() const
231  {
232  if (m_width <= 0) return false;
233  if (m_length <= 0) return false;
234  if (m_prismPosition <= 0) return false;
235  if (m_material.empty()) return false;
236  if (!m_innerPanel.isConsistent()) return false;
237  if (!m_outerPanel.isConsistent()) return false;
238  if (!m_sideRails.isConsistent()) return false;
239  if (!m_prismEnclosure.isConsistent()) return false;
240  if (!m_endPlate.isConsistent()) return false;
241  if (!m_coldPlate.isConsistent()) return false;
242  return true;
243  }
244 
245 
246  void TOPGeoQBB::print(const std::string& title) const
247  {
248  TOPGeoBase::printUnderlined(title);
249 
250  cout << " width = " << getWidth() << " " << s_unitName;
251  cout << ", length = " << getLength() << " " << s_unitName;
252  cout << ", prism-bar joint = " << getPrismPosition() << " " << s_unitName;
253  cout << ", inside material = " << getMaterial() << endl;
254 
255  m_innerPanel.print("QBB inner honeycomb panel geometry parameters");
256  m_outerPanel.print("QBB outer honeycomb panel geometry parameters");
257  m_sideRails.print();
258  m_prismEnclosure.print();
259  m_endPlate.print();
260  m_coldPlate.print();
261 
262  }
263 
265 } // end Belle2 namespace
double tan(double a)
tan for double
Definition: beamHelpers.h:31
std::pair< double, double > Pair
Shorthand for std::pair<double, double>
Abstract base class for different kinds of events.