Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-11 07:50:06

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Detector/detail/ProtoMaterialHelper.hpp"
0010 
0011 #include "Acts/Geometry/Extent.hpp"
0012 #include "Acts/Material/ProtoSurfaceMaterial.hpp"
0013 #include "Acts/Surfaces/Surface.hpp"
0014 
0015 std::vector<Acts::DirectedProtoAxis>
0016 Acts::Experimental::detail::ProtoMaterialHelper::attachProtoMaterial(
0017     const GeometryContext& gctx, Surface& surface,
0018     const std::vector<DirectedProtoAxis>& bDescription) {
0019   // The binning description, with eventually fixed range
0020   std::vector<DirectedProtoAxis> fbDescription;
0021   // Measure the surface
0022   Extent sExtent = surface.polyhedronRepresentation(gctx, 1).extent();
0023   for (const auto& dpAxis : bDescription) {
0024     DirectedProtoAxis fAxis(dpAxis);
0025     // Check if the binning needs to be fixed
0026     if (fAxis.isAutorange()) {
0027       auto range = sExtent.range(dpAxis.getAxisDirection());
0028       fAxis.setRange(range.min(), range.max());
0029     }
0030     fbDescription.emplace_back(fAxis);
0031   }
0032   // Create the new proto material description and assign it
0033   auto protoMaterial =
0034       std::make_shared<ProtoGridSurfaceMaterial>(fbDescription);
0035   surface.assignSurfaceMaterial(protoMaterial);
0036   // Return the (fixed) binning description
0037   return fbDescription;
0038 }