11 #include <arich/dbobjects/ARICHGeoDetectorPlane.h>
18 void ARICHGeoDetectorPlane::setRingPar(
const std::vector<std::pair<double, double>>& ringPar)
22 for (
auto ring : m_ringPar) {
23 double iPhi = ring.second / 2.;
24 while (iPhi < 2 * M_PI) {
25 m_slotPar.push_back({ring.first, iPhi});
30 m_nRings = m_ringPar.size();
31 m_nSlots = m_slotPar.size();
35 unsigned ARICHGeoDetectorPlane::getSlotRing(
unsigned slotID)
const
38 if (slotID > m_nSlots) B2ERROR(
"ARICHGeoDetectorPlane: invalid module slot ID number!");
41 for (
auto dphi : m_ringPar) {
42 nSlots +=
static_cast<int>(2 * M_PI / dphi.second + 0.5);
43 if (slotID < nSlots + 1)
return iRing;
50 unsigned ARICHGeoDetectorPlane::pointSlotID(
double x,
double y)
const
52 double r = sqrt(x * x + y * y);
53 double phi = atan2(y, x);
54 if (phi < 0) phi += 2 * M_PI;
55 if (r < (m_ringPar[0].first - (m_ringPar[1].first - m_ringPar[0].first) / 2.))
return 0;
57 if (r > (m_ringPar[m_nRings - 1].first + (m_ringPar[m_nRings - 1].first - m_ringPar[m_nRings - 2].first) / 2.))
return 0;
60 for (
unsigned i = 1; i < m_nRings; i++) {
61 if (r < (m_ringPar[i - 1].first + m_ringPar[i].first) / 2.) {
62 nslot += phi / m_ringPar[i - 1].second;
65 nslot +=
static_cast<int>(2 * M_PI / m_ringPar[i - 1].second + 0.5);
67 nslot += phi / m_ringPar[m_nRings - 1].second;
71 bool ARICHGeoDetectorPlane::isConsistent()
const
73 if (m_outerR < m_innerR)
return false;
74 if (m_thickness <= 0)
return false;
75 if (m_moduleHoleSize < 0)
return false;
76 if (m_supportBackWallHeight < 0)
return false;
77 if (m_supportBackWallThickness < 0)
return false;
78 if (m_supportZPosition < 0)
return false;
79 if (m_ringPar.size() == 0 || m_slotPar.size() == 0)
return false;
83 unsigned ARICHGeoDetectorPlane::getSlotIDFromSRF(
unsigned sector,
unsigned ring,
unsigned azimuth)
const
86 if (azimuth >
static_cast<unsigned>(2 * M_PI / m_ringPar[ring - 1].second + 0.5) / 6 || ring > getNRings() || sector > 6)
87 { B2ERROR(
"ARICHGeoDetectorPlane::getSlotIDFromSRF: invalid slot position parameters!");
return 0;}
89 unsigned moduleID = 0;
90 for (
unsigned i = 1; i < ring; i++) {
91 moduleID +=
static_cast<int>(2 * M_PI / m_ringPar[i - 1].second + 0.5);
93 moduleID += (sector - 1) *
static_cast<int>(2 * M_PI / m_ringPar[ring - 1].second + 0.5) / 6 + (azimuth - 1);
94 if (moduleID + 1 > m_nSlots) {B2ERROR(
"ARICHGeoDetectorPlane::getSlotIDFromSRF: invalid slot position parameters!");
return 0;}
99 void ARICHGeoDetectorPlane::print(
const std::string& title)
const
101 ARICHGeoBase::print(title);
102 cout <<
"Configuration of module slots:" << endl;
104 cout <<
" There are " << getNRings() <<
" module rings." << endl;
105 for (
auto ring : m_ringPar) {
106 cout <<
" ring: " << i + 1 <<
" has " <<
static_cast<int>(2 * M_PI / ring.second + 0.5) <<
" module slots, at radius: " <<
107 ring.first <<
" cm" << endl;
111 cout <<
" Support plate inner radius: " << getSupportInnerR() <<
" " << s_unitName << endl;
112 cout <<
" Support plate outer radius: " << getSupportOuterR() <<
" " << s_unitName << endl;
113 cout <<
" Support plate thickness: " << getSupportThickness() <<
" " << s_unitName << endl;
114 cout <<
" Support plate Z position: " << getSupportZPosition() <<
" " << s_unitName << endl;
115 cout <<
" Support plate backwalls height: " << getSupportBackWallHeight() <<
" " << s_unitName << endl;
116 cout <<
" Support plate backwall thickness: " << getSupportBackWallThickness() <<
" " << s_unitName << endl;
117 cout <<
" Support plate module hole size: " << getModuleHoleSize() <<
" X " << getModuleHoleSize() <<
" " << s_unitName << endl;
118 cout <<
" Support plate material: " << getSupportMaterial() << endl;
120 cout <<
"Positioning parameters (in local ARICH frame)" << endl;
121 ARICHGeoBase::printPlacement(m_x, m_y, m_z, m_rx, m_ry, m_rz);