34 #include "GaudiKernel/SystemOfUnits.h"
38 const std::string&
t,
const std::string&
n,
const IInterface*
p)
51 if (m_trackingVolumeArrayCreator.retrieve().isFailure()) {
52 ATH_MSG_FATAL(
"Failed to retrieve tool " << m_trackingVolumeArrayCreator);
53 return StatusCode::FAILURE;
55 ATH_MSG_INFO(
"Retrieved tool " << m_trackingVolumeArrayCreator);
59 if (m_trackingVolumeHelper.retrieve().isFailure()) {
60 ATH_MSG_FATAL(
"Failed to retrieve tool " << m_trackingVolumeHelper);
61 return StatusCode::FAILURE;
63 ATH_MSG_INFO(
"Retrieved tool " << m_trackingVolumeHelper);
66 if (m_buildMBTS && m_trackingVolumeCreator.retrieve().isFailure()) {
67 ATH_MSG_FATAL(
"Failed to retrieve tool " << m_trackingVolumeCreator);
68 return StatusCode::FAILURE;
70 ATH_MSG_INFO(
"Retrieved tool " << m_trackingVolumeCreator);
76 if (m_lArVolumeBuilder.retrieve().isFailure()) {
77 ATH_MSG_FATAL(
"Failed to retrieve tool " << m_lArVolumeBuilder);
78 return StatusCode::FAILURE;
84 if (m_tileVolumeBuilder.retrieve().isFailure()) {
85 ATH_MSG_FATAL(
"Failed to retrieve tool " << m_tileVolumeBuilder);
86 return StatusCode::FAILURE;
92 return StatusCode::SUCCESS;
95 std::unique_ptr<Trk::TrackingGeometry>
107 double enclosedInnerSectorHalflength = 0.;
108 double enclosedInnerSectorRadius = 0.;
122 if (!innerDetectorBounds)
125 enclosedInnerSectorHalflength = innerDetectorBounds->
halflengthZ();
126 enclosedInnerSectorRadius = innerDetectorBounds->
outerRadius();
128 keyDim.emplace_back(enclosedInnerSectorRadius, enclosedInnerSectorHalflength);
132 m_enclosingEnvelopeSvc->getCaloRZBoundary();
136 for (
unsigned int i = 0;
i < envelopeDefsIn.size();
i++) {
139 else if (envelopeDefsIn[
i].
second == envelopeDefsIn[ii].
second &&
140 envelopeDefsIn[
i].
first > envelopeDefsIn[ii].
first)
146 unsigned int inext = ii + 1;
147 if (inext == envelopeDefsIn.size())
149 if (envelopeDefsIn[inext].
second != envelopeDefsIn[ii].
second) {
151 inext = ii > 0 ? ii - 1 : envelopeDefsIn.size() - 1;
157 for (
unsigned int i = inext;
i < envelopeDefsIn.size();
i++)
158 envelopeDefs.push_back(envelopeDefsIn[
i]);
160 for (
unsigned int i = 0;
i <= inext - 1;
i++)
161 envelopeDefs.push_back(envelopeDefsIn[
i]);
165 envelopeDefs.push_back(envelopeDefsIn[
i]);
168 inext = envelopeDefsIn.size() - 1;
169 while (inext >= ii) {
170 envelopeDefs.push_back(envelopeDefsIn[inext]);
175 double envEnclosingVolumeHalfZ = m_caloDefaultHalflengthZ;
179 for (
unsigned int i = 0;
i < envelopeDefs.size();
i++) {
182 if (std::abs(envelopeDefs[
i].
second) < envEnclosingVolumeHalfZ)
183 envEnclosingVolumeHalfZ = std::abs(envelopeDefs[
i].
second);
185 if (envelopeDefs[
i].
first > 1100. && envelopeDefs[
i].
first < 1200. &&
188 if (enclosedInnerSectorRadius != envelopeDefs[
i].
first)
190 "Enclosed ID volume radius does not match ID envelope, adjusting "
192 envEnclosingVolumeHalfZ = envelopeDefs[
i].second;
194 enclosedInnerSectorRadius = envelopeDefs[
i].first;
195 enclosedInnerSectorHalflength = envelopeDefs[
i].second;
201 if (envelopeDefs[
i].
second > 0. && envelopeDefs[
i].
second < 6785. &&
202 (envelopeDefs[
i].
first > 1200. ||
203 envelopeDefs[
i].
second > envEnclosingVolumeHalfZ)) {
204 if (msCutouts.empty())
205 msCutouts.push_back(envelopeDefs[
i]);
208 while (envIter != msCutouts.end() &&
209 (*envIter).second < envelopeDefs[
i].second)
211 while (envIter != msCutouts.end() &&
212 (*envIter).second == envelopeDefs[
i].second &&
213 (*envIter).first > envelopeDefs[
i].first)
215 msCutouts.insert(envIter, envelopeDefs[
i]);
221 for (
unsigned int i = 0;
i < msCutouts.size();
i++)
223 <<
i <<
":" << msCutouts[
i].
first <<
","
228 double caloDefaultRadius = m_caloDefaultRadius;
229 double caloDefaultHalflengthZ = m_caloDefaultHalflengthZ;
231 if (!msCutouts.empty()) {
232 caloDefaultRadius = msCutouts[0].first;
233 caloDefaultHalflengthZ = msCutouts[0].second;
235 " Calo central cylinder dimensions adjusted using EnvelopeSvc:"
236 << m_caloDefaultRadius <<
"," << m_caloDefaultHalflengthZ);
243 enclosedInnerSectorRadius, enclosedInnerSectorHalflength);
249 dummyVolumes,
"Calo::GapVolumes::DummyID");
251 keyDim.emplace_back(enclosedInnerSectorRadius, enclosedInnerSectorHalflength);
255 const RZPairVector& bpDefs = m_enclosingEnvelopeSvc->getBeamPipeRZBoundary();
259 for (
unsigned int i = 0;
i < bpDefs.size();
i++) {
265 bpDefs[
i].
second >= envEnclosingVolumeHalfZ &&
266 bpDefs[
i].
second <= msCutouts.back().second) {
267 bpCutouts.push_back(bpDefs[
i]);
270 keyDim.push_back(bpDefs[
i]);
277 if (bpCutouts.size() > 1 &&
278 bpCutouts.back().second == bpCutouts[bpCutouts.size() - 2].second)
279 bpCutouts.erase(bpCutouts.end() - 1);
281 for (
unsigned int i = 0;
i < bpCutouts.size();
i++)
283 <<
i <<
":" << bpCutouts[
i].
first <<
","
286 keyDim.emplace_back(caloDefaultRadius, caloDefaultHalflengthZ);
295 const std::vector<Trk::TrackingVolume*>* lArVolumes =
296 m_lArVolumeBuilder->trackingVolumes(*caloDDM);
299 <<
" volumes retrieved from " << m_lArVolumeBuilder.name());
325 std::vector<Trk::TrackingVolume*>* tileVolumes =
326 m_tileVolumeBuilder->trackingVolumes(*caloDDM);
329 <<
" volumes retrieved from " << m_tileVolumeBuilder.name());
330 if (msgLvl(MSG::INFO)) {
332 "--------------- detailed output "
333 "---------------------------------------------------------- ");
334 std::vector<Trk::TrackingVolume*>::const_iterator tileVolIter =
335 tileVolumes->begin();
336 std::vector<Trk::TrackingVolume*>::const_iterator tileVolIterEnd =
338 for (; tileVolIter != tileVolIterEnd;
352 double rTileMin = ebBounds ? ebBounds->
innerRadius() : 2288.;
353 double zTileMin = ebBounds ? tilePositiveExtendedBarrel->
center().z() -
357 keyDim.emplace_back(rTileMin, zTileMin);
358 for (
unsigned int i = 0;
i < keyDim.size();
i++) {
372 if (!lArBarrelBounds)
377 if (!lArPositiveEndcapBounds)
382 if (!lArNegativeEndcapBounds)
387 if (!lArPositiveHecBounds)
392 if (!lArPositiveFcalBounds)
397 if (!lArNegativeFcalBounds)
403 if (!tileCombinedBounds)
422 double caloPositiveOuterBoundary = tileCombinedBounds->
halflengthZ();
424 double lArPositiveOuterBoundary = lArPositiveFcal->
center().z();
425 lArPositiveOuterBoundary += lArPositiveFcalBounds->
halflengthZ();
433 float caloVolsOuterRadius = tileCombinedBounds->
outerRadius();
434 float caloVolsExtendZ = caloPositiveOuterBoundary;
443 float rInnerGapBP = 0.;
444 std::pair<Trk::TrackingVolume*, Trk::TrackingVolume*> innerGapBP =
445 createBeamPipeVolumes(
446 bpCutouts, keyDim[0].
second,
448 keyDim.back().second,
"InnerGap", rInnerGapBP);
450 double z = 0.5 * (keyDim.back().second + keyDim[0].second);
452 auto mbtsNegLayers = std::make_unique<std::vector<Trk::Layer*>>();
453 auto mbtsPosLayers = std::make_unique<std::vector<Trk::Layer*>>();
455 if (lArPositiveMBTS && lArNegativeMBTS) {
460 if (mbtsBounds && m_buildMBTS) {
478 mbtsPosZpos, dibo->
clone(),
484 mbtsNegLayers->push_back(mbtsNegLayer);
485 mbtsPosLayers->push_back(mbtsPosLayer);
493 keyDim[0].
first, 0.5 * (keyDim.back().second - keyDim[0].second));
498 lArG1P, lArG1Bounds, lArSectorInnerGapMaterial, mbtsPosLayers.release(),
499 "Calo::GapVolumes::LAr::PositiveSectorInnerGap");
504 lArG1N, lArG1Bounds->
clone(), lArSectorInnerGapMaterial,
505 mbtsNegLayers.release(),
"Calo::GapVolumes::LAr::NegativeSectorInnerGap");
509 if (innerGapBP.first) {
510 std::vector<Trk::TrackingVolume*> volsInnerGap;
511 volsInnerGap.push_back(innerGapBP.first);
512 volsInnerGap.push_back(lArPositiveSectorInnerGap);
513 positiveInnerGap = m_trackingVolumeCreator->createContainerTrackingVolume(
514 volsInnerGap, m_caloMaterial,
"Calo::Container::PositiveInnerGap");
516 positiveInnerGap = lArPositiveSectorInnerGap;
519 if (innerGapBP.second) {
520 std::vector<Trk::TrackingVolume*> volsInnerGap;
521 volsInnerGap.push_back(innerGapBP.second);
522 volsInnerGap.push_back(lArNegativeSectorInnerGap);
523 negativeInnerGap = m_trackingVolumeCreator->createContainerTrackingVolume(
524 volsInnerGap, m_caloMaterial,
"Calo::Container::NegativeInnerGap");
526 negativeInnerGap = lArNegativeSectorInnerGap;
529 std::vector<Trk::TrackingVolume*> inBufferVolumes;
530 inBufferVolumes.push_back(negativeInnerGap);
531 inBufferVolumes.push_back(innerVol);
532 inBufferVolumes.push_back(positiveInnerGap);
535 m_trackingVolumeCreator->createContainerTrackingVolume(
536 inBufferVolumes, m_caloMaterial,
537 "Calo::Container::EnclosedInnerDetector");
544 float rEndcapBP = 0.;
545 std::pair<Trk::TrackingVolume*, Trk::TrackingVolume*> endcapBP =
546 createBeamPipeVolumes(bpCutouts, keyDim.back().second,
547 lArPositiveEndcap->
center().z() +
549 "Endcap", rEndcapBP);
573 ecpPos, ecpUpBounds, m_Al, dummyLayers, dummyVolumes,
574 "Calo::GapVolumes::LAr::PositiveECPresamplerCover");
576 ecpNeg, ecpUpBounds->
clone(), m_Al, dummyLayers, dummyVolumes,
577 "Calo::GapVolumes::LAr::NegativeECPresamplerCover");
580 dummyVolumes,
"Calo::GapVolumes::LAr::PositiveECPresamplerInner");
583 dummyVolumes,
"Calo::GapVolumes::LAr::NegativeECPresamplerInner");
586 std::vector<Trk::TrackingVolume*> volsECP;
587 volsECP.push_back(ecPresamplerInnerPos);
588 volsECP.push_back(lArPosECPresampler);
589 volsECP.push_back(ecPresamplerCoverPos);
591 m_trackingVolumeCreator->createContainerTrackingVolume(
592 volsECP, m_caloMaterial,
"Calo::Container::PositiveECPresamplerR");
593 std::vector<Trk::TrackingVolume*> volsECN;
594 volsECN.push_back(ecPresamplerInnerNeg);
595 volsECN.push_back(lArNegECPresampler);
596 volsECN.push_back(ecPresamplerCoverNeg);
598 m_trackingVolumeCreator->createContainerTrackingVolume(
599 volsECN, m_caloMaterial,
"Calo::Container::NegativeECPresamplerR");
602 z = lArPosECPresampler->
center().z() - ecpHz;
603 float z1 = lArPosECPresampler->
center().z() + ecpHz;
611 rEndcapBP, keyDim.back().first, 0.5 * (
z - keyDim.back().second));
617 rEndcapBP, keyDim.back().first, 0.5 * (z2 - z1));
620 ecIPos, ecpIBounds, m_Ar, dummyLayers, dummyVolumes,
621 "Calo::GapVolumes::LAr::PositiveECPresamplerIn");
623 ecINeg, ecpIBounds->
clone(), m_Ar, dummyLayers, dummyVolumes,
624 "Calo::GapVolumes::LAr::NegativeECPresamplerIn");
626 ecOPos, ecpOBounds, m_Ar, dummyLayers, dummyVolumes,
627 "Calo::GapVolumes::LAr::PositiveECPresamplerOut");
629 ecONeg, ecpOBounds->
clone(), m_Ar, dummyLayers, dummyVolumes,
630 "Calo::GapVolumes::LAr::NegativeECPresamplerOut");
633 std::vector<Trk::TrackingVolume*> volECP;
634 volECP.push_back(ecPresamplerInPos);
635 volECP.push_back(positiveECP);
636 volECP.push_back(ecPresamplerOutPos);
638 m_trackingVolumeCreator->createContainerTrackingVolume(
639 volECP, m_caloMaterial,
"Calo::Container::PositiveECPresampler");
640 std::vector<Trk::TrackingVolume*> volECN;
641 volECN.push_back(ecPresamplerOutNeg);
642 volECN.push_back(negativeECP);
643 volECN.push_back(ecPresamplerInNeg);
645 m_trackingVolumeCreator->createContainerTrackingVolume(
646 volECN, m_caloMaterial,
"Calo::Container::NegativeECPresampler");
664 ecPos, ecUpBounds, m_Ar, dummyLayers, dummyVolumes,
665 "Calo::GapVolumes::LAr::PositiveEndcapCover");
667 ecNeg, ecUpBounds->
clone(), m_Ar, dummyLayers, dummyVolumes,
668 "Calo::GapVolumes::LAr::NegativeEndcapCover");
671 dummyVolumes,
"Calo::GapVolumes::LAr::PositiveEndcapInner");
674 dummyVolumes,
"Calo::GapVolumes::LAr::NegativeEndcapInner");
677 std::vector<Trk::TrackingVolume*> volsEC;
678 volsEC.push_back(ecInnerPos);
679 volsEC.push_back(lArPositiveEndcap);
680 volsEC.push_back(ecCoverPos);
682 m_trackingVolumeCreator->createContainerTrackingVolume(
683 volsEC, m_caloMaterial,
"Calo::Container::PositiveEndcapR");
684 std::vector<Trk::TrackingVolume*> volsEN;
685 volsEN.push_back(ecInnerNeg);
686 volsEN.push_back(lArNegativeEndcap);
687 volsEN.push_back(ecCoverNeg);
689 m_trackingVolumeCreator->createContainerTrackingVolume(
690 volsEN, m_caloMaterial,
"Calo::Container::NegativeEndcapR");
693 std::vector<Trk::TrackingVolume*> volEEP;
694 volEEP.push_back(positiveEP);
695 volEEP.push_back(positiveEC);
697 m_trackingVolumeCreator->createContainerTrackingVolume(
698 volEEP, m_caloMaterial,
"Calo::Container::PositiveEMEC");
699 std::vector<Trk::TrackingVolume*> volEEN;
700 volEEN.push_back(negativeEC);
701 volEEN.push_back(negativeEP);
703 m_trackingVolumeCreator->createContainerTrackingVolume(
704 volEEN, m_caloMaterial,
"Calo::Container::NegativeEMEC");
708 std::vector<Trk::TrackingVolume*> volsEndcapPos;
710 volsEndcapPos.push_back(endcapBP.first);
711 volsEndcapPos.push_back(positiveEEP);
713 std::unique_ptr<Trk::TrackingVolume> positiveEndcap(
714 m_trackingVolumeCreator->createContainerTrackingVolume(
715 volsEndcapPos, m_caloMaterial,
"Calo::Container::PositiveEndcap"));
717 std::vector<Trk::TrackingVolume*> volsEndcapNeg;
719 volsEndcapNeg.push_back(endcapBP.second);
720 volsEndcapNeg.push_back(negativeEEP);
722 std::unique_ptr<Trk::TrackingVolume> negativeEndcap(
723 m_trackingVolumeCreator->createContainerTrackingVolume(
724 volsEndcapNeg, m_caloMaterial,
"Calo::Container::NegativeEndcap"));
730 std::pair<Trk::TrackingVolume*, Trk::TrackingVolume*> hecBP =
731 createBeamPipeVolumes(
751 lArHecPos, lArHecInnerGapBounds, m_Al, dummyLayers, dummyVolumes,
752 "Calo::GapVolumes::LAr::PositiveHecInnerGap");
755 lArHecNeg, lArHecInnerGapBounds->
clone(), m_Al, dummyLayers, dummyVolumes,
756 "Calo::GapVolumes::LAr::NegativeHecInnerGap");
765 dummyVolumes,
"Calo::GapVolumes::LAr::PositiveHecOuterGap");
769 dummyLayers, dummyVolumes,
"Calo::GapVolumes::LAr::NegativeHecOuterGap");
773 std::vector<Trk::TrackingVolume*> volsHecPos;
775 volsHecPos.push_back(hecBP.first);
776 volsHecPos.push_back(lArPositiveHecInnerGap);
777 volsHecPos.push_back(lArPositiveHec);
778 volsHecPos.push_back(lArPositiveHecOuterGap);
780 std::unique_ptr<Trk::TrackingVolume> positiveHec(
781 m_trackingVolumeCreator->createContainerTrackingVolume(
782 volsHecPos, m_caloMaterial,
"Calo::Container::PositiveHec"));
784 std::vector<Trk::TrackingVolume*> volsHecNeg;
786 volsHecNeg.push_back(hecBP.second);
787 volsHecNeg.push_back(lArNegativeHecInnerGap);
788 volsHecNeg.push_back(lArNegativeHec);
789 volsHecNeg.push_back(lArNegativeHecOuterGap);
791 std::unique_ptr<Trk::TrackingVolume> negativeHec(
792 m_trackingVolumeCreator->createContainerTrackingVolume(
793 volsHecNeg, m_caloMaterial,
"Calo::Container::NegativeHec"));
800 std::pair<Trk::TrackingVolume*, Trk::TrackingVolume*> fcalBP =
801 createBeamPipeVolumes(
810 if (rFcalBP > lArPositiveFcalBounds->
innerRadius()) {
812 << rFcalBP <<
">" << lArPositiveFcalBounds->
innerRadius()
829 lArFcalPos, lArFcalInnerGapBounds, m_Al, dummyLayers, dummyVolumes,
830 "Calo::GapVolumes::LAr::PositiveFcalInnerGap");
833 lArFcalNeg, lArFcalInnerGapBounds->
clone(), m_Al, dummyLayers,
834 dummyVolumes,
"Calo::GapVolumes::LAr::NegativeFcalInnerGap");
844 dummyLayers, dummyVolumes,
"Calo::GapVolumes::LAr::PositiveFcalOuterGap");
848 dummyLayers, dummyVolumes,
"Calo::GapVolumes::LAr::NegativeFcalOuterGap");
852 std::vector<Trk::TrackingVolume*> volsFcalPos;
854 volsFcalPos.push_back(fcalBP.first);
855 volsFcalPos.push_back(lArPositiveFcalInnerGap);
856 volsFcalPos.push_back(lArPositiveFcal);
857 volsFcalPos.push_back(lArPositiveHecFcalCover);
858 volsFcalPos.push_back(lArPositiveFcalOuterGap);
860 std::unique_ptr<Trk::TrackingVolume> positiveFcal(
861 m_trackingVolumeCreator->createContainerTrackingVolume(
862 volsFcalPos, m_caloMaterial,
"Calo::Container::PositiveFcal"));
864 std::vector<Trk::TrackingVolume*> volsFcalNeg;
866 volsFcalNeg.push_back(fcalBP.second);
867 volsFcalNeg.push_back(lArNegativeFcalInnerGap);
868 volsFcalNeg.push_back(lArNegativeFcal);
869 volsFcalNeg.push_back(lArNegativeHecFcalCover);
870 volsFcalNeg.push_back(lArNegativeFcalOuterGap);
872 std::unique_ptr<Trk::TrackingVolume> negativeFcal(
873 m_trackingVolumeCreator->createContainerTrackingVolume(
874 volsFcalNeg, m_caloMaterial,
"Calo::Container::NegativeFcal"));
881 std::pair<Trk::TrackingVolume*, Trk::TrackingVolume*> outBP =
882 createBeamPipeVolumes(bpCutouts, lArPositiveOuterBoundary,
883 caloPositiveOuterBoundary,
"Outer", rOutBP);
892 0.5 * (caloPositiveOuterBoundary - lArPositiveOuterBoundary));
896 430., keyDim.back().first,
898 0.5 * (caloPositiveOuterBoundary - lArPositiveOuterBoundary));
900 z = 0.5 * (caloPositiveOuterBoundary + lArPositiveOuterBoundary);
908 lArSecOutG0P, lArSectorOuterG0Bounds, lArSectorOuterGapMat, dummyLayers,
909 dummyVolumes,
"Calo::GapVolumes::LAr::PositiveSectorOuterGap0");
912 lArSecOutG1P, lArSectorOuterG1Bounds, m_Ar, dummyLayers, dummyVolumes,
913 "Calo::GapVolumes::LAr::PositiveSectorOuterGap");
920 lArNegativeSectorOuterGap0 =
922 lArSectorOuterGapMat, dummyLayers, dummyVolumes,
923 "Calo::GapVolumes::LAr::NegativeSectorOuterGap0");
926 lArSecOutG1N, lArSectorOuterG1Bounds->
clone(), m_Ar, dummyLayers,
927 dummyVolumes,
"Calo::GapVolumes::LAr::NegativeSectorOuterGap");
930 std::vector<Trk::TrackingVolume*> volsOuterGapP;
932 volsOuterGapP.push_back(outBP.first);
933 volsOuterGapP.push_back(lArPositiveSectorOuterGap0);
934 volsOuterGapP.push_back(lArPositiveSectorOuterGap);
935 std::unique_ptr<Trk::TrackingVolume> positiveOuterGap(
936 m_trackingVolumeCreator->createContainerTrackingVolume(
937 volsOuterGapP, m_caloMaterial,
"Calo::Container::PositiveOuterGap"));
939 std::vector<Trk::TrackingVolume*> volsOuterGapN;
941 volsOuterGapN.push_back(outBP.second);
942 volsOuterGapN.push_back(lArNegativeSectorOuterGap0);
943 volsOuterGapN.push_back(lArNegativeSectorOuterGap);
944 std::unique_ptr<Trk::TrackingVolume> negativeOuterGap(
945 m_trackingVolumeCreator->createContainerTrackingVolume(
946 volsOuterGapN, m_caloMaterial,
"Calo::Container::NegativeOuterGap"));
953 std::vector<Trk::TrackingVolume*> lArNegativeSectorVolumes;
955 lArNegativeSectorVolumes.push_back(negativeOuterGap.release());
957 lArNegativeSectorVolumes.push_back(negativeFcal.release());
959 lArNegativeSectorVolumes.push_back(negativeHec.release());
961 lArNegativeSectorVolumes.push_back(negativeEndcap.release());
963 lArNegativeSector = m_trackingVolumeCreator->createContainerTrackingVolume(
964 lArNegativeSectorVolumes, m_caloMaterial,
965 "Calo::LAr::Container::NegativeSector");
970 std::vector<Trk::TrackingVolume*> lArPositiveSectorVolumes;
972 lArPositiveSectorVolumes.push_back(positiveEndcap.release());
974 lArPositiveSectorVolumes.push_back(positiveHec.release());
976 lArPositiveSectorVolumes.push_back(positiveFcal.release());
978 lArPositiveSectorVolumes.push_back(positiveOuterGap.release());
980 lArPositiveSector = m_trackingVolumeCreator->createContainerTrackingVolume(
981 lArPositiveSectorVolumes, m_caloMaterial,
982 "Calo::LAr::Container::PositiveSector");
997 dummyVolumes,
"Calo::GapVolumes::SolenoidGap");
1005 nullptr, lArTileCentralG1Bounds, m_Ar, dummyLayers, dummyVolumes,
1006 "Calo::GapVolumes::LArTileCentralSectorGap");
1010 std::vector<Trk::TrackingVolume*> lArCentralBarrelSectorVolumes;
1012 lArCentralBarrelSectorVolumes.push_back(trtSolenoidGap);
1014 lArCentralBarrelSectorVolumes.push_back(solenoid);
1016 lArCentralBarrelSectorVolumes.push_back(solenoidlArPresamplerGap);
1018 lArCentralBarrelSectorVolumes.push_back(lArBarrelPresampler);
1020 lArCentralBarrelSectorVolumes.push_back(lArBarrel);
1022 lArCentralBarrelSectorVolumes.push_back(lArTileCentralSectorGap);
1024 lArCentralBarrelSector =
1025 m_trackingVolumeCreator->createContainerTrackingVolume(
1026 lArCentralBarrelSectorVolumes, m_caloMaterial,
1027 "Calo::Containers::LAr::CentralBarrelSector",
false,
true);
1033 std::vector<Trk::IdentifiedMaterial> matCrack;
1036 matCrack.emplace_back(&m_Scint, baseID);
1037 matCrack.emplace_back(&m_caloMaterial, -1);
1038 matCrack.emplace_back(&m_Al, -1);
1049 std::vector<std::vector<size_t>> indexP;
1050 std::vector<std::vector<size_t>> indexN;
1052 std::vector<Trk::BinUtility*> layDN(bun->
bins());
1053 std::vector<Trk::BinUtility*> layUP(bup->
bins());
1054 double crackZ1 = 3532.;
1055 double crackZ2 = 3540.;
1057 std::vector<float>
steps;
1058 for (
unsigned int i = 0;
i < bup->
bins();
i++) {
1060 std::vector<size_t> indx;
1062 steps.push_back(crackZ1);
1063 indx.push_back(i < bup->
bins() - 1 ? 0 : 1);
1064 steps.push_back(crackZ2);
1066 steps.push_back(keyDim.back().second);
1069 indexP.push_back(indx);
1079 0.5 * (keyDim.back().second - crackZ1));
1080 z = 0.5 * (keyDim.back().second + crackZ1);
1085 crackPosTransform, align, crackBoundsPos, crackBinPos, 17,
1086 "Calo::Detectors::Tile::CrackPos");
1088 for (
unsigned int i = 0;
i < bun->
bins();
i++) {
1090 std::vector<size_t> indx;
1092 steps.push_back(-keyDim.back().second);
1094 steps.push_back(-crackZ2);
1095 indx.push_back(
i > 0 ? 0 : 1);
1096 steps.push_back(-crackZ1);
1099 indexN.push_back(indx);
1111 crackNegTransform, align, crackBoundsPos->
clone(), crackBinNeg, 17,
1112 "Calo::Detectors::Tile::CrackNeg");
1117 0.5 * (crackZ1 - lArBarrelBounds->
halflengthZ()));
1124 lArCentralG1P, lArCentralG1Bounds, m_Ar, dummyLayers, dummyVolumes,
1125 "Calo::GapVolumes::LArCentralPositiveGap");
1131 lArCentralG1N, lArCentralG1Bounds->
clone(), m_Ar, dummyLayers,
1132 dummyVolumes,
"Calo::GapVolumes::LArCentralNegativeGap");
1137 std::vector<Trk::TrackingVolume*> lArCentralSectorVolumes;
1139 lArCentralSectorVolumes.push_back(crackNeg);
1141 lArCentralSectorVolumes.push_back(lArCentralNegativeGap);
1143 lArCentralSectorVolumes.push_back(lArCentralBarrelSector);
1145 lArCentralSectorVolumes.push_back(lArCentralPositiveGap);
1147 lArCentralSectorVolumes.push_back(crackPos);
1149 lArCentralSector = m_trackingVolumeCreator->createContainerTrackingVolume(
1150 lArCentralSectorVolumes, m_caloMaterial,
1151 "Calo::Containers::LAr::CentralSector");
1156 std::vector<Trk::TrackingVolume*> caloCentralSectorVolumes;
1158 caloCentralSectorVolumes.push_back(inDetEnclosed);
1160 caloCentralSectorVolumes.push_back(lArCentralSector);
1162 caloCentralSector = m_trackingVolumeCreator->createContainerTrackingVolume(
1163 caloCentralSectorVolumes, m_caloMaterial,
1164 "Calo::Containers::CaloCentralSector");
1171 std::vector<Trk::TrackingVolume*> lArCombinedVolumes;
1173 lArCombinedVolumes.push_back(lArNegativeSector);
1175 lArCombinedVolumes.push_back(caloCentralSector);
1177 lArCombinedVolumes.push_back(lArPositiveSector);
1179 lArCombined = m_trackingVolumeCreator->createContainerTrackingVolume(
1180 lArCombinedVolumes, m_caloMaterial,
"Calo::Containers::LAr::Combined");
1185 std::vector<Trk::TrackingVolume*> caloVolumes;
1187 caloVolumes.push_back(lArCombined);
1189 caloVolumes.push_back(tileCombined);
1191 caloCombined = m_trackingVolumeCreator->createContainerTrackingVolume(
1192 caloVolumes, m_caloMaterial,
"Calo::Containers::CombinedCalo");
1202 if (caloVolsOuterRadius > caloDefaultRadius) {
1204 "Calo volumes exceeds envelope radius: adjusting envelope "
1205 "(de-synchronizing...)");
1206 caloDefaultRadius = caloVolsOuterRadius;
1209 if (caloVolsOuterRadius < caloDefaultRadius) {
1211 "Build radial buffer to synchronize the boundaries in between R "
1212 << caloVolsOuterRadius <<
" and " << caloDefaultRadius);
1215 caloVolsOuterRadius, caloDefaultRadius, caloVolsExtendZ);
1217 nullptr, centralSynBounds, m_caloMaterial, dummyLayers, dummyVolumes,
1218 "Calo::GapVolumes::EnvelopeBuffer");
1221 if (caloVolsExtendZ < caloDefaultHalflengthZ) {
1223 "Build longitudinal buffers to synchronize the boundaries in between Z "
1224 << caloVolsExtendZ <<
" and " << caloDefaultHalflengthZ);
1227 0., caloDefaultRadius,
1228 0.5 * (caloDefaultHalflengthZ - caloVolsExtendZ));
1231 0.0053 *
pow(0.38, 3));
1233 float zPos = 0.5 * (caloDefaultHalflengthZ + caloVolsExtendZ);
1236 endcapSynBounds, m_Ar, dummyLayers, dummyVolumes,
1237 "Calo::GapVolumes::PosECBuffer");
1241 endcapSynBounds->
clone(), m_Ar, dummyLayers, dummyVolumes,
1242 "Calo::GapVolumes::NegECBuffer");
1246 "All gap volumes for the Calorimeter created. Starting to build Volume "
1255 std::vector<float> zCutStep;
1256 std::vector<float> rCutStep;
1257 if (msCutouts.size() > 1) {
1258 zCutStep.push_back(msCutouts[0].
second);
1259 rCutStep.push_back(msCutouts[0].
first);
1260 for (
unsigned int i = 1;
i < msCutouts.size();
i++) {
1261 if (msCutouts[
i].
second == zCutStep.back())
1262 rCutStep.push_back(msCutouts[
i].
first);
1264 zCutStep.push_back(msCutouts[
i].
second);
1266 nCutVol = zCutStep.size() - 1;
1271 std::vector<Trk::TrackingVolume*> forwardCutoutVols;
1272 std::vector<Trk::TrackingVolume*> backwardCutoutVols;
1275 std::vector<Trk::Material> cutOutMat;
1276 cutOutMat.emplace_back(19.9, 213., 50., 23.,
1278 cutOutMat.push_back(m_caloMaterial);
1284 float rout = rCutStep[0];
1285 float zlow = zCutStep[0];
1286 for (
unsigned int i = 1;
i < zCutStep.size();
i++) {
1287 float zup = zCutStep[
i];
1288 float rcut = rCutStep[
i];
1289 std::stringstream
ss;
1292 float rCutOutBP = 0.;
1293 std::pair<Trk::TrackingVolume*, Trk::TrackingVolume*> cutOutBP =
1294 createBeamPipeVolumes(bpCutouts, zlow, zup,
"CutOuts" +
ss.str(),
1298 unsigned int mindex =
i > 1 ? 1 :
i;
1305 cutInBounds, cutOutMat[mindex], dummyLayers, dummyVolumes,
1306 "Calo::GapVolumes::CaloPositiveCutIn" +
ss.str());
1310 cutInBounds->
clone(), cutOutMat[mindex], dummyLayers, dummyVolumes,
1311 "Calo::GapVolumes::CaloNegativeCutIn" +
ss.str());
1319 cutOutBounds, m_caloMaterial, dummyLayers, dummyVolumes,
1320 "Muon::GapVolumes::CaloPositiveCutOut" +
ss.str());
1324 cutOutBounds->
clone(), m_caloMaterial, dummyLayers, dummyVolumes,
1325 "Muon::GapVolumes::CaloNegativeCutOut" +
ss.str());
1332 std::vector<Trk::TrackingVolume*> cvPos;
1333 cvPos.push_back(cutOutBP.first);
1334 cvPos.push_back(caloInPos);
1335 cvPos.push_back(caloOutPos);
1337 m_trackingVolumeCreator->createContainerTrackingVolume(
1338 cvPos, m_caloMaterial,
1339 "Calo::GapVolumes::CaloPositiveCutoutVolume" +
ss.str());
1340 forwardCutoutVols.push_back(cutOutPos);
1342 std::vector<Trk::TrackingVolume*> cvNeg;
1343 cvNeg.push_back(cutOutBP.second);
1344 cvNeg.push_back(caloInNeg);
1345 cvNeg.push_back(caloOutNeg);
1347 m_trackingVolumeCreator->createContainerTrackingVolume(
1348 cvNeg, m_caloMaterial,
1349 "Calo::GapVolumes::CaloNegativeCutoutVolume" +
ss.str());
1350 backwardCutoutVols.insert(backwardCutoutVols.begin(), cutOutNeg);
1358 if (!centralBuffer) {
1360 calorimeter = caloCombined;
1364 std::vector<Trk::TrackingVolume*> envRVols;
1365 envRVols.push_back(caloCombined);
1366 envRVols.push_back(centralBuffer);
1369 if (!forwardCutoutVols.empty() || ecNegBuffer) {
1372 m_trackingVolumeCreator->createContainerTrackingVolume(
1373 envRVols, m_caloMaterial,
"Calo::Containers::CombinedRCalo");
1374 std::vector<Trk::TrackingVolume*> envZVols;
1375 envZVols.reserve(backwardCutoutVols.size());
1376 for (
auto& backwardCutoutVol : backwardCutoutVols)
1377 envZVols.push_back(backwardCutoutVol);
1379 envZVols.push_back(ecNegBuffer);
1380 envZVols.push_back(caloRVolume);
1382 envZVols.push_back(ecPosBuffer);
1383 for (
auto& forwardCutoutVol : forwardCutoutVols)
1384 envZVols.push_back(forwardCutoutVol);
1386 calorimeter = m_trackingVolumeCreator->createContainerTrackingVolume(
1387 envZVols, m_caloMaterial, m_exitVolume);
1391 calorimeter = m_trackingVolumeCreator->createContainerTrackingVolume(
1392 envRVols, m_caloMaterial, m_exitVolume);
1397 "TrackingVolume 'Calorimeter' built successfully. Wrap it in "
1398 "TrackingGeometry.");
1401 lArVolumes =
nullptr;
1403 tileVolumes =
nullptr;
1405 auto caloTrackingGeometry =
1406 std::make_unique<Trk::TrackingGeometry>(calorimeter);
1412 if (m_indexStaticLayers && caloTrackingGeometry){
1413 caloTrackingGeometry->indexStaticLayers(signature());
1416 return caloTrackingGeometry;
1425 << vol.
volumeName() <<
"' in LayerIndex/CaloCell_ID map");
1429 if (!confinedLayers)
1435 layerObjects.begin();
1440 std::vector<const Trk::Layer*> materialLayers;
1441 for (; layerObjIter != layerObjEnd; ++layerObjIter)
1442 if ((*layerObjIter)->layerMaterialProperties())
1443 materialLayers.push_back((*layerObjIter));
1445 unsigned int matLaySize = materialLayers.size();
1446 unsigned int ccidSize = ccid.size();
1449 << ccidSize <<
" CaloSample ids )");
1450 if (matLaySize != ccidSize)
1461 for (; layerIt != layerItEnd && ccidIt != ccidItEnd; ++layerIt, ++ccidIt)
1462 licsMap.insert(std::make_pair((*layerIt)->layerIndex(),
int(*ccidIt)));
1471 for (; ccidIt != ccidItEnd; ++ccidIt, --matLaySize)
1472 licsMap.insert(std::make_pair(
1473 (materialLayers[matLaySize - 1])->layerIndex(),
int(*ccidIt)));
1477 std::pair<Trk::TrackingVolume*, Trk::TrackingVolume*>
1480 const std::string&
name,
float& outerRadius)
const {
1488 if (bpCutouts.empty()) {
1489 return std::pair<Trk::TrackingVolume*, Trk::TrackingVolume*>(0, 0);
1494 float rOut = bpCutouts[0].first;
1495 for (
const auto& bpCutout : bpCutouts) {
1496 if (bpCutout.second <=
dim[0].second)
1497 dim[0].first = bpCutout.first;
1498 else if (bpCutout.second <=
zmax)
1499 dim.push_back(bpCutout);
1500 if (bpCutout.second <=
zmax)
1501 rOut = bpCutout.first;
1507 if (
dim.size() == 2) {
1509 outerRadius =
dim[0].first;
1519 dummyVolumes,
"BeamPipe::Positive" +
name);
1525 bpNeg, bpBounds->
clone(), m_caloMaterial, dummyLayers, dummyVolumes,
1526 "BeamPipe::Negative" +
name);
1532 return std::pair<Trk::TrackingVolume*, Trk::TrackingVolume*>(bpVolPos,
1538 outerRadius =
dim[0].first;
1541 for (
unsigned int i = 1;
i <
dim.size();
i++)
1543 outerRadius =
dim[
i].first;
1546 std::vector<Trk::TrackingVolume*> posVols;
1548 for (
unsigned int i = 0;
i <
dim.size() - 1;
i++) {
1562 dummyVolumes,
"BeamPipe::Positive" +
name);
1574 dummyLayers, dummyVolumes,
1575 "Calo::GapVolumes::Positive" +
name);
1581 std::vector<Trk::TrackingVolume*> gapVols;
1582 gapVols.push_back(bpVolPos);
1583 gapVols.push_back(bpVolGap);
1584 bpSector = m_trackingVolumeCreator->createContainerTrackingVolume(
1585 gapVols, m_caloMaterial,
"Calo::Container::PositiveBPSector" +
name);
1587 posVols.push_back(bpSector);
1591 m_trackingVolumeCreator->createContainerTrackingVolume(
1592 posVols, m_caloMaterial,
"Calo::Container::PositiveBP" +
name);
1595 std::vector<Trk::TrackingVolume*> negVols;
1597 for (
unsigned int i = 0;
i <
dim.size() - 1;
i++) {
1599 float zmax2 = -1. * (
dim[
i].second);
1600 float zmin2 = -1. * (
dim[
i + 1].second);
1614 dummyVolumes,
"BeamPipe::Negative" +
name);
1618 dim[
i].first < outerRadius
1622 0.5 * (zmax2 - zmin2)),
1623 m_caloMaterial, dummyLayers, dummyVolumes,
1624 "Calo::GapVolumes::Negative" +
name)
1630 std::vector<Trk::TrackingVolume*> gapVols;
1631 gapVols.push_back(bpVolNeg);
1632 gapVols.push_back(bpVolGap);
1633 bpSector = m_trackingVolumeCreator->createContainerTrackingVolume(
1634 gapVols, m_caloMaterial,
"Calo::Container::NegativeBPSector" +
name);
1637 if (negVols.empty())
1638 negVols.push_back(bpSector);
1640 negVols.insert(negVols.begin(), bpSector);
1644 m_trackingVolumeCreator->createContainerTrackingVolume(
1645 negVols, m_caloMaterial,
"Calo::Container::NegativeBP" +
name);
1647 return std::pair<Trk::TrackingVolume*, Trk::TrackingVolume*>(bpPosSector,