Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-07 10:01:38

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 celeritas/ext/GeantVolumeMapper.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <vector>
0010 
0011 #include "corecel/Config.hh"
0012 
0013 #include "corecel/io/Label.hh"
0014 #include "geocel/GeoParamsInterface.hh"
0015 #include "celeritas/Types.hh"
0016 
0017 // Geant4 forward declaration
0018 class G4LogicalVolume;  // IWYU pragma: keep
0019 
0020 namespace celeritas
0021 {
0022 //---------------------------------------------------------------------------//
0023 /*!
0024  * Map a Geant4 logical volume to a Celeritas volume ID.
0025  */
0026 class GeantVolumeMapper
0027 {
0028   public:
0029     // Convert to target geometry from geant4 transportation world
0030     explicit GeantVolumeMapper(GeoParamsInterface const& tgt);
0031 
0032     // Convert a volume; null if not found; warn if inexact match
0033     VolumeId operator()(G4LogicalVolume const&);
0034 
0035   private:
0036     GeoParamsInterface const& geo_;
0037     std::vector<Label> labels_;
0038 };
0039 
0040 #if !CELERITAS_USE_GEANT4
0041 inline GeantVolumeMapper::GeantVolumeMapper(GeoParamsInterface const& geo)
0042     : geo_{geo}
0043 {
0044     CELER_DISCARD(labels_);
0045     CELER_DISCARD(geo_);
0046     CELER_NOT_CONFIGURED("Geant4");
0047 }
0048 
0049 inline VolumeId GeantVolumeMapper::operator()(G4LogicalVolume const&)
0050 {
0051     CELER_ASSERT_UNREACHABLE();
0052 }
0053 #endif
0054 
0055 //---------------------------------------------------------------------------//
0056 }  // namespace celeritas