9 #include <top/dbobjects/TOPGeometry.h>
10 #include <framework/logging/Logger.h>
24 if (isModuleIDValid(module.getModuleID())) {
25 B2ERROR(
"TOPGeometry::appendModule: module already appended."
26 <<
LogVar(
"ID", module.getModuleID()));
29 m_modules.push_back(module);
33 bool TOPGeometry::isModuleIDValid(
int moduleID)
const
35 for (
const auto& module : m_modules) {
36 if (module.getModuleID() == moduleID)
return true;
44 for (
const auto& module : m_modules) {
45 if (module.getModuleID() == moduleID)
return module;
47 B2FATAL(
"TOPGeometry::getModule: invalid module, ID = " << moduleID);
52 std::map<unsigned, TOPNominalTTS>::const_iterator it = m_tts.find(type);
53 if (it == m_tts.end())
return m_nominalTTS;
57 double TOPGeometry::getPDETuningFactor(
unsigned type)
const
59 std::map<unsigned, float>::const_iterator it = m_tuneFactorsPDE.find(type);
60 if (it == m_tuneFactorsPDE.end())
return 1.0;
64 double TOPGeometry::getInnerRadius()
const
66 if (m_modules.empty())
return 0;
68 double R = m_modules[0].getRadius();
69 for (
auto& module : m_modules) {
70 double tmp = module.getRadius() + module.getBarThickness() / 2
71 - module.getPrism().getExitThickness();
77 double TOPGeometry::getOuterRadius()
const
79 if (m_modules.empty())
return 0;
81 double R = m_modules[0].getRadius();
82 for (
auto& module : m_modules) {
83 double x = module.getBarWidth() / 2;
84 double y = module.getRadius() + module.getBarThickness() / 2;
85 double tmp =
sqrt(x * x + y * y);
91 double TOPGeometry::getRadius()
const
93 if (m_modules.empty())
return 0;
96 for (
auto& module : m_modules) {
97 R += module.getRadius();
99 return R / m_modules.size();
102 double TOPGeometry::getBackwardZ()
const
104 if (m_modules.empty())
return 0;
106 double z = m_modules[0].getBackwardZ();
107 for (
auto& module : m_modules) {
108 double tmp = module.getBackwardZ() - module.getPrism().getFullLength();
109 if (tmp < z) z = tmp;
114 double TOPGeometry::getForwardZ()
const
116 if (m_modules.empty())
return 0;
118 double z = m_modules[0].getForwardZ();
119 for (
auto& module : m_modules) {
120 double tmp = module.getForwardZ();
121 if (tmp > z) z = tmp;
126 bool TOPGeometry::isConsistent()
const
128 if (m_modules.empty())
return false;
129 for (
const auto& module : m_modules) {
130 if (!module.isConsistent())
return false;
132 if (!m_frontEnd.isConsistent())
return false;
133 if (!m_QBB.isConsistent())
return false;
134 if (m_numBoardStacks == 0)
return false;
135 if (!m_nominalQE.isConsistent())
return false;
136 if (!m_nominalTTS.isConsistent())
return false;
137 if (!m_nominalTDC.isConsistent())
return false;
138 if (!m_wavelengthFilter.isConsistent())
return false;
142 void TOPGeometry::print(
const std::string&)
const
145 cout <<
"Geometry parameters of TOP counter:" << endl;
146 cout <<
"===================================" << endl;
147 cout <<
" name: " << m_name << endl;
148 cout <<
" number of modules: " << m_modules.size() << endl << endl;
150 for (
const auto& module : m_modules) {
155 cout <<
" Number of board stacks: " << m_numBoardStacks << endl;
161 cout <<
"Photo-detection efficiency tuning factors" << endl;
162 cout <<
"-----------------------------------------" << endl;
163 if (m_tuneFactorsPDE.empty()) {
164 cout <<
" Not available" << endl;
166 for (
const auto& x : m_tuneFactorsPDE) {
167 cout <<
" PMT type: " << x.first <<
" factor = " << x.second << endl;
171 m_nominalTTS.print();
173 for (
const auto& tts : m_tts) {
174 tts.second.print(
"TTS distribution");
177 m_nominalTDC.print();
179 m_wavelengthFilter.print();
Geometry parameters of a module (optical components + positioning)
Nominal time transition spread of PMT.
Class to store variables with their name which were sent to the logging service.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.