9 #include <top/dbobjects/TOPGeoPMTArray.h>
21 unsigned TOPGeoPMTArray::getPmtID(
unsigned row,
unsigned col)
const
23 if (row == 0 or row > m_numRows)
return 0;
24 if (col == 0 or col > m_numColumns)
return 0;
25 return (row - 1) * m_numColumns + col;
28 unsigned TOPGeoPMTArray::getRow(
unsigned pmtID)
const
30 if (pmtID == 0 or pmtID > getSize())
return 0;
31 return (pmtID - 1) / m_numColumns + 1;
34 unsigned TOPGeoPMTArray::getColumn(
unsigned pmtID)
const
36 if (pmtID == 0 or pmtID > getSize())
return 0;
37 return (pmtID - 1) % m_numColumns + 1;
40 int TOPGeoPMTArray::getPixelID(
double x,
double y,
unsigned pmtID)
const
42 if (pmtID == 0 or pmtID > getSize())
return 0;
45 unsigned col = m_pmt.getPixelColumn(x);
46 if (col == 0)
return 0;
49 unsigned row = m_pmt.getPixelRow(y);
50 if (row == 0)
return 0;
53 col += (pmtID % m_numColumns) * m_pmt.getNumColumns();
54 row += (pmtID / m_numColumns) * m_pmt.getNumRows();
55 return row * m_numColumns * m_pmt.getNumColumns() + col + 1;
58 int TOPGeoPMTArray::getPixelID(
unsigned pmtID,
unsigned pmtPixelID)
const
61 if (pmtID >= getSize())
return 0;
64 if (pmtPixelID >= m_pmt.getNumPixels())
return 0;
66 unsigned col = pmtPixelID % m_pmt.getNumColumns();
67 unsigned row = pmtPixelID / m_pmt.getNumColumns();
69 col += (pmtID % m_numColumns) * m_pmt.getNumColumns();
70 row += (pmtID / m_numColumns) * m_pmt.getNumRows();
71 return row * m_numColumns * m_pmt.getNumColumns() + col + 1;
74 void TOPGeoPMTArray::generateDecoupledPMTs(
double fraction)
76 if (fraction <= 0)
return;
78 for (
unsigned i = 0; i < getSize(); i++) {
79 if (gRandom->Rndm() < fraction) setDecoupledPMT(i + 1);
84 bool TOPGeoPMTArray::isPMTDecoupled(
unsigned pmtID)
const
86 for (
const auto& pmt : m_decoupledPMTs) {
87 if (pmtID == pmt)
return true;
93 bool TOPGeoPMTArray::isConsistent()
const
95 if (m_numRows == 0)
return false;
96 if (m_numColumns == 0)
return false;
97 if (m_dx <= 0)
return false;
98 if (m_dy <= 0)
return false;
99 if (m_material.empty())
return false;
100 if (!m_pmt.isConsistent())
return false;
101 if (m_cookieThickness <= 0)
return false;
102 if (m_cookieMaterial.empty())
return false;
103 if (m_filterThickness <= 0)
return false;
104 if (m_filterMaterial.empty())
return false;
108 void TOPGeoPMTArray::print(
const std::string& title)
const
110 TOPGeoBase::print(title);
111 cout <<
" size: " << getNumColumns() <<
" X " << getNumRows();
112 cout <<
", dimensions: " << getSizeX() <<
" X " << getSizeY() <<
" X " << getSizeZ();
113 cout <<
" " << s_unitName << endl;
114 cout <<
" cell: " << getDx() <<
" X " << getDy() <<
" " << s_unitName << endl;
115 cout <<
" material: " << getMaterial() << endl;
116 if (m_cookieThickness > 0) {
117 cout <<
" silicone cookies: thickness = " << getCookieThickness() <<
" "
118 << s_unitName <<
", material = " << getCookieMaterial() << endl;
119 cout <<
" wavelength filter: thickness = " << getFilterThickness() <<
" "
120 << s_unitName <<
", material = " << getFilterMaterial() << endl;
122 cout <<
" air gap (decoupled PMT's): " << getAirGap() <<
" " << s_unitName << endl;
123 cout <<
" optically decoupled PMT's:";
124 if (m_decoupledPMTs.empty()) {
127 for (
const auto& pmt : m_decoupledPMTs) cout <<
" " << pmt;
Abstract base class for different kinds of events.