Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-13 08:45:15

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file orange/g4org/PhysicalVolumeConverter.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <memory>
0010 
0011 #include "geocel/detail/LengthUnits.hh"
0012 
0013 #include "Volume.hh"
0014 
0015 class G4LogicalVolume;
0016 class G4VPhysicalVolume;
0017 
0018 namespace celeritas
0019 {
0020 class GeantGeoParams;
0021 namespace g4org
0022 {
0023 //---------------------------------------------------------------------------//
0024 /*!
0025  * Construct a "physical volume" and its children from a Geant4 object.
0026  *
0027  * This recurses through the physical volume. It holds a weak-pointer cache of
0028  * logical volumes already created.
0029  */
0030 class PhysicalVolumeConverter
0031 {
0032   public:
0033     //!@{
0034     //! \name Type aliases
0035     using arg_type = G4VPhysicalVolume const&;
0036     using result_type = PhysicalVolume;
0037     //!@}
0038 
0039     //! Input options for the conversion
0040     struct Options
0041     {
0042         //! Write output about volumes being converted
0043         bool verbose{false};
0044         //! Scale factor, customizable for unit testing
0045         double scale{celeritas::lengthunits::millimeter};
0046     };
0047 
0048   public:
0049     // Construct with options and parent geometry
0050     PhysicalVolumeConverter(GeantGeoParams const& geo, Options options);
0051 
0052     // Default destructor
0053     ~PhysicalVolumeConverter();
0054 
0055     // Convert a physical volume
0056     result_type operator()(arg_type vol);
0057 
0058   private:
0059     struct Data;
0060     struct Builder;
0061 
0062     // Cached data
0063     std::unique_ptr<Data> data_;
0064 };
0065 
0066 //---------------------------------------------------------------------------//
0067 }  // namespace g4org
0068 }  // namespace celeritas