9 #include <arich/dbobjects/ARICHGeoDetectorPlane.h>
16 void ARICHGeoDetectorPlane::setRingPar(
const std::vector<std::pair<double, double>>& ringPar)
20 for (
auto ring : m_ringPar) {
21 double iPhi = ring.second / 2.;
22 while (iPhi < 2 * M_PI) {
23 m_slotPar.push_back({ring.first, iPhi});
28 m_nRings = m_ringPar.size();
29 m_nSlots = m_slotPar.size();
33 unsigned ARICHGeoDetectorPlane::getSlotRing(
unsigned slotID)
const
36 if (slotID > m_nSlots) B2ERROR(
"ARICHGeoDetectorPlane: invalid module slot ID number!");
39 for (
auto dphi : m_ringPar) {
40 nSlots +=
static_cast<int>(2 * M_PI / dphi.second + 0.5);
41 if (slotID < nSlots + 1)
return iRing;
48 unsigned ARICHGeoDetectorPlane::pointSlotID(
double x,
double y)
const
50 double r =
sqrt(x * x + y * y);
51 double phi = atan2(y, x);
52 if (phi < 0) phi += 2 * M_PI;
53 if (r < (m_ringPar[0].first - (m_ringPar[1].first - m_ringPar[0].first) / 2.))
return 0;
55 if (r > (m_ringPar[m_nRings - 1].first + (m_ringPar[m_nRings - 1].first - m_ringPar[m_nRings - 2].first) / 2.))
return 0;
58 for (
unsigned i = 1; i < m_nRings; i++) {
59 if (r < (m_ringPar[i - 1].first + m_ringPar[i].first) / 2.) {
60 nslot += phi / m_ringPar[i - 1].second;
63 nslot +=
static_cast<int>(2 * M_PI / m_ringPar[i - 1].second + 0.5);
65 nslot += phi / m_ringPar[m_nRings - 1].second;
69 bool ARICHGeoDetectorPlane::isConsistent()
const
71 if (m_outerR < m_innerR)
return false;
72 if (m_thickness <= 0)
return false;
73 if (m_moduleHoleSize < 0)
return false;
74 if (m_supportBackWallHeight < 0)
return false;
75 if (m_supportBackWallThickness < 0)
return false;
76 if (m_supportZPosition < 0)
return false;
77 if (m_ringPar.size() == 0 || m_slotPar.size() == 0)
return false;
81 unsigned ARICHGeoDetectorPlane::getSlotIDFromSRF(
unsigned sector,
unsigned ring,
unsigned azimuth)
const
84 if (azimuth >
static_cast<unsigned>(2 * M_PI / m_ringPar[ring - 1].second + 0.5) / 6 || ring > getNRings() || sector > 6)
85 { B2ERROR(
"ARICHGeoDetectorPlane::getSlotIDFromSRF: invalid slot position parameters!");
return 0;}
87 unsigned moduleID = 0;
88 for (
unsigned i = 1; i < ring; i++) {
89 moduleID +=
static_cast<int>(2 * M_PI / m_ringPar[i - 1].second + 0.5);
91 moduleID += (sector - 1) *
static_cast<int>(2 * M_PI / m_ringPar[ring - 1].second + 0.5) / 6 + (azimuth - 1);
92 if (moduleID + 1 > m_nSlots) {B2ERROR(
"ARICHGeoDetectorPlane::getSlotIDFromSRF: invalid slot position parameters!");
return 0;}
97 void ARICHGeoDetectorPlane::print(
const std::string& title)
const
99 ARICHGeoBase::print(title);
100 cout <<
"Configuration of module slots:" << endl;
102 cout <<
" There are " << getNRings() <<
" module rings." << endl;
103 for (
auto ring : m_ringPar) {
104 cout <<
" ring: " << i + 1 <<
" has " <<
static_cast<int>(2 * M_PI / ring.second + 0.5) <<
" module slots, at radius: " <<
105 ring.first <<
" cm" << endl;
109 cout <<
" Support plate inner radius: " << getSupportInnerR() <<
" " << s_unitName << endl;
110 cout <<
" Support plate outer radius: " << getSupportOuterR() <<
" " << s_unitName << endl;
111 cout <<
" Support plate thickness: " << getSupportThickness() <<
" " << s_unitName << endl;
112 cout <<
" Support plate Z position: " << getSupportZPosition() <<
" " << s_unitName << endl;
113 cout <<
" Support plate backwalls height: " << getSupportBackWallHeight() <<
" " << s_unitName << endl;
114 cout <<
" Support plate backwall thickness: " << getSupportBackWallThickness() <<
" " << s_unitName << endl;
115 cout <<
" Support plate module hole size: " << getModuleHoleSize() <<
" X " << getModuleHoleSize() <<
" " << s_unitName << endl;
116 cout <<
" Support plate material: " << getSupportMaterial() << endl;
118 cout <<
"Positioning parameters (in local ARICH frame)" << endl;
119 ARICHGeoBase::printPlacement(m_x, m_y, m_z, m_rx, m_ry, m_rz);
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.