44 if (msgLevel(MSG::DEBUG))
msg(MSG::DEBUG) <<
" Building ZDC geometry " <<
endmsg;
48 if (StatusCode::SUCCESS != detStore()->retrieve(theExpt,
"ATLAS")) {
50 return StatusCode::FAILURE;
59 const nlohmann::json& zdcGeo = theZdcGeoDB->
getDB();
60 if (zdcGeo.is_null()) {
62 return StatusCode::FAILURE;
69 std::array<GeoTrf::Transform3D, 2> tanTrf;
70 for (
auto slot : zdcGeo[
"TAN/TAXN"].items()) {
72 int side = slot.value()[
"side"].get<
int>();
73 int iside = side == -1 ? 0 : 1;
74 double x = slot.value()[
"x"].get<
double>();
75 double y = slot.value()[
"y"].get<
double>();
76 double z = slot.value()[
"z"].get<
double>();
77 double height = slot.value()[
"height"].get<
double>();
78 double width = slot.value()[
"width"].get<
double>();
79 double depth = slot.value()[
"depth"].get<
double>();
80 std::string name = slot.value()[
"name"].get<std::string>();
81 tanTrf.at(iside) = GeoTrf::Translate3D(
x * Gaudi::Units::mm,
y * Gaudi::Units::mm,
z * Gaudi::Units::mm);
90 for (
auto det : zdcGeo[
"Detector"].items()) {
91 std::unique_ptr<ZDC_ModuleBase> pDet;
93 std::string name = det.value()[
"name"].get<std::string>();
94 int side = det.value()[
"side"].get<
int>();
95 int iside = side == -1 ? 0 : 1;
96 int module = det.value()[
"module"].get<
int>();
97 double x = det.value()[
"x"].get<
double>();
98 double y = det.value()[
"y"].get<
double>();
99 double z = det.value()[
"z"].get<
double>();
100 double q = det.value()[
"q"].get<
double>();
101 double i = det.value()[
"i"].get<
double>();
102 double j = det.value()[
"j"].get<
double>();
103 double k = det.value()[
"k"].get<
double>();
105 if (std::string(det.key()).find(
"ZDC") != std::string::npos) {
106 pDet = std::make_unique<ZDC_ZDCModule>( name, side, module, det.value()[
"type"].get<
int>() );
108 }
else if (std::string(det.key()).find(
"RPD") != std::string::npos) {
109 pDet = std::make_unique<ZDC_RPDModule>( name, side, module );
111 }
else if (std::string(det.key()).find(
"BRAN") != std::string::npos) {
112 pDet = std::make_unique<ZDC_BRANModule>( name, side, module );
116 return StatusCode::FAILURE;
120 pDet->setTransform(GeoTrf::Translate3D(
x - tanTrf.at(iside).translation().x(),
y - tanTrf.at(iside).translation().y(),
z - tanTrf.at(iside).translation().z()) * GeoTrf::Rotation3D(q, i, j, k) );
123 theZDCFactory.
addModule(std::move(pDet));
131 theZDCFactory.
create(world);
133 catch (
const std::bad_alloc&) {
135 if (msgLevel(MSG::FATAL))
msg(MSG::FATAL) <<
"Could not create new ZDC DetectorNode!" <<
endmsg;
136 return StatusCode::FAILURE;
142 return StatusCode::SUCCESS;}
144 msg(MSG::FATAL) <<
"Could not register ZDC detector manager" <<
endmsg;}
148 return StatusCode::FAILURE;