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 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/lowenergy/include/G4IonDEDXHandler.hh (Version 11.3.0) and /processes/electromagnetic/lowenergy/include/G4IonDEDXHandler.hh (Version 11.1.2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
 27 //                                                 27 //
 28 // ===========================================     28 // ===========================================================================
 29 // GEANT4 class header file                        29 // GEANT4 class header file
 30 //                                                 30 //
 31 // Class:                G4IonDEDXHandler          31 // Class:                G4IonDEDXHandler
 32 //                                                 32 //
 33 // Author:               Anton Lechner (Anton.     33 // Author:               Anton Lechner (Anton.Lechner@cern.ch)
 34 //                                                 34 //
 35 // First implementation: 11. 03. 2009              35 // First implementation: 11. 03. 2009
 36 //                                                 36 //
 37 // Modifications:                                  37 // Modifications: 
 38 //                                                 38 //
 39 //                                                 39 //
 40 // Class description:                              40 // Class description:
 41 //    Ion dE/dx table handler.                     41 //    Ion dE/dx table handler. 
 42 //                                                 42 //
 43 // Comments:                                       43 // Comments:
 44 //                                                 44 //
 45 // ===========================================     45 // =========================================================================== 
 46                                                    46 
 47 #ifndef G4IONDEDXHANDLER_HH                        47 #ifndef G4IONDEDXHANDLER_HH
 48 #define G4IONDEDXHANDLER_HH                        48 #define G4IONDEDXHANDLER_HH
 49                                                    49 
 50 #include "globals.hh"                              50 #include "globals.hh"
 51 #include <vector>                                  51 #include <vector>
 52 #include <utility>                                 52 #include <utility>
 53 #include <list>                                    53 #include <list>
 54 #include <map>                                     54 #include <map>
 55                                                    55 
 56 class G4ParticleDefinition;                        56 class G4ParticleDefinition;
 57 class G4Material;                                  57 class G4Material;
 58 class G4PhysicsVector;                             58 class G4PhysicsVector;
 59 class G4VIonDEDXTable;                             59 class G4VIonDEDXTable;
 60 class G4VIonDEDXScalingAlgorithm;                  60 class G4VIonDEDXScalingAlgorithm;
 61                                                    61 
 62                                                    62 
 63 // ###########################################     63 // #########################################################################
 64 // # Type definitions for a local cache            64 // # Type definitions for a local cache
 65 // ###########################################     65 // #########################################################################
 66                                                    66 
 67 typedef struct CacheValue{                         67 typedef struct CacheValue{
 68   G4double energyScaling;         // Scaling f     68   G4double energyScaling;         // Scaling factor for kinetic energy
 69   G4PhysicsVector* dedxVector;    // dE/dx vec     69   G4PhysicsVector* dedxVector;    // dE/dx vector for current projectile-
 70   // material combination                          70   // material combination
 71   G4double lowerEnergyEdge;       // Lower ene     71   G4double lowerEnergyEdge;       // Lower energy edge of dE/dx vector
 72   G4double upperEnergyEdge;       // Upper ene     72   G4double upperEnergyEdge;       // Upper energy edge of dE/dx vector
 73   G4double density;               // Material      73   G4double density;               // Material density
 74 } G4CacheValue;                                    74 } G4CacheValue;
 75 // ###########################################     75 // #########################################################################
 76 // # Class G4IonDEDXHandler: Handler class for     76 // # Class G4IonDEDXHandler: Handler class for stopping power tables
 77 // ###########################################     77 // #########################################################################
 78                                                    78 
 79 class G4IonDEDXHandler {                           79 class G4IonDEDXHandler {
 80  public:                                           80  public:
 81   explicit G4IonDEDXHandler(G4VIonDEDXTable* t     81   explicit G4IonDEDXHandler(G4VIonDEDXTable* tables,
 82           G4VIonDEDXScalingAlgorithm* algorith     82           G4VIonDEDXScalingAlgorithm* algorithm,
 83           const G4String& name,                    83           const G4String& name,
 84           G4int maxCacheSize = 5,                  84           G4int maxCacheSize = 5,
 85           G4bool splines = true);                  85           G4bool splines = true);
 86   ~G4IonDEDXHandler();                             86   ~G4IonDEDXHandler();
 87                                                    87 
 88   // Function checking the availability of sto     88   // Function checking the availability of stopping power values for a 
 89   // given ion-target combination (kinetic ene     89   // given ion-target combination (kinetic energy not considered) 
 90   G4bool IsApplicable(                             90   G4bool IsApplicable(
 91           const G4ParticleDefinition*,  // Pro     91           const G4ParticleDefinition*,  // Projectile (ion) 
 92           const G4Material*);           // Tar     92           const G4Material*);           // Target material             
 93                                                    93 
 94   // Function returning the stopping power of      94   // Function returning the stopping power of a given material for a
 95   // projectile of specified energy                95   // projectile of specified energy
 96   G4double GetDEDX(                                96   G4double GetDEDX(
 97        const G4ParticleDefinition*,  // Projec     97        const G4ParticleDefinition*,  // Projectile (ion) 
 98        const G4Material*,            // Target     98        const G4Material*,            // Target material 
 99        G4double);                    // Kineti     99        G4double);                    // Kinetic energy of projectile
100                                                   100   
101                                                   101   
102   // Function for building stopping power vect    102   // Function for building stopping power vectors according to Bragg's
103   // additivity rule                              103   // additivity rule
104   G4bool BuildDEDXTable(                          104   G4bool BuildDEDXTable(
105       const G4ParticleDefinition*,  // Project    105       const G4ParticleDefinition*,  // Projectile (ion) 
106       const G4Material*);           // Target     106       const G4Material*);           // Target material 
107                                                   107   
108   // Function for building stopping power vect    108   // Function for building stopping power vectors according to Bragg's
109   // additivity rule                              109   // additivity rule
110   G4bool BuildDEDXTable(                          110   G4bool BuildDEDXTable(
111       G4int atomicNumberIon,        // Atomic     111       G4int atomicNumberIon,        // Atomic number of ion 
112       const G4Material*);           // Target     112       const G4Material*);           // Target material 
113                                                   113   
114   // Function printing stopping powers for a g    114   // Function printing stopping powers for a given ion-material combination
115   // within a specified energy range              115   // within a specified energy range 
116   void PrintDEDXTable(                            116   void PrintDEDXTable(
117           const G4ParticleDefinition*,  // Pro    117           const G4ParticleDefinition*,  // Projectile (ion) 
118           const G4Material* ,           // Tar    118           const G4Material* ,           // Target material
119           G4double,                     // Min    119           G4double,                     // Minimum energy per nucleon
120           G4double,                     // Max    120           G4double,                     // Maximum energy per nucleon
121           G4int,                        // Num    121           G4int,                        // Number of bins
122           G4bool logScaleEnergy = true);// Log    122           G4bool logScaleEnergy = true);// Logarithmic scaling of energy
123                                                   123   
124   // Function returning the lower energy edge     124   // Function returning the lower energy edge of stopping power tables
125   G4double GetLowerEnergyEdge(                    125   G4double GetLowerEnergyEdge(
126             const G4ParticleDefinition*,  // P    126             const G4ParticleDefinition*,  // Projectile (ion) 
127             const G4Material*);           // T    127             const G4Material*);           // Target material 
128                                                   128   
129   // Function returning the upper energy edge     129   // Function returning the upper energy edge of stopping power tables 
130   G4double GetUpperEnergyEdge(                    130   G4double GetUpperEnergyEdge(
131             const G4ParticleDefinition*,  // P    131             const G4ParticleDefinition*,  // Projectile (ion) 
132             const G4Material*);           // T    132             const G4Material*);           // Target material 
133                                                   133   
134   // Function for clearing the cache              134   // Function for clearing the cache
135   void ClearCache();                              135   void ClearCache();
136                                                   136   
137   G4String GetName();                             137   G4String GetName();
138                                                   138   
139   G4IonDEDXHandler& operator=(const G4IonDEDXH    139   G4IonDEDXHandler& operator=(const G4IonDEDXHandler &r) = delete;
140   G4IonDEDXHandler(const G4IonDEDXHandler&) =     140   G4IonDEDXHandler(const G4IonDEDXHandler&) = delete;
141                                                   141 
142 private:                                          142 private:
143    // ########################################    143    // ######################################################################
144    // # Stopping power table (table of stoppin    144    // # Stopping power table (table of stopping power vectors either built
145    // # by G4VIonDEDXTable, or by the current     145    // # by G4VIonDEDXTable, or by the current class (using the Bragg 
146    // # addivity rule)                            146    // # addivity rule)
147    // ########################################    147    // ######################################################################
148                                                   148 
149    // Class which creates dE/dx vectors           149    // Class which creates dE/dx vectors 
150    G4VIonDEDXTable* table;                        150    G4VIonDEDXTable* table;
151                                                   151 
152    // Algorithm for scaling dE/dx values          152    // Algorithm for scaling dE/dx values
153    G4VIonDEDXScalingAlgorithm* algorithm;         153    G4VIonDEDXScalingAlgorithm* algorithm;
154                                                   154 
155    // Name associated with the dE/dx table        155    // Name associated with the dE/dx table
156    G4String tableName;                            156    G4String tableName;
157                                                   157 
158    // Map of all dE/dx vectors                    158    // Map of all dE/dx vectors
159    typedef std::pair<G4int, const G4Material*>    159    typedef std::pair<G4int, const G4Material*> G4IonKey;
160    typedef std::map<G4IonKey, G4PhysicsVector*    160    typedef std::map<G4IonKey, G4PhysicsVector*> DEDXTable; 
161    DEDXTable stoppingPowerTable;                  161    DEDXTable stoppingPowerTable;
162                                                   162 
163    // Map of dE/dx vectors, built according to    163    // Map of dE/dx vectors, built according to the Bragg additivity rule
164    typedef std::map<G4IonKey, G4PhysicsVector*    164    typedef std::map<G4IonKey, G4PhysicsVector*> DEDXTableBraggRule;
165    DEDXTableBraggRule stoppingPowerTableBragg;    165    DEDXTableBraggRule stoppingPowerTableBragg;
166                                                   166 
167    // Flag indicating the usage of splines for    167    // Flag indicating the usage of splines for dE/dx vectors built according
168    // to Bragg rule                               168    // to Bragg rule
169    G4bool useSplines;                             169    G4bool useSplines;
170                                                   170 
171    // ########################################    171    // ######################################################################
172    // # "Most-recently-used" cache, to provide    172    // # "Most-recently-used" cache, to provide a faster access to physics 
173    // # vectors                                   173    // # vectors
174    // ########################################    174    // ######################################################################
175                                                   175 
176    // A type definition of cache entry contain    176    // A type definition of cache entry containing a key-value pair
177    typedef std::pair<const G4ParticleDefinitio    177    typedef std::pair<const G4ParticleDefinition*, const G4Material*> G4CacheKey;
178    typedef struct CacheEntry {                    178    typedef struct CacheEntry {
179       G4CacheKey key;                             179       G4CacheKey key;
180       G4CacheValue value;                         180       G4CacheValue value;
181    } G4CacheEntry;                                181    } G4CacheEntry;
182                                                   182 
183    // A cache entry list, and a map of pointer    183    // A cache entry list, and a map of pointers to list iterators (for faster
184    // searching)                                  184    // searching)
185    typedef std::list<G4CacheEntry> CacheEntryL    185    typedef std::list<G4CacheEntry> CacheEntryList;
186    CacheEntryList cacheEntries;                   186    CacheEntryList cacheEntries;
187                                                   187 
188    typedef std::map<G4CacheKey, void*> CacheIt    188    typedef std::map<G4CacheKey, void*> CacheIterPointerMap;
189    CacheIterPointerMap cacheKeyPointers;          189    CacheIterPointerMap cacheKeyPointers;  
190                                                   190 
191   // Function for updating the cache              191   // Function for updating the cache
192    G4CacheValue UpdateCacheValue(                 192    G4CacheValue UpdateCacheValue(
193                 const G4ParticleDefinition*,      193                 const G4ParticleDefinition*,  // Projectile (ion) 
194                 const G4Material*);               194                 const G4Material*);           // Target material
195                                                   195 
196    // Function for retrieving cache values        196    // Function for retrieving cache values
197    G4CacheValue GetCacheValue(                    197    G4CacheValue GetCacheValue(
198                 const G4ParticleDefinition*,      198                 const G4ParticleDefinition*,  // Projectile (ion) 
199                 const G4Material*);               199                 const G4Material*);           // Target material
200                                                   200 
201    // Maximum number of cache entries             201    // Maximum number of cache entries
202    G4int maxCacheEntries;                         202    G4int maxCacheEntries;
203                                                   203 
204 };                                                204 };
205                                                   205 
206 #endif  // G4IONDEDXHANDLER_HH                    206 #endif  // G4IONDEDXHANDLER_HH
207                                                   207