12 #include <top/dbobjects/TOPGeoBase.h>
13 #include <framework/gearbox/Unit.h>
14 #include <framework/logging/Logger.h>
26 double TOPGeoBase::s_unit = Unit::cm;
27 std::string TOPGeoBase::s_unitName(
"cm");
30 void TOPGeoBase::print(
const std::string& title)
const
32 cout << title <<
":" << endl;
33 cout <<
" name: " << m_name << endl;
37 void TOPGeoBase::printUnderlined(
const std::string& title)
const
39 cout << title <<
":" << endl;
40 for (
size_t i = 0; i <= title.length(); i++) cout <<
"-";
42 cout <<
" name: " << m_name << endl;
48 cout <<
" Optical surface: ";
50 cout <<
"not defined" << endl;
54 cout <<
", model: " << surface.
getModel();
55 cout <<
", finish: " << surface.
getFinish();
56 cout <<
", type: " << surface.
getType();
57 cout <<
", value: " << surface.
getValue();
61 cout <<
" - property: ";
62 cout <<
property.getName() <<
" [";
63 for (
const auto& value : property.getValues()) cout << value <<
", ";
65 for (
const auto& value : property.getEnergies()) cout << value / Unit::eV <<
", ";
66 cout <<
"] eV" << endl;
69 cout <<
" - properties: None" << endl;
79 if (property.getName() ==
"REFLECTIVITY") {
80 auto energies =
property.getEnergies();
81 auto values =
property.getValues();
82 if (energies.size() < 2)
return 0;
83 if (energy < energies[0] or energy > energies.back()) {
84 B2WARNING(
"TOPGeoBase::getReflectivity: photon energy out of range - return value not reliable");
86 auto spline = TSpline3(
"tmp", energies.data(), values.data(), energies.size());
87 return spline.Eval(energy);
92 B2ERROR(
"Optical surface " << surface.
getName() <<
" has no property REFLECTIVITY");