11 #include <top/dbobjects/TOPGeoModule.h>
12 #include <framework/gearbox/Unit.h>
13 #include <framework/logging/Logger.h>
25 void TOPGeoModule::setBrokenGlue(
int glueID,
double fraction,
double angle,
26 const std::string& material)
30 m_mirror.setGlueDelamination(fraction, angle, material);
33 m_bar1.setGlueDelamination(fraction, angle, material);
36 m_bar2.setGlueDelamination(fraction, angle, material);
39 B2ERROR(
"TOPGeoModule::setBrokenGlue: invalid glue ID."
40 <<
LogVar(
"glue ID", glueID));
45 void TOPGeoModule::setPeelOffRegions(
double thickness,
const std::string& material)
47 double size = 2 * m_pmtArray.getDx();
48 double offset = (m_pmtArray.getX(1) + m_pmtArray.getX(2)) / 2 +
49 m_arrayDisplacement.getX();
50 m_prism.setPeelOffRegions(size, offset, thickness, material);
54 TVector3 TOPGeoModule::pointToGlobal(
const TVector3& point)
const
56 if (!m_rotation) setTransformation();
57 return (*m_rotation) * point + (*m_translation);
60 TVector3 TOPGeoModule::momentumToGlobal(
const TVector3& momentum)
const
62 if (!m_rotation) setTransformation();
63 return (*m_rotation) * momentum;
66 TVector3 TOPGeoModule::pointToLocal(
const TVector3& point)
const
68 if (!m_rotation) setTransformation();
69 return (*m_rotationInverse) * (point - (*m_translation));
72 TVector3 TOPGeoModule::momentumToLocal(
const TVector3& momentum)
const
74 if (!m_rotation) setTransformation();
75 return (*m_rotationInverse) * momentum;
78 void TOPGeoModule::setTransformation()
const
82 Rphi.RotateZ(m_phi - M_PI / 2);
83 TVector3 translation(0, m_radius, getZc() * s_unit);
85 TRotation Rot = Rphi * m_moduleDisplacement.getRotation();
86 translation += m_moduleDisplacement.getTranslation();
87 m_rotation =
new TRotation(Rot);
88 m_rotationInverse =
new TRotation(Rot.Inverse());
89 m_translation =
new TVector3(Rphi * translation);
93 bool TOPGeoModule::isConsistent()
const
95 if (m_moduleID <= 0)
return false;
96 if (!m_bar1.isConsistent())
return false;
97 if (!m_bar2.isConsistent())
return false;
98 if (!m_mirror.isConsistent())
return false;
99 if (!m_prism.isConsistent())
return false;
100 if (!m_pmtArray.isConsistent())
return false;
105 void TOPGeoModule::print(
const std::string&)
const
107 cout <<
"Slot " << getModuleID() <<
" geometry parameters:" << endl;
108 cout <<
"---------------------------" << endl;
109 cout <<
" name: " << m_name << endl;
110 cout <<
" moduleID = " << getModuleID();
111 cout <<
", radius = " << getRadius() <<
" " << s_unitName;
112 cout <<
", phi = " << getPhi() / Unit::deg <<
" deg";
113 cout <<
", backward z = " << getBackwardZ() <<
" " << s_unitName;
114 cout <<
", construction number = " << getModuleCNumber() << endl;
119 m_bar2.print(
"Bar segment 2 (backward) geometry parameters");
121 m_bar1.print(
"Bar segment 1 (forward) geometry parameters");
127 m_arrayDisplacement.print();
129 m_moduleDisplacement.print();