Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:17:46

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 geocel/g4/GeantNavHistoryUpdater.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/cont/Span.hh"
0010 #include "geocel/Types.hh"
0011 
0012 class G4NavigationHistory;
0013 
0014 namespace celeritas
0015 {
0016 class GeantGeoParams;
0017 namespace detail
0018 {
0019 class GeantVolumeInstanceMapper;
0020 }
0021 
0022 //---------------------------------------------------------------------------//
0023 /*!
0024  * Update a nav history to match the given volume instance stack.
0025  *
0026  * This requires metadata from \c celeritas::global_geant_geo .
0027  *
0028  * The constructed nav history always has at least one level (i.e. GetDepth is
0029  * zero). An empty input stack, corresponding to "outside" the world, results
0030  * in a nav history with one level but a \c nullptr physical volume as the top.
0031  *
0032  * \note The stack should have the same semantics as \c VolumeLevelId, i.e. the
0033  * initial entry is the "most global" level.
0034  */
0035 class GeantNavHistoryUpdater
0036 {
0037   public:
0038     //!@{
0039     //! \name Type aliases
0040     using VIMapper = detail::GeantVolumeInstanceMapper;
0041     //!@}
0042 
0043   public:
0044     // Construct using global geant geo
0045     explicit GeantNavHistoryUpdater(GeantGeoParams const&);
0046     //! Construct with volume instance mapper
0047     explicit GeantNavHistoryUpdater(VIMapper const& mapper) : mapper_{mapper}
0048     {
0049     }
0050 
0051     // Reconstruct into the given nav history
0052     void operator()(Span<VolumeInstanceId const> stack,
0053                     G4NavigationHistory* nav);
0054 
0055   private:
0056     VIMapper const& mapper_;
0057 };
0058 
0059 //---------------------------------------------------------------------------//
0060 }  // namespace celeritas