86 bool hasStations = !inertObjs.empty() || !stations.empty();
100 ATH_MSG_INFO(
" diluted inert material hardcoded for 3D "
101 "volume frame, adjusting setup");
130 for (
unsigned int i = 0; i < envelopeDefsIn.size(); i++) {
131 if (envelopeDefsIn[i].second > envelopeDefsIn[ii].second)
133 else if (envelopeDefsIn[i].second == envelopeDefsIn[ii].second &&
134 envelopeDefsIn[i].first > envelopeDefsIn[ii].first)
140 unsigned int inext = ii + 1;
141 if (inext == envelopeDefsIn.size())
143 if (envelopeDefsIn[inext].second != envelopeDefsIn[ii].second) {
145 inext = ii > 0 ? ii - 1 : envelopeDefsIn.size() - 1;
150 for (
unsigned int i = inext; i < envelopeDefsIn.size(); i++)
151 envelopeDefs.push_back(envelopeDefsIn[i]);
153 for (
unsigned int i = 0; i <= inext - 1; i++)
154 envelopeDefs.push_back(envelopeDefsIn[i]);
158 envelopeDefs.push_back(envelopeDefsIn[i]);
161 inext = envelopeDefsIn.size() - 1;
162 while (inext >= ii) {
163 envelopeDefs.push_back(envelopeDefsIn[inext]);
170 for (
auto& envelopeDef : envelopeDefs) {
171 if (envelopeDef.first > maxR)
172 maxR = envelopeDef.first;
184 for (
unsigned int i = 0; i < envelopeDefs.size(); i++) {
186 <<
"," << envelopeDefs[i].second);
194 auto topVolume = std::make_unique<Trk::TrackingVolume>(
nullptr, std::move(globalBounds), aLVC.
m_muonMaterial,
195 nullptr,
nullptr,
"GlobalVolume");
196 return std::make_unique<Trk::TrackingGeometry>(topVolume.release());
205 std::vector<TrackingVolumePtr> volumeGarbage{};
208 negativeMuonBigWheel{}, negativeMuonOuterBuffer{},
209 positiveMuonOuterWheel{}, negativeMuonSmallWheel{},
210 positiveMuonSmallWheel{}, negativeECT{}, positiveECT{},
211 positiveMuonBigWheel{}, positiveMuonOuterBuffer{};
213 TrackingVolumePtr negBeamPipe{}, posBeamPipe{}, negDiskShield{}, posDiskShield{},
214 negInnerShield{}, posInnerShield{}, negOuterShield{}, posOuterShield{};
216 std::shared_ptr<Trk::CylinderVolumeBounds> enclosedBounds{};
220 negativeMuonInnerEndcap{}, positiveMuonInnerEndcap{},
221 negNavOEndcap{}, posNavOEndcap{}, negativeMuonOuterEndcap{},
222 positiveMuonOuterEndcap{},
barrel{}, negOuterEndcap{},
223 posOuterEndcap{}, negInnerEndcap{}, posInnerEndcap{}, negNavEndcap{},
229 bool msEntryDefined =
false;
231 msEntryDefined =
true;
235 if (!enclosedDetectorBounds) {
236 ATH_MSG_ERROR(
" dynamic cast of enclosed volume to the cylinder bounds failed, aborting MTG build-up ");
239 double enclosedDetectorHalfZ = enclosedDetectorBounds->
halflengthZ();
240 double enclosedDetectorOuterRadius =
241 enclosedDetectorBounds->outerRadius();
247 if (!enclosedCentralFaceVolumes.empty()) {
249 if (cylR && cylR->outerRadius() != enclosedDetectorOuterRadius) {
250 enclosedDetectorOuterRadius = cylR->outerRadius();
252 "correspond to radius of glue volumes : adjusted ");
255 if (!enclosedNegativeFaceVolumes.empty() &&
256 !enclosedPositiveFaceVolumes.empty()) {
257 double negZ = -enclosedDetectorHalfZ;
258 double posZ = enclosedDetectorHalfZ;
261 negZ = enclosedNegativeFaceVolumes[0]->center().z() - cylN->halflengthZ();
265 posZ = enclosedPositiveFaceVolumes[0]->center().z() +
268 if (std::abs(negZ + enclosedDetectorHalfZ) > 0.001 ||
269 std::abs(posZ - enclosedDetectorHalfZ) > 0.001) {
270 ATH_MSG_WARNING(
" enclosed volume envelope z dimension does not correspond to that of glue volumes ");
271 if (std::abs(negZ + posZ) < 0.001) {
272 enclosedDetectorHalfZ = posZ;
275 ATH_MSG_ERROR(
"assymetric Z dimensions - cannot recover " << negZ <<
"," << posZ);
283 ATH_MSG_DEBUG(
" dimensions of enclosed detectors (halfZ,outerR):"
284 << enclosedDetectorHalfZ <<
","<< enclosedDetectorOuterRadius);
289 "muon envelope, abandon :R:"
290 << enclosedDetectorOuterRadius);
298 <<
"muon envelope, abandon :Z:"<< enclosedDetectorHalfZ);
302 auto barrelZPBounds = std::make_shared<Trk::CylinderVolumeBounds>(aLVC.
m_innerBarrelRadius,
303 0.5 * (
m_barrelZ - enclosedDetectorHalfZ));
304 auto barrelZMBounds = std::make_shared<Trk::CylinderVolumeBounds>(aLVC.
m_innerBarrelRadius,
305 0.5 * (
m_barrelZ - enclosedDetectorHalfZ));
306 double zbShift = 0.5 * (
m_barrelZ + enclosedDetectorHalfZ);
310 nullptr,
"BarrelRZPosBuffer");
313 nullptr,
"BarrelRZNegBuffer");
318 std::move(barrelZPBuffer),
321 std::string nameEncl = msEntryDefined ?
"All::Gaps::Barrel" :
m_entryVolume.value();
325 std::move(barrelZMBuffer),
341 <<
" m_enclosingEnvelopeSvc "
345 for (
const auto& envelopeDef : envelopeDefs) {
346 rmax = std::max(envelopeDef.first, rmax);
347 zmax = std::max(std::abs(envelopeDef.second), zmax);
349 if (!envelopeDefs.empty()) {
352 enclosedBounds = std::make_unique<Trk::CylinderVolumeBounds>(rmax, zmax);
354 ATH_MSG_DEBUG(
" input MSEntrance size (R,Z:"<< rmax <<
"," << zmax
355 <<
") clashes with MS material, switch to default values (R,Z:"
361 if (!enclosedBounds) {
365 enclosed = std::make_unique<Trk::TrackingVolume>(
nullptr, std::move(enclosedBounds),
375 for (
auto& envelopeDef : envelopeDefs) {
383 std::abs(envelopeDef.second) >
m_barrelZ)
401 for (; il < envelopeDefs.size(); il++)
404 for (
unsigned int i = 0; i < aLVC.
m_msCutoutsIn.size(); i++) {
424 auto negDiskShieldBounds = std::make_shared<Trk::CylinderVolumeBounds>(aLVC.
m_innerBarrelRadius,
427 std::move(negDiskShieldBounds));
428 negDiskShield =
processShield(negDiskVol, 2,
"Muons::Detectors::NegativeDiskShield",
431 auto posDiskShieldBounds = std::make_shared<Trk::CylinderVolumeBounds>(aLVC.
m_innerBarrelRadius,
434 std::move(posDiskShieldBounds));
435 posDiskShield =
processShield(posDiskVol, 2,
"Muons::Detectors::PositiveDiskShield",
441 std::move(posDiskShield),
443 "Container::CentralP");
446 std::move(negDiskShield),
448 "Container::Central");
459 Trk::Volume barrelVol(
nullptr, std::move(barrelBounds));
463 muonBarrel =
processVolume(barrelVol, 0,
"Detectors::Barrel",
466 muonBarrel =
processVolume(barrelVol, -1,
"Detectors::Barrel",
470 "Detectors::Barrel", aLVC, hasStations);
475 auto negativeSmallWheelBounds = std::make_shared<Trk::CylinderVolumeBounds>(
m_innerShieldRadius,
477 smallWheelZHalfSize);
480 std::move(negativeSmallWheelBounds));
482 negativeMuonSmallWheel =
processVolume(negSWVol, 1,
"Detectors::NegativeSmallWheel",
485 negativeMuonSmallWheel =
processVolume(negSWVol, -1,
"Detectors::NegativeSmallWheel",
491 "Detectors::NegativeSmallWheel",
497 positiveMuonSmallWheel =
processVolume(posSWVol, 1,
"Detectors::PositiveSmallWheel",
500 positiveMuonSmallWheel =
processVolume(posSWVol, -1,
"Detectors::PositiveSmallWheel",
516 std::move(negativeECTBounds));
518 negativeECT =
processVolume(negECTVol, 2,
"Detectors::NegativeECT",
521 negativeECT =
processVolume(negECTVol, -1,
"Detectors::NegativeECT",
525 "Detectors::NegativeECT", aLVC, hasStations);
532 positiveECT =
processVolume(posECTVol, 2,
"Detectors::PositiveECT",
535 positiveECT =
processVolume(posECTVol, -1,
"Detectors::PositiveECT",
546 std::move(negativeMuonSmallWheel),
548 "Container::NegInnerEndcap"));
549 positiveMuonInnerEndcap = (
m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(positiveMuonSmallWheel),
551 std::move(positiveECT),
553 "Container::PosInnerEndcap"));
557 auto negInnerShieldBounds = std::make_shared<Trk::CylinderVolumeBounds>(
m_beamPipeRadius,
559 innerEndcapZHalfSize);
561 std::move(negInnerShieldBounds)};
562 negInnerShield =
processShield(negisVol, 1,
"Muons::Detectors::NegativeInnerShield",
565 auto posInnerShieldBounds = std::make_shared<Trk::CylinderVolumeBounds>(
m_beamPipeRadius,
567 innerEndcapZHalfSize);
569 std::move(posInnerShieldBounds));
570 posInnerShield =
processShield(posisVol, 1,
"Muons::Detectors::PositiveInnerShield",
577 auto negativeOuterWheelBounds = std::make_shared<Trk::CylinderVolumeBounds>(
m_outerShieldRadius,
579 outerWheelZHalfSize);
581 outerWheelZHalfSize)),
582 std::move(negativeOuterWheelBounds));
584 negativeMuonOuterWheel =
processVolume(negOWVol, 3,
"Detectors::NegativeOuterWheel",
587 negativeMuonOuterWheel =
processVolume(negOWVol, -1,
"Detectors::NegativeOuterWheel",
599 positiveMuonOuterWheel =
processVolume(posOWVol, 3,
"Detectors::PositiveOuterWheel",
602 positiveMuonOuterWheel =
processVolume(posOWVol, -1,
"Detectors::PositiveOuterWheel",
611 auto negativeOuterBufferBounds = std::make_shared<Trk::CylinderVolumeBounds>(
m_outerShieldRadius,
613 outerBufferZHalfSize);
616 outerBufferZHalfSize)),
617 std::move(negativeOuterBufferBounds));
619 negativeMuonOuterBuffer =
processVolume(negBuffVol, 3,
"Detectors::NegativeOuterBuffer",
622 negativeMuonOuterBuffer =
processVolume(negBuffVol, -1,
"Detectors::NegativeOuterBuffer",
632 positiveMuonOuterBuffer =
processVolume(posBuffVol, 3,
"Detectors::PositiveOuterBuffer",
635 positiveMuonOuterBuffer =
processVolume(posBuffVol, -1,
"Detectors::PositiveOuterBuffer",
644 auto negativeBigWheelBounds = std::make_shared<Trk::CylinderVolumeBounds>(
m_outerShieldRadius,
650 std::move(negativeBigWheelBounds));
652 negativeMuonBigWheel =
processVolume(negBWVol, 3,
"Detectors::NegativeBigWheel",
655 negativeMuonBigWheel =
processVolume(negBWVol, -1,
"Detectors::NegativeBigWheel",
666 positiveMuonBigWheel =
processVolume(posBWVol, 3,
"Detectors::PositiveBigWheel",
669 positiveMuonBigWheel =
processVolume(posBWVol, -1,
"Detectors::PositiveBigWheel",
679 std::move(negativeMuonOuterBuffer),
681 "Container::NegOEndcap");
685 std::move(positiveMuonOuterWheel),
687 "Container::PosOEndcap");
692 std::move(negativeMuonBigWheel),
694 "Container::NegOuterEndcap");
696 positiveMuonOuterEndcap =
m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(positiveMuonBigWheel),
698 std::move(posNavOEndcap),
700 "Container::PosOuterEndcap");
705 auto negOuterShieldBounds = std::make_shared<Trk::CylinderVolumeBounds>(
m_beamPipeRadius,
707 outerEndcapZHalfSize);
709 std::move(negOuterShieldBounds));
710 negOuterShield =
processShield(negosVol, 0,
"Muons::Detectors::NegativeOuterShield",
713 auto posOuterShieldBounds = std::make_shared<Trk::CylinderVolumeBounds>(
716 std::move(posOuterShieldBounds));
717 posOuterShield =
processShield(pososVol, 0,
"Muons::Detectors::PositiveOuterShield",
721 auto negBeamPipeBounds = std::make_shared<Trk::CylinderVolumeBounds>(
m_beamPipeRadius,
722 outerEndcapZHalfSize + innerEndcapZHalfSize);
723 auto posBeamPipeBounds = std::make_shared<Trk::CylinderVolumeBounds>(
m_beamPipeRadius,
724 outerEndcapZHalfSize + innerEndcapZHalfSize);
726 std::move(negBeamPipeBounds));
727 negBeamPipe =
processVolume(negbpVol, 1, 1,
"Muons::Gaps::NegativeBeamPipe",
730 std::move(posBeamPipeBounds));
731 posBeamPipe =
processVolume(posbpVol, 1, 1,
"Muons::Gaps::PositiveBeamPipe",
735 posBeamPipe->registerColorCode(0);
747 "All::Container::Barrel");
752 std::move(negOuterShield),
754 "Container::NegativeOuterEndcap");
758 std::move(posOuterShield),
760 "Container::PositiveOuterEndcap");
766 std::move(negInnerShield),
768 "Container::NegativeInnerEndcap");
772 std::move(posInnerShield),
774 "Container::PositiveInnerEndcap");
780 std::move(negInnerEndcap),
782 "Container::NegativeEndcap");
786 std::move(posOuterEndcap),
788 "Container::PositiveEndcap");
794 std::move(negBeamPipe),
796 "All::Container::NegativeEndcap"));
799 std::move(posBeamPipe),
801 "All::Container::PositiveEndcap"));
811 "All::Container::NegDet");
822 auto trackingGeometry = std::make_unique<Trk::TrackingGeometry>(detector.release(),
Trk::globalSearch);
825 trackingGeometry->addToGarbage(std::move(stations));
826 trackingGeometry->addToGarbage(std::move(inertObjs));
828 volumeGarbage.push_back(std::move(negativeMuonOuterWheel));
829 volumeGarbage.push_back(std::move(negativeMuonBigWheel));
830 volumeGarbage.push_back(std::move(negativeMuonOuterBuffer));
831 volumeGarbage.push_back(std::move(positiveMuonOuterWheel));
833 volumeGarbage.push_back(std::move(negativeMuonSmallWheel));
834 volumeGarbage.push_back(std::move(positiveMuonSmallWheel));
835 volumeGarbage.push_back(std::move(negativeECT));
836 volumeGarbage.push_back(std::move(positiveECT));
837 volumeGarbage.push_back(std::move(positiveMuonBigWheel));
839 volumeGarbage.push_back(std::move(positiveMuonOuterBuffer));
840 volumeGarbage.push_back(std::move(negDiskShield));
841 volumeGarbage.push_back(std::move(posDiskShield));
843 trackingGeometry->addToGarbage(std::move(volumeGarbage));
847 return trackingGeometry;
933 const std::string& volumeName,
935 bool hasStations)
const {
940 std::vector<Trk::DetachedTrackingVolume*> blendVols;
943 if (etaN < 1 || phiN < 1) {
948 if (etaN * phiN > 1) {
951 ATH_MSG_ERROR(
" process volume: volume cylinder boundaries not retrieved, return 0 ");
954 double phiSect =
M_PI / phiN;
955 double etaSect = (cyl->halflengthZ()) / etaN;
957 auto subBds = std::make_shared<Trk::CylinderVolumeBounds>(cyl->innerRadius(), cyl->outerRadius(), phiSect, etaSect);
958 auto protVol = std::make_unique<Trk::Volume>(
nullptr, std::move(subBds));
961 std::vector<Trk::TrackingVolumeOrderPosition> subVolumes;
962 std::vector<Trk::TrackingVolume*> sVols;
963 std::vector<Trk::TrackingVolume*> sVolsNeg;
964 std::vector<Trk::TrackingVolume*> sVolsPos;
967 colorCode = 26 - colorCode;
969 double posZ = vol.
center().z() + etaSect * (2. *
eta + 1. - etaN);
970 double posR = 0.5 * (cyl->innerRadius() + cyl->outerRadius());
971 int geoSignature = 4;
973 for (
unsigned int in = 1; in < aLVC.
m_msCutoutsIn.size(); in++) {
981 if (geoSignature == 4) {
995 colorCode = 26 - colorCode;
999 auto subVol = std::make_unique<Trk::Volume>(*protVol, transf);
1004 std::vector<Trk::DetachedTrackingVolume*> detVols{};
1008 auto detVolVecPtr = std::make_unique<std::vector<Trk::DetachedTrackingVolume*>>(detVols);
1009 auto sVol = std::make_unique<Trk::TrackingVolume>(*subVol, aLVC.
m_muonMaterial,
1010 std::move(detVolVecPtr), volName);
1016 for (
auto& blendVol : blendVols) {
1017 aLVC.
m_blendMap[blendVol].push_back(sVol.get());
1021 if (geoSignature == 2) {
1024 if (geoSignature == 5) {
1027 sVol->registerColorCode(colorCode);
1030 Amg::Vector3D::UnitX();;
1032 sVols.push_back(sVol.get());
1034 sVolsNeg.push_back(sVol.get());
1035 if (
eta == etaN - 1)
1036 sVolsPos.push_back(sVol.get());
1038 if (phiN > 1 &&
phi > 0) {
1041 *sVols[
eta * phiN +
phi - 1],
1043 if (
phi == phiN - 1)
1050 if (etaN > 1 &&
eta > 0)
1053 *sVols[(
eta - 1) * phiN +
phi],
1056 subVolumes.emplace_back(std::move(sVol), transf * gp);
1063 volCenter.z() - cyl->halflengthZ(),
1064 volCenter.z() + cyl->halflengthZ(),
1069 auto subVols = std::make_unique<Trk::BinnedArray2D<Trk::TrackingVolume>>(std::move(subVolumes),
1072 tVol = std::make_unique<Trk::TrackingVolume>(vol, aLVC.
m_muonMaterial,
nullptr,
1073 std::move(subVols), volumeName);
1084 std::vector<Trk::DetachedTrackingVolume*> muonObjs{};
1088 auto muonObjsPtr = std::make_unique<std::vector<Trk::DetachedTrackingVolume*>>(muonObjs);
1090 tVol = std::make_unique<Trk::TrackingVolume>(vol, aLVC.
m_muonMaterial, std::move(muonObjsPtr),
1097 for (
auto& blendVol : blendVols) {
1098 aLVC.
m_blendMap[blendVol].push_back(tVol.get());
1108 const std::string& volumeName,
1110 bool hasStations)
const {
1122 std::vector<Trk::DetachedTrackingVolume*> blendVols;
1129 ATH_MSG_ERROR(
" process volume: volume cylinder boundaries not retrieved, return 0 ");
1133 std::vector<float> zSteps;
1134 std::vector<int> zTypes;
1135 double zPos = vol.
center().z();
1136 double hz = cyl->halflengthZ();
1137 double z1 = zPos - hz;
1138 double z2 = zPos + hz;
1139 zSteps.push_back(z1);
1140 for (
unsigned int iz = 0; iz < aLVC.
m_zPartitions.size(); iz++) {
1145 if (zTypes.empty()) {
1147 zTypes.push_back(0);
1155 zSteps.push_back(z2);
1157 for (
unsigned int iz = 0; iz < zSteps.size(); iz++)
1158 ATH_MSG_DEBUG(
"z partition in volume:" << volumeName <<
":" << iz <<
":"
1165 else if (std::abs(zPos) <=
m_ectZ)
1180 unsigned int etaN = zSteps.size() - 1;
1189 std::vector<std::vector<Trk::BinUtility>> hBinUtil{};
1190 for (
unsigned iz = 0; iz < zSteps.size() - 1; iz++) {
1191 std::vector<Trk::BinUtility> phBinUtil{};
1192 for (
unsigned ip = 0; ip < aLVC.
m_adjustedPhi.size(); ip++) {
1202 for (std::pair<int, float> i :
1206 <<
" zTypes[iz] " << zTypes[iz]
1207 <<
" m_adjustedPhiType[ip] "
1209 <<
" hPartitions " << i.second);
1211 phBinUtil.emplace_back(phiRef,
1214 hBinUtil.push_back(std::move(phBinUtil));
1218 std::vector<Trk::TrackingVolumeOrderPosition> subVolumesVect;
1219 std::vector<std::vector<std::vector<Trk::TrackingVolume*>>> subVolumes;
1220 std::vector<std::vector<std::shared_ptr<Trk::BinnedArray<Trk::TrackingVolume> > > >
1222 std::vector<Trk::TrackingVolume*> sVolsInn;
1223 std::vector<Trk::TrackingVolume*> sVolsOut;
1224 std::vector<Trk::TrackingVolume*> sVolsNeg;
1225 std::vector<Trk::TrackingVolume*> sVolsPos;
1226 for (
unsigned int eta = 0;
eta < zSteps.size() - 1;
eta++) {
1227 if (colorCode > 0) {
1228 colorCode = 6 - colorCode;
1230 double posZ = 0.5 * (zSteps[
eta] + zSteps[
eta + 1]);
1231 double hZ = 0.5 * std::abs(zSteps[
eta + 1] - zSteps[
eta]);
1232 std::vector<std::vector<Trk::TrackingVolume*> > phiSubs;
1233 std::vector<std::shared_ptr<Trk::BinnedArray<Trk::TrackingVolume>>> phBins;
1234 std::vector<int> phiType(phiTypeMax + 1, -1);
1235 std::vector<std::vector<Trk::Volume*> > garbVol(phiTypeMax + 1);
1236 unsigned int pCode = 1;
1237 for (
unsigned int phi = 0;
phi < phiN;
phi++) {
1238 pCode = (colorCode > 0) ? 3 - pCode : 0;
1240 double phiSect = 0.;
1241 if (
phi < phiN - 1) {
1250 std::vector<std::pair<int, float> > hSteps =
1253 std::vector<Trk::TrackingVolume*> hSubs;
1254 std::vector<Trk::TrackingVolumeOrderPosition> hSubsTr;
1257 unsigned int hCode = 1;
1258 for (
unsigned int h = 0;
h < hSteps.size() - 1;
h++) {
1259 hCode = colorCode > 0 ? 1 - hCode : 0;
1261 std::unique_ptr<Trk::Volume> subVol{};
1265 if (hSteps[
h].first == 1 && hSteps[
h + 1].first == 0)
1267 if (hSteps[
h].first == 0 && hSteps[
h + 1].first == 1)
1269 if (hSteps[
h].first == 1 && hSteps[
h + 1].first == 1)
1273 subVol = std::make_unique<Trk::Volume>(*phiSubs[phiP][
h],
1274 transf *phiSubs[phiP][
h]->transform().inverse());
1275 }
else if (phiSect < 0.5 *
M_PI) {
1276 auto subBds = std::make_shared<Trk::BevelledCylinderVolumeBounds>(hSteps[
h].second,
1277 hSteps[
h + 1].second,
1280 subVol = std::make_unique<Trk::Volume>(
makeTransform(transf), std::move(subBds));
1282 auto subBds = std::make_shared<Trk::CylinderVolumeBounds>(hSteps[
h].second,
1283 hSteps[
h + 1].second,
1285 subVol = std::make_unique<Trk::Volume>(
makeTransform(transf), std::move(subBds));
1290 std::string volName = volumeName +
1295 std::vector<Trk::DetachedTrackingVolume*> detVols{};
1299 auto detVolsPtr = std::make_unique<std::vector<Trk::DetachedTrackingVolume*>>(detVols);
1300 auto sVol = std::make_unique<Trk::TrackingVolume>(*subVol,
1302 std::move(detVolsPtr),
1310 for (
auto& blendVol : blendVols) {
1311 aLVC.
m_blendMap[blendVol].push_back(sVol.get());
1315 double posR = 0.5 * (hSteps[
h].second + hSteps[
h + 1].second);
1317 for (
unsigned int in = 1; in < aLVC.
m_msCutoutsIn.size(); ++in) {
1327 for (
unsigned int io = 1; io < aLVC.
m_msCutoutsOut.size(); ++io) {
1337 sVol->registerColorCode(colorCode + pCode + hCode);
1340 0.5 * (hSteps[
h].second + hSteps[
h + 1].second) * Amg::Vector3D::UnitX();
1341 hSubs.push_back(sVol.get());
1345 sVolsInn.push_back(sVol.get());
1346 if (
h == hSteps.size() - 2)
1347 sVolsOut.push_back(sVol.get());
1349 sVolsNeg.push_back(sVol.get());
1350 if (
eta == etaN - 1)
1351 sVolsPos.push_back(sVol.get());
1354 if (volType == 1 || volType == 3) {
1371 if (phiN > 1 &&
phi > 0) {
1375 if (
phi == phiN - 1){
1382 if (etaN > 1 &&
eta > 0) {
1391 subVolumesVect.emplace_back(std::move(sVol), transf * gp);
1394 auto& back = subVolumesVect.back();
1396 auto ptrNoDelete = std::shared_ptr<Trk::TrackingVolume>(
1399 hSubsTr.push_back({ptrNoDelete,back.second});
1401 phiSubs.push_back(std::move(hSubs));
1402 auto volBinArray = std::make_unique<Trk::BinnedArray1D<Trk::TrackingVolume>>(hSubsTr,
1404 phBins.emplace_back(std::move(volBinArray));
1410 if (phiN > 1 &&
phi > 0) {
1411 for (
auto& j : phiSubs[
phi - 1]) {
1417 if (phiN > 1 &&
phi == phiN - 1) {
1418 for (
auto& j : phiSubs[0]) {
1425 if (etaN > 1 &&
eta > 0) {
1426 for (
auto& j: subVolumes[
eta - 1][
phi]) {
1432 subVolumes.push_back(std::move(phiSubs));
1433 hBins.push_back(std::move(phBins));
1436 auto hBinVecPtr = std::move(hBinUtil);
1437 auto subVols = std::make_unique<Trk::BinnedArray1D1D1D<Trk::TrackingVolume>>(subVolumesVect,
1442 tVol = std::make_unique<Trk::TrackingVolume>(vol, aLVC.
m_muonMaterial,
nullptr,
1443 std::move(subVols), volumeName);
1463 if (etaN * phiN > 1) {
1467 std::vector<Trk::TrackingVolumeOrderPosition> subVolumes(etaN * phiN);
1468 std::vector<Trk::TrackingVolume*> sVols(etaN * phiN);
1469 std::vector<Trk::TrackingVolume*> sVolsNeg(phiN);
1470 std::vector<Trk::TrackingVolume*> sVolsPos(phiN);
1471 for (
unsigned int eta = 0;
eta < zSteps.size() - 1; ++
eta) {
1472 double posZ = 0.5 * (zSteps[
eta] + zSteps[
eta + 1]);
1473 double hZ = 0.5 * std::abs(zSteps[
eta + 1] - zSteps[
eta]);
1474 colorCode = 26 - colorCode;
1475 for (
unsigned int phi = 0;
phi < phiN;
phi++) {
1476 colorCode = 26 - colorCode;
1478 double phiSect = 0.;
1479 if (
phi < phiN - 1) {
1489 auto subBds = std::make_shared<Trk::CylinderVolumeBounds>(cyl->innerRadius(), cyl->outerRadius(), phiSect, hZ);
1499 std::vector<Trk::DetachedTrackingVolume*> detVols{} ;
1503 auto detVolPtr = std::make_unique<std::vector<Trk::DetachedTrackingVolume*>>(detVols);
1504 auto sVol = std::make_unique<Trk::TrackingVolume>(subVol, aLVC.
m_muonMaterial,
1505 std::move(detVolPtr),
1512 for (
auto& blendVol : blendVols) {
1513 aLVC.
m_blendMap[blendVol].push_back(sVol.get());
1517 double posR = 0.5 * (cyl->innerRadius() + cyl->outerRadius());
1519 for (
unsigned int in = 1; in < aLVC.
m_msCutoutsIn.size(); ++in) {
1528 for (
unsigned int io = 1; io < aLVC.
m_msCutoutsOut.size(); ++io) {
1536 sVol->registerColorCode(colorCode);
1538 const Amg::Vector3D gp = cyl->outerRadius() * Amg::Vector3D::UnitX();
1541 sVols[phiN *
eta +
phi] = sVol.get();
1543 sVolsNeg[
phi] = sVol.get();
1545 if (
eta == etaN - 1) {
1546 sVolsPos[
phi] = sVol.get();
1549 if (phiN > 1 &&
phi > 0) {
1552 *sVols[
eta * phiN +
phi - 1],
1554 if (
phi == phiN - 1) {
1562 if (etaN > 1 &&
eta > 0) {
1565 *sVols[(
eta - 1) * phiN +
phi],
1569 subVolumes[
phi * etaN +
eta] = std::make_pair(std::move(sVol), transf * gp);
1583 zBinUtil += pBinUtil;
1587 auto subVols = std::make_unique<Trk::BinnedArray2D<Trk::TrackingVolume>>(subVolumes,
1590 tVol = std::make_unique<Trk::TrackingVolume>(vol, aLVC.
m_muonMaterial,
nullptr,
1591 std::move(subVols), volumeName);
1602 std::vector<Trk::DetachedTrackingVolume*> muonObjs{};
1606 auto muonObjPtr = std::make_unique<std::vector<Trk::DetachedTrackingVolume*>>(muonObjs);
1607 tVol = std::make_unique<Trk::TrackingVolume>(vol, aLVC.
m_muonMaterial,
1608 std::move(muonObjPtr),
1615 for (
auto& blendVol : blendVols) {
1616 aLVC.
m_blendMap[blendVol].push_back(tVol.get());
1626 const std::string& volumeName,
1628 bool hasStations)
const {
1630 <<
" in mode:" <<
type);
1636 std::vector<Trk::DetachedTrackingVolume*> blendVols;
1643 ATH_MSG_ERROR(
" process volume: volume cylinder boundaries not retrieved, return 0 ");
1647 std::vector<float> zSteps;
1649 double zPos = vol.
center().z();
1650 double hz = cyl->halflengthZ();
1651 double z1 = zPos - hz;
1652 double z2 = zPos + hz;
1653 zSteps.push_back(z1);
1655 if (iz > z1 && iz < z2) {
1656 zSteps.push_back(iz);
1660 zSteps.push_back(z2);
1666 unsigned int etaN = zSteps.size() - 1;
1673 std::vector<std::vector<Trk::BinUtility>> hBinUtil{};
1675 for (
unsigned iz = 0; iz < zSteps.size() - 1; iz++) {
1676 std::vector<Trk::BinUtility> phBinUtil;
1678 hBinUtil.push_back(std::move(phBinUtil));
1683 std::vector<Trk::TrackingVolumeOrderPosition> subVolumesVect;
1684 std::vector<std::vector<std::vector<Trk::TrackingVolume*>>> subVolumes;
1685 std::vector<std::vector<std::shared_ptr<Trk::BinnedArray<Trk::TrackingVolume>>>> hBins;
1686 std::vector<Trk::TrackingVolume*> sVolsInn;
1687 std::vector<Trk::TrackingVolume*> sVolsOut;
1688 std::vector<Trk::TrackingVolume*> sVolsNeg;
1689 std::vector<Trk::TrackingVolume*> sVolsPos;
1690 for (
unsigned int eta = 0;
eta < zSteps.size() - 1;
eta++) {
1692 colorCode = 26 - colorCode;
1693 double posZ = 0.5 * (zSteps[
eta] + zSteps[
eta + 1]);
1694 double hZ = 0.5 * std::abs(zSteps[
eta + 1] - zSteps[
eta]);
1695 std::vector<std::vector<Trk::TrackingVolume*> > phiSubs;
1696 std::vector<std::shared_ptr<Trk::BinnedArray<Trk::TrackingVolume>>> phBins{};
1699 double phiSect =
M_PI;
1701 std::vector<Trk::TrackingVolume*> hSubs;
1702 std::vector<Trk::TrackingVolumeOrderPosition> hSubsTr;
1703 unsigned int hCode = 1;
1704 for (
unsigned int h = 0;
h < hSteps.size() - 1;
h++) {
1705 hCode = (colorCode > 0) ? 1 - hCode : 0;
1707 auto subBds = std::make_shared<Trk::CylinderVolumeBounds>(hSteps[
h].second, hSteps[
h + 1].second, phiSect, hZ);
1708 const double mediumRadius = subBds->mediumRadius();
1718 std::vector<Trk::DetachedTrackingVolume*> detVols{};
1722 auto detVolPtr = std::make_unique<std::vector<Trk::DetachedTrackingVolume*>>(detVols);
1723 auto sVol = std::make_unique<Trk::TrackingVolume>(subVol, aLVC.
m_muonMaterial,
1724 std::move(detVolPtr), volName);
1731 for (
auto& blendVol : blendVols) {
1732 aLVC.
m_blendMap[blendVol].push_back(sVol.get());
1736 double posR = 0.5 * (hSteps[
h].second + hSteps[
h + 1].second);
1738 for (
unsigned int in = 1; in < aLVC.
m_msCutoutsIn.size(); in++) {
1747 sVol->registerColorCode(colorCode + hCode);
1749 const Amg::Vector3D gp = mediumRadius * Amg::Vector3D::UnitX();
1750 hSubs.push_back(sVol.get());
1754 sVolsInn.push_back(sVol.get());
1755 if (
h == hSteps.size() - 2)
1756 sVolsOut.push_back(sVol.get());
1758 sVolsNeg.push_back(sVol.get());
1759 if (
eta == etaN - 1)
1760 sVolsPos.push_back(sVol.get());
1771 if (etaN > 1 &&
eta > 0)
1779 subVolumesVect.emplace_back(std::move(sVol), transf * gp);
1782 auto& back = subVolumesVect.back();
1784 auto ptrNoDelete = std::shared_ptr<Trk::TrackingVolume>(
1786 hSubsTr.push_back({ptrNoDelete, back.second});
1788 phiSubs.push_back(std::move(hSubs));
1790 auto volBinArray = std::make_unique<Trk::BinnedArray1D<Trk::TrackingVolume>>(hSubsTr, hBinUtil[
eta][
phi]);
1791 phBins.push_back(std::move(volBinArray));
1794 if (etaN > 1 &&
eta > 0) {
1795 for (
auto& j : subVolumes[
eta - 1][
phi]) {
1801 subVolumes.push_back(std::move(phiSubs));
1802 hBins.push_back(std::move(phBins));
1805 auto hBinVecPtr = std::move(hBinUtil);
1806 auto subVols = std::make_unique<Trk::BinnedArray1D1D1D<Trk::TrackingVolume>>(subVolumesVect,
1811 tVol = std::make_unique<Trk::TrackingVolume>(vol, aLVC.
m_muonMaterial,
nullptr,
1812 std::move(subVols), volumeName);
1825 std::vector<Trk::DetachedTrackingVolume*>& blendVols,
1830 std::vector<Trk::DetachedTrackingVolume*> detTVs{};
1837 double rmed{0.}, dphi{0.}, hz{0.}, rMin{0.}, rMax{0.}, rMaxc{0.};
1840 rmed = cyl->mediumRadius();
1841 dphi = cyl->halfPhiSector();
1842 hz = cyl->halflengthZ();
1843 rMin = cyl->innerRadius();
1844 rMax = cyl->outerRadius();
1847 rmed = bcyl->mediumRadius();
1848 dphi = bcyl->halfPhiSector();
1849 hz = bcyl->halflengthZ();
1850 rMin = bcyl->innerRadius();
1851 rMax = bcyl->outerRadius();
1855 rMaxc *= 1. / cos(dphi);
1861 double zMin = center[2] - hz;
1862 double zMax = center[2] + hz;
1864 double pMax = +2 *
M_PI;
1865 bool phiLim =
false;
1867 pMin = center.phi() - dphi +
M_PI;
1868 pMax = center.phi() + dphi +
M_PI;
1872 ATH_MSG_VERBOSE(
" zMin " << zMin <<
" zMax " << zMax <<
" rMin " << rMin
1873 <<
" rMax " << rMax <<
" rMaxc " << rMaxc
1874 <<
" phi limits " << pMin <<
" phiMax " << pMax
1875 <<
" phiLim " << phiLim);
1889 else if (zMin >= -
m_ectZ)
1898 else if (zMax <= -
m_ectZ)
1913 for (
int gMode = gMin; gMode <= gMax; gMode++) {
1914 for (
const auto&[station, s] : (aLVC.
m_stationSpan)[gMode]) {
1915 bool rLimit = !aLVC.
m_static3d || (s->rMin <= rMaxc && s->rMax >= rMin);
1917 bool meanZOK =
false;
1918 if (station->name() ==
"BME1_Station" ||
1919 station->name() ==
"BME2_Station") {
1920 if ((s->zMin + s->zMax) / 2. < zMax &&
1921 (s->zMin + s->zMax) / 2. > zMin)
1923 if ((s->phiMin + s->phiMax) / 2 < pMin && phiLim)
1929 ((s->zMin < zMax && s->zMax > zMin) || meanZOK)) {
1930 bool accepted =
false;
1932 if (pMin >= 0 && pMax <= 2 *
M_PI) {
1933 if (s->phiMin <= s->phiMax &&
1934 s->phiMin <= pMax && s->phiMax >= pMin)
1936 if (s->phiMin > s->phiMax &&
1937 (s->phiMin <= pMax || s->phiMax >= pMin))
1939 }
else if (pMin < 0) {
1940 if (s->phiMin <= s->phiMax &&
1941 (s->phiMin <= pMax ||
1942 s->phiMax >= pMin + 2 *
M_PI))
1944 if (s->phiMin > s->phiMax)
1946 }
else if (pMax > 2 *
M_PI) {
1947 if (s->phiMin <= s->phiMax &&
1948 (s->phiMin <= pMax - 2 *
M_PI ||
1951 if (s->phiMin > s->phiMax)
1959 detTVs.push_back(station);
1961 << station->name() <<
" zMin " << zMin
1962 <<
" zMax " << zMax <<
" rMin " << rMin
1963 <<
" rMax " << rMax <<
" PhiMin "
1964 << pMin <<
" PhiMax " << pMax);
1972 for (
int gMode = gMin; gMode <= gMax; gMode++) {
1973 for (
const auto& [inert, s]: (aLVC.
m_inertSpan)[gMode]) {
1975 (s->rMin <= rMaxc && s->rMax >= rMin));
1976 if (rLimit && s->zMin < zMax && s->zMax > zMin) {
1977 bool accepted =
false;
1979 if (pMin >= 0 && pMax <= 2 *
M_PI) {
1980 if (s->phiMin <= s->phiMax &&
1981 s->phiMin <= pMax && s->phiMax >= pMin)
1983 if (s->phiMin > s->phiMax &&
1984 (s->phiMin <= pMax || s->phiMax >= pMin))
1986 }
else if (pMin < 0) {
1987 if (s->phiMin <= s->phiMax &&
1988 (s->phiMin <= pMax ||
1989 s->phiMax >= pMin + 2 *
M_PI))
1991 if (s->phiMin > s->phiMax)
1993 }
else if (pMax > 2 *
M_PI) {
1994 if (s->phiMin <= s->phiMax &&
1995 (s->phiMin <= pMax - 2 *
M_PI ||
1998 if (s->phiMin > s->phiMax)
2005 inert->name().compare(inert->name().size() - 4, 4,
2008 detTVs.push_back(inert);
2010 blendVols.push_back(inert);
2012 << inert->name() <<
" zMin " << zMin
2013 <<
" zMax " << zMax <<
" rMin " << rMin
2014 <<
" rMax " << rMax <<
" PhiMin "
2015 << pMin <<
" PhiMax " << pMax);
2421 std::vector<std::pair<int, float> > barrelZ0F0;
2424 barrelZ0F0.emplace_back(0, 4450.);
2425 barrelZ0F0.emplace_back(0, 6500.);
2426 barrelZ0F0.emplace_back(0, 8900.);
2427 barrelZ0F0.emplace_back(0, 13000.);
2431 std::vector<std::pair<int, float> > barrelZ0F1;
2434 barrelZ0F1.emplace_back(1, 4500.);
2435 barrelZ0F1.emplace_back(1, 5900.);
2437 barrelZ0F1.emplace_back(0, 4450.);
2439 barrelZ0F1.emplace_back(0, 6500.);
2441 barrelZ0F1.emplace_back(1, 8900.);
2443 barrelZ0F1.emplace_back(0, 8900.);
2445 barrelZ0F1.emplace_back(1, 10100.);
2446 barrelZ0F1.emplace_back(0, 13000.);
2450 std::vector<std::pair<int, float> > barrelZ1F0;
2455 barrelZ1F0.emplace_back(0, 4450.);
2457 barrelZ1F0.emplace_back(1, 5800.);
2458 barrelZ1F0.emplace_back(1, 6500.);
2460 barrelZ1F0.emplace_back(0, 6500.);
2462 barrelZ1F0.emplace_back(1, 6750.);
2463 barrelZ1F0.emplace_back(1, 8400.);
2466 barrelZ1F0.emplace_back(0, 8770.);
2468 barrelZ1F0.emplace_back(1, 9850.);
2469 barrelZ1F0.emplace_back(0, 13000.);
2472 std::vector<std::pair<int, float> > barrelZ1F1;
2475 barrelZ1F1.emplace_back(1, 4500.);
2476 barrelZ1F1.emplace_back(1, 6000.);
2478 barrelZ1F1.emplace_back(0, 4450.);
2480 barrelZ1F1.emplace_back(0, 6500.);
2482 barrelZ1F1.emplace_back(1, 6800.);
2484 barrelZ1F1.emplace_back(1, 8900.);
2485 barrelZ1F1.emplace_back(1, 10100.);
2487 barrelZ1F1.emplace_back(0, 8900.);
2488 barrelZ1F1.emplace_back(0, 13000.);
2491 std::vector<std::vector<std::vector<std::pair<int, float> > > > barrelZF(2);
2492 barrelZF[0].push_back(std::move(barrelZ0F0));
2493 barrelZF[0].push_back(std::move(barrelZ0F1));
2494 barrelZF[1].push_back(std::move(barrelZ1F0));
2495 barrelZF[1].push_back(std::move(barrelZ1F1));
2499 std::vector<std::pair<int, float> > swZ0F0;
2502 swZ0F0.emplace_back(0, 2700.);
2507 swZ0F0.emplace_back(0, 4450.);
2509 swZ0F0.emplace_back(0, 6560.);
2510 swZ0F0.emplace_back(0, 8900.);
2515 std::vector<std::pair<int, float> > swZ0F1;
2518 swZ0F1.emplace_back(0, 2700.);
2522 swZ0F1.emplace_back(0, 4450.);
2524 swZ0F1.emplace_back(1, 5900.);
2526 swZ0F1.emplace_back(0, 6560.);
2528 swZ0F1.emplace_back(1, 8900.);
2529 swZ0F1.emplace_back(1, 10100.);
2531 swZ0F1.emplace_back(0, 8900.);
2534 std::vector<std::vector<std::vector<std::pair<int, float> > > > swZF(1);
2535 swZF[0].push_back(std::move(swZ0F0));
2536 swZF[0].push_back(std::move(swZ0F1));
2540 std::vector<std::pair<int, float> > innerZ0F0;
2543 innerZ0F0.emplace_back(0, 1100.);
2545 innerZ0F0.emplace_back(1, 5150.);
2547 innerZ0F0.emplace_back(1, 5300.);
2549 innerZ0F0.emplace_back(0, 6500.);
2550 innerZ0F0.emplace_back(0, 8900.);
2555 std::vector<std::pair<int, float> > innerZ0F1;
2558 innerZ0F1.emplace_back(0, 1100.);
2560 innerZ0F1.emplace_back(1, 1400.);
2561 innerZ0F1.emplace_back(1, 1685.);
2564 innerZ0F1.emplace_back(1, 4700.);
2565 innerZ0F1.emplace_back(1, 5900.);
2568 innerZ0F1.emplace_back(0, 6500.);
2569 innerZ0F1.emplace_back(0, 8900.);
2574 std::vector<std::pair<int, float> > innerZ0F2;
2577 innerZ0F2.emplace_back(0, 1100.);
2579 innerZ0F2.emplace_back(1, 1400.);
2580 innerZ0F2.emplace_back(1, 1685.);
2583 innerZ0F2.emplace_back(1, 4450.);
2584 innerZ0F2.emplace_back(1, 5900.);
2587 innerZ0F2.emplace_back(0, 6500.);
2589 innerZ0F2.emplace_back(1, 8900.);
2590 innerZ0F2.emplace_back(1, 10100.);
2592 innerZ0F2.emplace_back(0, 8900.);
2596 std::vector<std::pair<int, float> > innerZ1F0;
2599 innerZ1F0.emplace_back(0, 1100.);
2601 innerZ1F0.emplace_back(1, 5150.);
2603 innerZ1F0.emplace_back(1, 5300.);
2605 innerZ1F0.emplace_back(1, 5800.);
2607 innerZ1F0.emplace_back(1, 6750.);
2609 innerZ1F0.emplace_back(0, 6500.);
2611 innerZ1F0.emplace_back(1, 8400.);
2612 innerZ1F0.emplace_back(1, 9600.);
2614 innerZ1F0.emplace_back(0, 8900.);
2618 std::vector<std::pair<int, float> > innerZ1F1;
2621 innerZ1F1.emplace_back(0, 1100.);
2623 innerZ1F1.emplace_back(1, 1400.);
2624 innerZ1F1.emplace_back(1, 1685.);
2627 innerZ1F1.emplace_back(1, 4700.);
2628 innerZ1F1.emplace_back(1, 5800.);
2629 innerZ1F1.emplace_back(1, 6750.);
2631 innerZ1F1.emplace_back(0, 6500.);
2633 innerZ1F1.emplace_back(1, 8400.);
2634 innerZ1F1.emplace_back(1, 9600.);
2636 innerZ1F1.emplace_back(0, 8900.);
2640 std::vector<std::pair<int, float> > innerZ1F2;
2643 innerZ1F2.emplace_back(0, 1100.);
2645 innerZ1F2.emplace_back(1, 1400.);
2646 innerZ1F2.emplace_back(1, 1685.);
2648 innerZ1F2.emplace_back(0, 4150.);
2650 innerZ1F2.emplace_back(1, 4700.);
2651 innerZ1F2.emplace_back(1, 5900.);
2652 innerZ1F2.emplace_back(1, 6800.);
2654 innerZ1F2.emplace_back(0, 6500.);
2656 innerZ1F2.emplace_back(1, 8900.);
2657 innerZ1F2.emplace_back(1, 10100.);
2659 innerZ1F2.emplace_back(0, 8900.);
2662 std::vector<std::vector<std::vector<std::pair<int, float> > > > innerZF(2);
2663 innerZF[0].push_back(std::move(innerZ0F0));
2664 innerZF[0].push_back(std::move(innerZ0F1));
2665 innerZF[0].push_back(std::move(innerZ0F2));
2666 innerZF[1].push_back(std::move(innerZ1F0));
2667 innerZF[1].push_back(std::move(innerZ1F1));
2668 innerZF[1].push_back(std::move(innerZ1F2));
2671 std::vector<std::pair<int, float> > outerZ0F0;
2673 outerZ0F0.emplace_back(0, 2750.);
2674 outerZ0F0.emplace_back(0, 12650.);
2675 outerZ0F0.emplace_back(0, 13400.);
2678 std::vector<std::pair<int, float> > outerZ0F1;
2680 outerZ0F1.emplace_back(0, 2750.);
2682 outerZ0F1.emplace_back(0, 3600.);
2683 outerZ0F1.emplace_back(0, 5300.);
2684 outerZ0F1.emplace_back(0, 7000.);
2685 outerZ0F1.emplace_back(0, 8500.);
2686 outerZ0F1.emplace_back(0, 10000.);
2687 outerZ0F1.emplace_back(0, 12000.);
2689 outerZ0F1.emplace_back(0, 12650.);
2690 outerZ0F1.emplace_back(0, 13400.);
2693 std::vector<std::vector<std::vector<std::pair<int, float> > > > outerZF(2);
2694 outerZF[0].push_back(outerZ0F0);
2695 outerZF[0].push_back(outerZ0F0);
2696 outerZF[0].push_back(std::move(outerZ0F0));
2698 outerZF[1].push_back(outerZ0F1);
2699 outerZF[1].push_back(outerZ0F1);
2700 outerZF[1].push_back(std::move(outerZ0F1));