Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 09:06:12

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 namespace g4org
0021 {
0022 //---------------------------------------------------------------------------//
0023 /*!
0024  * Construct a "physical volume" and its children from a Geant4 object.
0025  *
0026  * This recurses through the physical volume. It holds a weak-pointer cache of
0027  * logical volumes already created.
0028  */
0029 class PhysicalVolumeConverter
0030 {
0031   public:
0032     //!@{
0033     //! \name Type aliases
0034     using arg_type = G4VPhysicalVolume const&;
0035     using result_type = PhysicalVolume;
0036     //!@}
0037 
0038     //! Input options for the conversion
0039     struct Options
0040     {
0041         //! Write output about volumes being converted
0042         bool verbose{false};
0043         //! Scale factor, customizable for unit testing
0044         double scale{celeritas::lengthunits::millimeter};
0045     };
0046 
0047   public:
0048     // Construct with options
0049     explicit PhysicalVolumeConverter(Options options);
0050 
0051     // Default destructor
0052     ~PhysicalVolumeConverter();
0053 
0054     // Convert a physical volume
0055     result_type operator()(arg_type g4world);
0056 
0057   private:
0058     struct Data;
0059     struct Builder;
0060 
0061     // Cached data
0062     std::unique_ptr<Data> data_;
0063 };
0064 
0065 //---------------------------------------------------------------------------//
0066 }  // namespace g4org
0067 }  // namespace celeritas