Belle II Software development
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
13using namespace std;
14
15namespace 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
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
108 }
109
111} // end Belle2 namespace
double getSizeZ() const
Returns full size in z.
Definition: TOPGeoPMT.h:141
unsigned getNumColumns() const
Returns number of pixel columns.
Definition: TOPGeoPMT.h:183
unsigned m_numColumns
number of pixel columns
Definition: TOPGeoPMT.h:317
float m_wallThickness
side wall thickness
Definition: TOPGeoPMT.h:310
float m_sensSizeX
sensitive volume (photo-cathode) size in x
Definition: TOPGeoPMT.h:314
float m_sizeX
full size in x
Definition: TOPGeoPMT.h:307
double getReflEdgeThickness() const
Returns reflective edge thickness.
Definition: TOPGeoPMT.h:237
double getDx() const
Returns pixel size in x.
Definition: TOPGeoPMT.h:285
const std::string & getSensMaterial() const
Returns sensitive material name.
Definition: TOPGeoPMT.h:201
float m_botThickness
bottom thickness
Definition: TOPGeoPMT.h:324
std::string m_winMaterial
window material
Definition: TOPGeoPMT.h:322
double getWinThickness() const
Returns entrance window thickness.
Definition: TOPGeoPMT.h:207
double getBotThickness() const
Returns bottom thickness.
Definition: TOPGeoPMT.h:219
unsigned m_numRows
number of pixel rows
Definition: TOPGeoPMT.h:318
double getDy() const
Returns pixel size in y.
Definition: TOPGeoPMT.h:291
GeoOpticalSurface m_reflEdgeSurface
reflective edge optical surface
Definition: TOPGeoPMT.h:329
const std::string & getWallMaterial() const
Returns wall (casing) material name.
Definition: TOPGeoPMT.h:153
double getReflEdgeWidth() const
Returns reflective edge width.
Definition: TOPGeoPMT.h:231
const std::string & getFillMaterial() const
Returns fill (inside) material name.
Definition: TOPGeoPMT.h:159
double getSensSizeX() const
Returns sensitive volume (photo-cathode) size in x.
Definition: TOPGeoPMT.h:165
float m_sizeZ
full size in z
Definition: TOPGeoPMT.h:309
float m_sensSizeY
sensitive volume (photo-cathode) size in y
Definition: TOPGeoPMT.h:315
double getSizeX() const
Returns full size in x.
Definition: TOPGeoPMT.h:129
float m_sizeY
full size in y
Definition: TOPGeoPMT.h:308
float m_sensThickness
sensitive volume (photo-cathode) thickness
Definition: TOPGeoPMT.h:316
double getSizeY() const
Returns full size in y.
Definition: TOPGeoPMT.h:135
std::string m_botMaterial
bottom material
Definition: TOPGeoPMT.h:325
double getWallThickness() const
Returns wall thickness.
Definition: TOPGeoPMT.h:147
double getSensThickness() const
Returns sensitive volume (photo-cathode) thickness.
Definition: TOPGeoPMT.h:177
std::string m_sensMaterial
sensitive material
Definition: TOPGeoPMT.h:319
const std::string & getWinMaterial() const
Returns entrance window material name.
Definition: TOPGeoPMT.h:213
unsigned getNumRows() const
Returns number of pixel rows.
Definition: TOPGeoPMT.h:189
float m_reflEdgeWidth
reflective edge width
Definition: TOPGeoPMT.h:327
const std::string & getBotMaterial() const
Returns bottom material name.
Definition: TOPGeoPMT.h:225
double getSensSizeY() const
Returns sensitive volume (photo-cathode) size in y.
Definition: TOPGeoPMT.h:171
float m_reflEdgeThickness
reflective edge thickness
Definition: TOPGeoPMT.h:328
float m_winThickness
window thickness
Definition: TOPGeoPMT.h:321
bool isConsistent() const override
Check for consistency of data members.
Definition: TOPGeoPMT.cc:58
static double s_unit
conversion unit for length
Definition: TOPGeoBase.h:86
double getX(unsigned col) const
Returns x coordinate of pixel center.
Definition: TOPGeoPMT.cc:47
double getY(unsigned row) const
Returns y coordinate of pixel center.
Definition: TOPGeoPMT.cc:52
void print(const std::string &title="MCP-PMT geometry parameters") const override
Print the content of the class.
Definition: TOPGeoPMT.cc:85
virtual void printSurface(const GeoOpticalSurface &surface) const
Print the content of optical surface.
Definition: TOPGeoBase.cc:44
virtual void print(const std::string &title) const
Print the content of the class.
Definition: TOPGeoBase.cc:28
unsigned getPixelColumn(double x) const
Converts x-coordinate to pixel column (1-based)
Definition: TOPGeoPMT.cc:21
static std::string s_unitName
conversion unit name
Definition: TOPGeoBase.h:87
unsigned getPixelRow(double y) const
Converts y-coordinate to pixel row (1-based)
Definition: TOPGeoPMT.cc:29
unsigned getPixelID(double x, double y) const
Converts x and y coordinates to PMT pixel ID (1-based)
Definition: TOPGeoPMT.cc:36
Abstract base class for different kinds of events.
STL namespace.