Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:17

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/Detector/ProtoBinning.hpp"
0012 #include "Acts/Geometry/Extent.hpp"
0013 #include "Acts/Material/ProtoSurfaceMaterial.hpp"
0014 #include "Acts/Surfaces/Surface.hpp"
0015 
0016 Acts::Experimental::BinningDescription
0017 Acts::Experimental::detail::ProtoMaterialHelper::attachProtoMaterial(
0018     const GeometryContext& gctx, Surface& surface,
0019     const BinningDescription& bDescription) {
0020   // The binning description, with eventually fixed range
0021   BinningDescription fbDescription;
0022   // Measure the surface
0023   Extent sExtent = surface.polyhedronRepresentation(gctx, 1).extent();
0024   for (const auto& b : bDescription.binning) {
0025     ProtoBinning fBinning = b;
0026     // Check if the binning needs to be fixed
0027     if (fBinning.autorange) {
0028       auto range = sExtent.range(b.axisDir);
0029       fBinning = ProtoBinning(b.axisDir, b.boundaryType, range.min(),
0030                               range.max(), b.bins(), b.expansion);
0031     }
0032     fbDescription.binning.push_back(fBinning);
0033   }
0034   // Create the new proto material description and assign it
0035   auto protoMaterial =
0036       std::make_shared<ProtoGridSurfaceMaterial>(fbDescription);
0037   surface.assignSurfaceMaterial(protoMaterial);
0038   // Return the (fixed) binning description
0039   return fbDescription;
0040 }