Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 09:54:43

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2023-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 accel/detail/TouchableUpdater.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "geocel/GeantGeoUtils.hh"
0011 #include "celeritas/Types.hh"
0012 #include "celeritas/Units.hh"
0013 
0014 namespace celeritas
0015 {
0016 namespace detail
0017 {
0018 //---------------------------------------------------------------------------//
0019 /*!
0020  * Update the temporary navigation state based on the position and direction.
0021  *
0022  * This is a helper class for \c HitProcessor.
0023  */
0024 class TouchableUpdater
0025 {
0026   public:
0027     //! Maximum step to try within the current volume [len]
0028     static constexpr double max_step() { return 1 * units::millimeter; }
0029 
0030     //! Warn when the step is greater than this amount [len]
0031     static constexpr double max_quiet_step()
0032     {
0033         return 1e-3 * units::millimeter;
0034     }
0035 
0036     // Construct with thread-local navigator and touchable
0037     inline TouchableUpdater(G4Navigator* navi, GeantTouchableBase* touchable);
0038 
0039     // Try to find the given point in the given logical volume
0040     bool
0041     operator()(Real3 const& pos, Real3 const& dir, G4LogicalVolume const* lv);
0042 
0043   private:
0044     G4Navigator* navi_;
0045     GeantTouchableBase* touchable_;
0046 };
0047 
0048 //---------------------------------------------------------------------------//
0049 // INLINE DEFINITIONS
0050 //---------------------------------------------------------------------------//
0051 /*!
0052  * Construct with with thread-local navigator and touchable.
0053  */
0054 TouchableUpdater::TouchableUpdater(G4Navigator* navi,
0055                                    GeantTouchableBase* touchable)
0056     : navi_{navi}, touchable_{touchable}
0057 {
0058     CELER_EXPECT(navi_);
0059     CELER_EXPECT(touchable_);
0060 }
0061 
0062 //---------------------------------------------------------------------------//
0063 }  // namespace detail
0064 }  // namespace celeritas