23 {
24 bool geoBuilt = true;
25 ServiceHandle<IAGDDtoGeoSvc>
svc(
"AGDDtoGeoSvc",
"MMDetectorHelper");
26 if (
svc.retrieve().isFailure()) { std::abort(); }
28 detectorList& dList =
c->GetDetectorStore().GetDetectorList();
29 detectorList::const_iterator
it;
30 for (it = dList.begin(); it != dList.end(); ++it) {
31 std::vector<AGDDDetectorPositioner*>& dPos = ((*it).second)->GetDetectorPositioners();
32 for (
unsigned int i = 0;
i < dPos.size();
i++) {
33 std::string chTag = dPos[
i]->ID.detectorAddress;
34 GeoFullPhysVol* vol = dPos[
i]->theVolume;
35
36 std::string
stName = chTag.substr(0, 4);
37
38 int etaIndex{999},
phiIndex{999}, mLayer{999}, iSide{0};
39 int iLS =
atoi((chTag.substr(3, 1)).c_str());
40 if (iLS == 3)
41 iLS = 1;
42 else
43 iLS = 0;
44 if (chTag.substr(13, 1) == "A")
45 iSide = 1;
46 else if (chTag.substr(13, 1) == "C")
47 iSide = -1;
48 etaIndex = iSide *
atoi((chTag.substr(5, 1)).c_str());
50 mLayer =
atoi((chTag.substr(7, 1)).c_str());
51 std::string
vName = vol->getLogVol()->getName();
52 std::string sName =
vName.substr(
vName.find(
'-') + 1);
53
54 if (chTag.substr(0, 3) == "sMD") {
55 std::unique_ptr<MMReadoutElement>
re = std::make_unique<MMReadoutElement>(vol, sName, etaIndex, phiIndex, mLayer, mgr);
58 mgr->addMMReadoutElement(std::move(
re));
59 } else if (chTag.substr(0, 3) == "sTG") {
60 std::unique_ptr<sTgcReadoutElement>
re = std::make_unique<sTgcReadoutElement>(vol, sName, etaIndex, phiIndex, mLayer, mgr);
61 std::string myVolName = (chTag.substr(0, 8)).c_str();
64 mgr->addsTgcReadoutElement(std::move(
re));
65 }
66 }
67 }
68 return geoBuilt;
69}
std::map< std::string, AGDDDetector * > detectorList
const boost::regex re(r_e)
CxxUtils::LockedPointer< AGDDController > LockedController
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
AthROOTErrorHandlerSvc * svc
const std::string & stName(StIndex index)
convert StIndex into a string
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi