Belle II Software  release-08-01-10
TOPGeoPMT.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/TOPGeoPMT.h>
10 #include <math.h>
11 #include <iostream>
12 
13 using namespace std;
14 
15 namespace Belle2 {
21  unsigned TOPGeoPMT::getPixelColumn(double x) const
22  {
23  x *= s_unit;
24  if (fabs(x) >= m_sensSizeX / 2) return 0;
25  return m_numColumns - int((x + m_sensSizeX / 2) / m_sensSizeX * m_numColumns);
26  }
27 
28 
29  unsigned TOPGeoPMT::getPixelRow(double y) const
30  {
31  y *= s_unit;
32  if (fabs(y) >= m_sensSizeY / 2) return 0;
33  return int((y + m_sensSizeY / 2) / m_sensSizeY * m_numRows) + 1;
34  }
35 
36  unsigned TOPGeoPMT::getPixelID(double x, double y) const
37  {
38  auto col = getPixelColumn(x);
39  if (col == 0) return 0;
40  auto row = getPixelRow(y);
41  if (row == 0) return 0;
42 
43  return (row - 1) * m_numColumns + col;
44  }
45 
46 
47  double TOPGeoPMT::getX(unsigned col) const
48  {
49  return (int)(m_numColumns + 1 - 2 * col) / 2.0 * getDx();
50  }
51 
52  double TOPGeoPMT::getY(unsigned row) const
53  {
54  return (int)(2 * row - m_numRows - 1) / 2.0 * getDy();
55  }
56 
57 
58  bool TOPGeoPMT::isConsistent() const
59  {
60  if (m_sizeX <= 0) return false;
61  if (m_sizeY <= 0) return false;
62  if (m_sizeZ <= 0) return false;
63  if (m_wallThickness <= 0) return false;
64 
65  if (m_sensSizeX <= 0) return false;
66  if (m_sensSizeY <= 0) return false;
67  if (m_sensThickness <= 0) return false;
68  if (m_numColumns == 0) return false;
69  if (m_numRows == 0) return false;
70  if (m_sensMaterial.empty()) return false;
71 
72  if (m_winThickness <= 0) return false;
73  if (m_winMaterial.empty()) return false;
74 
75  if (m_botThickness <= 0) return false;
76  if (m_botMaterial.empty()) return false;
77 
78  if (m_reflEdgeWidth <= 0) return false;
79  if (m_reflEdgeThickness <= 0) return false;
80 
81  return true;
82  }
83 
84 
85  void TOPGeoPMT::print(const std::string& title) const
86  {
87  TOPGeoBase::print(title);
88 
89  cout << " outer dimensions: " << getSizeX() << " X " << getSizeY()
90  << " X " << getSizeZ() << " " << s_unitName << endl;
91  cout << " wall thickness: " << getWallThickness() << " " << s_unitName << endl;
92  cout << " window thickness: " << getWinThickness() << " " << s_unitName << endl;
93  cout << " bottom thickness: " << getBotThickness() << " " << s_unitName << endl;
94  cout << " sensitive area: " << getSensSizeX() << " X " << getSensSizeY()
95  << " " << s_unitName;
96  cout << ", thickness: " << getSensThickness() << " " << s_unitName << endl;
97  cout << " number of pixels: " << getNumColumns() << " X " << getNumRows() << endl;
98  cout << " casing material: " << getWallMaterial() << endl;
99  cout << " inner material: " << getFillMaterial() << endl;
100  cout << " window material: " << getWinMaterial() << endl;
101  cout << " bottom material: " << getBotMaterial() << endl;
102  cout << " sensitive material: " << getSensMaterial() << endl;
103  cout << " reflective edge: " << endl;
104  cout << " - width: " << getReflEdgeWidth() << " " << s_unitName;
105  cout << ", thickness: " << getReflEdgeThickness() << " " << s_unitName << endl;
106 
107  printSurface(m_reflEdgeSurface);
108  }
109 
111 } // end Belle2 namespace
Abstract base class for different kinds of events.