Belle II Software  release-05-01-25
TOPGeoPMT.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/TOPGeoPMT.h>
12 #include <math.h>
13 #include <iostream>
14 
15 using namespace std;
16 
17 namespace Belle2 {
23  unsigned TOPGeoPMT::getPixelColumn(double x) const
24  {
25  if (fabs(x) >= m_sensSizeX / 2) return 0;
26  return m_numColumns - int((x + m_sensSizeX / 2) / m_sensSizeX * m_numColumns);
27  }
28 
29 
30  unsigned TOPGeoPMT::getPixelRow(double y) const
31  {
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  bool TOPGeoPMT::isConsistent() const
47  {
48  if (m_sizeX <= 0) return false;
49  if (m_sizeY <= 0) return false;
50  if (m_sizeZ <= 0) return false;
51  if (m_wallThickness <= 0) return false;
52 
53  if (m_sensSizeX <= 0) return false;
54  if (m_sensSizeY <= 0) return false;
55  if (m_sensThickness <= 0) return false;
56  if (m_numColumns == 0) return false;
57  if (m_numRows == 0) return false;
58  if (m_sensMaterial.empty()) return false;
59 
60  if (m_winThickness <= 0) return false;
61  if (m_winMaterial.empty()) return false;
62 
63  if (m_botThickness <= 0) return false;
64  if (m_botMaterial.empty()) return false;
65 
66  if (m_reflEdgeWidth <= 0) return false;
67  if (m_reflEdgeThickness <= 0) return false;
68 
69  return true;
70  }
71 
72 
73  void TOPGeoPMT::print(const std::string& title) const
74  {
75  TOPGeoBase::print(title);
76 
77  cout << " outer dimensions: " << getSizeX() << " X " << getSizeY()
78  << " X " << getSizeZ() << " " << s_unitName << endl;
79  cout << " wall thickness: " << getWallThickness() << " " << s_unitName << endl;
80  cout << " window thickness: " << getWinThickness() << " " << s_unitName << endl;
81  cout << " bottom thickness: " << getBotThickness() << " " << s_unitName << endl;
82  cout << " sensitive area: " << getSensSizeX() << " X " << getSensSizeY()
83  << " " << s_unitName;
84  cout << ", thickness: " << getSensThickness() << " " << s_unitName << endl;
85  cout << " number of pixels: " << getNumColumns() << " X " << getNumRows() << endl;
86  cout << " casing material: " << getWallMaterial() << endl;
87  cout << " inner material: " << getFillMaterial() << endl;
88  cout << " window material: " << getWinMaterial() << endl;
89  cout << " bottom material: " << getBotMaterial() << endl;
90  cout << " sensitive material: " << getSensMaterial() << endl;
91  cout << " reflective edge: " << endl;
92  cout << " - width: " << getReflEdgeWidth() << " " << s_unitName;
93  cout << ", thickness: " << getReflEdgeThickness() << " " << s_unitName << endl;
94 
95  printSurface(m_reflEdgeSurface);
96  }
97 
99 } // end Belle2 namespace
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19