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.45 2006/08/29 19:18:54 vnivanch Exp $ >> 27 // GEANT4 tag $Name: geant4-08-03-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 << 60 // 15-07-08 Reorder class members and improve << 61 // 21-07-08 Added vector of G4ElementSelector << 62 // 12-09-08 Added methods GetParticleCharge, G << 63 // CorrectionsAlongStep, ActivateNucl << 64 // 16-02-09 Moved implementations of virtual m << 65 // 07-04-09 Moved msc methods from G4VEmModel << 66 // 13-10-10 Added G4VEmAngularDistribution (VI << 67 // 62 // 68 // Class Description: 63 // Class Description: 69 // 64 // 70 // Abstract interface to energy loss models 65 // Abstract interface to energy loss models 71 66 72 // ------------------------------------------- 67 // ------------------------------------------------------------------- 73 // 68 // 74 69 75 #ifndef G4VEmModel_h 70 #ifndef G4VEmModel_h 76 #define G4VEmModel_h 1 71 #define G4VEmModel_h 1 77 72 78 #include "globals.hh" 73 #include "globals.hh" 79 #include "G4DynamicParticle.hh" 74 #include "G4DynamicParticle.hh" 80 #include "G4ParticleDefinition.hh" 75 #include "G4ParticleDefinition.hh" 81 #include "G4MaterialCutsCouple.hh" 76 #include "G4MaterialCutsCouple.hh" 82 #include "G4Material.hh" 77 #include "G4Material.hh" 83 #include "G4Element.hh" 78 #include "G4Element.hh" 84 #include "G4ElementVector.hh" 79 #include "G4ElementVector.hh" 85 #include "G4Isotope.hh" << 86 #include "G4DataVector.hh" 80 #include "G4DataVector.hh" 87 #include "G4VEmFluctuationModel.hh" 81 #include "G4VEmFluctuationModel.hh" 88 #include "G4VEmAngularDistribution.hh" << 82 #include "Randomize.hh" 89 #include "G4EmElementSelector.hh" << 90 #include <CLHEP/Random/RandomEngine.h> << 91 #include <vector> << 92 83 93 class G4ElementData; << 94 class G4PhysicsTable; 84 class G4PhysicsTable; 95 class G4Region; 85 class G4Region; 96 class G4VParticleChange; 86 class G4VParticleChange; 97 class G4ParticleChangeForLoss; << 98 class G4ParticleChangeForGamma; << 99 class G4Track; 87 class G4Track; 100 class G4LossTableManager; << 101 88 102 class G4VEmModel 89 class G4VEmModel 103 { 90 { 104 91 105 public: 92 public: 106 93 107 explicit G4VEmModel(const G4String& nam); << 94 G4VEmModel(const G4String& nam); 108 95 109 virtual ~G4VEmModel(); 96 virtual ~G4VEmModel(); 110 97 111 //------------------------------------------ 98 //------------------------------------------------------------------------ 112 // Virtual methods to be implemented for any << 99 // Virtual methods to be implemented for the concrete model 113 //------------------------------------------ 100 //------------------------------------------------------------------------ 114 101 115 virtual void Initialise(const G4ParticleDefi 102 virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&) = 0; 116 103 117 virtual void SampleSecondaries(std::vector<G << 118 const G4Mater << 119 const G4Dynam << 120 G4double tmin << 121 G4double tmax << 122 << 123 //------------------------------------------ << 124 // Methods for initialisation of MT; may be << 125 //------------------------------------------ << 126 104 127 // initialisation in local thread << 105 virtual std::vector<G4DynamicParticle*>* SampleSecondaries( 128 virtual void InitialiseLocal(const G4Particl << 106 const G4MaterialCutsCouple*, 129 G4VEmModel* mas << 107 const G4DynamicParticle*, 130 << 108 G4double tmin = 0.0, 131 // initialisation of a new material at run t << 109 G4double tmax = DBL_MAX) = 0; 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 110 139 //------------------------------------------ 111 //------------------------------------------------------------------------ 140 // Methods with standard implementation; may 112 // Methods with standard implementation; may be overwritten if needed 141 //------------------------------------------ 113 //------------------------------------------------------------------------ 142 114 143 // main method to compute dEdx << 115 virtual G4double MinEnergyCut(const G4ParticleDefinition*, 144 virtual G4double ComputeDEDXPerVolume(const << 116 const G4MaterialCutsCouple*); 145 const << 146 G4doub << 147 G4doub << 148 << 149 // main method to compute cross section per << 150 virtual G4double CrossSectionPerVolume(const << 151 const << 152 G4dou << 153 G4dou << 154 G4dou << 155 << 156 // method to get partial cross section << 157 virtual G4double GetPartialCrossSection(cons << 158 G4in << 159 cons << 160 G4do << 161 << 162 // main method to compute cross section per << 163 virtual G4double ComputeCrossSectionPerAtom( << 164 << 165 << 166 << 167 << 168 << 169 << 170 // main method to compute cross section per << 171 virtual G4double ComputeCrossSectionPerShell << 172 << 173 << 174 << 175 << 176 << 177 // Compute effective ion charge square << 178 virtual G4double ChargeSquareRatio(const G4T << 179 117 180 // Compute effective ion charge square << 118 virtual G4double ComputeDEDX(const G4MaterialCutsCouple*, 181 virtual G4double GetChargeSquareRatio(const << 119 const G4ParticleDefinition*, 182 const << 120 G4double kineticEnergy, 183 G4doub << 121 G4double cutEnergy = DBL_MAX); >> 122 >> 123 virtual G4double CrossSection(const G4MaterialCutsCouple*, >> 124 const G4ParticleDefinition*, >> 125 G4double kineticEnergy, >> 126 G4double cutEnergy = 0.0, >> 127 G4double maxEnergy = DBL_MAX); 184 128 185 // Compute ion charge << 129 virtual G4double ComputeDEDXPerVolume( 186 virtual G4double GetParticleCharge(const G4P << 130 const G4Material*, 187 const G4M << 131 const G4ParticleDefinition*, 188 G4double << 132 G4double kineticEnergy, 189 << 133 G4double cutEnergy = DBL_MAX); 190 // Initialisation for a new track << 191 virtual void StartTracking(G4Track*); << 192 << 193 // add correction to energy loss and compute << 194 virtual void CorrectionsAlongStep(const G4Ma << 195 const G4Dy << 196 const G4do << 197 G4double& << 198 << 199 // value which may be tabulated (by default << 200 virtual G4double Value(const G4MaterialCutsC << 201 const G4ParticleDefin << 202 G4double kineticEnerg << 203 << 204 // threshold for zero value << 205 virtual G4double MinPrimaryEnergy(const G4Ma << 206 const G4Pa << 207 G4double c << 208 134 209 // model can define low-energy limit for the << 210 virtual G4double MinEnergyCut(const G4Partic << 211 const G4Materi << 212 135 213 // initialisation at run time for a given ma << 136 virtual G4double ComputeCrossSectionPerAtom( 214 virtual void SetupForMaterial(const G4Partic << 137 const G4ParticleDefinition*, >> 138 G4double kinEnergy, >> 139 G4double Z, >> 140 G4double A = 0., >> 141 G4double cutEnergy = 0.0, >> 142 G4double maxEnergy = DBL_MAX); >> 143 >> 144 virtual G4double ComputeMeanFreePath( >> 145 const G4ParticleDefinition*, >> 146 G4double kineticEnergy, >> 147 const G4Material*, >> 148 G4double cutEnergy = 0.0, >> 149 G4double maxEnergy = DBL_MAX); >> 150 >> 151 virtual G4double CrossSectionPerVolume( 215 const G4Materi 152 const G4Material*, 216 G4double kinet << 153 const G4ParticleDefinition*, >> 154 G4double kineticEnergy, >> 155 G4double cutEnergy = 0.0, >> 156 G4double maxEnergy = DBL_MAX); >> 157 217 158 218 // add a region for the model << 159 219 virtual void DefineForRegion(const G4Region* << 160 // Methods for msc simulation 220 161 221 // fill number of different type of secondar << 162 virtual G4double ComputeTruePathLengthLimit( 222 virtual void FillNumberOfSecondaries(G4int& << 163 const G4Track& track, 223 G4int& << 164 G4PhysicsTable* theLambdaTable, >> 165 G4double currentMinimalStep); 224 166 225 // for automatic documentation << 167 virtual G4double ComputeGeomPathLength(G4double truePathLength); 226 virtual void ModelDescription(std::ostream& << 227 168 228 protected: << 169 virtual G4double ComputeTrueStepLength(G4double geomPathLength); 229 170 230 // initialisation of the ParticleChange for << 171 virtual void DefineForRegion(const G4Region*); 231 G4ParticleChangeForLoss* GetParticleChangeFo << 232 172 233 // initialisation of the ParticleChange for << 173 protected: 234 G4ParticleChangeForGamma* GetParticleChangeF << 235 174 236 // kinematically allowed max kinetic energy << 237 virtual G4double MaxSecondaryEnergy(const G4 175 virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*, 238 G4double << 176 G4double kineticEnergy); 239 << 240 public: << 241 177 242 //------------------------------------------ 178 //------------------------------------------------------------------------ 243 // Generic methods common to all models 179 // Generic methods common to all models 244 //------------------------------------------ 180 //------------------------------------------------------------------------ 245 181 246 // should be called at initialisation to bui << 182 public: 247 void InitialiseElementSelectors(const G4Part << 248 const G4Data << 249 << 250 // should be called at initialisation to acc << 251 inline std::vector<G4EmElementSelector*>* Ge << 252 << 253 // should be called at initialisation to set << 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 << 264 const G4Particl << 265 G4double kineti << 266 G4double cutEne << 267 G4double maxEne << 268 << 269 // compute mean free path via cross section << 270 inline G4double ComputeMeanFreePath(const G4 << 271 G4double << 272 const G4 << 273 G4double << 274 G4double << 275 << 276 // generic cross section per element << 277 inline G4double ComputeCrossSectionPerAtom(c << 278 c << 279 G << 280 G << 281 G << 282 << 283 // atom can be selected effitiantly if eleme << 284 inline const G4Element* SelectRandomAtom(con << 285 con << 286 G4d << 287 G4d << 288 G4d << 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 << 297 // to select atom cross section per volume i << 298 const G4Element* SelectRandomAtom(const G4Ma << 299 const G4Pa << 300 G4double k << 301 G4double c << 302 G4double m << 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 << 312 //------------------------------------------ << 313 // Get/Set methods << 314 //------------------------------------------ << 315 << 316 void SetParticleChange(G4VParticleChange*, G << 317 << 318 void SetCrossSectionTable(G4PhysicsTable*, G << 319 << 320 inline G4ElementData* GetElementData(); << 321 << 322 inline G4PhysicsTable* GetCrossSectionTable( << 323 << 324 inline G4VEmFluctuationModel* GetModelOfFluc << 325 << 326 inline G4VEmAngularDistribution* GetAngularD << 327 << 328 inline G4VEmModel* GetTripletModel(); << 329 << 330 inline void SetTripletModel(G4VEmModel*); << 331 << 332 inline void SetAngularDistribution(G4VEmAngu << 333 << 334 inline G4double HighEnergyLimit() const; << 335 << 336 inline G4double LowEnergyLimit() const; << 337 << 338 inline G4double HighEnergyActivationLimit() << 339 << 340 inline G4double LowEnergyActivationLimit() c << 341 << 342 inline G4double PolarAngleLimit() const; << 343 << 344 inline G4double SecondaryThreshold() const; << 345 << 346 inline G4bool DeexcitationFlag() const; << 347 << 348 inline G4bool ForceBuildTableFlag() const; << 349 << 350 inline G4bool UseAngularGeneratorFlag() cons << 351 << 352 inline void SetAngularGeneratorFlag(G4bool); << 353 << 354 inline void SetHighEnergyLimit(G4double); << 355 << 356 inline void SetLowEnergyLimit(G4double); << 357 << 358 inline void SetActivationHighEnergyLimit(G4d << 359 << 360 inline void SetActivationLowEnergyLimit(G4do << 361 << 362 inline G4bool IsActive(G4double kinEnergy) c << 363 << 364 inline void SetPolarAngleLimit(G4double); << 365 << 366 inline void SetSecondaryThreshold(G4double); << 367 << 368 inline void SetDeexcitationFlag(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 183 378 inline G4bool UseBaseMaterials() const; << 184 void SetParticleChange(G4VParticleChange*, G4VEmFluctuationModel*); 379 185 380 inline G4double MaxSecondaryKinEnergy(const << 186 G4VEmFluctuationModel* GetModelOfFluctuations(); 381 187 382 inline const G4String& GetName() const; << 188 G4double HighEnergyLimit(); 383 189 384 inline void SetCurrentCouple(const G4Materia << 190 G4double LowEnergyLimit(); 385 191 386 inline G4bool IsLocked() const; << 192 void SetHighEnergyLimit(G4double); 387 193 388 inline void SetLocked(G4bool); << 194 void SetLowEnergyLimit(G4double); 389 195 390 // obsolete methods << 196 G4double MaxSecondaryKinEnergy(const G4DynamicParticle* dynParticle); 391 [[deprecated("Use G4EmParameters::Instance() << 392 void SetLPMFlag(G4bool); << 393 197 394 void SetMasterThread(G4bool); << 198 const G4Element* SelectRandomAtom(const G4Material*, >> 199 const G4ParticleDefinition*, >> 200 G4double kineticEnergy, >> 201 G4double cutEnergy = 0.0, >> 202 G4double maxEnergy = DBL_MAX); 395 203 396 // hide assignment operator << 204 const G4String& GetName() const; 397 G4VEmModel & operator=(const G4VEmModel &ri << 398 G4VEmModel(const G4VEmModel&) = delete; << 399 205 400 protected: 206 protected: 401 207 402 inline const G4MaterialCutsCouple* CurrentCo << 208 const G4Element* GetCurrentElement() const; 403 209 404 inline void SetCurrentElement(const G4Elemen << 210 void SetCurrentElement(const G4Element*); 405 211 406 private: 212 private: 407 213 408 // ======== Parameters of the class fixed at << 214 // hide assignment operator 409 << 215 G4VEmModel & operator=(const G4VEmModel &right); 410 G4VEmFluctuationModel* flucModel = null << 216 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 217 430 private: << 218 G4double lowLimit; >> 219 G4double highLimit; >> 220 G4double xsec[40]; 431 221 432 G4double lowLimit; << 222 G4VEmFluctuationModel* fluc; 433 G4double highLimit; << 434 G4double eMinActive = 0.0; << 435 G4double eMaxActive = DBL_MAX; << 436 G4double secondaryThreshold = DBL_MAX; << 437 G4double polarAngleLimit; << 438 223 439 G4int nSelectors = 0; << 224 const G4String name; 440 G4int nsec = 5; << 225 const G4Element* currentElement; 441 226 442 protected: 227 protected: 443 228 444 std::size_t currentCoupleIndex = 0; << 229 G4VParticleChange* pParticleChange; 445 std::size_t basedCoupleIndex = 0; << 446 G4bool lossFlucFlag = true; << 447 << 448 private: << 449 << 450 G4bool flagDeexcitation = false; << 451 G4bool flagForceBuildTable = false; << 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 << 460 const G4String name; << 461 std::vector<G4double> xsec; << 462 << 463 }; 230 }; 464 231 465 // ======== Run time inline methods ========== << 232 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 233 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 466 234 467 inline void G4VEmModel::SetCurrentCouple(const << 235 inline G4double G4VEmModel::HighEnergyLimit() 468 { << 469 if(fCurrentCouple != ptr) { << 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 } << 482 << 483 //....oooOO0OOooo........oooOO0OOooo........oo << 484 << 485 inline const G4MaterialCutsCouple* G4VEmModel: << 486 { << 487 return fCurrentCouple; << 488 } << 489 << 490 //....oooOO0OOooo........oooOO0OOooo........oo << 491 << 492 inline void G4VEmModel::SetCurrentElement(cons << 493 { << 494 fCurrentElement = elm; << 495 } << 496 << 497 //....oooOO0OOooo........oooOO0OOooo........oo << 498 << 499 inline << 500 G4double G4VEmModel::MaxSecondaryKinEnergy(con << 501 { << 502 return MaxSecondaryEnergy(dynPart->GetPartic << 503 dynPart->GetKineti << 504 } << 505 << 506 //....oooOO0OOooo........oooOO0OOooo........oo << 507 << 508 inline G4double G4VEmModel::ComputeDEDX(const << 509 const << 510 G4doub << 511 G4doub << 512 { << 513 SetCurrentCouple(couple); << 514 return pFactor*ComputeDEDXPerVolume(pBaseMat << 515 } << 516 << 517 //....oooOO0OOooo........oooOO0OOooo........oo << 518 << 519 inline G4double G4VEmModel::CrossSection(const << 520 const << 521 G4dou << 522 G4dou << 523 G4dou << 524 { << 525 SetCurrentCouple(couple); << 526 return pFactor*CrossSectionPerVolume(pBaseMa << 527 cutEner << 528 } << 529 << 530 //....oooOO0OOooo........oooOO0OOooo........oo << 531 << 532 inline << 533 G4double G4VEmModel::ComputeMeanFreePath(const << 534 G4dou << 535 const << 536 G4dou << 537 G4dou << 538 { << 539 G4double cross = CrossSectionPerVolume(mater << 540 return (cross > 0.0) ? 1./cross : DBL_MAX; << 541 } << 542 << 543 //....oooOO0OOooo........oooOO0OOooo........oo << 544 << 545 inline G4double << 546 G4VEmModel::ComputeCrossSectionPerAtom(const G << 547 const G << 548 G4doubl << 549 G4doubl << 550 G4doubl << 551 { << 552 fCurrentElement = elm; << 553 return ComputeCrossSectionPerAtom(part,kinEn << 554 cutEnergy, << 555 } << 556 << 557 //....oooOO0OOooo........oooOO0OOooo........oo << 558 << 559 inline const G4Element* << 560 G4VEmModel::SelectRandomAtom(const G4MaterialC << 561 const G4ParticleD << 562 G4double kinEnerg << 563 G4double cutEnerg << 564 G4double maxEnerg << 565 { << 566 SetCurrentCouple(couple); << 567 fCurrentElement = (nSelectors > 0) ? << 568 ((*elmSelectors)[couple->GetIndex()])->Sel << 569 SelectRandomAtom(pBaseMaterial,part,kinEne << 570 return fCurrentElement; << 571 } << 572 << 573 //....oooOO0OOooo........oooOO0OOooo........oo << 574 << 575 inline const G4Element* << 576 G4VEmModel::SelectTargetAtom(const G4MaterialC << 577 const G4ParticleD << 578 G4double kinEnerg << 579 G4double logKinE, << 580 G4double cutEnerg << 581 G4double maxEnerg << 582 { << 583 SetCurrentCouple(couple); << 584 fCurrentElement = (nSelectors > 0) << 585 ? ((*elmSelectors)[couple->GetIndex()])->Se << 586 : SelectRandomAtom(pBaseMaterial,part,kinEn << 587 return fCurrentElement; << 588 } << 589 << 590 // ======== Get/Set inline methods used at ini << 591 << 592 inline G4VEmFluctuationModel* G4VEmModel::GetM << 593 { << 594 return flucModel; << 595 } << 596 << 597 //....oooOO0OOooo........oooOO0OOooo........oo << 598 << 599 inline G4VEmAngularDistribution* G4VEmModel::G << 600 { << 601 return anglModel; << 602 } << 603 << 604 //....oooOO0OOooo........oooOO0OOooo........oo << 605 << 606 inline void G4VEmModel::SetAngularDistribution << 607 { << 608 if(p != anglModel) { << 609 delete anglModel; << 610 anglModel = p; << 611 } << 612 } << 613 << 614 //....oooOO0OOooo........oooOO0OOooo........oo << 615 << 616 inline G4VEmModel* G4VEmModel::GetTripletModel << 617 { << 618 return fTripletModel; << 619 } << 620 << 621 //....oooOO0OOooo........oooOO0OOooo........oo << 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 << 633 inline G4double G4VEmModel::HighEnergyLimit() << 634 { 236 { 635 return highLimit; 237 return highLimit; 636 } 238 } 637 239 638 //....oooOO0OOooo........oooOO0OOooo........oo << 240 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 639 241 640 inline G4double G4VEmModel::LowEnergyLimit() c << 242 inline G4double G4VEmModel::LowEnergyLimit() 641 { 243 { 642 return lowLimit; 244 return lowLimit; 643 } 245 } 644 246 645 //....oooOO0OOooo........oooOO0OOooo........oo << 247 //....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 << 661 inline G4double G4VEmModel::PolarAngleLimit() << 662 { << 663 return polarAngleLimit; << 664 } << 665 << 666 //....oooOO0OOooo........oooOO0OOooo........oo << 667 << 668 inline G4double G4VEmModel::SecondaryThreshold << 669 { << 670 return secondaryThreshold; << 671 } << 672 << 673 //....oooOO0OOooo........oooOO0OOooo........oo << 674 << 675 inline G4bool G4VEmModel::DeexcitationFlag() c << 676 { << 677 return flagDeexcitation; << 678 } << 679 << 680 //....oooOO0OOooo........oooOO0OOooo........oo << 681 248 682 inline G4bool G4VEmModel::ForceBuildTableFlag( << 249 inline void G4VEmModel::SetHighEnergyLimit(G4double val) 683 { << 684 return flagForceBuildTable; << 685 } << 686 << 687 //....oooOO0OOooo........oooOO0OOooo........oo << 688 << 689 inline G4bool G4VEmModel::UseAngularGeneratorF << 690 { 250 { 691 return useAngularGenerator; << 251 highLimit = val; 692 } 252 } 693 253 694 //....oooOO0OOooo........oooOO0OOooo........oo << 254 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 695 255 696 inline void G4VEmModel::SetAngularGeneratorFla << 256 inline void G4VEmModel::SetLowEnergyLimit(G4double val) 697 { 257 { 698 useAngularGenerator = val; << 258 lowLimit = val; 699 } 259 } 700 260 701 //....oooOO0OOooo........oooOO0OOooo........oo << 261 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 702 262 703 inline void G4VEmModel::SetFluctuationFlag(G4b << 263 inline void G4VEmModel::SetParticleChange(G4VParticleChange* p, >> 264 G4VEmFluctuationModel* f = 0) 704 { 265 { 705 lossFlucFlag = val; << 266 if(p && pParticleChange != p) pParticleChange = p; >> 267 fluc = f; 706 } 268 } 707 269 708 //....oooOO0OOooo........oooOO0OOooo........oo << 270 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 709 << 710 inline G4bool G4VEmModel::IsMaster() const << 711 { << 712 return isMaster; << 713 } << 714 271 715 //....oooOO0OOooo........oooOO0OOooo........oo << 716 272 717 inline void G4VEmModel::SetUseBaseMaterials(G4 << 273 inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations() 718 { 274 { 719 useBaseMaterials = val; << 275 return fluc; 720 } 276 } 721 277 722 //....oooOO0OOooo........oooOO0OOooo........oo << 278 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 723 279 724 inline G4bool G4VEmModel::UseBaseMaterials() c << 280 inline G4double G4VEmModel::MinEnergyCut(const G4ParticleDefinition*, >> 281 const G4MaterialCutsCouple*) 725 { 282 { 726 return useBaseMaterials; << 283 return 0.0; 727 } 284 } 728 285 729 //....oooOO0OOooo........oooOO0OOooo........oo << 286 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 730 287 731 inline void G4VEmModel::SetHighEnergyLimit(G4d << 288 inline G4double G4VEmModel::ComputeDEDXPerVolume( >> 289 const G4Material*, >> 290 const G4ParticleDefinition*, >> 291 G4double, >> 292 G4double) 732 { 293 { 733 highLimit = val; << 294 return 0.0; 734 } 295 } 735 296 736 //....oooOO0OOooo........oooOO0OOooo........oo << 297 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 737 298 738 inline void G4VEmModel::SetLowEnergyLimit(G4do << 299 inline G4double G4VEmModel::ComputeDEDX(const G4MaterialCutsCouple* c, >> 300 const G4ParticleDefinition* p, >> 301 G4double kinEnergy, >> 302 G4double cutEnergy) 739 { 303 { 740 lowLimit = val; << 304 return ComputeDEDXPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy); 741 } 305 } 742 306 743 //....oooOO0OOooo........oooOO0OOooo........oo << 307 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 744 308 745 inline void G4VEmModel::SetActivationHighEnerg << 309 inline G4double G4VEmModel::CrossSection(const G4MaterialCutsCouple* c, >> 310 const G4ParticleDefinition* p, >> 311 G4double kinEnergy, >> 312 G4double cutEnergy, >> 313 G4double maxEnergy) 746 { 314 { 747 eMaxActive = val; << 315 return CrossSectionPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy,maxEnergy); 748 } 316 } 749 317 750 //....oooOO0OOooo........oooOO0OOooo........oo << 318 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 751 319 752 inline void G4VEmModel::SetActivationLowEnergy << 320 inline G4double G4VEmModel::ComputeCrossSectionPerAtom( >> 321 const G4ParticleDefinition*, >> 322 G4double, G4double, G4double, >> 323 G4double, G4double) 753 { 324 { 754 eMinActive = val; << 325 return 0.0; 755 } 326 } 756 327 757 //....oooOO0OOooo........oooOO0OOooo........oo << 328 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 758 329 759 inline G4bool G4VEmModel::IsActive(G4double ki << 330 inline const G4Element* G4VEmModel::SelectRandomAtom( 760 { << 331 const G4Material* material, 761 return (kinEnergy >= eMinActive && kinEnergy << 332 const G4ParticleDefinition* pd, >> 333 G4double kinEnergy, >> 334 G4double tcut, >> 335 G4double tmax) >> 336 { >> 337 const G4ElementVector* theElementVector = material->GetElementVector(); >> 338 currentElement = (*theElementVector)[0]; >> 339 G4int nelm = material->GetNumberOfElements() - 1; >> 340 if (nelm > 0) { >> 341 G4double x = G4UniformRand()* >> 342 CrossSectionPerVolume(material,pd,kinEnergy,tcut,tmax); >> 343 for(G4int i=0; i<nelm; i++) { >> 344 if (x <= xsec[i]) { >> 345 currentElement = (*theElementVector)[i]; >> 346 break; >> 347 } >> 348 } >> 349 } >> 350 return currentElement; 762 } 351 } 763 352 764 //....oooOO0OOooo........oooOO0OOooo........oo << 353 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 765 354 766 inline void G4VEmModel::SetPolarAngleLimit(G4d << 355 inline const G4Element* G4VEmModel::GetCurrentElement() const 767 { 356 { 768 if(!isLocked) { polarAngleLimit = val; } << 357 return currentElement; 769 } 358 } 770 359 771 //....oooOO0OOooo........oooOO0OOooo........oo << 360 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 772 361 773 inline void G4VEmModel::SetSecondaryThreshold( << 362 inline void G4VEmModel::SetCurrentElement(const G4Element* elm) 774 { 363 { 775 secondaryThreshold = val; << 364 currentElement = elm; 776 } 365 } 777 366 778 //....oooOO0OOooo........oooOO0OOooo........oo << 367 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 779 368 780 inline void G4VEmModel::SetDeexcitationFlag(G4 << 369 inline G4double G4VEmModel::MaxSecondaryKinEnergy( >> 370 const G4DynamicParticle* dynParticle) 781 { 371 { 782 flagDeexcitation = val; << 372 return MaxSecondaryEnergy(dynParticle->GetDefinition(), >> 373 dynParticle->GetKineticEnergy()); 783 } 374 } 784 375 785 //....oooOO0OOooo........oooOO0OOooo........oo << 376 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 786 377 787 inline void G4VEmModel::SetForceBuildTable(G4b << 378 inline G4double G4VEmModel::MaxSecondaryEnergy(const G4ParticleDefinition*, >> 379 G4double kineticEnergy) 788 { 380 { 789 flagForceBuildTable = val; << 381 return kineticEnergy; 790 } 382 } 791 383 792 //....oooOO0OOooo........oooOO0OOooo........oo << 384 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 793 385 794 inline const G4String& G4VEmModel::GetName() c 386 inline const G4String& G4VEmModel::GetName() const 795 { 387 { 796 return name; 388 return name; 797 } 389 } 798 390 799 //....oooOO0OOooo........oooOO0OOooo........oo << 391 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 392 // Methods for msc simulation >> 393 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 800 394 801 inline std::vector<G4EmElementSelector*>* G4VE << 395 inline G4double G4VEmModel::ComputeTruePathLengthLimit( >> 396 const G4Track&, >> 397 G4PhysicsTable*, >> 398 G4double) 802 { 399 { 803 return elmSelectors; << 400 return DBL_MAX; 804 } 401 } 805 402 806 //....oooOO0OOooo........oooOO0OOooo........oo << 403 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 807 404 808 inline void << 405 inline G4double G4VEmModel::ComputeGeomPathLength(G4double truePathLength) 809 G4VEmModel::SetElementSelectors(std::vector<G4 << 810 { 406 { 811 if(p != elmSelectors) { << 407 return truePathLength; 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 } 408 } 831 409 832 //....oooOO0OOooo........oooOO0OOooo........oo << 410 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 833 411 834 inline G4bool G4VEmModel::IsLocked() const << 412 inline G4double G4VEmModel::ComputeTrueStepLength(G4double geomPathLength) 835 { 413 { 836 return isLocked; << 414 return geomPathLength; 837 } 415 } 838 416 839 //....oooOO0OOooo........oooOO0OOooo........oo << 417 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 840 418 841 inline void G4VEmModel::SetLocked(G4bool val) << 419 inline void G4VEmModel::DefineForRegion(const G4Region*) 842 { << 420 {} 843 isLocked = val; << 844 } << 845 421 846 //....oooOO0OOooo........oooOO0OOooo........oo << 422 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 847 423 848 #endif 424 #endif >> 425 849 426