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 if (
key.starts_with (
"sMD") ||
key.starts_with (
"sTG")) {
70 int ec =
AC==
'C' ? -1 : 1;
71 std::string
vName = pV->getLogVol()->getName();
72 if (
key.starts_with(
"sMD")) {
73 std::string sName =
vName.substr(4,4);
74 std::unique_ptr<MuonGM::MMReadoutElement>
re = std::make_unique<MuonGM::MMReadoutElement>(pV, sName, ec*eta,phi,ml,
m_manager,
nullptr);
78 else if (
key.starts_with(
"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;
148 if (station->GetNrOfCutouts() > 0 && stname.substr(0, 1) !=
"T")
155 MuonChamberLite
l(*mysql, station,&mapFPV,&mapAXF);
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;
180 mst->setTransform(xf);
182 GeoTrf::Transform3D nativeToAmdbLRS=tsz_to_szt * station->native_to_tsz_frame(*mysql, position);
183 mst->setNativeToAmdbLRS(nativeToAmdbLRS);
184 mst->setNominalAmdbLRSToGlobal(station->tsz_to_global_frame(*mysql, position) * tsz_to_szt.inverse());
186 int nAlines = station->CountAlignPos(zi, fi);
188 ap.tras =
ap.traz =
ap.trat =
ap.rots =
ap.rotz =
ap.rott = 0.;
190 mst->setDelta_fromAline(
ap.tras,
ap.traz,
ap.trat,
ap.rots,
ap.rotz,
ap.rott);
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;
204 mst->setTransform(xf);
205 mst->setNativeToAmdbLRS(tsz_to_szt * station->native_to_tsz_frame(*mysql, position));
206 mst->setNominalAmdbLRSToGlobal(station->tsz_to_global_frame(*mysql, position) * tsz_to_szt.inverse());
207 mst->setDeltaAmdbLRS(GeoTrf::Transform3D::Identity());