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 // $Id: G4VEmModel.hh,v 1.77 2010-10-14 16:27:35 vnivanch Exp $ >> 27 // GEANT4 tag $Name: geant4-09-04-patch-01 $ >> 28 // 26 // ------------------------------------------- 29 // ------------------------------------------------------------------- 27 // 30 // 28 // GEANT4 Class header file 31 // GEANT4 Class header file 29 // 32 // 30 // 33 // 31 // File name: G4VEmModel 34 // File name: G4VEmModel 32 // 35 // 33 // Author: Vladimir Ivanchenko 36 // Author: Vladimir Ivanchenko 34 // 37 // 35 // Creation date: 03.01.2002 38 // Creation date: 03.01.2002 36 // 39 // 37 // Modifications: 40 // Modifications: 38 // 41 // 39 // 23-12-02 V.Ivanchenko change interface befo 42 // 23-12-02 V.Ivanchenko change interface before move to cut per region 40 // 24-01-03 Cut per region (V.Ivanchenko) 43 // 24-01-03 Cut per region (V.Ivanchenko) 41 // 13-02-03 Add name (V.Ivanchenko) 44 // 13-02-03 Add name (V.Ivanchenko) 42 // 25-02-03 Add sample theta and displacement 45 // 25-02-03 Add sample theta and displacement (V.Ivanchenko) 43 // 23-07-03 Replace G4Material by G4MaterialCu 46 // 23-07-03 Replace G4Material by G4MaterialCutCouple in dE/dx and CrossSection 44 // calculation (V.Ivanchenko) 47 // calculation (V.Ivanchenko) 45 // 01-03-04 L.Urban signature changed in Sampl 48 // 01-03-04 L.Urban signature changed in SampleCosineTheta 46 // 23-04-04 L.urban signature of SampleCosineT 49 // 23-04-04 L.urban signature of SampleCosineTheta changed back 47 // 17-11-04 Add method CrossSectionPerAtom (V. 50 // 17-11-04 Add method CrossSectionPerAtom (V.Ivanchenko) 48 // 14-03-05 Reduce number of pure virtual meth 51 // 14-03-05 Reduce number of pure virtual methods and make inline part 49 // separate (V.Ivanchenko) 52 // separate (V.Ivanchenko) 50 // 24-03-05 Remove IsInCharge and add G4VParti 53 // 24-03-05 Remove IsInCharge and add G4VParticleChange in the constructor (VI) 51 // 08-04-05 Major optimisation of internal int 54 // 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko) 52 // 15-04-05 optimize internal interface for ms 55 // 15-04-05 optimize internal interface for msc (V.Ivanchenko) 53 // 08-05-05 A -> N (V.Ivanchenko) 56 // 08-05-05 A -> N (V.Ivanchenko) 54 // 25-07-05 Move constructor and destructor to 57 // 25-07-05 Move constructor and destructor to the body (V.Ivanchenko) 55 // 02-02-06 ComputeCrossSectionPerAtom: defaul 58 // 02-02-06 ComputeCrossSectionPerAtom: default value A=0. (mma) 56 // 06-02-06 add method ComputeMeanFreePath() ( 59 // 06-02-06 add method ComputeMeanFreePath() (mma) 57 // 07-03-06 Optimize msc methods (V.Ivanchenko 60 // 07-03-06 Optimize msc methods (V.Ivanchenko) 58 // 29-06-06 Add member currentElement and Get/ 61 // 29-06-06 Add member currentElement and Get/Set methods (V.Ivanchenko) 59 // 29-10-07 Added SampleScattering (V.Ivanchen 62 // 29-10-07 Added SampleScattering (V.Ivanchenko) 60 // 15-07-08 Reorder class members and improve 63 // 15-07-08 Reorder class members and improve comments (VI) 61 // 21-07-08 Added vector of G4ElementSelector 64 // 21-07-08 Added vector of G4ElementSelector and methods to use it (VI) 62 // 12-09-08 Added methods GetParticleCharge, G 65 // 12-09-08 Added methods GetParticleCharge, GetChargeSquareRatio, 63 // CorrectionsAlongStep, ActivateNucl 66 // CorrectionsAlongStep, ActivateNuclearStopping (VI) 64 // 16-02-09 Moved implementations of virtual m 67 // 16-02-09 Moved implementations of virtual methods to source (VI) 65 // 07-04-09 Moved msc methods from G4VEmModel 68 // 07-04-09 Moved msc methods from G4VEmModel to G4VMscModel (VI) 66 // 13-10-10 Added G4VEmAngularDistribution (VI 69 // 13-10-10 Added G4VEmAngularDistribution (VI) 67 // 70 // 68 // Class Description: 71 // Class Description: 69 // 72 // 70 // Abstract interface to energy loss models 73 // Abstract interface to energy loss models 71 74 72 // ------------------------------------------- 75 // ------------------------------------------------------------------- 73 // 76 // 74 77 75 #ifndef G4VEmModel_h 78 #ifndef G4VEmModel_h 76 #define G4VEmModel_h 1 79 #define G4VEmModel_h 1 77 80 78 #include "globals.hh" 81 #include "globals.hh" 79 #include "G4DynamicParticle.hh" 82 #include "G4DynamicParticle.hh" 80 #include "G4ParticleDefinition.hh" 83 #include "G4ParticleDefinition.hh" 81 #include "G4MaterialCutsCouple.hh" 84 #include "G4MaterialCutsCouple.hh" 82 #include "G4Material.hh" 85 #include "G4Material.hh" 83 #include "G4Element.hh" 86 #include "G4Element.hh" 84 #include "G4ElementVector.hh" 87 #include "G4ElementVector.hh" 85 #include "G4Isotope.hh" << 86 #include "G4DataVector.hh" 88 #include "G4DataVector.hh" 87 #include "G4VEmFluctuationModel.hh" 89 #include "G4VEmFluctuationModel.hh" 88 #include "G4VEmAngularDistribution.hh" 90 #include "G4VEmAngularDistribution.hh" 89 #include "G4EmElementSelector.hh" 91 #include "G4EmElementSelector.hh" 90 #include <CLHEP/Random/RandomEngine.h> << 92 #include "Randomize.hh" 91 #include <vector> 93 #include <vector> 92 94 93 class G4ElementData; << 94 class G4PhysicsTable; 95 class G4PhysicsTable; 95 class G4Region; 96 class G4Region; 96 class G4VParticleChange; 97 class G4VParticleChange; 97 class G4ParticleChangeForLoss; 98 class G4ParticleChangeForLoss; 98 class G4ParticleChangeForGamma; 99 class G4ParticleChangeForGamma; 99 class G4Track; 100 class G4Track; 100 class G4LossTableManager; << 101 101 102 class G4VEmModel 102 class G4VEmModel 103 { 103 { 104 104 105 public: 105 public: 106 106 107 explicit G4VEmModel(const G4String& nam); << 107 G4VEmModel(const G4String& nam); 108 108 109 virtual ~G4VEmModel(); 109 virtual ~G4VEmModel(); 110 110 111 //------------------------------------------ 111 //------------------------------------------------------------------------ 112 // Virtual methods to be implemented for any 112 // Virtual methods to be implemented for any concrete model 113 //------------------------------------------ 113 //------------------------------------------------------------------------ 114 114 115 virtual void Initialise(const G4ParticleDefi << 115 virtual void Initialise(const G4ParticleDefinition*, >> 116 const G4DataVector&) = 0; 116 117 117 virtual void SampleSecondaries(std::vector<G 118 virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*, 118 const G4Mater << 119 const G4MaterialCutsCouple*, 119 const G4Dynam << 120 const G4DynamicParticle*, 120 G4double tmin << 121 G4double tmin = 0.0, 121 G4double tmax << 122 G4double tmax = DBL_MAX) = 0; 122 << 123 //------------------------------------------ << 124 // Methods for initialisation of MT; may be << 125 //------------------------------------------ << 126 << 127 // initialisation in local thread << 128 virtual void InitialiseLocal(const G4Particl << 129 G4VEmModel* mas << 130 << 131 // initialisation of a new material at run t << 132 virtual void InitialiseForMaterial(const G4P << 133 const G4M << 134 << 135 // initialisation of a new element at run ti << 136 virtual void InitialiseForElement(const G4Pa << 137 G4int Z); << 138 123 139 //------------------------------------------ 124 //------------------------------------------------------------------------ 140 // Methods with standard implementation; may 125 // Methods with standard implementation; may be overwritten if needed 141 //------------------------------------------ 126 //------------------------------------------------------------------------ 142 127 143 // main method to compute dEdx 128 // main method to compute dEdx 144 virtual G4double ComputeDEDXPerVolume(const 129 virtual G4double ComputeDEDXPerVolume(const G4Material*, 145 const << 130 const G4ParticleDefinition*, 146 G4doub << 131 G4double kineticEnergy, 147 G4doub << 132 G4double cutEnergy = DBL_MAX); 148 133 149 // main method to compute cross section per 134 // main method to compute cross section per Volume 150 virtual G4double CrossSectionPerVolume(const 135 virtual G4double CrossSectionPerVolume(const G4Material*, 151 const << 136 const G4ParticleDefinition*, 152 G4dou << 137 G4double kineticEnergy, 153 G4dou << 138 G4double cutEnergy = 0.0, 154 G4dou << 139 G4double maxEnergy = DBL_MAX); 155 << 156 // method to get partial cross section << 157 virtual G4double GetPartialCrossSection(cons << 158 G4in << 159 cons << 160 G4do << 161 140 162 // main method to compute cross section per 141 // main method to compute cross section per atom 163 virtual G4double ComputeCrossSectionPerAtom( 142 virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*, 164 << 143 G4double kinEnergy, 165 << 144 G4double Z, 166 << 145 G4double A = 0., /* amu */ 167 << 146 G4double cutEnergy = 0.0, 168 << 147 G4double maxEnergy = DBL_MAX); 169 << 148 170 // main method to compute cross section per << 149 // min cut in kinetic energy allowed by the model 171 virtual G4double ComputeCrossSectionPerShell << 150 // obsolete method will be removed 172 << 151 virtual G4double MinEnergyCut(const G4ParticleDefinition*, 173 << 152 const G4MaterialCutsCouple*); 174 << 175 << 176 153 177 // Compute effective ion charge square 154 // Compute effective ion charge square 178 virtual G4double ChargeSquareRatio(const G4T 155 virtual G4double ChargeSquareRatio(const G4Track&); 179 156 180 // Compute effective ion charge square 157 // Compute effective ion charge square 181 virtual G4double GetChargeSquareRatio(const 158 virtual G4double GetChargeSquareRatio(const G4ParticleDefinition*, 182 const << 159 const G4Material*, 183 G4doub << 160 G4double kineticEnergy); 184 161 185 // Compute ion charge 162 // Compute ion charge 186 virtual G4double GetParticleCharge(const G4P 163 virtual G4double GetParticleCharge(const G4ParticleDefinition*, 187 const G4M << 164 const G4Material*, 188 G4double << 165 G4double kineticEnergy); 189 << 190 // Initialisation for a new track << 191 virtual void StartTracking(G4Track*); << 192 166 193 // add correction to energy loss and compute 167 // add correction to energy loss and compute non-ionizing energy loss 194 virtual void CorrectionsAlongStep(const G4Ma 168 virtual void CorrectionsAlongStep(const G4MaterialCutsCouple*, 195 const G4Dy << 169 const G4DynamicParticle*, 196 const G4do << 170 G4double& eloss, 197 G4double& << 171 G4double& niel, 198 << 172 G4double length); 199 // value which may be tabulated (by default << 173 200 virtual G4double Value(const G4MaterialCutsC << 174 // sample PIXE deexcitation 201 const G4ParticleDefin << 175 virtual void SampleDeexcitationAlongStep(const G4Material*, 202 G4double kineticEnerg << 176 const G4Track&, 203 << 177 G4double& eloss); 204 // threshold for zero value << 205 virtual G4double MinPrimaryEnergy(const G4Ma << 206 const G4Pa << 207 G4double c << 208 << 209 // model can define low-energy limit for the << 210 virtual G4double MinEnergyCut(const G4Partic << 211 const G4Materi << 212 178 213 // initialisation at run time for a given ma << 179 // initilisation at run time for a given material 214 virtual void SetupForMaterial(const G4Partic 180 virtual void SetupForMaterial(const G4ParticleDefinition*, 215 const G4Materi << 181 const G4Material*, 216 G4double kinet 182 G4double kineticEnergy); 217 183 218 // add a region for the model 184 // add a region for the model 219 virtual void DefineForRegion(const G4Region* 185 virtual void DefineForRegion(const G4Region*); 220 186 221 // fill number of different type of secondar << 222 virtual void FillNumberOfSecondaries(G4int& << 223 G4int& << 224 << 225 // for automatic documentation << 226 virtual void ModelDescription(std::ostream& << 227 << 228 protected: 187 protected: 229 188 230 // initialisation of the ParticleChange for 189 // initialisation of the ParticleChange for the model 231 G4ParticleChangeForLoss* GetParticleChangeFo 190 G4ParticleChangeForLoss* GetParticleChangeForLoss(); 232 191 233 // initialisation of the ParticleChange for 192 // initialisation of the ParticleChange for the model 234 G4ParticleChangeForGamma* GetParticleChangeF 193 G4ParticleChangeForGamma* GetParticleChangeForGamma(); 235 194 236 // kinematically allowed max kinetic energy 195 // kinematically allowed max kinetic energy of a secondary 237 virtual G4double MaxSecondaryEnergy(const G4 196 virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*, 238 G4double << 197 G4double kineticEnergy); 239 198 240 public: 199 public: 241 200 242 //------------------------------------------ 201 //------------------------------------------------------------------------ 243 // Generic methods common to all models 202 // Generic methods common to all models 244 //------------------------------------------ 203 //------------------------------------------------------------------------ 245 204 246 // should be called at initialisation to bui 205 // should be called at initialisation to build element selectors 247 void InitialiseElementSelectors(const G4Part << 206 void InitialiseElementSelectors(const G4ParticleDefinition*, 248 const G4Data << 207 const G4DataVector&); 249 208 250 // should be called at initialisation to acc << 209 // dEdx per unit length 251 inline std::vector<G4EmElementSelector*>* Ge << 210 inline G4double ComputeDEDX(const G4MaterialCutsCouple*, >> 211 const G4ParticleDefinition*, >> 212 G4double kineticEnergy, >> 213 G4double cutEnergy = DBL_MAX); 252 214 253 // should be called at initialisation to set << 215 // cross section per volume 254 inline void SetElementSelectors(std::vector< << 255 << 256 // dEdx per unit length, base material appro << 257 inline G4double ComputeDEDX( const G4Materia << 258 const G4Particl << 259 G4double kineti << 260 G4double cutEne << 261 << 262 // cross section per volume, base material a << 263 inline G4double CrossSection(const G4Materia 216 inline G4double CrossSection(const G4MaterialCutsCouple*, 264 const G4Particl << 217 const G4ParticleDefinition*, 265 G4double kineti << 218 G4double kineticEnergy, 266 G4double cutEne << 219 G4double cutEnergy = 0.0, 267 G4double maxEne << 220 G4double maxEnergy = DBL_MAX); 268 221 269 // compute mean free path via cross section 222 // compute mean free path via cross section per volume 270 inline G4double ComputeMeanFreePath(const G4 223 inline G4double ComputeMeanFreePath(const G4ParticleDefinition*, 271 G4double << 224 G4double kineticEnergy, 272 const G4 << 225 const G4Material*, 273 G4double << 226 G4double cutEnergy = 0.0, 274 G4double << 227 G4double maxEnergy = DBL_MAX); 275 228 276 // generic cross section per element 229 // generic cross section per element 277 inline G4double ComputeCrossSectionPerAtom(c 230 inline G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*, 278 c 231 const G4Element*, 279 G << 232 G4double kinEnergy, 280 G << 233 G4double cutEnergy = 0.0, 281 G << 234 G4double maxEnergy = DBL_MAX); >> 235 >> 236 // select isotope in order to have precise mass of the nucleus >> 237 inline G4int SelectIsotopeNumber(const G4Element*); 282 238 283 // atom can be selected effitiantly if eleme 239 // atom can be selected effitiantly if element selectors are initialised 284 inline const G4Element* SelectRandomAtom(con 240 inline const G4Element* SelectRandomAtom(const G4MaterialCutsCouple*, 285 con << 241 const G4ParticleDefinition*, 286 G4d << 242 G4double kineticEnergy, 287 G4d << 243 G4double cutEnergy = 0.0, 288 G4d << 244 G4double maxEnergy = DBL_MAX); 289 // same as SelectRandomAtom above but more e << 290 inline const G4Element* SelectTargetAtom(con << 291 con << 292 G4d << 293 G4d << 294 G4d << 295 G4d << 296 245 297 // to select atom cross section per volume i 246 // to select atom cross section per volume is recomputed for each element 298 const G4Element* SelectRandomAtom(const G4Ma 247 const G4Element* SelectRandomAtom(const G4Material*, 299 const G4Pa << 248 const G4ParticleDefinition*, 300 G4double k << 249 G4double kineticEnergy, 301 G4double c << 250 G4double cutEnergy = 0.0, 302 G4double m << 251 G4double maxEnergy = DBL_MAX); 303 << 304 // to select atom if cross section is propor << 305 const G4Element* GetCurrentElement(const G4M << 306 G4int SelectRandomAtomNumber(const G4Materia << 307 << 308 // select isotope in order to have precise m << 309 const G4Isotope* GetCurrentIsotope(const G4E << 310 G4int SelectIsotopeNumber(const G4Element*) << 311 252 312 //------------------------------------------ 253 //------------------------------------------------------------------------ 313 // Get/Set methods 254 // Get/Set methods 314 //------------------------------------------ 255 //------------------------------------------------------------------------ 315 256 316 void SetParticleChange(G4VParticleChange*, G << 257 void SetParticleChange(G4VParticleChange*, G4VEmFluctuationModel* f=0); 317 << 318 void SetCrossSectionTable(G4PhysicsTable*, G << 319 << 320 inline G4ElementData* GetElementData(); << 321 << 322 inline G4PhysicsTable* GetCrossSectionTable( << 323 258 324 inline G4VEmFluctuationModel* GetModelOfFluc 259 inline G4VEmFluctuationModel* GetModelOfFluctuations(); 325 260 326 inline G4VEmAngularDistribution* GetAngularD 261 inline G4VEmAngularDistribution* GetAngularDistribution(); 327 262 328 inline G4VEmModel* GetTripletModel(); << 329 << 330 inline void SetTripletModel(G4VEmModel*); << 331 << 332 inline void SetAngularDistribution(G4VEmAngu 263 inline void SetAngularDistribution(G4VEmAngularDistribution*); 333 264 334 inline G4double HighEnergyLimit() const; 265 inline G4double HighEnergyLimit() const; 335 266 336 inline G4double LowEnergyLimit() const; 267 inline G4double LowEnergyLimit() const; 337 268 338 inline G4double HighEnergyActivationLimit() << 339 << 340 inline G4double LowEnergyActivationLimit() c << 341 << 342 inline G4double PolarAngleLimit() const; 269 inline G4double PolarAngleLimit() const; 343 270 344 inline G4double SecondaryThreshold() const; 271 inline G4double SecondaryThreshold() const; 345 272 346 inline G4bool DeexcitationFlag() const; << 273 inline G4bool LPMFlag() const; 347 << 348 inline G4bool ForceBuildTableFlag() const; << 349 << 350 inline G4bool UseAngularGeneratorFlag() cons << 351 274 352 inline void SetAngularGeneratorFlag(G4bool); << 275 inline G4bool DeexcitationFlag() const; 353 276 354 inline void SetHighEnergyLimit(G4double); 277 inline void SetHighEnergyLimit(G4double); 355 278 356 inline void SetLowEnergyLimit(G4double); 279 inline void SetLowEnergyLimit(G4double); 357 280 358 inline void SetActivationHighEnergyLimit(G4d 281 inline void SetActivationHighEnergyLimit(G4double); 359 282 360 inline void SetActivationLowEnergyLimit(G4do 283 inline void SetActivationLowEnergyLimit(G4double); 361 284 362 inline G4bool IsActive(G4double kinEnergy) c << 285 inline G4bool IsActive(G4double kinEnergy); 363 286 364 inline void SetPolarAngleLimit(G4double); 287 inline void SetPolarAngleLimit(G4double); 365 288 366 inline void SetSecondaryThreshold(G4double); 289 inline void SetSecondaryThreshold(G4double); 367 290 368 inline void SetDeexcitationFlag(G4bool val); << 291 inline void SetLPMFlag(G4bool val); 369 << 370 inline void SetForceBuildTable(G4bool val); << 371 << 372 inline void SetFluctuationFlag(G4bool val); << 373 << 374 inline G4bool IsMaster() const; << 375 << 376 inline void SetUseBaseMaterials(G4bool val); << 377 292 378 inline G4bool UseBaseMaterials() const; << 293 inline void SetDeexcitationFlag(G4bool val); 379 294 380 inline G4double MaxSecondaryKinEnergy(const 295 inline G4double MaxSecondaryKinEnergy(const G4DynamicParticle* dynParticle); 381 296 382 inline const G4String& GetName() const; 297 inline const G4String& GetName() const; 383 298 384 inline void SetCurrentCouple(const G4Materia 299 inline void SetCurrentCouple(const G4MaterialCutsCouple*); 385 300 386 inline G4bool IsLocked() const; << 301 inline const G4Element* GetCurrentElement() const; 387 << 388 inline void SetLocked(G4bool); << 389 << 390 // obsolete methods << 391 [[deprecated("Use G4EmParameters::Instance() << 392 void SetLPMFlag(G4bool); << 393 << 394 void SetMasterThread(G4bool); << 395 << 396 // hide assignment operator << 397 G4VEmModel & operator=(const G4VEmModel &ri << 398 G4VEmModel(const G4VEmModel&) = delete; << 399 302 400 protected: 303 protected: 401 304 402 inline const G4MaterialCutsCouple* CurrentCo 305 inline const G4MaterialCutsCouple* CurrentCouple() const; 403 306 404 inline void SetCurrentElement(const G4Elemen 307 inline void SetCurrentElement(const G4Element*); 405 308 406 private: 309 private: 407 310 408 // ======== Parameters of the class fixed at << 311 // hide assignment operator 409 << 312 G4VEmModel & operator=(const G4VEmModel &right); 410 G4VEmFluctuationModel* flucModel = null << 313 G4VEmModel(const G4VEmModel&); 411 G4VEmAngularDistribution* anglModel = null << 412 G4VEmModel* fTripletModel = << 413 const G4MaterialCutsCouple* fCurrentCouple = << 414 const G4Element* fCurrentElement << 415 std::vector<G4EmElementSelector*>* elmSelect << 416 G4LossTableManager* fEmManager; << 417 << 418 protected: << 419 << 420 G4ElementData* fElementData = << 421 G4VParticleChange* pParticleChange << 422 G4PhysicsTable* xSectionTable = << 423 const G4Material* pBaseMaterial = << 424 const std::vector<G4double>* theDensityFacto << 425 const std::vector<G4int>* theDensityIdx = << 426 << 427 G4double inveplus; << 428 G4double pFactor = 1.0; << 429 314 430 private: << 315 // ======== Parameters of the class fixed at construction ========= 431 316 432 G4double lowLimit; << 317 G4VEmFluctuationModel* flucModel; 433 G4double highLimit; << 318 G4VEmAngularDistribution* anglModel; 434 G4double eMinActive = 0.0; << 319 const G4String name; 435 G4double eMaxActive = DBL_MAX; << 320 436 G4double secondaryThreshold = DBL_MAX; << 321 // ======== Parameters of the class fixed at initialisation ======= 437 G4double polarAngleLimit; << 322 >> 323 G4double lowLimit; >> 324 G4double highLimit; >> 325 G4double eMinActive; >> 326 G4double eMaxActive; >> 327 G4double polarAngleLimit; >> 328 G4double secondaryThreshold; >> 329 G4bool theLPMflag; 438 330 439 G4int nSelectors = 0; << 331 G4int nSelectors; 440 G4int nsec = 5; << 332 std::vector<G4EmElementSelector*> elmSelectors; 441 333 442 protected: 334 protected: 443 335 444 std::size_t currentCoupleIndex = 0; << 336 G4VParticleChange* pParticleChange; 445 std::size_t basedCoupleIndex = 0; << 337 // G4bool nuclearStopping; 446 G4bool lossFlucFlag = true; << 338 >> 339 // ======== Cashed values - may be state dependent ================ 447 340 448 private: 341 private: 449 342 450 G4bool flagDeexcitation = false; << 343 const G4MaterialCutsCouple* currentCouple; 451 G4bool flagForceBuildTable = false; << 344 const G4Element* currentElement; 452 G4bool isMaster = true; << 453 << 454 G4bool localTable = true; << 455 G4bool localElmSelectors = true; << 456 G4bool useAngularGenerator = false; << 457 G4bool useBaseMaterials = false; << 458 G4bool isLocked = false; << 459 345 460 const G4String name; << 346 G4int nsec; >> 347 G4bool flagDeexcitation; 461 std::vector<G4double> xsec; 348 std::vector<G4double> xsec; 462 349 463 }; 350 }; 464 351 465 // ======== Run time inline methods ========== 352 // ======== Run time inline methods ================ 466 353 467 inline void G4VEmModel::SetCurrentCouple(const << 354 inline void G4VEmModel::SetCurrentCouple(const G4MaterialCutsCouple* p) 468 { 355 { 469 if(fCurrentCouple != ptr) { << 356 currentCouple = p; 470 fCurrentCouple = ptr; << 471 basedCoupleIndex = currentCoupleIndex = pt << 472 pBaseMaterial = ptr->GetMaterial(); << 473 pFactor = 1.0; << 474 if(useBaseMaterials) { << 475 basedCoupleIndex = (*theDensityIdx)[curr << 476 if(nullptr != pBaseMaterial->GetBaseMate << 477 pBaseMaterial = pBaseMaterial->GetBaseMateri << 478 pFactor = (*theDensityFactor)[currentCou << 479 } << 480 } << 481 } 357 } 482 358 483 //....oooOO0OOooo........oooOO0OOooo........oo << 359 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 484 360 485 inline const G4MaterialCutsCouple* G4VEmModel: 361 inline const G4MaterialCutsCouple* G4VEmModel::CurrentCouple() const 486 { 362 { 487 return fCurrentCouple; << 363 return currentCouple; 488 } 364 } 489 365 490 //....oooOO0OOooo........oooOO0OOooo........oo << 366 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 491 367 492 inline void G4VEmModel::SetCurrentElement(cons 368 inline void G4VEmModel::SetCurrentElement(const G4Element* elm) 493 { 369 { 494 fCurrentElement = elm; << 370 currentElement = elm; 495 } 371 } 496 372 497 //....oooOO0OOooo........oooOO0OOooo........oo << 373 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 374 >> 375 inline const G4Element* G4VEmModel::GetCurrentElement() const >> 376 { >> 377 return currentElement; >> 378 } >> 379 >> 380 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 498 381 499 inline 382 inline 500 G4double G4VEmModel::MaxSecondaryKinEnergy(con 383 G4double G4VEmModel::MaxSecondaryKinEnergy(const G4DynamicParticle* dynPart) 501 { 384 { 502 return MaxSecondaryEnergy(dynPart->GetPartic 385 return MaxSecondaryEnergy(dynPart->GetParticleDefinition(), 503 dynPart->GetKineti 386 dynPart->GetKineticEnergy()); 504 } 387 } 505 388 506 //....oooOO0OOooo........oooOO0OOooo........oo << 389 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 507 390 508 inline G4double G4VEmModel::ComputeDEDX(const << 391 inline G4double G4VEmModel::ComputeDEDX(const G4MaterialCutsCouple* c, 509 const << 392 const G4ParticleDefinition* p, 510 G4doub << 393 G4double kinEnergy, 511 G4doub << 394 G4double cutEnergy) 512 { 395 { 513 SetCurrentCouple(couple); << 396 currentCouple = c; 514 return pFactor*ComputeDEDXPerVolume(pBaseMat << 397 return ComputeDEDXPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy); 515 } 398 } 516 399 517 //....oooOO0OOooo........oooOO0OOooo........oo << 400 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 518 401 519 inline G4double G4VEmModel::CrossSection(const << 402 inline G4double G4VEmModel::CrossSection(const G4MaterialCutsCouple* c, 520 const << 403 const G4ParticleDefinition* p, 521 G4dou << 404 G4double kinEnergy, 522 G4dou << 405 G4double cutEnergy, 523 G4dou << 406 G4double maxEnergy) 524 { << 407 { 525 SetCurrentCouple(couple); << 408 currentCouple = c; 526 return pFactor*CrossSectionPerVolume(pBaseMa << 409 return CrossSectionPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy,maxEnergy); 527 cutEner << 528 } 410 } 529 411 530 //....oooOO0OOooo........oooOO0OOooo........oo << 412 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 531 413 532 inline << 414 inline G4double G4VEmModel::ComputeMeanFreePath(const G4ParticleDefinition* p, 533 G4double G4VEmModel::ComputeMeanFreePath(const << 415 G4double ekin, 534 G4dou << 416 const G4Material* material, 535 const << 417 G4double emin, 536 G4dou << 418 G4double emax) 537 G4dou << 538 { 419 { 539 G4double cross = CrossSectionPerVolume(mater << 420 G4double mfp = DBL_MAX; 540 return (cross > 0.0) ? 1./cross : DBL_MAX; << 421 G4double cross = CrossSectionPerVolume(material,p,ekin,emin,emax); >> 422 if (cross > DBL_MIN) { mfp = 1./cross; } >> 423 return mfp; 541 } 424 } 542 425 543 //....oooOO0OOooo........oooOO0OOooo........oo << 426 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 544 427 545 inline G4double << 428 inline G4double G4VEmModel::ComputeCrossSectionPerAtom( 546 G4VEmModel::ComputeCrossSectionPerAtom(const G << 429 const G4ParticleDefinition* part, 547 const G << 430 const G4Element* elm, 548 G4doubl << 431 G4double kinEnergy, 549 G4doubl << 432 G4double cutEnergy, 550 G4doubl << 433 G4double maxEnergy) 551 { 434 { 552 fCurrentElement = elm; << 435 currentElement = elm; 553 return ComputeCrossSectionPerAtom(part,kinEn 436 return ComputeCrossSectionPerAtom(part,kinEnergy,elm->GetZ(),elm->GetN(), 554 cutEnergy, << 437 cutEnergy,maxEnergy); 555 } 438 } 556 439 557 //....oooOO0OOooo........oooOO0OOooo........oo << 440 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 558 441 559 inline const G4Element* << 442 inline 560 G4VEmModel::SelectRandomAtom(const G4MaterialC << 443 const G4Element* G4VEmModel::SelectRandomAtom(const G4MaterialCutsCouple* couple, 561 const G4ParticleD << 444 const G4ParticleDefinition* p, 562 G4double kinEnerg << 445 G4double kinEnergy, 563 G4double cutEnerg << 446 G4double cutEnergy, 564 G4double maxEnerg << 447 G4double maxEnergy) 565 { << 448 { 566 SetCurrentCouple(couple); << 449 currentCouple = couple; 567 fCurrentElement = (nSelectors > 0) ? << 450 if(nSelectors > 0) { 568 ((*elmSelectors)[couple->GetIndex()])->Sel << 451 currentElement = 569 SelectRandomAtom(pBaseMaterial,part,kinEne << 452 elmSelectors[couple->GetIndex()]->SelectRandomAtom(kinEnergy); 570 return fCurrentElement; << 453 } else { >> 454 currentElement = SelectRandomAtom(couple->GetMaterial(),p,kinEnergy, >> 455 cutEnergy,maxEnergy); >> 456 } >> 457 return currentElement; 571 } 458 } 572 459 573 //....oooOO0OOooo........oooOO0OOooo........oo << 460 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 574 461 575 inline const G4Element* << 462 inline G4int G4VEmModel::SelectIsotopeNumber(const G4Element* elm) 576 G4VEmModel::SelectTargetAtom(const G4MaterialC << 463 { 577 const G4ParticleD << 464 currentElement = elm; 578 G4double kinEnerg << 465 G4int N = G4int(elm->GetN() + 0.5); 579 G4double logKinE, << 466 G4int ni = elm->GetNumberOfIsotopes(); 580 G4double cutEnerg << 467 if(ni > 0) { 581 G4double maxEnerg << 468 G4int idx = 0; 582 { << 469 if(ni > 1) { 583 SetCurrentCouple(couple); << 470 G4double* ab = elm->GetRelativeAbundanceVector(); 584 fCurrentElement = (nSelectors > 0) << 471 G4double x = G4UniformRand(); 585 ? ((*elmSelectors)[couple->GetIndex()])->Se << 472 for(; idx<ni; ++idx) { 586 : SelectRandomAtom(pBaseMaterial,part,kinEn << 473 x -= ab[idx]; 587 return fCurrentElement; << 474 if (x <= 0.0) { break; } >> 475 } >> 476 if(idx >= ni) { idx = ni - 1; } >> 477 } >> 478 N = elm->GetIsotope(idx)->GetN(); >> 479 } >> 480 return N; 588 } 481 } 589 482 590 // ======== Get/Set inline methods used at ini 483 // ======== Get/Set inline methods used at initialisation ================ 591 484 592 inline G4VEmFluctuationModel* G4VEmModel::GetM 485 inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations() 593 { 486 { 594 return flucModel; 487 return flucModel; 595 } 488 } 596 489 597 //....oooOO0OOooo........oooOO0OOooo........oo << 490 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 598 491 599 inline G4VEmAngularDistribution* G4VEmModel::G 492 inline G4VEmAngularDistribution* G4VEmModel::GetAngularDistribution() 600 { 493 { 601 return anglModel; 494 return anglModel; 602 } 495 } 603 496 604 //....oooOO0OOooo........oooOO0OOooo........oo << 497 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 605 498 606 inline void G4VEmModel::SetAngularDistribution 499 inline void G4VEmModel::SetAngularDistribution(G4VEmAngularDistribution* p) 607 { 500 { 608 if(p != anglModel) { << 501 anglModel = p; 609 delete anglModel; << 610 anglModel = p; << 611 } << 612 } << 613 << 614 //....oooOO0OOooo........oooOO0OOooo........oo << 615 << 616 inline G4VEmModel* G4VEmModel::GetTripletModel << 617 { << 618 return fTripletModel; << 619 } 502 } 620 503 621 //....oooOO0OOooo........oooOO0OOooo........oo << 504 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 622 << 623 inline void G4VEmModel::SetTripletModel(G4VEmM << 624 { << 625 if(p != fTripletModel) { << 626 delete fTripletModel; << 627 fTripletModel = p; << 628 } << 629 } << 630 << 631 //....oooOO0OOooo........oooOO0OOooo........oo << 632 505 633 inline G4double G4VEmModel::HighEnergyLimit() 506 inline G4double G4VEmModel::HighEnergyLimit() const 634 { 507 { 635 return highLimit; 508 return highLimit; 636 } 509 } 637 510 638 //....oooOO0OOooo........oooOO0OOooo........oo << 511 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 639 512 640 inline G4double G4VEmModel::LowEnergyLimit() c 513 inline G4double G4VEmModel::LowEnergyLimit() const 641 { 514 { 642 return lowLimit; 515 return lowLimit; 643 } 516 } 644 517 645 //....oooOO0OOooo........oooOO0OOooo........oo << 518 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 646 << 647 inline G4double G4VEmModel::HighEnergyActivati << 648 { << 649 return eMaxActive; << 650 } << 651 << 652 //....oooOO0OOooo........oooOO0OOooo........oo << 653 << 654 inline G4double G4VEmModel::LowEnergyActivatio << 655 { << 656 return eMinActive; << 657 } << 658 << 659 //....oooOO0OOooo........oooOO0OOooo........oo << 660 519 661 inline G4double G4VEmModel::PolarAngleLimit() 520 inline G4double G4VEmModel::PolarAngleLimit() const 662 { 521 { 663 return polarAngleLimit; 522 return polarAngleLimit; 664 } 523 } 665 524 666 //....oooOO0OOooo........oooOO0OOooo........oo << 525 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 667 526 668 inline G4double G4VEmModel::SecondaryThreshold 527 inline G4double G4VEmModel::SecondaryThreshold() const 669 { 528 { 670 return secondaryThreshold; 529 return secondaryThreshold; 671 } 530 } 672 531 673 //....oooOO0OOooo........oooOO0OOooo........oo 532 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 674 533 675 inline G4bool G4VEmModel::DeexcitationFlag() c << 534 inline G4bool G4VEmModel::LPMFlag() const 676 { << 677 return flagDeexcitation; << 678 } << 679 << 680 //....oooOO0OOooo........oooOO0OOooo........oo << 681 << 682 inline G4bool G4VEmModel::ForceBuildTableFlag( << 683 { << 684 return flagForceBuildTable; << 685 } << 686 << 687 //....oooOO0OOooo........oooOO0OOooo........oo << 688 << 689 inline G4bool G4VEmModel::UseAngularGeneratorF << 690 { 535 { 691 return useAngularGenerator; << 536 return theLPMflag; 692 } 537 } 693 538 694 //....oooOO0OOooo........oooOO0OOooo........oo 539 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 695 540 696 inline void G4VEmModel::SetAngularGeneratorFla << 541 inline G4bool G4VEmModel::DeexcitationFlag() const 697 { << 698 useAngularGenerator = val; << 699 } << 700 << 701 //....oooOO0OOooo........oooOO0OOooo........oo << 702 << 703 inline void G4VEmModel::SetFluctuationFlag(G4b << 704 { << 705 lossFlucFlag = val; << 706 } << 707 << 708 //....oooOO0OOooo........oooOO0OOooo........oo << 709 << 710 inline G4bool G4VEmModel::IsMaster() const << 711 { << 712 return isMaster; << 713 } << 714 << 715 //....oooOO0OOooo........oooOO0OOooo........oo << 716 << 717 inline void G4VEmModel::SetUseBaseMaterials(G4 << 718 { << 719 useBaseMaterials = val; << 720 } << 721 << 722 //....oooOO0OOooo........oooOO0OOooo........oo << 723 << 724 inline G4bool G4VEmModel::UseBaseMaterials() c << 725 { 542 { 726 return useBaseMaterials; << 543 return flagDeexcitation; 727 } 544 } 728 545 729 //....oooOO0OOooo........oooOO0OOooo........oo << 546 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 730 547 731 inline void G4VEmModel::SetHighEnergyLimit(G4d 548 inline void G4VEmModel::SetHighEnergyLimit(G4double val) 732 { 549 { 733 highLimit = val; 550 highLimit = val; 734 } 551 } 735 552 736 //....oooOO0OOooo........oooOO0OOooo........oo << 553 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 737 554 738 inline void G4VEmModel::SetLowEnergyLimit(G4do 555 inline void G4VEmModel::SetLowEnergyLimit(G4double val) 739 { 556 { 740 lowLimit = val; 557 lowLimit = val; 741 } 558 } 742 559 743 //....oooOO0OOooo........oooOO0OOooo........oo << 560 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 744 561 745 inline void G4VEmModel::SetActivationHighEnerg 562 inline void G4VEmModel::SetActivationHighEnergyLimit(G4double val) 746 { 563 { 747 eMaxActive = val; 564 eMaxActive = val; 748 } 565 } 749 566 750 //....oooOO0OOooo........oooOO0OOooo........oo << 567 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 751 568 752 inline void G4VEmModel::SetActivationLowEnergy 569 inline void G4VEmModel::SetActivationLowEnergyLimit(G4double val) 753 { 570 { 754 eMinActive = val; 571 eMinActive = val; 755 } 572 } 756 573 757 //....oooOO0OOooo........oooOO0OOooo........oo << 574 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 758 575 759 inline G4bool G4VEmModel::IsActive(G4double ki << 576 inline G4bool G4VEmModel::IsActive(G4double kinEnergy) 760 { 577 { 761 return (kinEnergy >= eMinActive && kinEnergy 578 return (kinEnergy >= eMinActive && kinEnergy <= eMaxActive); 762 } 579 } 763 580 764 //....oooOO0OOooo........oooOO0OOooo........oo << 581 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 765 582 766 inline void G4VEmModel::SetPolarAngleLimit(G4d 583 inline void G4VEmModel::SetPolarAngleLimit(G4double val) 767 { 584 { 768 if(!isLocked) { polarAngleLimit = val; } << 585 polarAngleLimit = val; 769 } 586 } 770 587 771 //....oooOO0OOooo........oooOO0OOooo........oo << 588 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 772 589 773 inline void G4VEmModel::SetSecondaryThreshold( 590 inline void G4VEmModel::SetSecondaryThreshold(G4double val) 774 { 591 { 775 secondaryThreshold = val; 592 secondaryThreshold = val; 776 } 593 } 777 594 778 //....oooOO0OOooo........oooOO0OOooo........oo 595 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 779 596 780 inline void G4VEmModel::SetDeexcitationFlag(G4 << 597 inline void G4VEmModel::SetLPMFlag(G4bool val) 781 { 598 { 782 flagDeexcitation = val; << 599 theLPMflag = val; 783 } 600 } 784 601 785 //....oooOO0OOooo........oooOO0OOooo........oo 602 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 786 603 787 inline void G4VEmModel::SetForceBuildTable(G4b << 604 inline void G4VEmModel::SetDeexcitationFlag(G4bool val) 788 { 605 { 789 flagForceBuildTable = val; << 606 flagDeexcitation = val; 790 } 607 } 791 608 792 //....oooOO0OOooo........oooOO0OOooo........oo << 609 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 793 610 794 inline const G4String& G4VEmModel::GetName() c 611 inline const G4String& G4VEmModel::GetName() const 795 { 612 { 796 return name; 613 return name; 797 } 614 } 798 615 799 //....oooOO0OOooo........oooOO0OOooo........oo << 616 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 800 << 801 inline std::vector<G4EmElementSelector*>* G4VE << 802 { << 803 return elmSelectors; << 804 } << 805 << 806 //....oooOO0OOooo........oooOO0OOooo........oo << 807 << 808 inline void << 809 G4VEmModel::SetElementSelectors(std::vector<G4 << 810 { << 811 if(p != elmSelectors) { << 812 elmSelectors = p; << 813 nSelectors = (nullptr != elmSelectors) ? G << 814 localElmSelectors = false; << 815 } << 816 } << 817 << 818 //....oooOO0OOooo........oooOO0OOooo........oo << 819 << 820 inline G4ElementData* G4VEmModel::GetElementDa << 821 { << 822 return fElementData; << 823 } << 824 << 825 //....oooOO0OOooo........oooOO0OOooo........oo << 826 << 827 inline G4PhysicsTable* G4VEmModel::GetCrossSec << 828 { << 829 return xSectionTable; << 830 } << 831 << 832 //....oooOO0OOooo........oooOO0OOooo........oo << 833 << 834 inline G4bool G4VEmModel::IsLocked() const << 835 { << 836 return isLocked; << 837 } << 838 << 839 //....oooOO0OOooo........oooOO0OOooo........oo << 840 << 841 inline void G4VEmModel::SetLocked(G4bool val) << 842 { << 843 isLocked = val; << 844 } << 845 << 846 //....oooOO0OOooo........oooOO0OOooo........oo << 847 617 848 #endif 618 #endif >> 619 849 620