7 #include "GaudiKernel/MsgStream.h"
8 #include "GaudiKernel/SystemOfUnits.h"
10 #include "GeoModelKernel/GeoFullPhysVol.h"
11 #include "GeoModelKernel/GeoPerfUtils.h"
12 #include "GeoModelKernel/GeoPhysVol.h"
42 m_pDetStore{pDetStore},
43 m_sqliteReader(sqliteReader) {
53 std::map<std::string, GeoAlignableTransform*> mapAXF =
m_sqliteReader->getPublishedNodes<std::string, GeoAlignableTransform*>(
"MuonSys");
54 std::map<std::string, GeoFullPhysVol*> mapFPV =
m_sqliteReader->getPublishedNodes<std::string, GeoFullPhysVol*>(
"MuonSys");
65 for (
const auto& [
key, pV] : mapFPV) {
66 int eta=
key[5]-
'0', ml=
key[7]-
'0', phi=
key[12]-
'0';
69 int ec =
AC==
'C' ? -1 : 1;
70 std::string
vName = pV->getLogVol()->getName();
71 if (
key.substr(0,3)==
"sMD") {
72 std::string sName =
vName.substr(4,4);
73 std::unique_ptr<MuonGM::MMReadoutElement>
re = std::make_unique<MuonGM::MMReadoutElement>(pV, sName, ec*eta,phi,ml,
m_manager,
nullptr);
78 else if (
key.substr(0,3)==
"sTG") {
79 std::string sName =
vName.substr(7,4);
80 std::unique_ptr<sTgcReadoutElement>
re = std::make_unique<sTgcReadoutElement>(pV, sName, ec*eta, phi, ml,
m_manager);
91 mysql->set_amdb_from_RDB(
true);
93 std::unique_ptr<RDBReaderAtlas>
dbr;
96 std::string oracleTag=
"";
97 std::string oracleNode=
"";
98 std::map<std::string, std::string>
ascii{};
116 sc =
dbr->ProcessDB(*mysql);
117 if (
sc != StatusCode::SUCCESS) {
118 log << MSG::ERROR <<
" FAILURE in DB access; Muon node will not be built" <<
endmsg;
122 GeoFullPhysVol *p4 = mapFPV[
"MuonTreeTop"];
124 log << MSG::INFO <<
" TreeTop added to the Manager" <<
endmsg;
127 std::set<std::string> mappedStations;
128 for (
const auto&
i: mapFPV) {
129 size_t pos=
i.first.find(
"_Station");
130 if (
pos!=std::string::npos) mappedStations.insert(
i.first.substr(0,
pos));
136 std::set<std::string> keyset;
138 for (
const auto&
i: mappedStations) {
139 auto it= mysql->stationMap().find(
i);
140 if (
it==mysql->stationMap().end()) {
141 throw std::runtime_error(
"Raw/readout geometry mismatch");
144 Station *station = (*it).second.get();
145 std::string stname(station->
GetName(), 0, 3);
147 bool isAssembly =
false;
156 l.setKeyset(&keyset);
160 for (
auto const& [
key, position] : *station) {
161 int zi = position.zindex;
162 int fi = position.phiindex;
165 if (stname ==
"CSL") isAssembly =
true;
176 log << MSG::WARNING <<
"For Station with nameTag=<" << station->GetName() <<
"> at zi/fi = " << zi <<
"/" <<
fi
177 <<
" no MuonStation found => no possibility to align" <<
endmsg;
182 GeoTrf::Transform3D nativeToAmdbLRS=tsz_to_szt * station->native_to_tsz_frame(*mysql, position);
186 int nAlines = station->CountAlignPos(zi,
fi);
188 ap.tras =
ap.traz =
ap.trat =
ap.rots =
ap.rotz =
ap.rott = 0.;
191 }
else if (nAlines > 0) {
196 ap = acurrent->second;
197 if (
ap.phiindex !=
fi ||
ap.zindex != zi) {
198 log << MSG::ERROR <<
"Inconsistent AlignedPosition found in the static Geometry DB: aligPos.fi, zi = " <<
ap.phiindex <<
", " <<
ap.zindex
199 <<
" for station " << station->GetName() <<
" at fi/zi = " <<
fi <<
"/" << zi <<
" AlignPos indices fi/zi " <<
fi <<
"/" << zi <<
endmsg;