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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/utils/include/G4EmModelManager.hh (Version 11.3.0) and /processes/electromagnetic/utils/include/G4EmModelManager.hh (Version 5.2.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                    <<   3 // * DISCLAIMER                                                       *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th <<   5 // * The following disclaimer summarizes all the specific disclaimers *
  6 // * the Geant4 Collaboration.  It is provided <<   6 // * of contributors to this software. The specific disclaimers,which *
  7 // * conditions of the Geant4 Software License <<   7 // * govern, are listed with their locations in:                      *
  8 // * LICENSE and available at  http://cern.ch/ <<   8 // *   http://cern.ch/geant4/license                                  *
  9 // * include a list of copyright holders.      << 
 10 // *                                                9 // *                                                                  *
 11 // * Neither the authors of this software syst     10 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     11 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     12 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     13 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  <<  14 // * use.                                                             *
 16 // * for the full disclaimer and the limitatio << 
 17 // *                                               15 // *                                                                  *
 18 // * This  code  implementation is the result  <<  16 // * This  code  implementation is the  intellectual property  of the *
 19 // * technical work of the GEANT4 collaboratio <<  17 // * GEANT4 collaboration.                                            *
 20 // * By using,  copying,  modifying or  distri <<  18 // * By copying,  distributing  or modifying the Program (or any work *
 21 // * any work based  on the software)  you  ag <<  19 // * based  on  the Program)  you indicate  your  acceptance of  this *
 22 // * use  in  resulting  scientific  publicati <<  20 // * statement, and all its terms.                                    *
 23 // * acceptance of all terms of the Geant4 Sof << 
 24 // *******************************************     21 // ********************************************************************
 25 //                                                 22 //
 26 //                                                 23 //
 27 // -------------------------------------------     24 // -------------------------------------------------------------------
 28 //                                                 25 //
 29 // GEANT4 Class header file                        26 // GEANT4 Class header file
 30 //                                                 27 //
                                                   >>  28 //
 31 // File name:     G4EmModelManager                 29 // File name:     G4EmModelManager
 32 //                                                 30 //
 33 // Author:        Vladimir Ivanchenko              31 // Author:        Vladimir Ivanchenko
 34 //                                                 32 //
 35 // Creation date: 07.05.2002                       33 // Creation date: 07.05.2002
 36 //                                                 34 //
 37 // Modifications:                                  35 // Modifications:
 38 //                                                 36 //
 39 // 03-12-02 V.Ivanchenko fix a bug in model se     37 // 03-12-02 V.Ivanchenko fix a bug in model selection
 40 // 20-01-03 Migrade to cut per region (V.Ivanc     38 // 20-01-03 Migrade to cut per region (V.Ivanchenko)
 41 // 27-01-03 Make models region aware (V.Ivanch     39 // 27-01-03 Make models region aware (V.Ivanchenko)
 42 // 13-02-03 The set of models is defined for r     40 // 13-02-03 The set of models is defined for region (V.Ivanchenko)
 43 // 26-03-03 Add GetDEDXDispersion (V.Ivanchenk     41 // 26-03-03 Add GetDEDXDispersion (V.Ivanchenko)
 44 // 13-04-03 Add startFromNull (V.Ivanchenko)       42 // 13-04-03 Add startFromNull (V.Ivanchenko)
 45 // 13-05-03 Add calculation of precise range (     43 // 13-05-03 Add calculation of precise range (V.Ivanchenko)
 46 // 21-07-03 Add UpdateEmModel method (V.Ivanch << 
 47 // 03-11-03 Substitute STL vector for G4Region << 
 48 // 11-04-05 Remove access to fluctuation model << 
 49 // 10-01-06 PreciseRange -> CSDARange (V.Ivant << 
 50 // 20-01-06 Introduce G4EmTableType and reduci << 
 51 // 13-05-06 Add GetModel by index method (VI)  << 
 52 // 15-03-07 Add maxCutInRange (V.Ivanchenko)   << 
 53 // 08-04-08 Simplify Select method for only on << 
 54 // 03-08-09 Removed unused members and simplif << 
 55 //          model is used (VI)                 << 
 56 // 14-07-11 Use pointer to the vector of cuts  << 
 57 //                                                 44 //
 58 // Class Description:                              45 // Class Description:
 59 //                                                 46 //
 60 // It is the unified energy loss process it ca     47 // It is the unified energy loss process it calculates the continuous
 61 // energy loss for charged particles using a s     48 // energy loss for charged particles using a set of Energy Loss
 62 // models valid for different energy regions.      49 // models valid for different energy regions. There are a possibility
 63 // to create and access to dE/dx and range tab     50 // to create and access to dE/dx and range tables, or to calculate
 64 // that information on fly.                        51 // that information on fly.
 65                                                    52 
 66 // -------------------------------------------     53 // -------------------------------------------------------------------
 67 //                                                 54 //
 68                                                    55 
                                                   >>  56 
 69 #ifndef G4EmModelManager_h                         57 #ifndef G4EmModelManager_h
 70 #define G4EmModelManager_h 1                       58 #define G4EmModelManager_h 1
 71                                                    59 
 72 //....oooOO0OOooo........oooOO0OOooo........oo     60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 73                                                    61 
 74 #include "globals.hh"                              62 #include "globals.hh"
 75 #include "G4DataVector.hh"                         63 #include "G4DataVector.hh"
 76 #include "G4EmTableType.hh"                    << 
 77 #include "G4EmProcessSubType.hh"               << 
 78 #include "G4Region.hh"                         << 
 79                                                << 
 80 #include "G4VEmModel.hh"                       << 
 81 #include "G4VEmFluctuationModel.hh"            << 
 82 #include "G4DynamicParticle.hh"                << 
 83 #include <iostream>                            << 
 84                                                    64 
 85 class G4RegionModels                               65 class G4RegionModels
 86 {                                                  66 {
 87                                                    67 
 88 friend class G4EmModelManager;                     68 friend class G4EmModelManager;
 89                                                    69 
                                                   >>  70 public:
                                                   >>  71 
 90 private:                                           72 private:
 91                                                    73 
 92   G4RegionModels(G4int nMod, std::vector<G4int <<  74   G4RegionModels(G4int nMod, std::vector<G4int>& list, G4DataVector& lowE);
 93                  G4DataVector& lowE, const G4R << 
 94                                                    75 
 95   ~G4RegionModels();                               76   ~G4RegionModels();
 96                                                    77 
 97   inline G4int SelectIndex(G4double e) const { <<  78   G4int SelectIndex(G4double e) const {
 98     G4int idx = 0;                                 79     G4int idx = 0;
 99     if (nModelsForRegion>1) {                      80     if (nModelsForRegion>1) {
100       idx = nModelsForRegion;                      81       idx = nModelsForRegion;
101       // Loop checking, 03-Aug-2015, Vladimir  <<  82       do {idx--;} while (idx && e <= lowKineticEnergy[idx]);
102       do {--idx;} while (idx > 0 && e <= lowKi << 
103     }                                              83     }
104     return theListOfModelIndexes[idx];             84     return theListOfModelIndexes[idx];
105   };                                               85   };
106                                                    86 
107   inline G4int ModelIndex(G4int n) const {     <<  87   G4int ModelIndex(G4int n) const {
108     return theListOfModelIndexes[n];               88     return theListOfModelIndexes[n];
109   };                                               89   };
110                                                    90 
111   inline G4int NumberOfModels() const {        <<  91   G4int NumberOfModels() const {
112     return nModelsForRegion;                       92     return nModelsForRegion;
113   };                                               93   };
114                                                    94 
115   inline G4double LowEdgeEnergy(G4int n) const << 
116     return lowKineticEnergy[n];                << 
117   };                                           << 
118                                                << 
119   inline const G4Region* Region() const {      << 
120     return theRegion;                          << 
121   };                                           << 
122                                                << 
123   G4RegionModels(G4RegionModels &) = delete;   << 
124   G4RegionModels & operator=(const G4RegionMod << 
125                                                << 
126   const G4Region*    theRegion;                << 
127   G4int              nModelsForRegion;             95   G4int              nModelsForRegion;
128   G4int*             theListOfModelIndexes;        96   G4int*             theListOfModelIndexes;
129   G4double*          lowKineticEnergy;             97   G4double*          lowKineticEnergy;
130                                                    98 
131 };                                                 99 };
132                                                   100 
133 //....oooOO0OOooo........oooOO0OOooo........oo << 101 #include "G4VEmModel.hh"
                                                   >> 102 #include "G4VEmFluctuationModel.hh"
                                                   >> 103 #include "G4DynamicParticle.hh"
134                                                   104 
135 class G4Region;                                   105 class G4Region;
136 class G4ParticleDefinition;                       106 class G4ParticleDefinition;
                                                   >> 107 class G4DataVector;
137 class G4PhysicsVector;                            108 class G4PhysicsVector;
138 class G4MaterialCutsCouple;                       109 class G4MaterialCutsCouple;
139                                                   110 
140 //....oooOO0OOooo........oooOO0OOooo........oo    111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
141                                                   112 
142 class G4EmModelManager                            113 class G4EmModelManager
143 {                                                 114 {
144 public:                                           115 public:
145                                                   116 
146   G4EmModelManager();                             117   G4EmModelManager();
147                                                   118 
148   ~G4EmModelManager();                         << 119  ~G4EmModelManager();
149                                                   120 
150   void Clear();                                   121   void Clear();
151                                                   122 
152   const G4DataVector* Initialise(const G4Parti << 123   const G4DataVector* Initialise(const G4ParticleDefinition*,
153                                  const G4Parti << 124                                  const G4ParticleDefinition*,
154                                  G4int verb);  << 125                G4double,
                                                   >> 126                                        G4int);
155                                                   127 
156   void FillDEDXVector(G4PhysicsVector*, const  << 128   const G4DataVector* Cuts() const;
157                       G4EmTableType t = fRestr << 
158                                                   129 
159   void FillLambdaVector(G4PhysicsVector*, cons << 130   const G4DataVector* SubCutoff() const;
160                         G4bool startFromNull = << 
161                         G4EmTableType t = fRes << 
162                                                   131 
163   void AddEmModel(G4int, G4VEmModel*, G4VEmFlu << 132   void FillDEDXVector(G4PhysicsVector*, const G4MaterialCutsCouple*);
164                   const G4Region* r);          << 
165                                                   133 
166   // Get model pointer from the model list     << 134   void FillDEDXVectorForPreciseRange(G4PhysicsVector*, const G4MaterialCutsCouple*);
167   G4VEmModel* GetModel(G4int idx, G4bool ver = << 
168                                                   135 
169   // Get model pointer from the model list for << 136   void FillLambdaVector(G4PhysicsVector*, const G4MaterialCutsCouple*, 
170   // no check on material cuts couple index    << 137                         G4bool startFromNull = true);
171   G4VEmModel* GetRegionModel(G4int idx, std::s << 
172                                                << 
173   // total number of models for material cut c << 
174   // no check on material cuts couple index    << 
175   G4int NumberOfRegionModels(std::size_t index << 
176                                                   138 
177   // Automatic documentation                   << 139   void FillSubLambdaVector(G4PhysicsVector*, const G4MaterialCutsCouple*,
178   void DumpModelList(std::ostream& out, G4int  << 140                            G4bool startFromNull = true);
179                                                   141 
180   // Select model for given material cuts coup << 142   G4VEmModel* SelectModel(G4double& energy, size_t& index);
181   inline G4VEmModel* SelectModel(G4double ener << 
182                                                   143 
183   // Access to cuts                            << 144   G4double SampleFluctuations(const G4Material* material,
184   inline const G4DataVector* Cuts() const;     << 145                               const G4DynamicParticle* dp,
                                                   >> 146                                     G4double& tmax,
                                                   >> 147                         G4double& length,
                                                   >> 148                         G4double& eloss,
                                                   >> 149             G4double& preStepKinEnergy,
                                                   >> 150             size_t&   index);
                                                   >> 151 
                                                   >> 152   G4double GetDEDXDispersion( const G4Material* material,
                                                   >> 153                               const G4DynamicParticle* dp,
                                                   >> 154                                     G4double& tmax,
                                                   >> 155                         G4double& length,
                                                   >> 156             size_t&   index);
185                                                   157 
186   // Set flag of fluorescence                  << 158   void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel*, const G4Region*);
187   inline void SetFluoFlag(G4bool val);         << 
188                                                   159 
189   // total number of models                    << 160 private:
190   inline G4int NumberOfModels() const;         << 
191                                                   161 
192   // hide  assignment operator                    162   // hide  assignment operator
193   G4EmModelManager(G4EmModelManager &) = delet << 163 
194   G4EmModelManager & operator=(const G4EmModel << 164   G4EmModelManager(G4EmModelManager &);
                                                   >> 165   G4EmModelManager & operator=(const G4EmModelManager &right);
                                                   >> 166 
                                                   >> 167 // =====================================================================
195                                                   168 
196 private:                                          169 private:
197                                                   170 
198   const G4ParticleDefinition* particle = nullp << 171   G4DataVector                theCuts;
199   const G4DataVector*         theCuts = nullpt << 172   G4DataVector                theSubCuts;
200   G4DataVector*               theCutsNew = nul << 173 
201                                                << 174   std::vector<G4VEmModel*>                models;
202   // may be changed in run time                << 175   std::vector<G4VEmFluctuationModel*>     flucModels;
203   G4RegionModels*             currRegionModel  << 176   std::vector<const G4Region*>            regions;
204   G4VEmModel*                 currModel = null << 177   std::vector<G4int>                      orderOfModels;
205                                                << 178   G4DataVector                              upperEkin;
206   G4int                       nEmModels = 0;   << 179 
207   G4int                       nRegions = 0;    << 180   G4int                       nEmModels;
208                                                << 181   G4int                       nRegions;
209   G4int                       verboseLevel = 0 << 182   G4int                       nCouples;
210   G4bool                      severalModels =  << 183 
211   G4bool                      fluoFlag = false << 184   std::vector<G4int>                      idxOfRegionModels;
212                                                << 185   std::vector<G4RegionModels*>            setOfRegionModels;
213   std::vector<G4VEmModel*>             models; << 186 
214   std::vector<G4VEmFluctuationModel*>  flucMod << 187   G4double                    minSubRange;
215   std::vector<const G4Region*>         regions << 188 
216   std::vector<G4int>                   orderOf << 189   const G4ParticleDefinition* particle;
217   std::vector<G4int>                   isUsed; << 190   const G4ParticleDefinition* secondaryParticle;
                                                   >> 191 
                                                   >> 192   G4int                       verboseLevel;
                                                   >> 193 
                                                   >> 194   // cash
                                                   >> 195   G4int                       currentIdx;
218                                                   196 
219   std::vector<G4int>            idxOfRegionMod << 
220   std::vector<G4RegionModels*>  setOfRegionMod << 
221 };                                                197 };
222                                                   198 
223 //....oooOO0OOooo........oooOO0OOooo........oo    199 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
224 //....oooOO0OOooo........oooOO0OOooo........oo    200 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
225                                                   201 
226 inline                                         << 202 inline G4VEmModel* G4EmModelManager::SelectModel(G4double& kinEnergy, size_t& index)
227 G4VEmModel* G4EmModelManager::SelectModel(G4do << 
228 {                                                 203 {
229   if(severalModels) {                          << 204   currentIdx = (setOfRegionModels[idxOfRegionModels[index]])->SelectIndex(kinEnergy);
230     if(nRegions > 1) {                         << 205   return models[currentIdx];
231       currRegionModel = setOfRegionModels[idxO << 
232     }                                          << 
233     currModel = models[currRegionModel->Select << 
234   }                                            << 
235   return currModel;                            << 
236 }                                                 206 }
237                                                   207 
                                                   >> 208 
238 //....oooOO0OOooo........oooOO0OOooo........oo    209 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
239                                                   210 
240 inline const G4DataVector* G4EmModelManager::C << 211 inline G4double G4EmModelManager::SampleFluctuations(
                                                   >> 212                               const G4Material* material,
                                                   >> 213                               const G4DynamicParticle* dp,
                                                   >> 214                                     G4double& tmax,
                                                   >> 215                         G4double& length,
                                                   >> 216                         G4double& eloss,
                                                   >> 217             G4double& kinEnergy,
                                                   >> 218             size_t&   index)
                                                   >> 219 
241 {                                                 220 {
242   return theCuts;                              << 221   currentIdx = (setOfRegionModels[idxOfRegionModels[index]])->SelectIndex(kinEnergy);
                                                   >> 222   G4VEmFluctuationModel* fm = flucModels[currentIdx];
                                                   >> 223   G4double x = eloss;
                                                   >> 224   if(fm) x = fm->SampleFluctuations(material,dp,tmax,length,eloss);
                                                   >> 225   return x;
243 }                                                 226 }
244                                                   227 
245 //....oooOO0OOooo........oooOO0OOooo........oo    228 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
246                                                   229 
247 inline void G4EmModelManager::SetFluoFlag(G4bo << 230 inline G4double G4EmModelManager::GetDEDXDispersion(
                                                   >> 231                               const G4Material* material,
                                                   >> 232                               const G4DynamicParticle* dp,
                                                   >> 233                                     G4double& tmax,
                                                   >> 234                         G4double& length,
                                                   >> 235             size_t&   index)
                                                   >> 236 {
                                                   >> 237   currentIdx = (setOfRegionModels[idxOfRegionModels[index]])
                                                   >> 238              ->SelectIndex(dp->GetKineticEnergy());
                                                   >> 239   G4VEmFluctuationModel* fm = flucModels[currentIdx];
                                                   >> 240   G4double x = 0.0;
                                                   >> 241   if(fm) x = fm->Dispersion(material,dp,tmax,length);
                                                   >> 242   return x;
                                                   >> 243 }
                                                   >> 244 
                                                   >> 245 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 246 
                                                   >> 247 inline const G4DataVector* G4EmModelManager::Cuts() const
248 {                                                 248 {
249   fluoFlag = val;                              << 249   return &theCuts;
250 }                                                 250 }
251                                                   251 
252 //....oooOO0OOooo........oooOO0OOooo........oo    252 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
253                                                   253 
254 inline G4int G4EmModelManager::NumberOfModels( << 254 inline const G4DataVector* G4EmModelManager::SubCutoff() const
255 {                                                 255 {
256   return nEmModels;                            << 256   return &theSubCuts;
257 }                                                 257 }
258                                                   258 
259 //....oooOO0OOooo........oooOO0OOooo........oo    259 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
260                                                   260 
261 #endif                                            261 #endif
262                                                   262 
263                                                   263