Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:17:10

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2024 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file orange/g4org/PhysicalVolumeConverter.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <memory>
0011 
0012 #include "geocel/detail/LengthUnits.hh"
0013 
0014 #include "Volume.hh"
0015 
0016 class G4LogicalVolume;
0017 class G4VPhysicalVolume;
0018 
0019 namespace celeritas
0020 {
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
0050     explicit PhysicalVolumeConverter(Options options);
0051 
0052     // Default destructor
0053     ~PhysicalVolumeConverter();
0054 
0055     // Convert a physical volume
0056     result_type operator()(arg_type g4world);
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