11 #include <top/dbobjects/TOPGeometry.h>
12 #include <framework/logging/Logger.h>
26 if (isModuleIDValid(module.getModuleID())) {
27 B2ERROR(
"TOPGeometry::appendModule: module already appended."
28 <<
LogVar(
"ID", module.getModuleID()));
31 m_modules.push_back(module);
35 bool TOPGeometry::isModuleIDValid(
int moduleID)
const
37 for (
const auto& module : m_modules) {
38 if (module.getModuleID() == moduleID)
return true;
46 for (
const auto& module : m_modules) {
47 if (module.getModuleID() == moduleID)
return module;
49 B2FATAL(
"TOPGeometry::getModule: invalid module, ID = " << moduleID);
54 std::map<unsigned, TOPNominalTTS>::const_iterator it = m_tts.find(type);
55 if (it == m_tts.end())
return m_nominalTTS;
59 double TOPGeometry::getPDETuningFactor(
unsigned type)
const
61 std::map<unsigned, float>::const_iterator it = m_tuneFactorsPDE.find(type);
62 if (it == m_tuneFactorsPDE.end())
return 1.0;
66 double TOPGeometry::getInnerRadius()
const
68 if (m_modules.empty())
return 0;
70 double R = m_modules[0].getRadius();
71 for (
auto& module : m_modules) {
72 double tmp = module.getRadius() + module.getBarThickness() / 2
73 - module.getPrism().getExitThickness();
79 double TOPGeometry::getOuterRadius()
const
81 if (m_modules.empty())
return 0;
83 double R = m_modules[0].getRadius();
84 for (
auto& module : m_modules) {
85 double x = module.getBarWidth() / 2;
86 double y = module.getRadius() + module.getBarThickness() / 2;
87 double tmp = sqrt(x * x + y * y);
93 double TOPGeometry::getRadius()
const
95 if (m_modules.empty())
return 0;
98 for (
auto& module : m_modules) {
99 R += module.getRadius();
101 return R / m_modules.size();
104 double TOPGeometry::getBackwardZ()
const
106 if (m_modules.empty())
return 0;
108 double z = m_modules[0].getBackwardZ();
109 for (
auto& module : m_modules) {
110 double tmp = module.getBackwardZ() - module.getPrism().getFullLength();
111 if (tmp < z) z = tmp;
116 double TOPGeometry::getForwardZ()
const
118 if (m_modules.empty())
return 0;
120 double z = m_modules[0].getForwardZ();
121 for (
auto& module : m_modules) {
122 double tmp = module.getForwardZ();
123 if (tmp > z) z = tmp;
128 bool TOPGeometry::isConsistent()
const
130 if (m_modules.empty())
return false;
131 for (
const auto& module : m_modules) {
132 if (!module.isConsistent())
return false;
134 if (!m_frontEnd.isConsistent())
return false;
135 if (!m_QBB.isConsistent())
return false;
136 if (m_numBoardStacks == 0)
return false;
137 if (!m_nominalQE.isConsistent())
return false;
138 if (!m_nominalTTS.isConsistent())
return false;
139 if (!m_nominalTDC.isConsistent())
return false;
140 if (!m_wavelengthFilter.isConsistent())
return false;
144 void TOPGeometry::print(
const std::string&)
const
147 cout <<
"Geometry parameters of TOP counter:" << endl;
148 cout <<
"===================================" << endl;
149 cout <<
" name: " << m_name << endl;
150 cout <<
" number of modules: " << m_modules.size() << endl << endl;
152 for (
const auto& module : m_modules) {
157 cout <<
" Number of board stacks: " << m_numBoardStacks << endl;
163 cout <<
"Photo-detection efficiency tuning factors" << endl;
164 cout <<
"-----------------------------------------" << endl;
165 if (m_tuneFactorsPDE.empty()) {
166 cout <<
" Not available" << endl;
168 for (
const auto& x : m_tuneFactorsPDE) {
169 cout <<
" PMT type: " << x.first <<
" factor = " << x.second << endl;
173 m_nominalTTS.print();
175 for (
const auto& tts : m_tts) {
176 tts.second.print(
"TTS distribution");
179 m_nominalTDC.print();
181 m_wavelengthFilter.print();