Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:11:32

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4RegularNavigationHelper
0027 //
0028 // Class description:
0029 //
0030 // Utility class for navigation on regular structures, providing step
0031 // lengths counting for each regular voxel of the structure.
0032 
0033 // Author: Pedro Arce (CIEMAT), November 2008
0034 // --------------------------------------------------------------------
0035 #ifndef G4RegularNavigationHelper_HH
0036 #define G4RegularNavigationHelper_HH 1
0037 
0038 #include <vector>
0039 
0040 #include "globals.hh"
0041 #include "G4ThreadLocalSingleton.hh"
0042 
0043 using G4RegularNavigationHelper_theStepLengths_t = 
0044       std::vector< std::pair<G4int,G4double> >;
0045 
0046 /**
0047  * @brief G4RegularNavigationHelper is a singleton utility class for navigation
0048  * on regular structures, providing step lengths counting for each regular voxel
0049  * of the structure.
0050  */
0051 
0052 class G4RegularNavigationHelper
0053 {
0054   friend class G4ThreadLocalSingleton<G4RegularNavigationHelper>;
0055 
0056   public:
0057 
0058     /**
0059      * Singleton instance accessor.
0060      */
0061     static G4RegularNavigationHelper* Instance();
0062 
0063     /**
0064      * Default Destructor.
0065      */
0066    ~G4RegularNavigationHelper() = default;
0067   
0068     /**
0069      * Resets the state.
0070      */
0071     void ClearStepLengths();
0072 
0073     /**
0074      * Stores step in container, associated to given voxel.
0075      *  @param[in] copyNo Voxel number.
0076      *  @param[in] slen Value of step length to store.
0077      */
0078     void AddStepLength( G4int copyNo, G4double slen );
0079 
0080     /**
0081      * Returns the collection of stored steps per voxels.
0082      */
0083     const std::vector< std::pair<G4int,G4double> > & GetStepLengths();
0084 
0085   private:
0086 
0087     /**
0088      * Private default Constructor.
0089      */
0090     G4RegularNavigationHelper() = default;
0091 
0092   private:
0093 
0094     /** The collection of steps associated to voxels. */
0095     std::vector< std::pair<G4int,G4double> > theStepLengths;
0096 };
0097 
0098 #endif