Geant4 Cross Reference |
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 // 31 // 32 // File name: G4VEnergyLossProcess 32 // File name: G4VEnergyLossProcess 33 // 33 // 34 // Author: Vladimir Ivanchenko on base 34 // Author: Vladimir Ivanchenko on base of Laszlo Urban code 35 // 35 // 36 // Creation date: 03.01.2002 36 // Creation date: 03.01.2002 37 // 37 // 38 // Modifications: Vladimir Ivanchenko 38 // Modifications: Vladimir Ivanchenko 39 // 39 // 40 // Class Description: 40 // Class Description: 41 // 41 // 42 // It is the unified energy loss process it ca 42 // It is the unified energy loss process it calculates the continuous 43 // energy loss for charged particles using a s 43 // energy loss for charged particles using a set of Energy Loss 44 // models valid for different energy regions. 44 // models valid for different energy regions. There are a possibility 45 // to create and access to dE/dx and range tab 45 // to create and access to dE/dx and range tables, or to calculate 46 // that information on fly. 46 // that information on fly. 47 47 48 // ------------------------------------------- 48 // ------------------------------------------------------------------- 49 // 49 // 50 50 51 #ifndef G4VEnergyLossProcess_h 51 #ifndef G4VEnergyLossProcess_h 52 #define G4VEnergyLossProcess_h 1 52 #define G4VEnergyLossProcess_h 1 53 53 54 #include "G4VContinuousDiscreteProcess.hh" 54 #include "G4VContinuousDiscreteProcess.hh" 55 #include "globals.hh" 55 #include "globals.hh" 56 #include "G4Material.hh" 56 #include "G4Material.hh" 57 #include "G4MaterialCutsCouple.hh" 57 #include "G4MaterialCutsCouple.hh" 58 #include "G4Track.hh" 58 #include "G4Track.hh" 59 #include "G4EmModelManager.hh" 59 #include "G4EmModelManager.hh" >> 60 #include "G4UnitsTable.hh" 60 #include "G4ParticleChangeForLoss.hh" 61 #include "G4ParticleChangeForLoss.hh" 61 #include "G4EmTableType.hh" 62 #include "G4EmTableType.hh" 62 #include "G4EmSecondaryParticleType.hh" << 63 #include "G4PhysicsTable.hh" 63 #include "G4PhysicsTable.hh" 64 #include "G4PhysicsVector.hh" 64 #include "G4PhysicsVector.hh" >> 65 #include "G4EmParameters.hh" 65 66 66 class G4Step; 67 class G4Step; 67 class G4ParticleDefinition; 68 class G4ParticleDefinition; 68 class G4EmParameters; << 69 class G4VEmModel; 69 class G4VEmModel; 70 class G4VEmFluctuationModel; 70 class G4VEmFluctuationModel; 71 class G4DataVector; 71 class G4DataVector; 72 class G4Region; 72 class G4Region; 73 class G4SafetyHelper; 73 class G4SafetyHelper; 74 class G4VAtomDeexcitation; 74 class G4VAtomDeexcitation; 75 class G4VSubCutProducer; 75 class G4VSubCutProducer; 76 class G4EmBiasingManager; 76 class G4EmBiasingManager; 77 class G4LossTableManager; 77 class G4LossTableManager; 78 class G4EmDataHandler; << 79 78 80 //....oooOO0OOooo........oooOO0OOooo........oo 79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 81 80 82 class G4VEnergyLossProcess : public G4VContinu 81 class G4VEnergyLossProcess : public G4VContinuousDiscreteProcess 83 { 82 { 84 public: 83 public: 85 84 86 G4VEnergyLossProcess(const G4String& name = 85 G4VEnergyLossProcess(const G4String& name = "EnergyLoss", 87 G4ProcessType type = fE 86 G4ProcessType type = fElectromagnetic); 88 87 89 ~G4VEnergyLossProcess() override; << 88 virtual ~G4VEnergyLossProcess(); >> 89 >> 90 private: >> 91 // clean vectors and arrays >> 92 void Clean(); 90 93 91 //------------------------------------------ 94 //------------------------------------------------------------------------ 92 // Virtual methods to be implemented in conc 95 // Virtual methods to be implemented in concrete processes 93 //------------------------------------------ 96 //------------------------------------------------------------------------ 94 97 >> 98 public: >> 99 virtual G4bool IsApplicable(const G4ParticleDefinition& p) override = 0; >> 100 >> 101 // obsolete to be removed >> 102 virtual void PrintInfo() {}; >> 103 >> 104 virtual void ProcessDescription(std::ostream& outFile) const override; >> 105 95 protected: 106 protected: 96 107 97 // description of specific process parameter << 98 virtual void StreamProcessInfo(std::ostream& 108 virtual void StreamProcessInfo(std::ostream&) const {}; 99 109 100 virtual void InitialiseEnergyLossProcess(con 110 virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*, 101 con 111 const G4ParticleDefinition*) = 0; 102 112 103 public: << 113 //------------------------------------------------------------------------ >> 114 // Methods with standard implementation; may be overwritten if needed >> 115 //------------------------------------------------------------------------ 104 116 105 // used as low energy limit LambdaTable << 106 virtual G4double MinPrimaryEnergy(const G4Pa 117 virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*, 107 const G4Ma 118 const G4Material*, G4double cut); 108 119 109 // print documentation in html format << 120 //------------------------------------------------------------------------ 110 void ProcessDescription(std::ostream& outFil << 121 // Virtual methods implementation common to all EM ContinuousDiscrete >> 122 // processes. Further inheritance is not assumed >> 123 //------------------------------------------------------------------------ >> 124 >> 125 public: 111 126 112 // prepare all tables 127 // prepare all tables 113 void PreparePhysicsTable(const G4ParticleDef << 128 virtual void PreparePhysicsTable(const G4ParticleDefinition&) override; 114 129 115 // build all tables 130 // build all tables 116 void BuildPhysicsTable(const G4ParticleDefin << 131 virtual void BuildPhysicsTable(const G4ParticleDefinition&) override; 117 132 118 // build a table 133 // build a table 119 G4PhysicsTable* BuildDEDXTable(G4EmTableType 134 G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted); 120 135 121 // build a table 136 // build a table 122 G4PhysicsTable* BuildLambdaTable(G4EmTableTy 137 G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted); 123 138 124 // Called before tracking of each new G4Trac 139 // Called before tracking of each new G4Track 125 void StartTracking(G4Track*) override; << 140 virtual void StartTracking(G4Track*) override; 126 141 127 // Step limit from AlongStep 142 // Step limit from AlongStep 128 G4double AlongStepGetPhysicalInteractionLeng << 143 virtual G4double AlongStepGetPhysicalInteractionLength( 129 const G4Trac 144 const G4Track&, 130 G4double pr 145 G4double previousStepSize, 131 G4double cu 146 G4double currentMinimumStep, 132 G4double& cu 147 G4double& currentSafety, 133 G4GPILSelect 148 G4GPILSelection* selection) override; 134 149 135 // Step limit from cross section 150 // Step limit from cross section 136 G4double PostStepGetPhysicalInteractionLengt << 151 virtual G4double PostStepGetPhysicalInteractionLength( 137 const G4Trac 152 const G4Track& track, 138 G4double pre << 153 G4double previousStepSize, 139 G4ForceCondi 154 G4ForceCondition* condition) override; 140 155 141 // AlongStep computations 156 // AlongStep computations 142 G4VParticleChange* AlongStepDoIt(const G4Tra << 157 virtual G4VParticleChange* AlongStepDoIt(const G4Track&, >> 158 const G4Step&) override; >> 159 >> 160 // Sampling of secondaries in vicinity of geometrical boundary >> 161 // Return sum of secodaries energy >> 162 G4double SampleSubCutSecondaries(std::vector<G4Track*>&, const G4Step&, >> 163 G4VEmModel* model, G4int matIdx); 143 164 144 // PostStep sampling of secondaries 165 // PostStep sampling of secondaries 145 G4VParticleChange* PostStepDoIt(const G4Trac << 166 virtual G4VParticleChange* PostStepDoIt(const G4Track&, >> 167 const G4Step&) override; 146 168 147 // Store all PhysicsTable in files. 169 // Store all PhysicsTable in files. 148 // Return false in case of any fatal failure 170 // Return false in case of any fatal failure at I/O 149 G4bool StorePhysicsTable(const G4ParticleDef << 171 virtual G4bool StorePhysicsTable(const G4ParticleDefinition*, 150 const G4String& dir << 172 const G4String& directory, 151 G4bool ascii = fals << 173 G4bool ascii = false) override; 152 174 153 // Retrieve all Physics from a files. 175 // Retrieve all Physics from a files. 154 // Return true if all the Physics Table are 176 // Return true if all the Physics Table are built. 155 // Return false if any fatal failure. 177 // Return false if any fatal failure. 156 G4bool RetrievePhysicsTable(const G4Particle << 178 virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition*, 157 const G4String& << 179 const G4String& directory, 158 G4bool ascii) ov << 180 G4bool ascii) override; 159 181 160 private: 182 private: 161 183 162 // summary printout after initialisation 184 // summary printout after initialisation 163 void StreamInfo(std::ostream& out, const G4P 185 void StreamInfo(std::ostream& out, const G4ParticleDefinition& part, 164 G4bool rst=false) const; 186 G4bool rst=false) const; 165 187 >> 188 // store a table >> 189 G4bool StoreTable(const G4ParticleDefinition* p, >> 190 G4PhysicsTable*, G4bool ascii, >> 191 const G4String& directory, >> 192 const G4String& tname); >> 193 >> 194 // retrieve a table >> 195 G4bool RetrieveTable(const G4ParticleDefinition* p, >> 196 G4PhysicsTable*, G4bool ascii, >> 197 const G4String& directory, >> 198 const G4String& tname, >> 199 G4bool mandatory); >> 200 166 //------------------------------------------ 201 //------------------------------------------------------------------------ 167 // Public interface to cross section, mfp an 202 // Public interface to cross section, mfp and sampling of fluctuations 168 // These methods are not used in run time 203 // These methods are not used in run time 169 //------------------------------------------ 204 //------------------------------------------------------------------------ 170 205 171 public: 206 public: 172 207 173 // access to dispersion of restricted energy 208 // access to dispersion of restricted energy loss 174 G4double GetDEDXDispersion(const G4MaterialC 209 G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple, 175 const G4DynamicPa 210 const G4DynamicParticle* dp, 176 G4double length); 211 G4double length); 177 212 178 // Access to cross section table 213 // Access to cross section table 179 G4double CrossSectionPerVolume(G4double kine 214 G4double CrossSectionPerVolume(G4double kineticEnergy, 180 const G4Mater 215 const G4MaterialCutsCouple* couple); 181 G4double CrossSectionPerVolume(G4double kine << 182 const G4Mater << 183 G4double logK << 184 216 185 // access to cross section 217 // access to cross section 186 G4double MeanFreePath(const G4Track& track); 218 G4double MeanFreePath(const G4Track& track); 187 219 188 // access to step limit 220 // access to step limit 189 G4double ContinuousStepLimit(const G4Track& 221 G4double ContinuousStepLimit(const G4Track& track, 190 G4double previo 222 G4double previousStepSize, 191 G4double curren 223 G4double currentMinimumStep, 192 G4double& curre 224 G4double& currentSafety); 193 225 194 protected: 226 protected: 195 227 196 // implementation of the pure virtual method 228 // implementation of the pure virtual method 197 G4double GetMeanFreePath(const G4Track& trac << 229 virtual G4double GetMeanFreePath(const G4Track& track, 198 G4double previousSt << 230 G4double previousStepSize, 199 G4ForceCondition* c << 231 G4ForceCondition* condition) override; 200 232 201 // implementation of the pure virtual method 233 // implementation of the pure virtual method 202 G4double GetContinuousStepLimit(const G4Trac << 234 virtual G4double GetContinuousStepLimit(const G4Track& track, 203 G4double pre << 235 G4double previousStepSize, 204 G4double cur << 236 G4double currentMinimumStep, 205 G4double& cu << 237 G4double& currentSafety) override; >> 238 >> 239 //------------------------------------------------------------------------ >> 240 // Run time method which may be also used by derived processes >> 241 //------------------------------------------------------------------------ 206 242 207 // creation of an empty vector for cross sec << 243 // creeation of an empty vector for cross section 208 G4PhysicsVector* LambdaPhysicsVector(const G 244 G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*, 209 G4doubl 245 G4double cut); 210 246 211 inline std::size_t CurrentMaterialCutsCouple << 247 inline size_t CurrentMaterialCutsCoupleIndex() const; 212 248 213 //------------------------------------------ 249 //------------------------------------------------------------------------ 214 // Specific methods to set, access, modify m 250 // Specific methods to set, access, modify models 215 //------------------------------------------ 251 //------------------------------------------------------------------------ 216 252 217 // Select model in run time 253 // Select model in run time 218 inline void SelectModel(G4double kinEnergy); 254 inline void SelectModel(G4double kinEnergy); 219 255 220 public: 256 public: 221 // Select model by energy and couple index << 257 // Select model by energy and region index 222 // Not for run time processing << 223 inline G4VEmModel* SelectModelForMaterial(G4 258 inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, 224 st << 259 size_t& idx) const; 225 260 226 // Add EM model coupled with fluctuation mod 261 // Add EM model coupled with fluctuation model for region, smaller value 227 // of order defines which pair of models wil 262 // of order defines which pair of models will be selected for a given 228 // energy interval 263 // energy interval 229 void AddEmModel(G4int, G4VEmModel*, 264 void AddEmModel(G4int, G4VEmModel*, 230 G4VEmFluctuationModel* fluc << 265 G4VEmFluctuationModel* fluc = 0, 231 const G4Region* region = nul 266 const G4Region* region = nullptr); 232 267 >> 268 // Define new energy range for the model identified by the name >> 269 void UpdateEmModel(const G4String&, G4double, G4double); >> 270 233 // Assign a model to a process local list, t 271 // Assign a model to a process local list, to enable the list in run time 234 // the derived process should execute AddEmM 272 // the derived process should execute AddEmModel(..) for all such models 235 void SetEmModel(G4VEmModel*, G4int index=0); 273 void SetEmModel(G4VEmModel*, G4int index=0); 236 << 237 // Access to models << 238 inline std::size_t NumberOfModels() const; << 239 274 240 // Return a model from the local list << 275 // return a model from the local list 241 inline G4VEmModel* EmModel(std::size_t index << 276 G4VEmModel* EmModel(size_t index=0) const; 242 277 243 // Access to models from G4EmModelManager li << 278 // Access to models 244 inline G4VEmModel* GetModelByIndex(std::size << 279 G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false) const; >> 280 >> 281 G4int NumberOfModels() const; 245 282 246 // Assign a fluctuation model to a process 283 // Assign a fluctuation model to a process 247 inline void SetFluctModel(G4VEmFluctuationMo 284 inline void SetFluctModel(G4VEmFluctuationModel*); 248 285 249 // Return the assigned fluctuation model << 286 // return the assigned fluctuation model 250 inline G4VEmFluctuationModel* FluctModel() c << 287 inline G4VEmFluctuationModel* FluctModel(); 251 288 252 //------------------------------------------ 289 //------------------------------------------------------------------------ 253 // Define and access particle type 290 // Define and access particle type 254 //------------------------------------------ 291 //------------------------------------------------------------------------ 255 292 256 protected: 293 protected: 257 inline void SetParticle(const G4ParticleDefi 294 inline void SetParticle(const G4ParticleDefinition* p); 258 inline void SetSecondaryParticle(const G4Par 295 inline void SetSecondaryParticle(const G4ParticleDefinition* p); 259 296 260 public: 297 public: 261 inline void SetBaseParticle(const G4Particle 298 inline void SetBaseParticle(const G4ParticleDefinition* p); 262 inline const G4ParticleDefinition* Particle( 299 inline const G4ParticleDefinition* Particle() const; 263 inline const G4ParticleDefinition* BaseParti 300 inline const G4ParticleDefinition* BaseParticle() const; 264 inline const G4ParticleDefinition* Secondary 301 inline const G4ParticleDefinition* SecondaryParticle() const; 265 302 266 // hide assignment operator << 267 G4VEnergyLossProcess(G4VEnergyLossProcess &) << 268 G4VEnergyLossProcess & operator=(const G4VEn << 269 << 270 //------------------------------------------ 303 //------------------------------------------------------------------------ 271 // Get/set parameters to configure the proce 304 // Get/set parameters to configure the process at initialisation time 272 //------------------------------------------ 305 //------------------------------------------------------------------------ 273 306 274 // Add subcut processor for the region << 307 // Add subcutoff option for the region 275 void ActivateSubCutoff(const G4Region* regio << 308 void ActivateSubCutoff(G4bool val, const G4Region* region = nullptr); 276 309 277 // Activate biasing 310 // Activate biasing 278 void SetCrossSectionBiasingFactor(G4double f 311 void SetCrossSectionBiasingFactor(G4double f, G4bool flag = true); 279 312 280 void ActivateForcedInteraction(G4double leng 313 void ActivateForcedInteraction(G4double length, 281 const G4Strin 314 const G4String& region, 282 G4bool flag = 315 G4bool flag = true); 283 316 284 void ActivateSecondaryBiasing(const G4String 317 void ActivateSecondaryBiasing(const G4String& region, G4double factor, 285 G4double energ 318 G4double energyLimit); 286 319 >> 320 // Add subcutoff process (bremsstrahlung) to sample secondary >> 321 // particle production in vicinity of the geometry boundary >> 322 void AddCollaborativeProcess(G4VEnergyLossProcess*); >> 323 287 inline void SetLossFluctuations(G4bool val); 324 inline void SetLossFluctuations(G4bool val); 288 325 289 inline void SetSpline(G4bool val); << 326 inline void SetIntegral(G4bool val); 290 inline void SetCrossSectionType(G4CrossSecti << 327 inline G4bool IsIntegral() const; 291 inline G4CrossSectionType CrossSectionType() << 292 328 293 // Set/Get flag "isIonisation" 329 // Set/Get flag "isIonisation" 294 void SetIonisation(G4bool val); 330 void SetIonisation(G4bool val); 295 inline G4bool IsIonisationProcess() const; 331 inline G4bool IsIonisationProcess() const; 296 332 297 // Redefine parameteters for stepping contro 333 // Redefine parameteters for stepping control 298 void SetLinearLossLimit(G4double val); 334 void SetLinearLossLimit(G4double val); 299 void SetStepFunction(G4double v1, G4double v << 335 void SetStepFunction(G4double v1, G4double v2, G4bool lock=true); 300 void SetLowestEnergyLimit(G4double); 336 void SetLowestEnergyLimit(G4double); 301 337 302 inline G4int NumberOfSubCutoffRegions() cons 338 inline G4int NumberOfSubCutoffRegions() const; 303 339 304 //------------------------------------------ 340 //------------------------------------------------------------------------ 305 // Specific methods to path Physics Tables t 341 // Specific methods to path Physics Tables to the process 306 //------------------------------------------ 342 //------------------------------------------------------------------------ 307 343 308 void SetDEDXTable(G4PhysicsTable* p, G4EmTab 344 void SetDEDXTable(G4PhysicsTable* p, G4EmTableType tType); 309 void SetCSDARangeTable(G4PhysicsTable* pRang 345 void SetCSDARangeTable(G4PhysicsTable* pRange); 310 void SetRangeTableForLoss(G4PhysicsTable* p) 346 void SetRangeTableForLoss(G4PhysicsTable* p); >> 347 void SetSecondaryRangeTable(G4PhysicsTable* p); 311 void SetInverseRangeTable(G4PhysicsTable* p) 348 void SetInverseRangeTable(G4PhysicsTable* p); 312 void SetLambdaTable(G4PhysicsTable* p); << 313 << 314 void SetTwoPeaksXS(std::vector<G4TwoPeaksXS* << 315 void SetEnergyOfCrossSectionMax(std::vector< << 316 349 317 //------------------------------------------ << 350 void SetLambdaTable(G4PhysicsTable* p); 318 // Specific methods to define custom Physics << 351 void SetSubLambdaTable(G4PhysicsTable* p); 319 //------------------------------------------ << 320 352 321 // Binning for dEdx, range, inverse range an << 353 // Binning for dEdx, range, inverse range and labda tables 322 void SetDEDXBinning(G4int nbins); 354 void SetDEDXBinning(G4int nbins); 323 355 324 // Min kinetic energy for tables 356 // Min kinetic energy for tables 325 void SetMinKinEnergy(G4double e); 357 void SetMinKinEnergy(G4double e); 326 inline G4double MinKinEnergy() const; 358 inline G4double MinKinEnergy() const; 327 359 328 // Max kinetic energy for tables 360 // Max kinetic energy for tables 329 void SetMaxKinEnergy(G4double e); 361 void SetMaxKinEnergy(G4double e); 330 inline G4double MaxKinEnergy() const; 362 inline G4double MaxKinEnergy() const; 331 363 332 // Biasing parameters 364 // Biasing parameters 333 inline G4double CrossSectionBiasingFactor() 365 inline G4double CrossSectionBiasingFactor() const; 334 366 335 // Return values for given G4MaterialCutsCou 367 // Return values for given G4MaterialCutsCouple 336 inline G4double GetDEDX(G4double kineticEner << 368 inline G4double GetDEDX(G4double kineticEnergy, 337 inline G4double GetCSDADEDX(G4double kinetic << 369 const G4MaterialCutsCouple*); 338 const G4Material << 370 inline G4double GetDEDXForSubsec(G4double kineticEnergy, 339 inline G4double GetDEDX(G4double kineticEner << 371 const G4MaterialCutsCouple*); 340 G4double logKineticE << 372 inline G4double GetRange(G4double kineticEnergy, 341 inline G4double GetRange(G4double kineticEne << 373 const G4MaterialCutsCouple*); 342 inline G4double GetRange(G4double kineticEne << 343 G4double logKinetic << 344 inline G4double GetCSDARange(G4double kineti 374 inline G4double GetCSDARange(G4double kineticEnergy, 345 const G4Materia 375 const G4MaterialCutsCouple*); >> 376 inline G4double GetRangeForLoss(G4double kineticEnergy, >> 377 const G4MaterialCutsCouple*); 346 inline G4double GetKineticEnergy(G4double ra 378 inline G4double GetKineticEnergy(G4double range, 347 const G4Mat 379 const G4MaterialCutsCouple*); 348 inline G4double GetLambda(G4double kineticEn << 380 inline G4double GetLambda(G4double kineticEnergy, 349 inline G4double GetLambda(G4double kineticEn << 381 const G4MaterialCutsCouple*); 350 G4double logKineti << 351 382 352 inline G4bool TablesAreBuilt() const; 383 inline G4bool TablesAreBuilt() const; 353 384 354 // Access to specific tables 385 // Access to specific tables 355 inline G4PhysicsTable* DEDXTable() const; 386 inline G4PhysicsTable* DEDXTable() const; >> 387 inline G4PhysicsTable* DEDXTableForSubsec() const; 356 inline G4PhysicsTable* DEDXunRestrictedTable 388 inline G4PhysicsTable* DEDXunRestrictedTable() const; 357 inline G4PhysicsTable* IonisationTable() con 389 inline G4PhysicsTable* IonisationTable() const; >> 390 inline G4PhysicsTable* IonisationTableForSubsec() const; 358 inline G4PhysicsTable* CSDARangeTable() cons 391 inline G4PhysicsTable* CSDARangeTable() const; >> 392 inline G4PhysicsTable* SecondaryRangeTable() const; 359 inline G4PhysicsTable* RangeTableForLoss() c 393 inline G4PhysicsTable* RangeTableForLoss() const; 360 inline G4PhysicsTable* InverseRangeTable() c 394 inline G4PhysicsTable* InverseRangeTable() const; 361 inline G4PhysicsTable* LambdaTable() const; 395 inline G4PhysicsTable* LambdaTable() const; 362 inline std::vector<G4TwoPeaksXS*>* TwoPeaksX << 396 inline G4PhysicsTable* SubLambdaTable() const; 363 inline std::vector<G4double>* EnergyOfCrossS << 364 << 365 inline G4bool UseBaseMaterial() const; << 366 397 367 //------------------------------------------ 398 //------------------------------------------------------------------------ 368 // Run time method for simulation of ionisat 399 // Run time method for simulation of ionisation 369 //------------------------------------------ 400 //------------------------------------------------------------------------ 370 401 371 // access atom on which interaction happens 402 // access atom on which interaction happens 372 const G4Element* GetCurrentElement() const; 403 const G4Element* GetCurrentElement() const; 373 404 374 // Set scaling parameters for ions is needed 405 // Set scaling parameters for ions is needed to G4EmCalculator 375 void SetDynamicMassCharge(G4double massratio << 406 inline void SetDynamicMassCharge(G4double massratio, G4double charge2ratio); 376 407 377 private: 408 private: 378 409 379 void FillSecondariesAlongStep(G4double weigh << 410 void FillSecondariesAlongStep(G4double& eloss, G4double& weight); 380 411 381 void PrintWarning(const G4String&, G4double << 412 void PrintWarning(G4String, G4double val); 382 413 383 // define material and indexes 414 // define material and indexes 384 inline void DefineMaterial(const G4MaterialC 415 inline void DefineMaterial(const G4MaterialCutsCouple* couple); 385 416 386 //------------------------------------------ 417 //------------------------------------------------------------------------ 387 // Compute values using scaling relation, ma 418 // Compute values using scaling relation, mass and charge of based particle 388 //------------------------------------------ 419 //------------------------------------------------------------------------ 389 inline G4double GetDEDXForScaledEnergy(G4dou << 390 inline G4double GetDEDXForScaledEnergy(G4dou << 391 G4dou << 392 inline G4double GetIonisationForScaledEnergy << 393 inline G4double GetScaledRangeForScaledEnerg << 394 inline G4double GetScaledRangeForScaledEnerg << 395 << 396 << 397 inline G4double GetLimitScaledRangeForScaled << 398 inline G4double GetLimitScaledRangeForScaled << 399 << 400 420 >> 421 inline G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy); >> 422 inline G4double GetSubDEDXForScaledEnergy(G4double scaledKinEnergy); >> 423 inline G4double GetIonisationForScaledEnergy(G4double scaledKinEnergy); >> 424 inline G4double GetSubIonisationForScaledEnergy(G4double scaledKinEnergy); >> 425 inline G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy); >> 426 inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy); 401 inline G4double ScaledKinEnergyForLoss(G4dou 427 inline G4double ScaledKinEnergyForLoss(G4double range); 402 inline G4double GetLambdaForScaledEnergy(G4d << 428 inline G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy); 403 inline G4double GetLambdaForScaledEnergy(G4d << 429 void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy); 404 G4d << 405 << 406 inline G4double LogScaledEkin(const G4Track& << 407 << 408 void ComputeLambdaForScaledEnergy(G4double s << 409 const G4Tr << 410 430 411 G4bool IsRegionForCubcutProcessor(const G4Tr << 431 // hide assignment operator 412 << 432 G4VEnergyLossProcess(G4VEnergyLossProcess &) = delete; 413 protected: << 433 G4VEnergyLossProcess & operator=(const G4VEnergyLossProcess &right) = delete; 414 << 415 G4ParticleChangeForLoss fParticleChange; << 416 const G4Material* currentMaterial << 417 const G4MaterialCutsCouple* currentCouple = << 418 434 419 private: << 435 // ======== Parameters of the class fixed at construction ========= 420 436 421 G4LossTableManager* lManager; 437 G4LossTableManager* lManager; 422 G4EmModelManager* modelManager; 438 G4EmModelManager* modelManager; 423 G4VEmModel* currentModel = n << 439 G4EmBiasingManager* biasManager; 424 G4EmBiasingManager* biasManager = nu << 425 G4SafetyHelper* safetyHelper; 440 G4SafetyHelper* safetyHelper; 426 G4EmParameters* theParameters; 441 G4EmParameters* theParameters; 427 G4VEmFluctuationModel* fluctModel = nul << 428 G4VAtomDeexcitation* atomDeexcitation << 429 G4VSubCutProducer* subcutProducer = << 430 << 431 const G4ParticleDefinition* particle = nullp << 432 const G4ParticleDefinition* baseParticle = n << 433 const G4ParticleDefinition* secondaryParticl << 434 G4EmDataHandler* theData = nullptr; << 435 << 436 G4PhysicsTable* theDEDXTable = nullptr; << 437 G4PhysicsTable* theDEDXunRestrictedTable = n << 438 G4PhysicsTable* theIonisationTable = nullptr << 439 G4PhysicsTable* theRangeTableForLoss = nullp << 440 G4PhysicsTable* theCSDARangeTable = nullptr; << 441 G4PhysicsTable* theInverseRangeTable = nullp << 442 G4PhysicsTable* theLambdaTable = nullptr; << 443 << 444 std::vector<const G4Region*>* scoffRegions = << 445 std::vector<G4VEmModel*>* emModels = nul << 446 const std::vector<G4int>* theDensityIdx << 447 const std::vector<G4double>* theDensityFact << 448 const G4DataVector* theCuts = null << 449 442 450 std::vector<G4double>* theEnergyOfCrossSecti << 443 const G4ParticleDefinition* secondaryParticle; 451 std::vector<G4TwoPeaksXS*>* fXSpeaks = nullp << 444 const G4ParticleDefinition* theElectron; >> 445 const G4ParticleDefinition* thePositron; >> 446 const G4ParticleDefinition* theGamma; >> 447 const G4ParticleDefinition* theGenericIon; >> 448 >> 449 // ======== Parameters of the class fixed at initialisation ======= >> 450 >> 451 std::vector<G4VEmModel*> emModels; >> 452 G4VEmFluctuationModel* fluctModel; >> 453 G4VAtomDeexcitation* atomDeexcitation; >> 454 G4VSubCutProducer* subcutProducer; >> 455 std::vector<const G4Region*> scoffRegions; >> 456 G4int nSCoffRegions; >> 457 G4bool* idxSCoffRegions; >> 458 >> 459 std::vector<G4VEnergyLossProcess*> scProcesses; >> 460 G4int nProcesses; >> 461 >> 462 // tables and vectors >> 463 G4PhysicsTable* theDEDXTable; >> 464 G4PhysicsTable* theDEDXSubTable; >> 465 G4PhysicsTable* theDEDXunRestrictedTable; >> 466 G4PhysicsTable* theIonisationTable; >> 467 G4PhysicsTable* theIonisationSubTable; >> 468 G4PhysicsTable* theRangeTableForLoss; >> 469 G4PhysicsTable* theCSDARangeTable; >> 470 G4PhysicsTable* theSecondaryRangeTable; >> 471 G4PhysicsTable* theInverseRangeTable; >> 472 G4PhysicsTable* theLambdaTable; >> 473 G4PhysicsTable* theSubLambdaTable; >> 474 >> 475 size_t idxDEDX; >> 476 size_t idxDEDXSub; >> 477 size_t idxDEDXunRestricted; >> 478 size_t idxIonisation; >> 479 size_t idxIonisationSub; >> 480 size_t idxRange; >> 481 size_t idxCSDA; >> 482 size_t idxSecRange; >> 483 size_t idxInverseRange; >> 484 size_t idxLambda; >> 485 size_t idxSubLambda; >> 486 >> 487 std::vector<G4double> theDEDXAtMaxEnergy; >> 488 std::vector<G4double> theRangeAtMaxEnergy; >> 489 std::vector<G4double> theEnergyOfCrossSectionMax; >> 490 std::vector<G4double> theCrossSectionMax; >> 491 >> 492 const std::vector<G4double>* theDensityFactor; >> 493 const std::vector<G4int>* theDensityIdx; >> 494 >> 495 const G4DataVector* theCuts; >> 496 const G4DataVector* theSubCuts; >> 497 >> 498 const G4ParticleDefinition* baseParticle; >> 499 >> 500 G4int nBins; >> 501 G4int nBinsCSDA; 452 502 453 G4double lowestKinEnergy; 503 G4double lowestKinEnergy; 454 G4double minKinEnergy; 504 G4double minKinEnergy; 455 G4double maxKinEnergy; 505 G4double maxKinEnergy; 456 G4double maxKinEnergyCSDA; 506 G4double maxKinEnergyCSDA; 457 507 458 G4double linLossLimit = 0.01; << 508 G4double linLossLimit; 459 G4double dRoverRange = 0.2; << 509 G4double dRoverRange; 460 G4double finalRange; 510 G4double finalRange; 461 G4double lambdaFactor = 0.8; << 511 G4double lambdaFactor; 462 G4double invLambdaFactor; << 512 G4double biasFactor; 463 G4double biasFactor = 1.0; << 513 464 << 514 G4bool lossFluctuationFlag; 465 G4double massRatio = 1.0; << 515 G4bool rndmStepFlag; 466 G4double logMassRatio = 0.0; << 516 G4bool tablesAreBuilt; 467 G4double fFactor = 1.0; << 517 G4bool integral; 468 G4double reduceFactor = 1.0; << 518 G4bool isIon; 469 G4double chargeSqRatio = 1.0; << 519 G4bool isIonisation; 470 G4double fRange = 0.0; << 520 G4bool useSubCutoff; 471 G4double fRangeEnergy = 0.0; << 521 G4bool useDeexcitation; >> 522 G4bool biasFlag; >> 523 G4bool weightFlag; >> 524 G4bool isMaster; >> 525 G4bool actIntegral; >> 526 G4bool actStepFunc; >> 527 G4bool actLinLossLimit; >> 528 G4bool actLossFluc; >> 529 G4bool actBinning; >> 530 G4bool actMinKinEnergy; >> 531 G4bool actMaxKinEnergy; 472 532 473 protected: 533 protected: 474 534 475 G4double preStepLambda = 0.0; << 535 G4ParticleChangeForLoss fParticleChange; 476 G4double preStepKinEnergy = 0.0; << 536 const G4Material* currentMaterial; 477 G4double preStepScaledEnergy = 0.0; << 537 const G4MaterialCutsCouple* currentCouple; 478 G4double mfpKinEnergy = 0.0; << 538 size_t currentCoupleIndex; >> 539 >> 540 G4double preStepLambda; >> 541 G4double fRange; >> 542 G4double computedRange; >> 543 G4double preStepKinEnergy; >> 544 G4double preStepScaledEnergy; >> 545 G4double preStepRangeEnergy; >> 546 G4double mfpKinEnergy; 479 547 480 std::size_t currentCoupleIndex = 0; << 548 // ======== Cached values - may be state dependent ================ 481 549 482 private: 550 private: 483 551 484 G4int nBins; << 552 std::vector<G4DynamicParticle*> secParticles; 485 G4int nBinsCSDA; << 553 std::vector<G4Track*> scTracks; 486 G4int numberOfModels = 0; << 554 487 G4int nSCoffRegions = 0; << 555 const G4ParticleDefinition* particle; 488 G4int secID = _DeltaElectron; << 556 489 G4int tripletID = _TripletElectron; << 557 G4VEmModel* currentModel; 490 G4int biasID = _DeltaEBelowCut; << 558 size_t basedCoupleIndex; 491 G4int epixeID = _ePIXE; << 559 size_t lastIdx; 492 G4int gpixeID = _GammaPIXE; << 493 G4int mainSecondaries = 1; << 494 << 495 std::size_t basedCoupleIndex = 0; << 496 std::size_t coupleIdxRange = 0; << 497 std::size_t idxDEDX = 0; << 498 std::size_t idxDEDXunRestricted = 0; << 499 std::size_t idxIonisation = 0; << 500 std::size_t idxRange = 0; << 501 std::size_t idxCSDA = 0; << 502 std::size_t idxSecRange = 0; << 503 std::size_t idxInverseRange = 0; << 504 std::size_t idxLambda = 0; << 505 << 506 G4GPILSelection aGPILSelection; << 507 G4CrossSectionType fXSType = fEmOnePeak; << 508 << 509 G4bool lossFluctuationFlag = true; << 510 G4bool useCutAsFinalRange = false; << 511 G4bool tablesAreBuilt = false; << 512 G4bool spline = true; << 513 G4bool isIon = false; << 514 G4bool isIonisation = false; << 515 G4bool useDeexcitation = false; << 516 G4bool biasFlag = false; << 517 G4bool weightFlag = false; << 518 G4bool isMaster = false; << 519 G4bool baseMat = false; << 520 G4bool actLinLossLimit = false; << 521 G4bool actLossFluc = false; << 522 G4bool actBinning = false; << 523 G4bool actMinKinEnergy = false; << 524 G4bool actMaxKinEnergy = false; << 525 560 526 std::vector<G4DynamicParticle*> secParticles << 561 G4double massRatio; 527 std::vector<G4Track*> scTracks; << 562 G4double fFactor; >> 563 G4double reduceFactor; >> 564 G4double chargeSqRatio; >> 565 >> 566 G4GPILSelection aGPILSelection; >> 567 >> 568 G4int secID; >> 569 G4int subsecID; >> 570 G4int biasID; 528 }; 571 }; 529 572 530 // ======== Run time inline methods ========== 573 // ======== Run time inline methods ================ 531 574 532 inline std::size_t G4VEnergyLossProcess::Curre << 575 inline size_t G4VEnergyLossProcess::CurrentMaterialCutsCoupleIndex() const 533 { 576 { 534 return currentCoupleIndex; 577 return currentCoupleIndex; 535 } 578 } 536 579 537 //....oooOO0OOooo........oooOO0OOooo........oo 580 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 538 581 539 inline void G4VEnergyLossProcess::SelectModel( 582 inline void G4VEnergyLossProcess::SelectModel(G4double kinEnergy) 540 { 583 { 541 currentModel = modelManager->SelectModel(kin 584 currentModel = modelManager->SelectModel(kinEnergy, currentCoupleIndex); 542 currentModel->SetCurrentCouple(currentCouple 585 currentModel->SetCurrentCouple(currentCouple); 543 } 586 } 544 587 545 //....oooOO0OOooo........oooOO0OOooo........oo 588 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 546 589 547 inline G4VEmModel* G4VEnergyLossProcess::Selec 590 inline G4VEmModel* G4VEnergyLossProcess::SelectModelForMaterial( 548 G4double kinEnergy, std::si << 591 G4double kinEnergy, size_t& idx) const 549 { 592 { 550 return modelManager->SelectModel(kinEnergy, 593 return modelManager->SelectModel(kinEnergy, idx); 551 } 594 } 552 595 553 //....oooOO0OOooo........oooOO0OOooo........oo 596 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 554 597 555 inline void 598 inline void 556 G4VEnergyLossProcess::DefineMaterial(const G4M 599 G4VEnergyLossProcess::DefineMaterial(const G4MaterialCutsCouple* couple) 557 { 600 { 558 if(couple != currentCouple) { 601 if(couple != currentCouple) { 559 currentCouple = couple; << 602 currentCouple = couple; 560 currentMaterial = couple->GetMaterial(); 603 currentMaterial = couple->GetMaterial(); 561 basedCoupleIndex = currentCoupleIndex = co << 604 currentCoupleIndex = couple->GetIndex(); 562 fFactor = chargeSqRatio*biasFactor; << 605 basedCoupleIndex = (*theDensityIdx)[currentCoupleIndex]; 563 mfpKinEnergy = DBL_MAX; << 606 fFactor = chargeSqRatio*biasFactor*(*theDensityFactor)[currentCoupleIndex]; 564 idxLambda = 0; << 565 if(baseMat) { << 566 basedCoupleIndex = (*theDensityIdx)[curr << 567 fFactor *= (*theDensityFactor)[currentCo << 568 } << 569 reduceFactor = 1.0/(fFactor*massRatio); 607 reduceFactor = 1.0/(fFactor*massRatio); >> 608 mfpKinEnergy = DBL_MAX; >> 609 idxLambda = idxSubLambda = 0; 570 } 610 } 571 } 611 } 572 612 573 //....oooOO0OOooo........oooOO0OOooo........oo 613 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 574 614 >> 615 inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio, >> 616 G4double charge2ratio) >> 617 { >> 618 massRatio = massratio; >> 619 fFactor = charge2ratio*biasFactor*(*theDensityFactor)[currentCoupleIndex]; >> 620 chargeSqRatio = charge2ratio; >> 621 reduceFactor = 1.0/(fFactor*massRatio); >> 622 } >> 623 >> 624 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 625 575 inline G4double G4VEnergyLossProcess::GetDEDXF 626 inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e) 576 { 627 { 577 /* 628 /* 578 G4cout << "G4VEnergyLossProcess::GetDEDX: Id 629 G4cout << "G4VEnergyLossProcess::GetDEDX: Idx= " 579 << basedCoupleIndex << " E(MeV)= " 630 << basedCoupleIndex << " E(MeV)= " << e 580 << " Emin= " << minKinEnergy << " Fa 631 << " Emin= " << minKinEnergy << " Factor= " << fFactor 581 << " " << theDEDXTable << G4endl; */ 632 << " " << theDEDXTable << G4endl; */ 582 G4double x = fFactor*(*theDEDXTable)[basedCo 633 G4double x = fFactor*(*theDEDXTable)[basedCoupleIndex]->Value(e, idxDEDX); 583 if(e < minKinEnergy) { x *= std::sqrt(e/minK 634 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); } 584 return x; 635 return x; 585 } 636 } 586 637 587 //....oooOO0OOooo........oooOO0OOooo........oo 638 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 588 639 589 inline << 640 inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e) 590 G4double G4VEnergyLossProcess::GetDEDXForScale << 591 { 641 { 592 /* << 642 G4double x = 593 G4cout << "G4VEnergyLossProcess::GetDEDX: Id << 643 fFactor*(*theDEDXSubTable)[basedCoupleIndex]->Value(e, idxDEDXSub); 594 << basedCoupleIndex << " E(MeV)= " << 595 << " Emin= " << minKinEnergy << " Fa << 596 << " " << theDEDXTable << G4endl; */ << 597 G4double x = fFactor*(*theDEDXTable)[basedCo << 598 if(e < minKinEnergy) { x *= std::sqrt(e/minK 644 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); } 599 return x; 645 return x; 600 } 646 } 601 647 602 //....oooOO0OOooo........oooOO0OOooo........oo 648 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 603 649 604 inline G4double G4VEnergyLossProcess::GetIonis 650 inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(G4double e) 605 { 651 { 606 G4double x = 652 G4double x = 607 fFactor*(*theIonisationTable)[basedCoupleI 653 fFactor*(*theIonisationTable)[basedCoupleIndex]->Value(e, idxIonisation); 608 if(e < minKinEnergy) { x *= std::sqrt(e/minK 654 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); } 609 return x; 655 return x; 610 } 656 } 611 657 612 //....oooOO0OOooo........oooOO0OOooo........oo 658 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 613 659 614 inline G4double G4VEnergyLossProcess::GetScale << 660 inline >> 661 G4double G4VEnergyLossProcess::GetSubIonisationForScaledEnergy(G4double e) 615 { 662 { 616 //G4cout << "G4VEnergyLossProcess::GetScaled << 663 G4double x = fFactor* 617 // << basedCoupleIndex << " E(MeV)= << 664 (*theIonisationSubTable)[basedCoupleIndex]->Value(e, idxIonisationSub); 618 // << " lastIdx= " << lastIdx << " << 665 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); } 619 if(currentCoupleIndex != coupleIdxRange || f << 666 return x; 620 coupleIdxRange = currentCoupleIndex; << 621 fRangeEnergy = e; << 622 fRange = reduceFactor*((*theRangeTableForL << 623 if (fRange < 0.0) { fRange = 0.0; } << 624 else if (e < minKinEnergy) { fRange *= std << 625 } << 626 //G4cout << "G4VEnergyLossProcess::GetScaled << 627 // << basedCoupleIndex << " E(MeV)= << 628 // << " R= " << computedRange << " << 629 return fRange; << 630 } 667 } 631 668 632 inline G4double << 669 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 633 G4VEnergyLossProcess::GetScaledRangeForScaledE << 670 >> 671 inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e) 634 { 672 { 635 //G4cout << "G4VEnergyLossProcess::GetScaled 673 //G4cout << "G4VEnergyLossProcess::GetScaledRange: Idx= " 636 // << basedCoupleIndex << " E(MeV)= 674 // << basedCoupleIndex << " E(MeV)= " << e 637 // << " lastIdx= " << lastIdx << " 675 // << " lastIdx= " << lastIdx << " " << theRangeTableForLoss << G4endl; 638 if(currentCoupleIndex != coupleIdxRange || f << 676 if(basedCoupleIndex != lastIdx || preStepRangeEnergy != e) { 639 coupleIdxRange = currentCoupleIndex; << 677 lastIdx = basedCoupleIndex; 640 fRangeEnergy = e; << 678 preStepRangeEnergy = e; 641 fRange = reduceFactor*((*theRangeTableForL << 679 computedRange = 642 if (fRange < 0.0) { fRange = 0.0; } << 680 ((*theRangeTableForLoss)[basedCoupleIndex])->Value(e, idxRange); 643 else if (e < minKinEnergy) { fRange *= std << 681 if(e < minKinEnergy) { computedRange *= std::sqrt(e/minKinEnergy); } 644 } 682 } 645 //G4cout << "G4VEnergyLossProcess::GetScaled 683 //G4cout << "G4VEnergyLossProcess::GetScaledRange: Idx= " 646 // << basedCoupleIndex << " E(MeV)= 684 // << basedCoupleIndex << " E(MeV)= " << e 647 // << " R= " << fRange << " " << t << 685 // << " R= " << fRange << " " << theRangeTableForLoss << G4endl; 648 return fRange; << 649 } << 650 686 651 //....oooOO0OOooo........oooOO0OOooo........oo << 687 return computedRange; 652 << 653 inline G4double << 654 G4VEnergyLossProcess::GetLimitScaledRangeForSc << 655 { << 656 G4double x = ((*theCSDARangeTable)[basedCoup << 657 if (x < 0.0) { x = 0.0; } << 658 else if (e < minKinEnergy) { x *= std::sqrt( << 659 return x; << 660 } 688 } 661 689 662 //....oooOO0OOooo........oooOO0OOooo........oo 690 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 663 691 664 inline G4double 692 inline G4double 665 G4VEnergyLossProcess::GetLimitScaledRangeForSc << 693 G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(G4double e) 666 << 667 { 694 { 668 G4double x = ((*theCSDARangeTable)[basedCoup << 695 G4double x; 669 if (x < 0.0) { x = 0.0; } << 696 if (e < maxKinEnergyCSDA) { 670 else if (e < minKinEnergy) { x *= std::sqrt( << 697 x = ((*theCSDARangeTable)[basedCoupleIndex])->Value(e, idxCSDA); >> 698 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); } >> 699 } else { >> 700 x = theRangeAtMaxEnergy[basedCoupleIndex] + >> 701 (e - maxKinEnergyCSDA)/theDEDXAtMaxEnergy[basedCoupleIndex]; >> 702 } 671 return x; 703 return x; 672 } 704 } 673 705 674 //....oooOO0OOooo........oooOO0OOooo........oo 706 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 675 707 676 inline G4double G4VEnergyLossProcess::ScaledKi 708 inline G4double G4VEnergyLossProcess::ScaledKinEnergyForLoss(G4double r) 677 { 709 { 678 //G4cout << "G4VEnergyLossProcess::GetEnergy 710 //G4cout << "G4VEnergyLossProcess::GetEnergy: Idx= " 679 // << basedCoupleIndex << " R(mm)= " 711 // << basedCoupleIndex << " R(mm)= " << r << " " 680 // << theInverseRangeTable << G4endl 712 // << theInverseRangeTable << G4endl; 681 G4PhysicsVector* v = (*theInverseRangeTable) 713 G4PhysicsVector* v = (*theInverseRangeTable)[basedCoupleIndex]; 682 G4double rmin = v->Energy(0); 714 G4double rmin = v->Energy(0); 683 G4double e = 0.0; 715 G4double e = 0.0; 684 if(r >= rmin) { e = v->Value(r, idxInverseRa 716 if(r >= rmin) { e = v->Value(r, idxInverseRange); } 685 else if(r > 0.0) { 717 else if(r > 0.0) { 686 G4double x = r/rmin; 718 G4double x = r/rmin; 687 e = minKinEnergy*x*x; 719 e = minKinEnergy*x*x; 688 } 720 } 689 return e; 721 return e; 690 } 722 } 691 723 692 //....oooOO0OOooo........oooOO0OOooo........oo 724 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 693 725 694 inline G4double G4VEnergyLossProcess::GetLambd 726 inline G4double G4VEnergyLossProcess::GetLambdaForScaledEnergy(G4double e) 695 { 727 { 696 return fFactor*((*theLambdaTable)[basedCoupl 728 return fFactor*((*theLambdaTable)[basedCoupleIndex])->Value(e, idxLambda); 697 } 729 } 698 730 699 //....oooOO0OOooo........oooOO0OOooo........oo 731 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 700 732 701 inline G4double << 702 G4VEnergyLossProcess::GetLambdaForScaledEnergy << 703 { << 704 return fFactor*((*theLambdaTable)[basedCoupl << 705 } << 706 << 707 //....oooOO0OOooo........oooOO0OOooo........oo << 708 << 709 inline G4double G4VEnergyLossProcess::LogScale << 710 { << 711 return track.GetDynamicParticle()->GetLogKin << 712 } << 713 << 714 //....oooOO0OOooo........oooOO0OOooo........oo << 715 << 716 inline G4double 733 inline G4double 717 G4VEnergyLossProcess::GetDEDX(G4double kinEner << 734 G4VEnergyLossProcess::GetDEDX(G4double kineticEnergy, 718 const G4Material 735 const G4MaterialCutsCouple* couple) 719 { 736 { 720 DefineMaterial(couple); 737 DefineMaterial(couple); 721 return GetDEDXForScaledEnergy(kinEnergy*mass << 738 return GetDEDXForScaledEnergy(kineticEnergy*massRatio); 722 } 739 } 723 740 724 //....oooOO0OOooo........oooOO0OOooo........oo 741 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 725 742 726 inline G4double 743 inline G4double 727 G4VEnergyLossProcess::GetDEDX(G4double kinEner << 744 G4VEnergyLossProcess::GetDEDXForSubsec(G4double kineticEnergy, 728 const G4Material << 745 const G4MaterialCutsCouple* couple) 729 G4double logKinE << 730 { 746 { 731 DefineMaterial(couple); 747 DefineMaterial(couple); 732 return GetDEDXForScaledEnergy(kinEnergy*mass << 748 return GetSubDEDXForScaledEnergy(kineticEnergy*massRatio); 733 } 749 } 734 750 735 //....oooOO0OOooo........oooOO0OOooo........oo 751 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 736 752 737 inline G4double 753 inline G4double 738 G4VEnergyLossProcess::GetRange(G4double kinEne << 754 G4VEnergyLossProcess::GetRange(G4double kineticEnergy, 739 const G4Materia 755 const G4MaterialCutsCouple* couple) 740 { 756 { >> 757 G4double x = fRange; 741 DefineMaterial(couple); 758 DefineMaterial(couple); 742 return GetScaledRangeForScaledEnergy(kinEner << 759 if(theCSDARangeTable) { >> 760 x = GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio) >> 761 * reduceFactor; >> 762 } else if(theRangeTableForLoss) { >> 763 x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor; >> 764 } >> 765 return x; 743 } 766 } 744 767 745 //....oooOO0OOooo........oooOO0OOooo........oo 768 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 746 769 747 inline G4double 770 inline G4double 748 G4VEnergyLossProcess::GetRange(G4double kinEne << 771 G4VEnergyLossProcess::GetCSDARange(G4double kineticEnergy, 749 const G4Materia << 772 const G4MaterialCutsCouple* couple) 750 G4double logKin << 751 { 773 { 752 DefineMaterial(couple); 774 DefineMaterial(couple); 753 return GetScaledRangeForScaledEnergy(kinEner << 775 return (theCSDARangeTable) ? >> 776 GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor >> 777 : DBL_MAX; 754 } 778 } 755 779 756 //....oooOO0OOooo........oooOO0OOooo........oo 780 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 757 781 758 inline G4double 782 inline G4double 759 G4VEnergyLossProcess::GetCSDARange(G4double ki << 783 G4VEnergyLossProcess::GetRangeForLoss(G4double kineticEnergy, 760 const G4Mat << 784 const G4MaterialCutsCouple* couple) 761 { 785 { >> 786 // G4cout << "GetRangeForLoss: Range from " << GetProcessName() << G4endl; 762 DefineMaterial(couple); 787 DefineMaterial(couple); 763 return (nullptr == theCSDARangeTable) ? DBL_ << 788 return GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor; 764 GetLimitScaledRangeForScaledEnergy(kinetic << 765 } 789 } 766 790 767 //....oooOO0OOooo........oooOO0OOooo........oo 791 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 768 792 769 inline G4double 793 inline G4double 770 G4VEnergyLossProcess::GetKineticEnergy(G4doubl 794 G4VEnergyLossProcess::GetKineticEnergy(G4double range, 771 const G 795 const G4MaterialCutsCouple* couple) 772 { 796 { 773 DefineMaterial(couple); 797 DefineMaterial(couple); 774 return ScaledKinEnergyForLoss(range/reduceFa 798 return ScaledKinEnergyForLoss(range/reduceFactor)/massRatio; 775 } 799 } 776 800 777 //....oooOO0OOooo........oooOO0OOooo........oo 801 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 778 802 779 inline G4double 803 inline G4double 780 G4VEnergyLossProcess::GetLambda(G4double kinEn << 804 G4VEnergyLossProcess::GetLambda(G4double kineticEnergy, 781 const G4Materi 805 const G4MaterialCutsCouple* couple) 782 { 806 { 783 DefineMaterial(couple); 807 DefineMaterial(couple); 784 return (nullptr != theLambdaTable) ? << 808 return theLambdaTable ? GetLambdaForScaledEnergy(kineticEnergy*massRatio) : 0.0; 785 GetLambdaForScaledEnergy(kinEnergy*massRat << 786 } << 787 << 788 //....oooOO0OOooo........oooOO0OOooo........oo << 789 << 790 inline G4double << 791 G4VEnergyLossProcess::GetLambda(G4double kinEn << 792 const G4Materi << 793 G4double logKi << 794 { << 795 DefineMaterial(couple); << 796 return (nullptr != theLambdaTable) ? << 797 GetLambdaForScaledEnergy(kinEnergy*massRat << 798 : 0.0; << 799 } 809 } 800 810 801 // ======== Get/Set inline methods used at ini 811 // ======== Get/Set inline methods used at initialisation ================ 802 812 803 inline void G4VEnergyLossProcess::SetFluctMode 813 inline void G4VEnergyLossProcess::SetFluctModel(G4VEmFluctuationModel* p) 804 { 814 { 805 fluctModel = p; 815 fluctModel = p; 806 } 816 } 807 817 808 //....oooOO0OOooo........oooOO0OOooo........oo 818 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 809 819 810 inline G4VEmFluctuationModel* G4VEnergyLossPro << 820 inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel() 811 { 821 { 812 return fluctModel; 822 return fluctModel; 813 } 823 } 814 824 815 //....oooOO0OOooo........oooOO0OOooo........oo 825 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 816 826 817 inline void G4VEnergyLossProcess::SetParticle( 827 inline void G4VEnergyLossProcess::SetParticle(const G4ParticleDefinition* p) 818 { 828 { 819 particle = p; 829 particle = p; 820 } 830 } 821 831 822 //....oooOO0OOooo........oooOO0OOooo........oo 832 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 823 833 824 inline void 834 inline void 825 G4VEnergyLossProcess::SetSecondaryParticle(con 835 G4VEnergyLossProcess::SetSecondaryParticle(const G4ParticleDefinition* p) 826 { 836 { 827 secondaryParticle = p; 837 secondaryParticle = p; 828 } 838 } 829 839 830 //....oooOO0OOooo........oooOO0OOooo........oo 840 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 831 841 832 inline void 842 inline void 833 G4VEnergyLossProcess::SetBaseParticle(const G4 843 G4VEnergyLossProcess::SetBaseParticle(const G4ParticleDefinition* p) 834 { 844 { 835 baseParticle = p; 845 baseParticle = p; 836 } 846 } 837 847 838 //....oooOO0OOooo........oooOO0OOooo........oo 848 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 839 849 840 inline const G4ParticleDefinition* G4VEnergyLo 850 inline const G4ParticleDefinition* G4VEnergyLossProcess::Particle() const 841 { 851 { 842 return particle; 852 return particle; 843 } 853 } 844 854 845 //....oooOO0OOooo........oooOO0OOooo........oo 855 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 846 856 847 inline const G4ParticleDefinition* G4VEnergyLo 857 inline const G4ParticleDefinition* G4VEnergyLossProcess::BaseParticle() const 848 { 858 { 849 return baseParticle; 859 return baseParticle; 850 } 860 } 851 861 852 //....oooOO0OOooo........oooOO0OOooo........oo 862 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 853 863 854 inline const G4ParticleDefinition* 864 inline const G4ParticleDefinition* 855 G4VEnergyLossProcess::SecondaryParticle() cons 865 G4VEnergyLossProcess::SecondaryParticle() const 856 { 866 { 857 return secondaryParticle; 867 return secondaryParticle; 858 } 868 } 859 869 860 //....oooOO0OOooo........oooOO0OOooo........oo 870 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 861 871 862 inline void G4VEnergyLossProcess::SetLossFluct 872 inline void G4VEnergyLossProcess::SetLossFluctuations(G4bool val) 863 { 873 { 864 lossFluctuationFlag = val; 874 lossFluctuationFlag = val; 865 actLossFluc = true; 875 actLossFluc = true; 866 } 876 } 867 877 868 //....oooOO0OOooo........oooOO0OOooo........oo 878 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 869 879 870 inline void G4VEnergyLossProcess::SetSpline(G4 << 880 inline void G4VEnergyLossProcess::SetIntegral(G4bool val) 871 { << 872 spline = val; << 873 } << 874 << 875 //....oooOO0OOooo........oooOO0OOooo........oo << 876 << 877 inline void G4VEnergyLossProcess::SetCrossSect << 878 { 881 { 879 fXSType = val; << 882 integral = val; >> 883 actIntegral = true; 880 } 884 } 881 885 882 //....oooOO0OOooo........oooOO0OOooo........oo 886 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 883 887 884 inline G4CrossSectionType G4VEnergyLossProcess << 888 inline G4bool G4VEnergyLossProcess::IsIntegral() const 885 { 889 { 886 return fXSType; << 890 return integral; 887 } 891 } 888 892 889 //....oooOO0OOooo........oooOO0OOooo........oo 893 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 890 894 891 inline G4bool G4VEnergyLossProcess::IsIonisati 895 inline G4bool G4VEnergyLossProcess::IsIonisationProcess() const 892 { 896 { 893 return isIonisation; 897 return isIonisation; 894 } 898 } 895 899 896 //....oooOO0OOooo........oooOO0OOooo........oo 900 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 897 901 898 inline G4int G4VEnergyLossProcess::NumberOfSub 902 inline G4int G4VEnergyLossProcess::NumberOfSubCutoffRegions() const 899 { 903 { 900 return nSCoffRegions; 904 return nSCoffRegions; 901 } 905 } 902 906 903 //....oooOO0OOooo........oooOO0OOooo........oo 907 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 904 908 905 inline G4double G4VEnergyLossProcess::MinKinEn 909 inline G4double G4VEnergyLossProcess::MinKinEnergy() const 906 { 910 { 907 return minKinEnergy; 911 return minKinEnergy; 908 } 912 } 909 913 910 //....oooOO0OOooo........oooOO0OOooo........oo 914 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 911 915 912 inline G4double G4VEnergyLossProcess::MaxKinEn 916 inline G4double G4VEnergyLossProcess::MaxKinEnergy() const 913 { 917 { 914 return maxKinEnergy; 918 return maxKinEnergy; 915 } 919 } 916 920 917 //....oooOO0OOooo........oooOO0OOooo........oo 921 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 918 922 919 inline G4double G4VEnergyLossProcess::CrossSec 923 inline G4double G4VEnergyLossProcess::CrossSectionBiasingFactor() const 920 { 924 { 921 return biasFactor; 925 return biasFactor; 922 } 926 } 923 927 924 //....oooOO0OOooo........oooOO0OOooo........oo 928 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 925 929 926 inline G4bool G4VEnergyLossProcess::TablesAreB 930 inline G4bool G4VEnergyLossProcess::TablesAreBuilt() const 927 { 931 { 928 return tablesAreBuilt; << 932 return tablesAreBuilt; 929 } 933 } 930 934 931 //....oooOO0OOooo........oooOO0OOooo........oo 935 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 932 936 933 inline G4PhysicsTable* G4VEnergyLossProcess::D 937 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const 934 { 938 { 935 return theDEDXTable; 939 return theDEDXTable; 936 } 940 } 937 941 938 //....oooOO0OOooo........oooOO0OOooo........oo 942 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 939 943 940 inline G4PhysicsTable* G4VEnergyLossProcess::D << 944 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTableForSubsec() const 941 { << 942 return theDEDXunRestrictedTable; << 943 } << 944 << 945 //....oooOO0OOooo........oooOO0OOooo........oo << 946 << 947 inline G4PhysicsTable* G4VEnergyLossProcess::I << 948 { << 949 return theIonisationTable; << 950 } << 951 << 952 //....oooOO0OOooo........oooOO0OOooo........oo << 953 << 954 inline G4PhysicsTable* G4VEnergyLossProcess::C << 955 { 945 { 956 return theCSDARangeTable; << 946 return theDEDXSubTable; 957 } 947 } 958 948 959 //....oooOO0OOooo........oooOO0OOooo........oo 949 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 960 950 961 inline G4PhysicsTable* G4VEnergyLossProcess::R << 951 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const 962 { 952 { 963 return theRangeTableForLoss; << 953 return theDEDXunRestrictedTable; 964 } 954 } 965 955 966 //....oooOO0OOooo........oooOO0OOooo........oo 956 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 967 957 968 inline G4PhysicsTable* G4VEnergyLossProcess::I << 958 inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTable() const 969 { 959 { 970 return theInverseRangeTable; << 960 return theIonisationTable; 971 } 961 } 972 962 973 //....oooOO0OOooo........oooOO0OOooo........oo 963 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 974 964 975 inline G4PhysicsTable* G4VEnergyLossProcess::L << 965 inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTableForSubsec() const 976 { 966 { 977 return theLambdaTable; << 967 return theIonisationSubTable; 978 } 968 } 979 969 980 //....oooOO0OOooo........oooOO0OOooo........oo 970 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 981 971 982 inline G4bool G4VEnergyLossProcess::UseBaseMat << 972 inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const 983 { 973 { 984 return baseMat; << 974 return theCSDARangeTable; 985 } 975 } 986 976 987 //....oooOO0OOooo........oooOO0OOooo........oo 977 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 988 978 989 inline std::vector<G4double>* << 979 inline G4PhysicsTable* G4VEnergyLossProcess::SecondaryRangeTable() const 990 G4VEnergyLossProcess::EnergyOfCrossSectionMax( << 991 { 980 { 992 return theEnergyOfCrossSectionMax; << 981 return theSecondaryRangeTable; 993 } 982 } 994 983 995 //....oooOO0OOooo........oooOO0OOooo........oo 984 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 996 985 997 inline std::vector<G4TwoPeaksXS*>* G4VEnergyLo << 986 inline G4PhysicsTable* G4VEnergyLossProcess::RangeTableForLoss() const 998 { 987 { 999 return fXSpeaks; << 988 return theRangeTableForLoss; 1000 } 989 } 1001 990 1002 //....oooOO0OOooo........oooOO0OOooo........o 991 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1003 992 1004 inline std::size_t G4VEnergyLossProcess::Numb << 993 inline G4PhysicsTable* G4VEnergyLossProcess::InverseRangeTable() const 1005 { 994 { 1006 return numberOfModels; << 995 return theInverseRangeTable; 1007 } 996 } 1008 997 1009 //....oooOO0OOooo........oooOO0OOooo........o 998 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1010 999 1011 inline G4VEmModel* G4VEnergyLossProcess::EmMo << 1000 inline G4PhysicsTable* G4VEnergyLossProcess::LambdaTable() const 1012 { 1001 { 1013 return (index < emModels->size()) ? (*emMod << 1002 return theLambdaTable; 1014 } 1003 } 1015 1004 1016 //....oooOO0OOooo........oooOO0OOooo........o 1005 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1017 1006 1018 inline G4VEmModel* << 1007 inline G4PhysicsTable* G4VEnergyLossProcess::SubLambdaTable() const 1019 G4VEnergyLossProcess::GetModelByIndex(std::si << 1020 { 1008 { 1021 return modelManager->GetModel((G4int)idx, v << 1009 return theSubLambdaTable; 1022 } 1010 } 1023 1011 1024 //....oooOO0OOooo........oooOO0OOooo........o 1012 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1025 1013 1026 #endif 1014 #endif 1027 1015