11 #include <top/dbobjects/TOPGeoPrism.h>
12 #include <framework/gearbox/Unit.h>
13 #include <framework/logging/Logger.h>
25 bool TOPGeoPrism::isConsistent()
const
27 if (m_exitThickness <= 0)
return false;
28 if (m_flatLength < 0)
return false;
29 if (m_width <= 0)
return false;
30 if (m_thickness <= 0)
return false;
31 if (m_length <= 0)
return false;
32 if (m_material.empty())
return false;
33 if (m_surface.getName().empty() and !m_surface.hasProperties())
return false;
34 if (m_sigmaAlpha < 0)
return false;
35 if (m_brokenFraction > 0 and m_brokenGlueMaterial.empty())
return false;
36 if (!m_peelOffRegions.empty()) {
37 if (m_peelOffSize <= 0)
return false;
38 if (m_peelOffThickness <= 0)
return false;
39 if (m_peelOffMaterial.empty())
return false;
40 double halfSize = (getWidth() - getPeelOffSize()) / 2;
41 for (
const auto& region : m_peelOffRegions) {
42 if (fabs(getPeelOffCenter(region)) > halfSize)
return false;
49 void TOPGeoPrism::print(
const std::string& title)
const
51 TOPGeoBase::print(title);
52 cout <<
" Vendor: " << getVendor() <<
", serial number: " << getSerialNumber() << endl;
53 cout <<
" Dimensions: " << getWidth() <<
" X " << getThickness() <<
" X " << getLength()
54 <<
" " << s_unitName << endl;
55 cout <<
" Exit window dimensions: " << getWidth() <<
" X "
56 << getExitThickness() <<
" " << s_unitName << endl;
57 cout <<
" Prism angle: " << getAngle() / Unit::deg <<
" deg";
58 cout <<
", flat surface length: " << getFlatLength() <<
" " << s_unitName << endl;
59 cout <<
" Material: " << getMaterial() << endl;
60 if (getFilterThickness() > 0) {
61 cout <<
" Wavelenght filter: " << getFilterMaterial()
62 <<
", thickness: " << getFilterThickness() <<
" " << s_unitName << endl;
64 if (!m_peelOffRegions.empty()) {
65 cout <<
" Peel-off cookie regions: ";
66 cout <<
" size = " << getPeelOffSize() <<
" " << s_unitName;
67 cout <<
" thickness = " << getPeelOffThickness() <<
" " << s_unitName;
68 cout <<
" material = " << getPeelOffMaterial() << endl;
69 for (
const auto& region : m_peelOffRegions) {
70 cout <<
" ID = " << region.ID <<
", fraction = " << region.fraction
71 <<
", angle = " << region.angle / Unit::deg <<
" deg"
72 <<
", xc = " << getPeelOffCenter(region) <<
" " << s_unitName << endl;
75 cout <<
" Peel-off regions: None" << endl;
77 printSurface(m_surface);
78 cout <<
" - sigmaAlpha: " << getSigmaAlpha() << endl;
83 void TOPGeoPrism::appendPeelOffRegion(
unsigned ID,
double fraction,
double angle)
85 for (
const auto& region : m_peelOffRegions) {
86 if (region.ID == ID) {
87 B2ERROR(
"TOPGeoPrism::appendPeelOffRegion: region already appended."
88 <<
LogVar(
"region ID", ID));
94 region.fraction = fraction;
96 double halfSize = (getWidth() - getPeelOffSize()) / 2;
97 if (fabs(getPeelOffCenter(region)) > halfSize) {
98 B2ERROR(
"TOPGeoPrism::appendPeelOffRegion: region doesn't fit into prism."
99 <<
LogVar(
"region ID", ID));
102 m_peelOffRegions.push_back(region);
105 typedef std::pair<double, double>
Pair;
107 std::vector<Pair> TOPGeoPrism::getPeelOffContour(
const PeelOffRegion& region)
const
109 std::vector<Pair> contour;
110 constructContour(getPeelOffSize() / 2, getExitThickness() / 2,
111 region.fraction, region.angle,