|
||||
File indexing completed on 2025-01-18 09:58:31
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 // 0027 // 0028 // =========================================================================== 0029 // GEANT4 class header file 0030 // 0031 // Class: G4IonDEDXHandler 0032 // 0033 // Author: Anton Lechner (Anton.Lechner@cern.ch) 0034 // 0035 // First implementation: 11. 03. 2009 0036 // 0037 // Modifications: 0038 // 0039 // 0040 // Class description: 0041 // Ion dE/dx table handler. 0042 // 0043 // Comments: 0044 // 0045 // =========================================================================== 0046 0047 #ifndef G4IONDEDXHANDLER_HH 0048 #define G4IONDEDXHANDLER_HH 0049 0050 #include "globals.hh" 0051 #include <vector> 0052 #include <utility> 0053 #include <list> 0054 #include <map> 0055 0056 class G4ParticleDefinition; 0057 class G4Material; 0058 class G4PhysicsVector; 0059 class G4VIonDEDXTable; 0060 class G4VIonDEDXScalingAlgorithm; 0061 0062 0063 // ######################################################################### 0064 // # Type definitions for a local cache 0065 // ######################################################################### 0066 0067 typedef struct CacheValue{ 0068 G4double energyScaling; // Scaling factor for kinetic energy 0069 G4PhysicsVector* dedxVector; // dE/dx vector for current projectile- 0070 // material combination 0071 G4double lowerEnergyEdge; // Lower energy edge of dE/dx vector 0072 G4double upperEnergyEdge; // Upper energy edge of dE/dx vector 0073 G4double density; // Material density 0074 } G4CacheValue; 0075 // ######################################################################### 0076 // # Class G4IonDEDXHandler: Handler class for stopping power tables 0077 // ######################################################################### 0078 0079 class G4IonDEDXHandler { 0080 public: 0081 explicit G4IonDEDXHandler(G4VIonDEDXTable* tables, 0082 G4VIonDEDXScalingAlgorithm* algorithm, 0083 const G4String& name, 0084 G4int maxCacheSize = 5, 0085 G4bool splines = true); 0086 ~G4IonDEDXHandler(); 0087 0088 // Function checking the availability of stopping power values for a 0089 // given ion-target combination (kinetic energy not considered) 0090 G4bool IsApplicable( 0091 const G4ParticleDefinition*, // Projectile (ion) 0092 const G4Material*); // Target material 0093 0094 // Function returning the stopping power of a given material for a 0095 // projectile of specified energy 0096 G4double GetDEDX( 0097 const G4ParticleDefinition*, // Projectile (ion) 0098 const G4Material*, // Target material 0099 G4double); // Kinetic energy of projectile 0100 0101 0102 // Function for building stopping power vectors according to Bragg's 0103 // additivity rule 0104 G4bool BuildDEDXTable( 0105 const G4ParticleDefinition*, // Projectile (ion) 0106 const G4Material*); // Target material 0107 0108 // Function for building stopping power vectors according to Bragg's 0109 // additivity rule 0110 G4bool BuildDEDXTable( 0111 G4int atomicNumberIon, // Atomic number of ion 0112 const G4Material*); // Target material 0113 0114 // Function printing stopping powers for a given ion-material combination 0115 // within a specified energy range 0116 void PrintDEDXTable( 0117 const G4ParticleDefinition*, // Projectile (ion) 0118 const G4Material* , // Target material 0119 G4double, // Minimum energy per nucleon 0120 G4double, // Maximum energy per nucleon 0121 G4int, // Number of bins 0122 G4bool logScaleEnergy = true);// Logarithmic scaling of energy 0123 0124 // Function returning the lower energy edge of stopping power tables 0125 G4double GetLowerEnergyEdge( 0126 const G4ParticleDefinition*, // Projectile (ion) 0127 const G4Material*); // Target material 0128 0129 // Function returning the upper energy edge of stopping power tables 0130 G4double GetUpperEnergyEdge( 0131 const G4ParticleDefinition*, // Projectile (ion) 0132 const G4Material*); // Target material 0133 0134 // Function for clearing the cache 0135 void ClearCache(); 0136 0137 G4String GetName(); 0138 0139 G4IonDEDXHandler& operator=(const G4IonDEDXHandler &r) = delete; 0140 G4IonDEDXHandler(const G4IonDEDXHandler&) = delete; 0141 0142 private: 0143 // ###################################################################### 0144 // # Stopping power table (table of stopping power vectors either built 0145 // # by G4VIonDEDXTable, or by the current class (using the Bragg 0146 // # addivity rule) 0147 // ###################################################################### 0148 0149 // Class which creates dE/dx vectors 0150 G4VIonDEDXTable* table; 0151 0152 // Algorithm for scaling dE/dx values 0153 G4VIonDEDXScalingAlgorithm* algorithm; 0154 0155 // Name associated with the dE/dx table 0156 G4String tableName; 0157 0158 // Map of all dE/dx vectors 0159 typedef std::pair<G4int, const G4Material*> G4IonKey; 0160 typedef std::map<G4IonKey, G4PhysicsVector*> DEDXTable; 0161 DEDXTable stoppingPowerTable; 0162 0163 // Map of dE/dx vectors, built according to the Bragg additivity rule 0164 typedef std::map<G4IonKey, G4PhysicsVector*> DEDXTableBraggRule; 0165 DEDXTableBraggRule stoppingPowerTableBragg; 0166 0167 // Flag indicating the usage of splines for dE/dx vectors built according 0168 // to Bragg rule 0169 G4bool useSplines; 0170 0171 // ###################################################################### 0172 // # "Most-recently-used" cache, to provide a faster access to physics 0173 // # vectors 0174 // ###################################################################### 0175 0176 // A type definition of cache entry containing a key-value pair 0177 typedef std::pair<const G4ParticleDefinition*, const G4Material*> G4CacheKey; 0178 typedef struct CacheEntry { 0179 G4CacheKey key; 0180 G4CacheValue value; 0181 } G4CacheEntry; 0182 0183 // A cache entry list, and a map of pointers to list iterators (for faster 0184 // searching) 0185 typedef std::list<G4CacheEntry> CacheEntryList; 0186 CacheEntryList cacheEntries; 0187 0188 typedef std::map<G4CacheKey, void*> CacheIterPointerMap; 0189 CacheIterPointerMap cacheKeyPointers; 0190 0191 // Function for updating the cache 0192 G4CacheValue UpdateCacheValue( 0193 const G4ParticleDefinition*, // Projectile (ion) 0194 const G4Material*); // Target material 0195 0196 // Function for retrieving cache values 0197 G4CacheValue GetCacheValue( 0198 const G4ParticleDefinition*, // Projectile (ion) 0199 const G4Material*); // Target material 0200 0201 // Maximum number of cache entries 0202 G4int maxCacheEntries; 0203 0204 }; 0205 0206 #endif // G4IONDEDXHANDLER_HH
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |