64 std::vector<std::unique_ptr<Acts::Volume>>
cells;
71 std::vector<std::unique_ptr<Box>> boxStore;
72 std::vector<Box*> prims;
75 std::make_unique<Box>(
cell->boundingBox({0.1, 0.1, 0.1})));
76 prims.push_back(boxStore.back().get());
84 std::shared_ptr<Acts::CutoutCylinderVolumeBounds> caloVolBounds
95 std::vector<std::unique_ptr<const Acts::Volume>> cellVols;
96 cellVols.reserve(
cells.size());
98 std::unique_ptr<const Acts::Volume>
up;
100 up = std::unique_ptr<const Acts::Volume>(
dynamic_cast<const Acts::Volume*
>(
cell.release()));
101 cellVols.push_back(std::move(
up));
106 throw std::runtime_error{
"Calo building for ACTS currently disabled"};
107 std::shared_ptr<Acts::TrackingVolume> calo;
117 std::shared_ptr<Acts::TrackingVolume> mutInsideVolume
118 = std::const_pointer_cast<Acts::TrackingVolume>(insideVolume);
119 auto idBounds =
dynamic_cast<const Acts::CylinderVolumeBounds*
>(&insideVolume->volumeBounds());
120 if (idBounds ==
nullptr) {
121 ATH_MSG_ERROR(
"Unable to dynamic cast volume bounds to Acts::CylinderVolumeBounds");
122 throw std::runtime_error(
"Error casting to CylinderVolumeBounds");
128 auto trackingVolumeArrayCreator
129 = std::make_shared<const Acts::TrackingVolumeArrayCreator>(
130 Acts::TrackingVolumeArrayCreator::Config{},
132 Acts::CylinderVolumeHelper::Config cvhCfg;
133 cvhCfg.trackingVolumeArrayCreator = trackingVolumeArrayCreator;
134 Acts::CylinderVolumeHelper cvh(cvhCfg,
makeActsAthenaLogger(
this, std::string(
"ACaloTrkVB"), std::string(
"CylVolHlp")));
136 std::vector<double> lPos = {};
137 std::vector<std::shared_ptr<Acts::TrackingVolume>> noVolumes;
141 auto idGapPosXY = cvh.createGapTrackingVolume(gctx,
144 idBounds->get(CVBBV::eMinR),
145 idBounds->get(CVBBV::eMaxR),
146 idBounds->get(CVBBV::eHalfLengthZ),
147 caloVolBounds->get(CCVBBV::eHalfLengthZcutout),
153 auto idGapNegXY = cvh.createGapTrackingVolume(gctx,
156 idBounds->get(CVBBV::eMinR),
157 idBounds->get(CVBBV::eMaxR),
158 -caloVolBounds->get(CCVBBV::eHalfLengthZcutout),
159 -idBounds->get(CVBBV::eHalfLengthZ),
165 auto idGapCylOuter = cvh.createGapTrackingVolume(gctx,
168 idBounds->get(CVBBV::eMaxR),
169 caloVolBounds->get(CCVBBV::eMedR),
170 -caloVolBounds->get(CCVBBV::eHalfLengthZcutout),
171 +caloVolBounds->get(CCVBBV::eHalfLengthZcutout),
177 ATH_MSG_VERBOSE(
"Create container volume to contain ID and gap volumes");
178 auto idContainerZ = cvh.createContainerTrackingVolume(gctx, {idGapNegXY, mutInsideVolume, idGapPosXY});
179 auto idContainer = cvh.createContainerTrackingVolume(gctx, {idContainerZ, idGapCylOuter});
184 const Acts::GlueVolumesDescriptor& gvd
185 = idContainer->glueVolumesDescriptor();
190 std::cout <<
"POSITIVE: " << std::endl;
191 for(
const auto& subvol : tVolArrPos->arrayObjects()) {
192 std::cout << subvol->volumeName() << std::endl;
193 std::cout << *subvol << std::endl;
196 std::cout <<
"NEGATIVE: " << std::endl;
197 for(
const auto& subvol : tVolArrNeg->arrayObjects()) {
198 std::cout << subvol->volumeName() << std::endl;
199 std::cout << *subvol << std::endl;
202 using BoundarySurface = Acts::BoundarySurfaceT<Acts::TrackingVolume>;
208 ATH_MSG_VERBOSE(
"Glueing " << calo->volumeName() <<
" inner cover to " << idOutVolArray->arrayObjects().size() <<
" volumes");
210 ->attachVolumeArray(idOutVolArray, Acts::Direction::Backward);
212 for(
const auto& idVol : idOutVolArray->arrayObjects()){
214 <<
" to inner cover of " << calo->volumeName());
216 ->attachVolume(calo.get(), Acts::Direction::Forward);
222 ATH_MSG_VERBOSE(
"Glueing " << calo->volumeName() <<
" positive inner cutout disc to "
223 << idPosXYVolArray->arrayObjects().size() <<
" volumes");
224 std::const_pointer_cast<BoundarySurface>(calo->boundarySurfaces().at(
Acts::index5))
225 ->attachVolumeArray(idPosXYVolArray, Acts::Direction::Backward);
227 for(
const auto& idVol : idPosXYVolArray->arrayObjects()){
229 <<
" to positive inner coutout disc of " << calo->volumeName());
231 ->attachVolume(calo.get(), Acts::Direction::Forward);
237 ATH_MSG_VERBOSE(
"Glueing " << calo->volumeName() <<
" negative inner cutout disc to "
238 << idNegXYVolArray->arrayObjects().size() <<
" volumes");
239 std::const_pointer_cast<BoundarySurface>(calo->boundarySurfaces().at(
Acts::index4))
240 ->attachVolumeArray(idNegXYVolArray, Acts::Direction::Forward);
242 for(
const auto& idVol : idNegXYVolArray->arrayObjects()){
244 <<
" to negative inner coutout disc of " << calo->volumeName());
246 ->attachVolume(calo.get(), Acts::Direction::Backward);
256 double caloRMin = caloVolBounds->get(CCVBBV::eMinR);
257 double caloRMed = caloVolBounds->get(CCVBBV::eMedR);
258 double caloRMax = caloVolBounds->get(CCVBBV::eMaxR);
259 double caloDZ1 = caloVolBounds->get(CCVBBV::eHalfLengthZ);
260 double caloDZ2 = caloVolBounds->get(CCVBBV::eHalfLengthZcutout);
262 Acts::Vector3 caloChokeRPos
263 = {caloRMin + (caloRMax - caloRMin)/2., 0, 0};
265 std::vector<Acts::TrackingVolumeOrderPosition> tVolOrdPosNeg;
266 tVolOrdPosNeg.push_back(std::make_pair(calo, caloChokeRPos));
267 std::vector<float> posNegBoundaries
269 auto binUtilityPosNeg = std::make_unique<const Acts::BinUtility>(posNegBoundaries,
273 = std::make_shared<const Acts::BinnedArrayXD<Acts::TrackingVolumePtr>>(
274 tVolOrdPosNeg, std::move(binUtilityPosNeg));
276 double chokeZOffset = caloDZ2 + (caloDZ1 - caloDZ2)/2.;
277 Acts::Transform3 posTrf(Acts::Translation3(Acts::Vector3::UnitZ() * chokeZOffset));
278 Acts::Transform3 negTrf(Acts::Translation3(Acts::Vector3::UnitZ()* -1 *chokeZOffset));
280 auto posNegCylBounds = std::make_shared<Acts::CylinderVolumeBounds>(
281 caloRMin, caloRMax, (caloDZ1 - caloDZ2) / 2.);
284 auto posContainer = std::make_shared<Acts::TrackingVolume>(
289 Acts::MutableTrackingVolumeVector{});
292 auto negContainer = std::make_shared<Acts::TrackingVolume>(
297 Acts::MutableTrackingVolumeVector{});
302 std::vector<Acts::TrackingVolumeOrderPosition> tVolOrderedCtr;
303 tVolOrderedCtr.push_back(std::make_pair(idContainer, Acts::Vector3(caloRMed / 2., 0, 0)));
304 tVolOrderedCtr.push_back(std::make_pair(calo,
305 Acts::Vector3(caloRMed +
306 (caloRMax- caloRMed) / 2., 0, 0)));
308 std::vector<float> ctrBoundaries = {0,
float(caloRMed),
float(caloRMax)};
310 = std::make_unique<const Acts::BinUtility>(
315 = std::make_shared<const Acts::BinnedArrayXD<Acts::TrackingVolumePtr>>(
316 tVolOrderedCtr, std::move(binUtilityCtr));
319 auto ctrContainer = std::make_shared<Acts::TrackingVolume>(Acts::Transform3::Identity(),
320 std::make_shared<Acts::CylinderVolumeBounds>(
321 caloRMin, caloRMax, caloDZ2),
324 Acts::MutableTrackingVolumeVector{}
328 ATH_MSG_VERBOSE(
"- containing: " << idContainer->volumeName() <<
", " << calo->volumeName());
331 Acts::TrackingVolumeArrayCreator tvac{Acts::TrackingVolumeArrayCreator::Config{}};
333 auto mainContainer = std::make_shared<Acts::TrackingVolume>(Acts::Transform3::Identity(),
334 std::make_shared<Acts::CylinderVolumeBounds>(
335 caloRMin, caloRMax, caloDZ1),
337 tvac.trackingVolumeArray(gctx, {negContainer, ctrContainer, posContainer},
339 Acts::MutableTrackingVolumeVector{}
345 return mainContainer;