Changeset 961 for trunk/source/processes/electromagnetic/utils/include
- Timestamp:
- Apr 6, 2009, 12:21:12 PM (17 years ago)
- Location:
- trunk/source/processes/electromagnetic/utils/include
- Files:
-
- 19 edited
-
G4DummyModel.hh (modified) (1 diff)
-
G4EmCalculator.hh (modified) (1 diff)
-
G4EmCorrections.hh (modified) (11 diffs)
-
G4EmModelManager.hh (modified) (7 diffs)
-
G4EmMultiModel.hh (modified) (1 diff)
-
G4EmProcessOptions.hh (modified) (3 diffs)
-
G4EmTableType.hh (modified) (2 diffs)
-
G4EnergyLossMessenger.hh (modified) (6 diffs)
-
G4EnergyLossTables.hh (modified) (1 diff)
-
G4LossTableBuilder.hh (modified) (5 diffs)
-
G4LossTableManager.hh (modified) (11 diffs)
-
G4MscStepLimitType.hh (modified) (1 diff)
-
G4VEmFluctuationModel.hh (modified) (3 diffs)
-
G4VEmModel.hh (modified) (14 diffs)
-
G4VEmProcess.hh (modified) (14 diffs)
-
G4VEnergyLoss.hh (modified) (1 diff)
-
G4VEnergyLossProcess.hh (modified) (18 diffs)
-
G4VMultipleScattering.hh (modified) (19 diffs)
-
G4ionEffectiveCharge.hh (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/utils/include/G4DummyModel.hh
r819 r961 25 25 // 26 26 // $Id: G4DummyModel.hh,v 1.3 2007/05/22 17:31:57 vnivanch Exp $ 27 // GEANT4 tag $Name: $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- -
trunk/source/processes/electromagnetic/utils/include/G4EmCalculator.hh
r819 r961 25 25 // 26 26 // $Id: G4EmCalculator.hh,v 1.18 2007/03/15 12:34:46 vnivanch Exp $ 27 // GEANT4 tag $Name: $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // -
trunk/source/processes/electromagnetic/utils/include/G4EmCorrections.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4EmCorrections.hh,v 1. 10 2008/01/11 19:55:29vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4EmCorrections.hh,v 1.24 2008/09/12 14:44:48 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 41 41 // 28.04.2006 General cleanup, add finite size corrections (V.Ivanchenko) 42 42 // 13.05.2006 Add corrections for ion stopping (V.Ivanhcenko) 43 // 20.05.2008 Removed Finite Size correction (V.Ivanchenko) 44 // 12.09.2008 Added inlined interfaces to effective charge (V.Ivanchenko) 43 45 // 44 46 // Class Description: … … 58 60 #include "G4Material.hh" 59 61 #include "G4ParticleDefinition.hh" 62 #include "G4NistManager.hh" 60 63 61 64 class G4VEmModel; 62 65 class G4PhysicsVector; 63 66 class G4IonTable; 64 class G4 NistManager;67 class G4MaterialCutsCouple; 65 68 66 69 class G4EmCorrections … … 73 76 virtual ~G4EmCorrections(); 74 77 75 G4double HighOrderCorrections(const G4ParticleDefinition* p, 76 const G4Material* material, 77 G4double kineticEnergy); 78 79 G4double Bethe(const G4ParticleDefinition* p, 80 const G4Material* material, 78 G4double HighOrderCorrections(const G4ParticleDefinition*, 79 const G4Material*, 80 G4double kineticEnergy, 81 G4double cutEnergy); 82 83 G4double IonHighOrderCorrections(const G4ParticleDefinition*, 84 const G4MaterialCutsCouple*, 85 G4double kineticEnergy); 86 87 G4double ComputeIonCorrections(const G4ParticleDefinition*, 88 const G4Material*, 89 G4double kineticEnergy); 90 91 G4double IonBarkasCorrection(const G4ParticleDefinition*, 92 const G4Material*, 93 G4double kineticEnergy); 94 95 G4double Bethe(const G4ParticleDefinition*, 96 const G4Material*, 81 97 G4double kineticEnergy); 82 98 83 G4double SpinCorrection(const G4ParticleDefinition* p,84 const G4Material* material,99 G4double SpinCorrection(const G4ParticleDefinition*, 100 const G4Material*, 85 101 G4double kineticEnergy); 86 102 87 G4double KShellCorrection(const G4ParticleDefinition* p,88 const G4Material* material,103 G4double KShellCorrection(const G4ParticleDefinition*, 104 const G4Material*, 89 105 G4double kineticEnergy); 90 106 91 G4double LShellCorrection(const G4ParticleDefinition* p,92 const G4Material* material,107 G4double LShellCorrection(const G4ParticleDefinition*, 108 const G4Material*, 93 109 G4double kineticEnergy); 94 110 95 G4double ShellCorrection(const G4ParticleDefinition* p,96 const G4Material* material,111 G4double ShellCorrection(const G4ParticleDefinition*, 112 const G4Material*, 97 113 G4double kineticEnergy); 98 114 99 G4double ShellCorrectionSTD(const G4ParticleDefinition* p,100 const G4Material* material,115 G4double ShellCorrectionSTD(const G4ParticleDefinition*, 116 const G4Material*, 101 117 G4double kineticEnergy); 102 118 103 G4double DensityCorrection(const G4ParticleDefinition* p,104 const G4Material* material,119 G4double DensityCorrection(const G4ParticleDefinition*, 120 const G4Material*, 105 121 G4double kineticEnergy); 106 122 107 G4double BarkasCorrection(const G4ParticleDefinition* p,108 const G4Material* material,123 G4double BarkasCorrection(const G4ParticleDefinition*, 124 const G4Material*, 109 125 G4double kineticEnergy); 110 126 111 G4double BlochCorrection(const G4ParticleDefinition* p,112 const G4Material* material,127 G4double BlochCorrection(const G4ParticleDefinition*, 128 const G4Material*, 113 129 G4double kineticEnergy); 114 130 115 G4double MottCorrection(const G4ParticleDefinition* p,116 const G4Material* material,131 G4double MottCorrection(const G4ParticleDefinition*, 132 const G4Material*, 117 133 G4double kineticEnergy); 118 134 119 G4double FiniteSizeCorrection(const G4ParticleDefinition* p, 120 const G4Material* material, 121 G4double kineticEnergy); 122 123 G4double NuclearDEDX(const G4ParticleDefinition* p, 124 const G4Material* material, 135 G4double NuclearDEDX(const G4ParticleDefinition*, 136 const G4Material*, 125 137 G4double kineticEnergy, 126 138 G4bool fluct = true); 127 139 128 140 void AddStoppingData(G4int Z, G4int A, const G4String& materialName, 129 G4PhysicsVector& dVector); 130 141 G4PhysicsVector* dVector); 142 143 void InitialiseForNewRun(); 144 145 // effective charge correction using stopping power data 131 146 G4double EffectiveChargeCorrection(const G4ParticleDefinition*, 132 147 const G4Material*, 133 G4double); 134 135 G4ionEffectiveCharge* GetIonEffectiveCharge(G4VEmModel* m = 0); 136 137 G4int GetNumberOfStoppingVectors(); 148 G4double kineticEnergy); 149 150 // effective charge of an ion 151 inline G4double GetParticleCharge(const G4ParticleDefinition*, 152 const G4Material*, 153 G4double kineticEnergy); 154 155 inline 156 G4double EffectiveChargeSquareRatio(const G4ParticleDefinition*, 157 const G4Material*, 158 G4double kineticEnergy); 159 160 // ionisation models for ions 161 inline void SetIonisationModels(G4VEmModel* m1 = 0, G4VEmModel* m2 = 0); 162 163 inline G4int GetNumberOfStoppingVectors(); 138 164 139 165 private: … … 141 167 void Initialise(); 142 168 143 G4PhysicsVector* InitialiseMaterial(const G4Material* mat);144 145 void SetupKinematics(const G4ParticleDefinition* p,146 const G4Material* material,169 void BuildCorrectionVector(); 170 171 void SetupKinematics(const G4ParticleDefinition*, 172 const G4Material*, 147 173 G4double kineticEnergy); 148 174 … … 207 233 G4double Z23[100]; 208 234 235 std::vector<const G4Material*> currmat; 236 std::vector<G4double> thcorr[100]; 237 size_t ncouples; 238 209 239 const G4ParticleDefinition* particle; 210 240 const G4ParticleDefinition* curParticle; … … 218 248 G4double mass; 219 249 G4double massFactor; 250 G4double formfact; 251 G4double eth; 220 252 G4double tau; 221 253 G4double gamma; … … 225 257 G4double ba2; 226 258 G4double tmax; 227 G4double tmax0;228 259 G4double charge; 229 260 G4double q2; 261 G4double eCorrMin; 262 G4double eCorrMax; 263 G4int nbinCorr; 230 264 231 265 G4AtomicShells shells; … … 234 268 G4NistManager* nist; 235 269 const G4IonTable* ionTable; 236 G4VEmModel* ionModel; 270 G4VEmModel* ionLEModel; 271 G4VEmModel* ionHEModel; 237 272 238 273 // Ion stopping data 239 274 G4int nIons; 240 275 G4int idx; 276 G4int currentZ; 241 277 std::vector<G4int> Zion; 242 278 std::vector<G4int> Aion; 243 279 std::vector<G4String> materialName; 280 281 std::vector<const G4ParticleDefinition*> ionList; 244 282 245 283 std::vector<const G4Material*> materialList; … … 271 309 z21*((xv-x1)*(y2-yv)+(yv-y1)*(x2-xv)))) 272 310 / ((x2-x1)*(y2-y1)); 311 } 312 313 inline 314 void G4EmCorrections::SetIonisationModels(G4VEmModel* m1, G4VEmModel* m2) 315 { 316 if(m1) ionLEModel = m1; 317 if(m2) ionHEModel = m2; 318 } 319 320 inline G4int G4EmCorrections::GetNumberOfStoppingVectors() 321 { 322 return nIons; 323 } 324 325 inline G4double 326 G4EmCorrections::GetParticleCharge(const G4ParticleDefinition* p, 327 const G4Material* mat, 328 G4double kineticEnergy) 329 { 330 return effCharge.EffectiveCharge(p,mat,kineticEnergy); 331 } 332 333 inline G4double 334 G4EmCorrections::EffectiveChargeSquareRatio(const G4ParticleDefinition* p, 335 const G4Material* mat, 336 G4double kineticEnergy) 337 { 338 return effCharge.EffectiveChargeSquareRatio(p,mat,kineticEnergy); 273 339 } 274 340 … … 289 355 G4double ratio = electron_mass_c2/mass; 290 356 tmax = 2.0*electron_mass_c2*bg2 /(1. + 2.0*gamma*ratio + ratio*ratio); 291 tmax0 = tmax;292 357 charge = p->GetPDGCharge()/eplus; 293 if(charge < 1.5) q2 = charge*charge;358 if(charge < 1.5) {q2 = charge*charge;} 294 359 else { 295 360 q2 = effCharge.EffectiveChargeSquareRatio(p,mat,kinEnergy); 296 361 charge = std::sqrt(q2); 297 362 } 298 if(mass > 120.*MeV)299 tmax = std::min(tmax,51200.*electron_mass_c2*std::pow(proton_mass_c2/mass,0.666667));300 363 } 301 364 if(mat != material) { -
trunk/source/processes/electromagnetic/utils/include/G4EmModelManager.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4EmModelManager.hh,v 1.2 2 2007/11/09 11:35:54vnivanch Exp $27 // GEANT4 tag $Name: $26 // $Id: G4EmModelManager.hh,v 1.25 2008/10/13 14:56:56 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 74 74 #include "G4DataVector.hh" 75 75 #include "G4EmTableType.hh" 76 #include "G4EmProcessSubType.hh" 77 #include "G4Region.hh" 76 78 77 79 class G4RegionModels … … 84 86 private: 85 87 86 G4RegionModels(G4int nMod, std::vector<G4int>& list, G4DataVector& lowE); 88 G4RegionModels(G4int nMod, std::vector<G4int>& indx, 89 G4DataVector& lowE, const G4Region* reg); 87 90 88 91 ~G4RegionModels(); … … 105 108 }; 106 109 110 G4double LowEdgeEnergy(G4int n) const { 111 return lowKineticEnergy[n]; 112 }; 113 114 const G4Region* Region() const { 115 return theRegion; 116 }; 117 118 const G4Region* theRegion; 107 119 G4int nModelsForRegion; 108 120 G4int* theListOfModelIndexes; … … 150 162 G4VEmModel* SelectModel(G4double& energy, size_t& index); 151 163 152 G4VEmModel* GetModel(G4int );164 G4VEmModel* GetModel(G4int, G4bool ver = false); 153 165 154 166 G4int NumberOfModels() const; … … 157 169 158 170 void UpdateEmModel(const G4String&, G4double, G4double); 171 172 void DumpModelList(G4int verb); 159 173 160 174 private: … … 176 190 std::vector<const G4Region*> regions; 177 191 std::vector<G4int> orderOfModels; 178 G4DataVector upperEkin;179 192 180 193 G4int nEmModels; -
trunk/source/processes/electromagnetic/utils/include/G4EmMultiModel.hh
r819 r961 25 25 // 26 26 // $Id: G4EmMultiModel.hh,v 1.6 2007/05/22 17:31:57 vnivanch Exp $ 27 // GEANT4 tag $Name: $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- -
trunk/source/processes/electromagnetic/utils/include/G4EmProcessOptions.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4EmProcessOptions.hh,v 1.1 2 2007/05/18 18:39:54vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4EmProcessOptions.hh,v 1.15 2009/02/18 14:40:10 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // … … 107 107 void SetLinearLossLimit(G4double val); 108 108 109 void ActivateDeexcitation(G4bool val, const G4Region* r = 0); 109 void ActivateDeexcitation(const G4String& proc, G4bool val, 110 const G4String& reg = ""); 110 111 111 112 void SetMscStepLimitation(G4MscStepLimitType val); … … 121 122 void SetLPMFlag(G4bool val); 122 123 124 void SetSplineFlag(G4bool val); 125 123 126 void SetBremsstrahlungTh(G4double val); 127 128 void SetPolarAngleLimit(G4double val); 124 129 125 130 private: -
trunk/source/processes/electromagnetic/utils/include/G4EmTableType.hh
r819 r961 25 25 // 26 26 // 27 // $Id: G4EmTableType.hh,v 1. 3 2007/01/15 17:27:40vnivanch Exp $28 // GEANT4 tag $Name: $27 // $Id: G4EmTableType.hh,v 1.4 2008/10/13 14:56:56 vnivanch Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 //--------------------------------------------------------------- … … 51 51 fRestricted, 52 52 fSubRestricted, 53 fI onisation,54 f SubIonisation53 fIsIonisation, 54 fIsSubIonisation 55 55 }; 56 56 #endif -
trunk/source/processes/electromagnetic/utils/include/G4EnergyLossMessenger.hh
r819 r961 25 25 // 26 26 // 27 // $Id: G4EnergyLossMessenger.hh,v 1. 18 2007/05/18 18:39:54vnivanch Exp $28 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $27 // $Id: G4EnergyLossMessenger.hh,v 1.23 2009/02/18 14:40:10 vnivanch Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // ------------------------------------------------------------------- … … 45 45 // 16-03-07 modify /process/eLoss/minsubsec command (V.Ivanchenko) 46 46 // 18-05-07 add /process/msc directory and commands (V.Ivanchenko) 47 // 11-03-08 add /process/em directory and commands (V.Ivanchenko) 47 48 // 48 49 // ------------------------------------------------------------------- … … 100 101 G4UIdirectory* eLossDirectory; 101 102 G4UIdirectory* mscDirectory; 103 G4UIdirectory* emDirectory; 102 104 G4UIcmdWithABool* RndmStepCmd; 103 105 G4UIcmdWithABool* EnlossFlucCmd; … … 105 107 G4UIcmdWithADouble* MinSubSecCmd; 106 108 G4UIcommand* StepFuncCmd; 109 G4UIcommand* deexCmd; 107 110 G4UIcmdWithAString* mscCmd; 108 111 G4UIcmdWithADoubleAndUnit* MinEnCmd; … … 112 115 G4UIcmdWithABool* lpmCmd; 113 116 G4UIcmdWithABool* latCmd; 117 G4UIcmdWithABool* splCmd; 118 G4UIcmdWithABool* aplCmd; 114 119 G4UIcmdWithAnInteger* verCmd; 120 G4UIcmdWithAnInteger* ver1Cmd; 115 121 G4UIcmdWithAnInteger* dedxCmd; 116 122 G4UIcmdWithAnInteger* lamCmd; … … 120 126 G4UIcmdWithADouble* frCmd; 121 127 G4UIcmdWithADouble* fgCmd; 128 G4UIcmdWithADoubleAndUnit* angCmd; 122 129 }; 123 130 -
trunk/source/processes/electromagnetic/utils/include/G4EnergyLossTables.hh
r819 r961 26 26 // 27 27 // $Id: G4EnergyLossTables.hh,v 1.19 2006/06/29 19:54:35 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // $Id: -
trunk/source/processes/electromagnetic/utils/include/G4LossTableBuilder.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4LossTableBuilder.hh,v 1. 7 2006/06/29 19:54:37 gunterExp $27 // GEANT4 tag $Name: $26 // $Id: G4LossTableBuilder.hh,v 1.8 2008/07/22 15:55:15 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // … … 40 40 // 41 41 // Modifications: 42 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivan tchenko)43 // 42 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko) 43 // 17-07-08 Added splineFlag (V.Ivanchenko) 44 44 // 45 45 // Class Description: … … 56 56 #include "globals.hh" 57 57 #include "G4PhysicsTable.hh" 58 59 58 60 59 class G4LossTableBuilder … … 75 74 G4PhysicsTable* invRangeTable, 76 75 G4bool isIonisation = false); 76 77 inline void SetSplineFlag(G4bool flag); 77 78 78 79 private: … … 81 82 G4LossTableBuilder(const G4LossTableBuilder&); 82 83 84 G4bool splineFlag; 85 83 86 }; 87 88 inline void G4LossTableBuilder::SetSplineFlag(G4bool flag) 89 { 90 splineFlag = flag; 91 } 84 92 85 93 //....oooOO0OOooo.......oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -
trunk/source/processes/electromagnetic/utils/include/G4LossTableManager.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4LossTableManager.hh,v 1. 48 2007/11/07 18:38:49vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4LossTableManager.hh,v 1.53 2008/07/15 16:56:38 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // … … 77 77 #define G4LossTableManager_h 1 78 78 79 80 79 #include <map> 81 80 #include <vector> … … 91 90 class G4VEmProcess; 92 91 class G4EmCorrections; 92 class G4EmSaturation; 93 93 class G4LossTableBuilder; 94 94 … … 152 152 153 153 void DeRegister(G4VEmProcess* p); 154 155 void Register(G4VEmModel* p); 156 157 void DeRegister(G4VEmModel* p); 158 159 void Register(G4VEmFluctuationModel* p); 160 161 void DeRegister(G4VEmFluctuationModel* p); 154 162 155 163 void EnergyLossProcessIsInitialised(const G4ParticleDefinition* aParticle, … … 195 203 void SetLPMFlag(G4bool val); 196 204 205 void SetSplineFlag(G4bool val); 206 197 207 void SetLinearLossLimit(G4double val); 198 208 … … 207 217 G4bool LPMFlag() const; 208 218 219 G4bool SplineFlag() const; 220 209 221 G4double BremsstrahlungTh() const; 210 222 … … 217 229 inline G4VEnergyLossProcess* GetEnergyLossProcess(const G4ParticleDefinition*); 218 230 219 inline G4EmCorrections* EmCorrections(); 231 G4EmCorrections* EmCorrections(); 232 233 G4EmSaturation* EmSaturation(); 220 234 221 235 private: … … 251 265 std::vector<G4VMultipleScattering*> msc_vector; 252 266 std::vector<G4VEmProcess*> emp_vector; 267 std::vector<G4VEmModel*> mod_vector; 268 std::vector<G4VEmFluctuationModel*> fmod_vector; 253 269 254 270 // cash … … 274 290 G4bool stepFunctionActive; 275 291 G4bool flagLPM; 292 G4bool splineFlag; 276 293 277 294 G4double minSubRange; … … 286 303 G4EnergyLossMessenger* theMessenger; 287 304 G4EmCorrections* emCorrections; 305 G4EmSaturation* emSaturation; 306 288 307 const G4ParticleDefinition* firstParticle; 289 308 G4int verbose; … … 418 437 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 419 438 420 inline G4EmCorrections* G4LossTableManager::EmCorrections()421 {422 return emCorrections;423 }424 425 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......426 427 439 #endif 428 440 -
trunk/source/processes/electromagnetic/utils/include/G4MscStepLimitType.hh
r819 r961 26 26 // 27 27 // $Id: G4MscStepLimitType.hh,v 1.2 2007/06/11 14:56:51 vnivanch Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 //--------------------------------------------------------------- -
trunk/source/processes/electromagnetic/utils/include/G4VEmFluctuationModel.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VEmFluctuationModel.hh,v 1.1 0 2006/06/29 19:54:41 gunterExp $27 // GEANT4 tag $Name: $26 // $Id: G4VEmFluctuationModel.hh,v 1.12 2009/02/19 11:25:50 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 95 95 virtual void InitialiseMe(const G4ParticleDefinition*); 96 96 97 virtual void SetParticleAndCharge(const G4ParticleDefinition*, G4double q2); 98 97 99 //------------------------------------------------------------------------ 98 100 // Generic methods common to all models 99 101 //------------------------------------------------------------------------ 100 102 101 G4String GetName() const;103 inline G4String GetName() const; 102 104 103 105 private: … … 113 115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 114 116 115 inline void G4VEmFluctuationModel::InitialiseMe(const G4ParticleDefinition*)116 {}117 118 117 inline G4String G4VEmFluctuationModel::GetName() const 119 118 { -
trunk/source/processes/electromagnetic/utils/include/G4VEmModel.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VEmModel.hh,v 1. 48 2007/10/29 08:38:58vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4VEmModel.hh,v 1.66 2009/02/19 09:57:36 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 61 61 // 29-06-06 Add member currentElement and Get/Set methods (V.Ivanchenko) 62 62 // 29-10-07 Added SampleScattering (V.Ivanchenko) 63 // 15-07-08 Reorder class members and improve comments (VI) 64 // 21-07-08 Added vector of G4ElementSelector and methods to use it (VI) 65 // 12-09-08 Added methods GetParticleCharge, GetChargeSquareRatio, 66 // CorrectionsAlongStep, ActivateNuclearStopping (VI) 67 // 16-02-09 Move implementations of virtual methods to source (VI) 63 68 // 64 69 // Class Description: … … 81 86 #include "G4DataVector.hh" 82 87 #include "G4VEmFluctuationModel.hh" 88 #include "G4EmElementSelector.hh" 83 89 #include "Randomize.hh" 90 #include <vector> 84 91 85 92 class G4PhysicsTable; … … 98 105 99 106 //------------------------------------------------------------------------ 100 // Virtual methods to be implemented for theconcrete model101 //------------------------------------------------------------------------ 102 103 virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&) = 0;104 107 // Virtual methods to be implemented for any concrete model 108 //------------------------------------------------------------------------ 109 110 virtual void Initialise(const G4ParticleDefinition*, 111 const G4DataVector&) = 0; 105 112 106 113 virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*, … … 114 121 //------------------------------------------------------------------------ 115 122 116 virtual G4double MinEnergyCut(const G4ParticleDefinition*, 117 const G4MaterialCutsCouple*); 118 119 virtual G4double ComputeDEDX(const G4MaterialCutsCouple*, 120 const G4ParticleDefinition*, 121 G4double kineticEnergy, 122 G4double cutEnergy = DBL_MAX); 123 124 virtual G4double CrossSection(const G4MaterialCutsCouple*, 125 const G4ParticleDefinition*, 126 G4double kineticEnergy, 127 G4double cutEnergy = 0.0, 128 G4double maxEnergy = DBL_MAX); 129 123 // main method to compute dEdx 130 124 virtual G4double ComputeDEDXPerVolume(const G4Material*, 131 125 const G4ParticleDefinition*, … … 133 127 G4double cutEnergy = DBL_MAX); 134 128 135 136 virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*, 137 G4double kinEnergy, 138 G4double Z, 139 G4double A = 0., 140 G4double cutEnergy = 0.0, 141 G4double maxEnergy = DBL_MAX); 142 143 virtual G4double ComputeMeanFreePath(const G4ParticleDefinition*, 144 G4double kineticEnergy, 145 const G4Material*, 146 G4double cutEnergy = 0.0, 147 G4double maxEnergy = DBL_MAX); 148 129 // main method to compute cross section per Volume 149 130 virtual G4double CrossSectionPerVolume(const G4Material*, 150 131 const G4ParticleDefinition*, … … 153 134 G4double maxEnergy = DBL_MAX); 154 135 136 // main method to compute cross section depending on atom 137 virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*, 138 G4double kinEnergy, 139 G4double Z, 140 G4double A = 0., /* amu */ 141 G4double cutEnergy = 0.0, 142 G4double maxEnergy = DBL_MAX); 143 144 // min cut in kinetic energy allowed by the model 145 virtual G4double MinEnergyCut(const G4ParticleDefinition*, 146 const G4MaterialCutsCouple*); 147 148 // Compute effective ion charge square 149 virtual G4double GetChargeSquareRatio(const G4ParticleDefinition*, 150 const G4Material*, 151 G4double kineticEnergy); 152 153 // Compute ion charge 154 virtual G4double GetParticleCharge(const G4ParticleDefinition*, 155 const G4Material*, 156 G4double kineticEnergy); 157 158 // add correction to energy loss and ompute non-ionizing energy loss 159 virtual void CorrectionsAlongStep(const G4MaterialCutsCouple*, 160 const G4DynamicParticle*, 161 G4double& eloss, 162 G4double& niel, 163 G4double length); 164 165 // sample PIXE deexcitation 166 virtual void SampleDeexcitationAlongStep(const G4Material*, 167 const G4Track&, 168 G4double& eloss); 169 155 170 protected: 156 171 172 // kinematically allowed max kinetic energy of a secondary 157 173 virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*, 158 174 G4double kineticEnergy); … … 177 193 virtual void DefineForRegion(const G4Region*); 178 194 195 virtual void SetupForMaterial(const G4ParticleDefinition*, 196 const G4Material*, 197 G4double kineticEnergy); 198 179 199 //------------------------------------------------------------------------ 180 200 // Generic methods common to all models 181 201 //------------------------------------------------------------------------ 182 202 183 void SetParticleChange(G4VParticleChange*, G4VEmFluctuationModel*); 184 185 G4VEmFluctuationModel* GetModelOfFluctuations(); 186 187 G4double HighEnergyLimit(); 188 189 G4double LowEnergyLimit(); 190 191 void SetHighEnergyLimit(G4double); 192 193 void SetLowEnergyLimit(G4double); 194 195 G4double MaxSecondaryKinEnergy(const G4DynamicParticle* dynParticle); 196 197 const G4Element* SelectRandomAtom(const G4Material*, 198 const G4ParticleDefinition*, 199 G4double kineticEnergy, 200 G4double cutEnergy = 0.0, 201 G4double maxEnergy = DBL_MAX); 202 203 const G4String& GetName() const; 203 // should be called at initialisation to build element selectors 204 void InitialiseElementSelectors(const G4ParticleDefinition*, 205 const G4DataVector&); 206 207 // dEdx per unit length 208 inline G4double ComputeDEDX(const G4MaterialCutsCouple*, 209 const G4ParticleDefinition*, 210 G4double kineticEnergy, 211 G4double cutEnergy = DBL_MAX); 212 213 // cross section per volume 214 inline G4double CrossSection(const G4MaterialCutsCouple*, 215 const G4ParticleDefinition*, 216 G4double kineticEnergy, 217 G4double cutEnergy = 0.0, 218 G4double maxEnergy = DBL_MAX); 219 220 // compute mean free path via cross section per volume 221 inline G4double ComputeMeanFreePath(const G4ParticleDefinition*, 222 G4double kineticEnergy, 223 const G4Material*, 224 G4double cutEnergy = 0.0, 225 G4double maxEnergy = DBL_MAX); 226 227 // generic cross section per element 228 inline G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*, 229 const G4Element*, 230 G4double kinEnergy, 231 G4double cutEnergy = 0.0, 232 G4double maxEnergy = DBL_MAX); 233 234 // atom can be selected effitiantly if element selectors are initialised 235 inline const G4Element* SelectRandomAtom(const G4MaterialCutsCouple*, 236 const G4ParticleDefinition*, 237 G4double kineticEnergy, 238 G4double cutEnergy = 0.0, 239 G4double maxEnergy = DBL_MAX); 240 241 // to select atom cross section per volume is recomputed for each element 242 inline const G4Element* SelectRandomAtom(const G4Material*, 243 const G4ParticleDefinition*, 244 G4double kineticEnergy, 245 G4double cutEnergy = 0.0, 246 G4double maxEnergy = DBL_MAX); 247 248 // select isotope in order to have precise mass of the nucleus 249 inline G4int SelectIsotopeNumber(const G4Element*); 250 251 //------------------------------------------------------------------------ 252 // Get/Set methods 253 //------------------------------------------------------------------------ 254 255 inline G4VEmFluctuationModel* GetModelOfFluctuations(); 256 257 inline G4double HighEnergyLimit() const; 258 259 inline G4double LowEnergyLimit() const; 260 261 inline G4double PolarAngleLimit() const; 262 263 inline G4double SecondaryThreshold() const; 264 265 inline G4bool LPMFlag() const; 266 267 inline G4bool DeexcitationFlag() const; 268 269 inline void SetHighEnergyLimit(G4double); 270 271 inline void SetLowEnergyLimit(G4double); 272 273 inline void SetPolarAngleLimit(G4double); 274 275 inline void SetSecondaryThreshold(G4double); 276 277 inline void SetLPMFlag(G4bool val); 278 279 inline void SetDeexcitationFlag(G4bool val); 280 281 inline void ActivateNuclearStopping(G4bool); 282 283 inline G4double MaxSecondaryKinEnergy(const G4DynamicParticle* dynParticle); 284 285 inline const G4String& GetName() const; 286 287 inline void SetParticleChange(G4VParticleChange*, G4VEmFluctuationModel*); 288 289 inline void SetCurrentCouple(const G4MaterialCutsCouple*); 204 290 205 291 protected: 206 292 207 const G4Element* GetCurrentElement() const; 208 209 void SetCurrentElement(const G4Element*); 293 inline const G4MaterialCutsCouple* CurrentCouple() const; 294 295 inline void SetCurrentElement(const G4Element*); 296 297 inline const G4Element* GetCurrentElement() const; 210 298 211 299 private: … … 215 303 G4VEmModel(const G4VEmModel&); 216 304 305 // ======== Parameters of the class fixed at construction ========= 306 307 G4VEmFluctuationModel* fluc; 308 const G4String name; 309 310 // ======== Parameters of the class fixed at initialisation ======= 311 217 312 G4double lowLimit; 218 313 G4double highLimit; 219 G4double xsec[40];220 221 G4 VEmFluctuationModel* fluc;222 223 const G4String name;224 const G4Element* currentElement;314 G4double polarAngleLimit; 315 G4double secondaryThreshold; 316 G4bool theLPMflag; 317 318 G4int nSelectors; 319 std::vector<G4EmElementSelector*> elmSelectors; 225 320 226 321 protected: 227 322 228 323 G4VParticleChange* pParticleChange; 324 G4bool nuclearStopping; 325 326 // ======== Cashed values - may be state dependent ================ 327 328 private: 329 330 const G4MaterialCutsCouple* currentCouple; 331 const G4Element* currentElement; 332 333 G4int nsec; 334 G4bool flagDeexcitation; 335 std::vector<G4double> xsec; 336 229 337 }; 230 338 231 339 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 232 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......233 234 inline G4double G4VEmModel::HighEnergyLimit()235 {236 return highLimit;237 }238 239 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......240 241 inline G4double G4VEmModel::LowEnergyLimit()242 {243 return lowLimit;244 }245 246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......247 248 inline void G4VEmModel::SetHighEnergyLimit(G4double val)249 {250 highLimit = val;251 }252 253 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......254 255 inline void G4VEmModel::SetLowEnergyLimit(G4double val)256 {257 lowLimit = val;258 }259 260 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......261 262 inline void G4VEmModel::SetParticleChange(G4VParticleChange* p,263 G4VEmFluctuationModel* f = 0)264 {265 if(p && pParticleChange != p) pParticleChange = p;266 fluc = f;267 }268 269 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......270 271 272 inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations()273 {274 return fluc;275 }276 277 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......278 279 inline G4double G4VEmModel::MinEnergyCut(const G4ParticleDefinition*,280 const G4MaterialCutsCouple*)281 {282 return 0.0;283 }284 285 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......286 287 inline G4double G4VEmModel::ComputeDEDXPerVolume(288 const G4Material*,289 const G4ParticleDefinition*,290 G4double,291 G4double)292 {293 return 0.0;294 }295 296 340 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 297 341 … … 301 345 G4double cutEnergy) 302 346 { 347 currentCouple = c; 303 348 return ComputeDEDXPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy); 304 349 } … … 312 357 G4double maxEnergy) 313 358 { 314 return 315 CrossSectionPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy,maxEnergy); 359 currentCouple = c; 360 return CrossSectionPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy,maxEnergy); 361 } 362 363 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 364 365 inline G4double G4VEmModel::ComputeMeanFreePath(const G4ParticleDefinition* p, 366 G4double ekin, 367 const G4Material* material, 368 G4double emin, 369 G4double emax) 370 { 371 G4double mfp = DBL_MAX; 372 G4double cross = CrossSectionPerVolume(material,p,ekin,emin,emax); 373 if (cross > DBL_MIN) mfp = 1./cross; 374 return mfp; 316 375 } 317 376 … … 319 378 320 379 inline G4double G4VEmModel::ComputeCrossSectionPerAtom( 321 const G4ParticleDefinition*, 322 G4double, G4double, G4double, 323 G4double, G4double) 324 { 325 return 0.0; 326 } 327 328 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 329 330 inline const G4Element* G4VEmModel::SelectRandomAtom( 331 const G4Material* material, 332 const G4ParticleDefinition* pd, 333 G4double kinEnergy, 334 G4double tcut, 335 G4double tmax) 380 const G4ParticleDefinition* part, 381 const G4Element* elm, 382 G4double kinEnergy, 383 G4double cutEnergy, 384 G4double maxEnergy) 385 { 386 currentElement = elm; 387 return ComputeCrossSectionPerAtom(part,kinEnergy,elm->GetZ(),elm->GetN(), 388 cutEnergy,maxEnergy); 389 } 390 391 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 392 393 inline 394 const G4Element* G4VEmModel::SelectRandomAtom(const G4MaterialCutsCouple* couple, 395 const G4ParticleDefinition* p, 396 G4double kinEnergy, 397 G4double cutEnergy, 398 G4double maxEnergy) 399 { 400 currentCouple = couple; 401 if(nSelectors > 0) { 402 currentElement = 403 elmSelectors[couple->GetIndex()]->SelectRandomAtom(kinEnergy); 404 } else { 405 currentElement = SelectRandomAtom(couple->GetMaterial(),p,kinEnergy, 406 cutEnergy,maxEnergy); 407 } 408 return currentElement; 409 } 410 411 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 412 413 inline 414 const G4Element* G4VEmModel::SelectRandomAtom(const G4Material* material, 415 const G4ParticleDefinition* pd, 416 G4double kinEnergy, 417 G4double tcut, 418 G4double tmax) 336 419 { 337 420 const G4ElementVector* theElementVector = material->GetElementVector(); 338 G4int n elm = material->GetNumberOfElements();339 currentElement = (*theElementVector)[n elm-1];340 if (n elm > 1) {421 G4int n = material->GetNumberOfElements() - 1; 422 currentElement = (*theElementVector)[n]; 423 if (n > 0) { 341 424 G4double x = G4UniformRand()* 342 CrossSectionPerVolume(material,pd,kinEnergy,tcut,tmax);343 for(G4int i=0; i<n elm; i++) {425 G4VEmModel::CrossSectionPerVolume(material,pd,kinEnergy,tcut,tmax); 426 for(G4int i=0; i<n; i++) { 344 427 if (x <= xsec[i]) { 345 428 currentElement = (*theElementVector)[i]; … … 353 436 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 354 437 438 inline G4int G4VEmModel::SelectIsotopeNumber(const G4Element* elm) 439 { 440 G4int N = G4int(elm->GetN() + 0.5); 441 G4int ni = elm->GetNumberOfIsotopes(); 442 if(ni > 0) { 443 G4int idx = 0; 444 if(ni > 1) { 445 G4double* ab = currentElement->GetRelativeAbundanceVector(); 446 G4double x = G4UniformRand(); 447 for(; idx<ni; idx++) { 448 x -= ab[idx]; 449 if (x <= 0.0) break; 450 } 451 if(idx >= ni) idx = ni - 1; 452 } 453 N = elm->GetIsotope(idx)->GetN(); 454 } 455 return N; 456 } 457 458 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 459 460 inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations() 461 { 462 return fluc; 463 } 464 465 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 466 467 inline G4double G4VEmModel::HighEnergyLimit() const 468 { 469 return highLimit; 470 } 471 472 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 473 474 inline G4double G4VEmModel::LowEnergyLimit() const 475 { 476 return lowLimit; 477 } 478 479 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 480 481 inline G4double G4VEmModel::PolarAngleLimit() const 482 { 483 return polarAngleLimit; 484 } 485 486 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 487 488 inline G4double G4VEmModel::SecondaryThreshold() const 489 { 490 return secondaryThreshold; 491 } 492 493 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 494 495 inline G4bool G4VEmModel::LPMFlag() const 496 { 497 return theLPMflag; 498 } 499 500 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 501 502 inline G4bool G4VEmModel::DeexcitationFlag() const 503 { 504 return flagDeexcitation; 505 } 506 507 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 508 509 inline void G4VEmModel::SetHighEnergyLimit(G4double val) 510 { 511 highLimit = val; 512 } 513 514 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 515 516 inline void G4VEmModel::SetLowEnergyLimit(G4double val) 517 { 518 lowLimit = val; 519 } 520 521 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 522 523 inline void G4VEmModel::SetPolarAngleLimit(G4double val) 524 { 525 polarAngleLimit = val; 526 } 527 528 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 529 530 inline void G4VEmModel::SetSecondaryThreshold(G4double val) 531 { 532 secondaryThreshold = val; 533 } 534 535 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 536 537 inline void G4VEmModel::SetLPMFlag(G4bool val) 538 { 539 theLPMflag = val; 540 } 541 542 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 543 544 inline void G4VEmModel::SetDeexcitationFlag(G4bool val) 545 { 546 flagDeexcitation = val; 547 } 548 549 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 550 551 inline void G4VEmModel::ActivateNuclearStopping(G4bool val) 552 { 553 nuclearStopping = val; 554 } 555 556 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 557 558 inline 559 G4double G4VEmModel::MaxSecondaryKinEnergy(const G4DynamicParticle* dynPart) 560 { 561 return MaxSecondaryEnergy(dynPart->GetDefinition(), 562 dynPart->GetKineticEnergy()); 563 } 564 565 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 566 567 inline const G4String& G4VEmModel::GetName() const 568 { 569 return name; 570 } 571 572 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 573 574 inline void G4VEmModel::SetParticleChange(G4VParticleChange* p, 575 G4VEmFluctuationModel* f = 0) 576 { 577 if(p && pParticleChange != p) pParticleChange = p; 578 fluc = f; 579 } 580 581 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 582 583 inline void G4VEmModel::SetCurrentCouple(const G4MaterialCutsCouple* p) 584 { 585 currentCouple = p; 586 } 587 588 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 589 590 inline const G4MaterialCutsCouple* G4VEmModel::CurrentCouple() const 591 { 592 return currentCouple; 593 } 594 595 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 596 597 inline void G4VEmModel::SetCurrentElement(const G4Element* elm) 598 { 599 currentElement = elm; 600 } 601 602 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 603 355 604 inline const G4Element* G4VEmModel::GetCurrentElement() const 356 605 { … … 360 609 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 361 610 362 inline void G4VEmModel::SetCurrentElement(const G4Element* elm)363 {364 currentElement = elm;365 }366 367 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......368 369 inline G4double G4VEmModel::MaxSecondaryKinEnergy(370 const G4DynamicParticle* dynParticle)371 {372 return MaxSecondaryEnergy(dynParticle->GetDefinition(),373 dynParticle->GetKineticEnergy());374 }375 376 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......377 378 inline G4double G4VEmModel::MaxSecondaryEnergy(const G4ParticleDefinition*,379 G4double kineticEnergy)380 {381 return kineticEnergy;382 }383 384 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......385 386 inline const G4String& G4VEmModel::GetName() const387 {388 return name;389 }390 391 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......392 // Methods for msc simulation393 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......394 395 inline void G4VEmModel::SampleScattering(const G4DynamicParticle*, G4double)396 {}397 398 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......399 400 inline G4double G4VEmModel::ComputeTruePathLengthLimit(401 const G4Track&,402 G4PhysicsTable*,403 G4double)404 {405 return DBL_MAX;406 }407 408 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......409 410 inline G4double G4VEmModel::ComputeGeomPathLength(G4double truePathLength)411 {412 return truePathLength;413 }414 415 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......416 417 inline G4double G4VEmModel::ComputeTrueStepLength(G4double geomPathLength)418 {419 return geomPathLength;420 }421 422 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......423 424 inline void G4VEmModel::DefineForRegion(const G4Region*)425 {}426 427 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......428 429 611 #endif 430 612 -
trunk/source/processes/electromagnetic/utils/include/G4VEmProcess.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VEmProcess.hh,v 1. 43 2007/10/29 08:38:58vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4VEmProcess.hh,v 1.50 2009/02/19 09:57:36 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 55 55 // PostStepGetPhysicalInteractionLength (V.Ivanchenko) 56 56 // 27-10-07 Virtual functions moved to source (V.Ivanchenko) 57 // 15-07-08 Reorder class members for further multi-thread development (VI) 57 58 // 58 59 // Class Description: … … 90 91 91 92 G4VEmProcess(const G4String& name, 92 G4ProcessType type = fElectromagnetic);93 G4ProcessType type = fElectromagnetic); 93 94 94 95 virtual ~G4VEmProcess(); … … 107 108 108 109 //------------------------------------------------------------------------ 109 // Methods with standard implementation; may be overwritten if needed 110 //------------------------------------------------------------------------ 111 112 inline G4double RecalculateLambda(G4double kinEnergy, 113 const G4MaterialCutsCouple* couple); 114 115 //------------------------------------------------------------------------ 116 // Generic methods common to all Discrete processes 110 // Implementation of virtual methods common to all Discrete processes 117 111 //------------------------------------------------------------------------ 118 112 119 113 public: 120 114 115 // Initialise for build of tables 116 void PreparePhysicsTable(const G4ParticleDefinition&); 117 118 // Build physics table during initialisation 119 void BuildPhysicsTable(const G4ParticleDefinition&); 120 121 121 void PrintInfoDefinition(); 122 122 123 G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&); 124 125 void PreparePhysicsTable(const G4ParticleDefinition&); 126 // Initialise for build of tables 127 128 void BuildPhysicsTable(const G4ParticleDefinition&); 129 // Build physics table during initialisation 130 131 G4bool StorePhysicsTable(const G4ParticleDefinition*, 132 const G4String& directory, 133 G4bool ascii = false); 134 // Store PhysicsTable in a file. 135 // Return false in case of failure at I/O 136 137 G4bool RetrievePhysicsTable(const G4ParticleDefinition*, 138 const G4String& directory, 139 G4bool ascii); 140 // Retrieve Physics from a file. 141 // (return true if the Physics Table can be build by using file) 142 // (return false if the process has no functionality or in case of failure) 143 // File name should is constructed as processName+particleName and the 144 // should be placed under the directory specifed by the argument. 145 146 //------------------------------------------------------------------------ 147 // Specific methods for Discrete EM post step simulation 148 //------------------------------------------------------------------------ 149 150 inline G4double MicroscopicCrossSection(G4double kineticEnergy, 151 const G4MaterialCutsCouple* couple); 152 // It returns the cross section of the process for energy/ material 153 154 inline G4double ComputeCrossSectionPerAtom(G4double kineticEnergy, 155 G4double Z, G4double A=0., 156 G4double cut=0.0); 157 // It returns the cross section of the process per atom 158 159 inline G4double MeanFreePath(const G4Track& track); 160 161 virtual G4double PostStepGetPhysicalInteractionLength( 123 // implementation of virtual method, specific for G4VEmProcess 124 G4double PostStepGetPhysicalInteractionLength( 162 125 const G4Track& track, 163 126 G4double previousStepSize, … … 165 128 ); 166 129 130 // implementation of virtual method, specific for G4VEmProcess 131 G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&); 132 133 // Store PhysicsTable in a file. 134 // Return false in case of failure at I/O 135 G4bool StorePhysicsTable(const G4ParticleDefinition*, 136 const G4String& directory, 137 G4bool ascii = false); 138 139 // Retrieve Physics from a file. 140 // (return true if the Physics Table can be build by using file) 141 // (return false if the process has no functionality or in case of failure) 142 // File name should is constructed as processName+particleName and the 143 // should be placed under the directory specifed by the argument. 144 G4bool RetrievePhysicsTable(const G4ParticleDefinition*, 145 const G4String& directory, 146 G4bool ascii); 147 148 // deexcitation activated per G4Region 149 void ActivateDeexcitation(G4bool, const G4Region* r = 0); 150 151 //------------------------------------------------------------------------ 152 // Specific methods for Discrete EM post step simulation 153 //------------------------------------------------------------------------ 154 155 // It returns the cross section per volume for energy/ material 156 G4double CrossSectionPerVolume(G4double kineticEnergy, 157 const G4MaterialCutsCouple* couple); 158 159 // It returns the cross section of the process per atom 160 inline G4double ComputeCrossSectionPerAtom(G4double kineticEnergy, 161 G4double Z, G4double A=0., 162 G4double cut=0.0); 163 164 inline G4double MeanFreePath(const G4Track& track); 165 166 // It returns cross section per volume 167 inline G4double GetLambda(G4double& kinEnergy, 168 const G4MaterialCutsCouple* couple); 169 170 //------------------------------------------------------------------------ 171 // Specific methods to build and access Physics Tables 172 //------------------------------------------------------------------------ 173 174 // Binning for lambda table 175 inline void SetLambdaBinning(G4int nbins); 176 inline G4int LambdaBinning() const; 177 178 // Min kinetic energy for tables 179 inline void SetMinKinEnergy(G4double e); 180 inline G4double MinKinEnergy() const; 181 182 // Max kinetic energy for tables 183 inline void SetMaxKinEnergy(G4double e); 184 inline G4double MaxKinEnergy() const; 185 186 inline void SetPolarAngleLimit(G4double a); 187 inline G4double PolarAngleLimit() const; 188 189 inline const G4PhysicsTable* LambdaTable() const; 190 191 //------------------------------------------------------------------------ 192 // Define and access particle type 193 //------------------------------------------------------------------------ 194 195 inline const G4ParticleDefinition* Particle() const; 196 inline const G4ParticleDefinition* SecondaryParticle() const; 197 198 //------------------------------------------------------------------------ 199 // Specific methods to set, access, modify models and basic parameters 200 //------------------------------------------------------------------------ 201 202 protected: 203 // Select model in run time 204 inline void SelectModel(G4double& kinEnergy); 205 206 public: 207 // Select model by energy and region index 167 208 inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, 168 209 size_t& idxRegion) const; 169 170 inline G4double GetLambda(G4double& kinEnergy, 171 const G4MaterialCutsCouple* couple); 172 // It returns the Lambda of the process 173 174 //------------------------------------------------------------------------ 175 // Specific methods to build and access Physics Tables 176 //------------------------------------------------------------------------ 177 178 inline void SetLambdaBinning(G4int nbins); 179 inline G4int LambdaBinning() const; 180 // Binning for lambda table 181 182 inline void SetMinKinEnergy(G4double e); 183 inline G4double MinKinEnergy() const; 184 // Min kinetic energy for tables 185 186 inline void SetMaxKinEnergy(G4double e); 187 inline G4double MaxKinEnergy() const; 188 // Max kinetic energy for tables 189 190 inline const G4PhysicsTable* LambdaTable() const; 191 192 //------------------------------------------------------------------------ 193 // Define and access particle type 194 //------------------------------------------------------------------------ 195 196 inline const G4ParticleDefinition* Particle() const; 197 inline const G4ParticleDefinition* SecondaryParticle() const; 198 199 //------------------------------------------------------------------------ 200 // Specific methods to set, access, modify models 201 //------------------------------------------------------------------------ 202 210 211 // Add model for region, smaller value of order defines which 212 // model will be selected for a given energy interval 203 213 inline void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0); 204 // Add EM model coupled for the region 205 206 inline void SetModel(G4VEmModel*); 214 207 215 // Assign a model to a process 216 inline void SetModel(G4VEmModel*, G4int index = 1); 208 217 209 inline G4VEmModel* Model();210 218 // return the assigned model 219 inline G4VEmModel* Model(G4int index = 1); 211 220 221 // Define new energy range for the model identified by the name 212 222 inline void UpdateEmModel(const G4String&, G4double, G4double); 213 // Define new energy range for the model identified by the name214 223 215 224 // Access to models 216 inline G4VEmModel* GetModelByIndex(G4int idx = 0); 217 218 //------------------------------------------------------------------------ 219 // Get/set parameters used for simulation of energy loss 220 //------------------------------------------------------------------------ 221 222 inline void ActivateDeexcitation(G4bool, const G4Region* r = 0); 225 inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false); 223 226 224 227 inline void SetLambdaFactor(G4double val); … … 228 231 229 232 inline void SetApplyCuts(G4bool val); 233 234 //------------------------------------------------------------------------ 235 // Other generic methods 236 //------------------------------------------------------------------------ 230 237 231 238 protected: … … 237 244 G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*); 238 245 246 inline G4double RecalculateLambda(G4double kinEnergy, 247 const G4MaterialCutsCouple* couple); 248 249 inline G4ParticleChangeForGamma* GetParticleChange(); 250 239 251 inline void SetParticle(const G4ParticleDefinition* p); 240 252 241 253 inline void SetSecondaryParticle(const G4ParticleDefinition* p); 242 254 243 inline G4VEmModel* SelectModel(G4double& kinEnergy);244 245 255 inline size_t CurrentMaterialCutsCoupleIndex() const; 246 256 … … 273 283 inline G4double ComputeCurrentLambda(G4double kinEnergy); 274 284 275 // hide assignment operator 276 285 // copy constructor and hide assignment operator 277 286 G4VEmProcess(G4VEmProcess &); 278 287 G4VEmProcess & operator=(const G4VEmProcess &right); 279 288 280 // ===================================================================== 281 282 protected: 283 284 G4ParticleChangeForGamma fParticleChange; 285 286 private: 287 288 std::vector<G4DynamicParticle*> secParticles; 289 // ======== Parameters of the class fixed at construction ========= 289 290 290 291 G4EmModelManager* modelManager; 291 G4VEmModel* selectedModel; 292 const G4ParticleDefinition* theGamma; 293 const G4ParticleDefinition* theElectron; 294 const G4ParticleDefinition* thePositron; 295 const G4ParticleDefinition* secondaryParticle; 296 297 G4bool buildLambdaTable; 298 299 // ======== Parameters of the class fixed at initialisation ======= 300 301 std::vector<G4VEmModel*> emModels; 292 302 293 303 // tables and vectors … … 296 306 G4double* theCrossSectionMax; 297 307 298 const G4ParticleDefinition* particle;299 const G4ParticleDefinition* secondaryParticle;300 const G4ParticleDefinition* theGamma;301 const G4ParticleDefinition* theElectron;302 const G4ParticleDefinition* thePositron;303 304 308 const std::vector<G4double>* theCuts; 305 309 const std::vector<G4double>* theCutsGamma; … … 312 316 G4double maxKinEnergy; 313 317 G4double lambdaFactor; 318 G4double polarAngleLimit; 319 320 G4bool integral; 321 G4bool applyCuts; 322 G4bool startFromNull; 323 G4bool useDeexcitation; 324 325 G4int nDERegions; 326 std::vector<const G4Region*> deRegions; 327 G4bool* idxDERegions; 328 329 // ======== Cashed values - may be state dependent ================ 330 331 protected: 332 333 G4ParticleChangeForGamma fParticleChange; 334 335 private: 336 337 std::vector<G4DynamicParticle*> secParticles; 338 339 G4VEmModel* currentModel; 340 341 const G4ParticleDefinition* particle; 314 342 315 343 // cash … … 322 350 G4double preStepLambda; 323 351 324 G4bool integral;325 G4bool buildLambdaTable;326 G4bool applyCuts;327 G4bool startFromNull;328 329 G4int nRegions;330 std::vector<G4Region*> regions;331 std::vector<G4bool> flagsDeexcitation;332 333 352 }; 334 353 335 354 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 355 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 356 357 inline G4double G4VEmProcess::ComputeCrossSectionPerAtom( 358 G4double kineticEnergy, G4double Z, G4double A, G4double cut) 359 { 360 SelectModel(kineticEnergy); 361 G4double x = 0.0; 362 if(currentModel) { 363 x = currentModel->ComputeCrossSectionPerAtom(particle,kineticEnergy, 364 Z,A,cut); 365 } 366 return x; 367 } 368 369 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 370 371 inline G4double G4VEmProcess::MeanFreePath(const G4Track& track) 372 { 373 DefineMaterial(track.GetMaterialCutsCouple()); 374 preStepLambda = GetCurrentLambda(track.GetKineticEnergy()); 375 G4double x = DBL_MAX; 376 if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda; 377 return x; 378 } 379 380 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 381 382 inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy, 383 const G4MaterialCutsCouple* couple) 384 { 385 DefineMaterial(couple); 386 return GetCurrentLambda(kineticEnergy); 387 } 388 389 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 390 391 inline void G4VEmProcess::SetLambdaBinning(G4int nbins) 392 { 393 nLambdaBins = nbins; 394 } 395 396 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 397 398 inline G4int G4VEmProcess::LambdaBinning() const 399 { 400 return nLambdaBins; 401 } 402 403 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 404 405 inline void G4VEmProcess::SetMinKinEnergy(G4double e) 406 { 407 minKinEnergy = e; 408 } 409 410 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 411 412 inline G4double G4VEmProcess::MinKinEnergy() const 413 { 414 return minKinEnergy; 415 } 416 417 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 418 419 inline void G4VEmProcess::SetMaxKinEnergy(G4double e) 420 { 421 maxKinEnergy = e; 422 } 423 424 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 425 426 inline G4double G4VEmProcess::MaxKinEnergy() const 427 { 428 return maxKinEnergy; 429 } 430 431 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 432 433 inline void G4VEmProcess::SetPolarAngleLimit(G4double val) 434 { 435 if(val < 0.0) polarAngleLimit = 0.0; 436 else if(val > pi) polarAngleLimit = pi; 437 else polarAngleLimit = val; 438 } 439 440 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 441 442 inline G4double G4VEmProcess::PolarAngleLimit() const 443 { 444 return polarAngleLimit; 445 } 446 447 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 448 449 inline const G4PhysicsTable* G4VEmProcess::LambdaTable() const 450 { 451 return theLambdaTable; 452 } 453 454 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 455 456 inline const G4ParticleDefinition* G4VEmProcess::Particle() const 457 { 458 return particle; 459 } 460 461 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 462 463 inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const 464 { 465 return secondaryParticle; 466 } 467 468 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 469 470 inline void G4VEmProcess::SelectModel(G4double& kinEnergy) 471 { 472 currentModel = modelManager->SelectModel(kinEnergy, currentMaterialIndex); 473 currentModel->SetCurrentCouple(currentCouple); 474 } 475 476 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 477 478 inline G4VEmModel* G4VEmProcess::SelectModelForMaterial( 479 G4double kinEnergy, size_t& idxRegion) const 480 { 481 return modelManager->SelectModel(kinEnergy, idxRegion); 482 } 483 484 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 485 486 inline void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p, 487 const G4Region* region) 488 { 489 G4VEmFluctuationModel* fm = 0; 490 modelManager->AddEmModel(order, p, fm, region); 491 if(p) p->SetParticleChange(pParticleChange); 492 } 493 494 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 495 496 inline void G4VEmProcess::SetModel(G4VEmModel* p, G4int index) 497 { 498 G4int n = emModels.size(); 499 if(index >= n) for(G4int i=n; i<index+1; i++) {emModels.push_back(0);} 500 emModels[index] = p; 501 } 502 503 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 504 505 inline G4VEmModel* G4VEmProcess::Model(G4int index) 506 { 507 G4VEmModel* p = 0; 508 if(index >= 0 && index < G4int(emModels.size())) p = emModels[index]; 509 return p; 510 } 511 512 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 513 514 inline void G4VEmProcess::UpdateEmModel(const G4String& nam, 515 G4double emin, G4double emax) 516 { 517 modelManager->UpdateEmModel(nam, emin, emax); 518 } 519 520 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 521 522 inline G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx, G4bool ver) 523 { 524 return modelManager->GetModel(idx, ver); 525 } 526 527 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 528 529 inline void G4VEmProcess::SetLambdaFactor(G4double val) 530 { 531 if(val > 0.0 && val <= 1.0) lambdaFactor = val; 532 } 533 534 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 535 536 inline void G4VEmProcess::SetIntegral(G4bool val) 537 { 538 if(particle && particle != theGamma) integral = val; 539 if(integral) buildLambdaTable = true; 540 } 541 542 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 543 544 inline G4bool G4VEmProcess::IsIntegral() const 545 { 546 return integral; 547 } 548 549 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 550 551 inline void G4VEmProcess::SetApplyCuts(G4bool val) 552 { 553 applyCuts = val; 554 } 555 556 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 557 558 inline G4double G4VEmProcess::RecalculateLambda(G4double e, 559 const G4MaterialCutsCouple* couple) 560 { 561 DefineMaterial(couple); 562 return ComputeCurrentLambda(e); 563 } 564 565 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 566 567 inline G4ParticleChangeForGamma* G4VEmProcess::GetParticleChange() 568 { 569 return &fParticleChange; 570 } 571 572 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 573 574 inline void G4VEmProcess::SetParticle(const G4ParticleDefinition* p) 575 { 576 particle = p; 577 } 578 579 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 580 581 inline void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p) 582 { 583 secondaryParticle = p; 584 } 585 586 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 587 588 inline size_t G4VEmProcess::CurrentMaterialCutsCoupleIndex() const 589 { 590 return currentMaterialIndex; 591 } 592 593 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 594 595 inline G4double G4VEmProcess::GetGammaEnergyCut() 596 { 597 return (*theCutsGamma)[currentMaterialIndex]; 598 } 599 600 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 601 602 inline G4double G4VEmProcess::GetElectronEnergyCut() 603 { 604 return (*theCutsElectron)[currentMaterialIndex]; 605 } 606 607 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 608 609 inline void G4VEmProcess::SetBuildTableFlag(G4bool val) 610 { 611 buildLambdaTable = val; 612 if(!val) integral = false; 613 } 614 615 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 616 617 inline void G4VEmProcess::SetStartFromNullFlag(G4bool val) 618 { 619 startFromNull = val; 620 } 621 622 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 623 624 inline void G4VEmProcess::InitialiseStep(const G4Track& track) 625 { 626 preStepKinEnergy = track.GetKineticEnergy(); 627 DefineMaterial(track.GetMaterialCutsCouple()); 628 if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX; 629 } 630 336 631 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 337 632 … … 344 639 mfpKinEnergy = DBL_MAX; 345 640 } 346 }347 348 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....349 350 inline void G4VEmProcess::InitialiseStep(const G4Track& track)351 {352 preStepKinEnergy = track.GetKineticEnergy();353 DefineMaterial(track.GetMaterialCutsCouple());354 if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX;355 }356 357 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....358 359 inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy,360 const G4MaterialCutsCouple* couple)361 {362 DefineMaterial(couple);363 return GetCurrentLambda(kineticEnergy);364 }365 366 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....367 368 inline G4double G4VEmProcess::GetCurrentLambda(G4double e)369 {370 G4double x = 0.0;371 if(theLambdaTable) x = GetLambdaFromTable(e);372 else x = ComputeCurrentLambda(e);373 return x;374 }375 376 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....377 378 inline G4double G4VEmProcess::RecalculateLambda(G4double e,379 const G4MaterialCutsCouple* couple)380 {381 DefineMaterial(couple);382 return ComputeCurrentLambda(e);383 }384 385 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....386 387 inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)388 {389 G4VEmModel* currentModel = SelectModel(e);390 G4double x = 0.0;391 if(currentModel)392 x = currentModel->CrossSectionPerVolume(currentMaterial,particle,393 e,(*theCuts)[currentMaterialIndex]);394 return x;395 }396 397 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....398 399 inline G4double G4VEmProcess::GetLambdaFromTable(G4double e)400 {401 G4bool b;402 return (((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b));403 641 } 404 642 … … 428 666 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 429 667 430 inline G4double G4VEmProcess::MeanFreePath(const G4Track& track) 431 { 432 DefineMaterial(track.GetMaterialCutsCouple()); 433 preStepLambda = GetCurrentLambda(track.GetKineticEnergy()); 434 G4double x = DBL_MAX; 435 if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda; 668 inline G4double G4VEmProcess::GetLambdaFromTable(G4double e) 669 { 670 G4bool b; 671 return (((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b)); 672 } 673 674 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 675 676 inline G4double G4VEmProcess::GetCurrentLambda(G4double e) 677 { 678 G4double x = 0.0; 679 if(theLambdaTable) x = GetLambdaFromTable(e); 680 else x = ComputeCurrentLambda(e); 436 681 return x; 437 682 } … … 439 684 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 440 685 441 inline G4VEmModel* G4VEmProcess::SelectModel(G4double& kinEnergy) 442 { 443 return modelManager->SelectModel(kinEnergy, currentMaterialIndex); 444 } 445 446 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 447 448 inline G4VEmModel* G4VEmProcess::SelectModelForMaterial( 449 G4double kinEnergy, size_t& idxRegion) const 450 { 451 return modelManager->SelectModel(kinEnergy, idxRegion); 452 } 453 454 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 455 456 inline const G4ParticleDefinition* G4VEmProcess::Particle() const 457 { 458 return particle; 459 } 460 461 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 462 463 inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const 464 { 465 return secondaryParticle; 466 } 467 468 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 469 470 inline G4double G4VEmProcess::GetGammaEnergyCut() 471 { 472 return (*theCutsGamma)[currentMaterialIndex]; 473 } 474 475 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 476 477 inline G4double G4VEmProcess::GetElectronEnergyCut() 478 { 479 return (*theCutsElectron)[currentMaterialIndex]; 480 } 481 482 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 483 484 inline void G4VEmProcess::SetLambdaFactor(G4double val) 485 { 486 if(val > 0.0 && val <= 1.0) lambdaFactor = val; 487 } 488 489 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 490 491 inline G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx) 492 { 493 return modelManager->GetModel(idx); 494 } 495 496 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 497 498 inline void G4VEmProcess::SetParticle(const G4ParticleDefinition* p) 499 { 500 particle = p; 501 } 502 503 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 504 505 inline void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p) 506 { 507 secondaryParticle = p; 508 } 509 510 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 511 512 inline void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p, 513 const G4Region* region) 514 { 515 G4VEmFluctuationModel* fm = 0; 516 modelManager->AddEmModel(order, p, fm, region); 517 if(p) p->SetParticleChange(pParticleChange); 518 } 519 520 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 521 522 inline void G4VEmProcess::SetModel(G4VEmModel* model) 523 { 524 selectedModel = model; 525 } 526 527 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 528 529 inline G4VEmModel* G4VEmProcess::Model() 530 { 531 return selectedModel; 532 } 533 534 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 535 536 inline void G4VEmProcess::UpdateEmModel(const G4String& nam, 537 G4double emin, G4double emax) 538 { 539 modelManager->UpdateEmModel(nam, emin, emax); 540 } 541 542 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 543 544 inline G4double G4VEmProcess::ComputeCrossSectionPerAtom( 545 G4double kineticEnergy, G4double Z, G4double A, G4double cut) 546 { 547 G4VEmModel* model = SelectModel(kineticEnergy); 548 return model->ComputeCrossSectionPerAtom(particle,kineticEnergy,Z,A,cut); 549 } 550 551 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 552 553 inline void G4VEmProcess::SetLambdaBinning(G4int nbins) 554 { 555 nLambdaBins = nbins; 556 } 557 558 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 559 560 inline G4int G4VEmProcess::LambdaBinning() const 561 { 562 return nLambdaBins; 563 } 564 565 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 566 567 inline void G4VEmProcess::SetMinKinEnergy(G4double e) 568 { 569 minKinEnergy = e; 570 } 571 572 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 573 574 inline G4double G4VEmProcess::MinKinEnergy() const 575 { 576 return minKinEnergy; 577 } 578 579 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 580 581 inline void G4VEmProcess::SetMaxKinEnergy(G4double e) 582 { 583 maxKinEnergy = e; 584 } 585 586 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 587 588 inline G4double G4VEmProcess::MaxKinEnergy() const 589 { 590 return maxKinEnergy; 591 } 592 593 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 594 595 inline void G4VEmProcess::ActivateDeexcitation(G4bool, const G4Region*) 596 {} 597 598 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 599 600 inline const G4PhysicsTable* G4VEmProcess::LambdaTable() const 601 { 602 return theLambdaTable; 603 } 604 605 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 606 607 inline void G4VEmProcess::SetIntegral(G4bool val) 608 { 609 if(particle && particle != theGamma) integral = val; 610 if(integral) buildLambdaTable = true; 611 } 612 613 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 614 615 inline G4bool G4VEmProcess::IsIntegral() const 616 { 617 return integral; 618 } 619 620 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 621 622 inline void G4VEmProcess::SetBuildTableFlag(G4bool val) 623 { 624 buildLambdaTable = val; 625 if(!val) integral = false; 626 } 627 628 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 629 630 inline void G4VEmProcess::SetStartFromNullFlag(G4bool val) 631 { 632 startFromNull = val; 633 } 634 635 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 636 637 inline void G4VEmProcess::SetApplyCuts(G4bool val) 638 { 639 applyCuts = val; 640 } 641 642 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 643 644 inline size_t G4VEmProcess::CurrentMaterialCutsCoupleIndex() const 645 { 646 return currentMaterialIndex; 686 inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e) 687 { 688 SelectModel(e); 689 G4double x = 0.0; 690 if(currentModel) { 691 x = currentModel->CrossSectionPerVolume(currentMaterial,particle, 692 e,(*theCuts)[currentMaterialIndex]); 693 } 694 return x; 647 695 } 648 696 -
trunk/source/processes/electromagnetic/utils/include/G4VEnergyLoss.hh
r819 r961 26 26 // 27 27 // $Id: G4VEnergyLoss.hh,v 1.18 2006/06/29 19:54:47 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // -
trunk/source/processes/electromagnetic/utils/include/G4VEnergyLossProcess.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VEnergyLossProcess.hh,v 1. 76 2007/11/07 18:38:49vnivanch Exp $26 // $Id: G4VEnergyLossProcess.hh,v 1.86 2009/02/19 09:57:36 vnivanch Exp $ 27 27 // GEANT4 tag $Name: 28 28 // … … 79 79 // PostStepGetPhysicalInteractionLength (V.Ivanchenko) 80 80 // 27-10-07 Virtual functions moved to source (V.Ivanchenko) 81 // 15-07-08 Reorder class members for further multi-thread development (VI) 81 82 // 82 83 // Class Description: … … 125 126 virtual ~G4VEnergyLossProcess(); 126 127 128 private: 129 // clean vectors and arrays 130 void Clean(); 131 127 132 //------------------------------------------------------------------------ 128 133 // Virtual methods to be implemented in concrete processes 129 134 //------------------------------------------------------------------------ 130 135 136 public: 131 137 virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0; 132 138 … … 141 147 // Methods with standard implementation; may be overwritten if needed 142 148 //------------------------------------------------------------------------ 143 protected:144 149 145 150 virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*, 146 151 const G4Material*, G4double cut); 147 152 148 virtual void CorrectionsAlongStep(const G4MaterialCutsCouple*, 149 const G4DynamicParticle*, 150 G4double& eloss, 151 G4double& length); 152 153 //------------------------------------------------------------------------ 154 // Generic methods common to all ContinuousDiscrete processes 155 //------------------------------------------------------------------------ 153 //------------------------------------------------------------------------ 154 // Virtual methods implementation common to all EM ContinuousDiscrete 155 // processes. Further inheritance is not assumed 156 //------------------------------------------------------------------------ 157 156 158 public: 157 159 160 // prepare all tables 161 void PreparePhysicsTable(const G4ParticleDefinition&); 162 163 // build all tables 164 void BuildPhysicsTable(const G4ParticleDefinition&); 165 166 // build a table 167 G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted); 168 169 // build a table 170 G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted); 171 172 // summary printout after initialisation 158 173 void PrintInfoDefinition(); 159 174 160 void PreparePhysicsTable(const G4ParticleDefinition&); 161 162 void BuildPhysicsTable(const G4ParticleDefinition&); 163 175 // Add subcutoff option for the region 176 void ActivateSubCutoff(G4bool val, const G4Region* region = 0); 177 178 // Activate deexcitation code for region 179 void ActivateDeexcitation(G4bool, const G4Region* region = 0); 180 181 // Step limit from AlongStep 182 G4double AlongStepGetPhysicalInteractionLength(const G4Track&, 183 G4double previousStepSize, 184 G4double currentMinimumStep, 185 G4double& currentSafety, 186 G4GPILSelection* selection); 187 188 // Step limit from cross section 189 G4double PostStepGetPhysicalInteractionLength(const G4Track& track, 190 G4double previousStepSize, 191 G4ForceCondition* condition); 192 193 // AlongStep computations 164 194 G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&); 165 195 196 // Sampling of secondaries in vicinity of geometrical boundary 197 void SampleSubCutSecondaries(std::vector<G4Track*>&, const G4Step&, 198 G4VEmModel* model, G4int matIdx, 199 G4double& extraEdep); 200 201 // PostStep sampling of secondaries 166 202 G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&); 167 203 168 // Store PhysicsTable in a file.169 // Return false in case of failure at I/O204 // Store all PhysicsTable in files. 205 // Return false in case of any fatal failure at I/O 170 206 G4bool StorePhysicsTable(const G4ParticleDefinition*, 171 207 const G4String& directory, 172 208 G4bool ascii = false); 173 209 174 // Retrieve Physics from a file. 175 // (return true if the Physics Table can be build by using file) 176 // (return false if the process has no functionality or in case of failure) 177 // File name should is constructed as processName+particleName and the 178 // should be placed under the directory specifed by the argument. 210 // Retrieve all Physics from a files. 211 // Return true if all the Physics Table are built. 212 // Return false if any fatal failure. 179 213 G4bool RetrievePhysicsTable(const G4ParticleDefinition*, 180 214 const G4String& directory, 181 215 G4bool ascii); 182 216 217 private: 218 // store a table 219 G4bool StoreTable(const G4ParticleDefinition* p, 220 G4PhysicsTable*, G4bool ascii, 221 const G4String& directory, 222 const G4String& tname); 223 224 // retrieve a table 225 G4bool RetrieveTable(const G4ParticleDefinition* p, 226 G4PhysicsTable*, G4bool ascii, 227 const G4String& directory, 228 const G4String& tname, 229 G4bool mandatory); 230 231 //------------------------------------------------------------------------ 232 // Public interface to cross section, mfp and sampling of fluctuations 233 // These methods are not used in run time 234 //------------------------------------------------------------------------ 235 236 public: 237 // access to dispersion of restricted energy loss 238 G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple, 239 const G4DynamicParticle* dp, 240 G4double length); 241 242 // Access to cross section table 243 G4double CrossSectionPerVolume(G4double kineticEnergy, 244 const G4MaterialCutsCouple* couple); 245 246 // access to cross section 247 G4double MeanFreePath(const G4Track& track); 248 249 // access to step limit 250 G4double ContinuousStepLimit(const G4Track& track, 251 G4double previousStepSize, 252 G4double currentMinimumStep, 253 G4double& currentSafety); 254 183 255 protected: 184 256 257 // implementation of the pure virtual method 185 258 G4double GetMeanFreePath(const G4Track& track, 186 259 G4double previousStepSize, 187 260 G4ForceCondition* condition); 188 261 262 // implementation of the pure virtual method 189 263 G4double GetContinuousStepLimit(const G4Track& track, 190 264 G4double previousStepSize, … … 193 267 194 268 //------------------------------------------------------------------------ 195 // Specific methods for along/post step EM processes 196 //------------------------------------------------------------------------ 269 // Run time method which may be also used by derived processes 270 //------------------------------------------------------------------------ 271 272 // creeation of an empty vector for cross section 273 G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*, 274 G4double cut); 275 276 inline G4ParticleChangeForLoss* GetParticleChange(); 277 278 inline size_t CurrentMaterialCutsCoupleIndex() const; 279 280 inline G4double GetCurrentRange() const; 281 282 //------------------------------------------------------------------------ 283 // Specific methods to set, access, modify models 284 //------------------------------------------------------------------------ 285 286 // Select model in run time 287 inline void SelectModel(G4double kinEnergy); 197 288 198 289 public: 199 290 // Select model by energy and region index 291 inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, 292 size_t& idx) const; 293 294 // Add EM model coupled with fluctuation model for region, smaller value 295 // of order defines which pair of models will be selected for a given 296 // energy interval 297 inline void AddEmModel(G4int, G4VEmModel*, 298 G4VEmFluctuationModel* fluc = 0, 299 const G4Region* region = 0); 300 301 // Define new energy range for the model identified by the name 302 inline void UpdateEmModel(const G4String&, G4double, G4double); 303 304 // Assign a model to a process 305 inline void SetEmModel(G4VEmModel*, G4int index=1); 306 307 // return the assigned model 308 inline G4VEmModel* EmModel(G4int index=1); 309 310 // Access to models 311 inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false); 312 313 inline G4int NumberOfModels(); 314 315 // Assign a fluctuation model to a process 316 inline void SetFluctModel(G4VEmFluctuationModel*); 317 318 // return the assigned fluctuation model 319 inline G4VEmFluctuationModel* FluctModel(); 320 321 //------------------------------------------------------------------------ 322 // Define and access particle type 323 //------------------------------------------------------------------------ 324 325 protected: 326 inline void SetParticle(const G4ParticleDefinition* p); 327 inline void SetSecondaryParticle(const G4ParticleDefinition* p); 328 329 public: 330 inline void SetBaseParticle(const G4ParticleDefinition* p); 331 inline const G4ParticleDefinition* Particle() const; 332 inline const G4ParticleDefinition* BaseParticle() const; 333 inline const G4ParticleDefinition* SecondaryParticle() const; 334 335 //------------------------------------------------------------------------ 336 // Get/set parameters to configure the process at initialisation time 337 //------------------------------------------------------------------------ 338 339 // Add subcutoff process (bremsstrahlung) to sample secondary 340 // particle production in vicinity of the geometry boundary 200 341 void AddCollaborativeProcess(G4VEnergyLossProcess*); 201 342 202 void SampleSubCutSecondaries(std::vector<G4Track*>&, const G4Step&, 203 G4VEmModel* model, G4int matIdx, 204 G4double& extraEdep); 205 206 G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple, 207 const G4DynamicParticle* dp, 208 G4double length); 209 210 211 virtual G4double AlongStepGetPhysicalInteractionLength( 212 const G4Track&, 213 G4double previousStepSize, 214 G4double currentMinimumStep, 215 G4double& currentSafety, 216 G4GPILSelection* selection 217 ); 218 219 virtual G4double PostStepGetPhysicalInteractionLength( 220 const G4Track& track, 221 G4double previousStepSize, 222 G4ForceCondition* condition 223 ); 224 225 //------------------------------------------------------------------------ 226 // Specific methods to build and access Physics Tables 227 //------------------------------------------------------------------------ 228 229 G4double MicroscopicCrossSection(G4double kineticEnergy, 230 const G4MaterialCutsCouple* couple); 231 232 G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted); 233 234 G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted); 343 inline void SetLossFluctuations(G4bool val); 344 inline void SetRandomStep(G4bool val); 345 346 inline void SetIntegral(G4bool val); 347 inline G4bool IsIntegral() const; 348 349 // Set/Get flag "isIonisation" 350 inline void SetIonisation(G4bool val); 351 inline G4bool IsIonisationProcess() const; 352 353 // Redefine parameteters for stepping control 354 // 355 inline void SetLinearLossLimit(G4double val); 356 inline void SetMinSubRange(G4double val); 357 inline void SetLambdaFactor(G4double val); 358 inline void SetStepFunction(G4double v1, G4double v2); 359 360 inline G4int NumberOfSubCutoffRegions() const; 361 inline G4int NumberOfDERegions() const; 362 363 //------------------------------------------------------------------------ 364 // Specific methods to path Physics Tables to the process 365 //------------------------------------------------------------------------ 235 366 236 367 void SetDEDXTable(G4PhysicsTable* p, G4EmTableType tType); 237 368 void SetCSDARangeTable(G4PhysicsTable* pRange); 238 369 void SetRangeTableForLoss(G4PhysicsTable* p); 370 void SetSecondaryRangeTable(G4PhysicsTable* p); 239 371 void SetInverseRangeTable(G4PhysicsTable* p); 240 void SetSecondaryRangeTable(G4PhysicsTable* p);241 372 242 373 void SetLambdaTable(G4PhysicsTable* p); … … 260 391 // Max kinetic energy for tables 261 392 inline void SetMaxKinEnergyForCSDARange(G4double e); 393 394 // Return values for given G4MaterialCutsCouple 395 inline G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple*); 396 inline G4double GetDEDXForSubsec(G4double& kineticEnergy, 397 const G4MaterialCutsCouple*); 398 inline G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple*); 399 inline G4double GetCSDARange(G4double& kineticEnergy, const G4MaterialCutsCouple*); 400 inline G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple*); 401 inline G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple*); 402 inline G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple*); 403 404 inline G4bool TablesAreBuilt() const; 262 405 263 406 // Access to specific tables … … 273 416 inline G4PhysicsTable* SubLambdaTable(); 274 417 275 // Return values for given G4MaterialCutsCouple276 inline G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple*);277 inline G4double GetDEDXForSubsec(G4double& kineticEnergy,278 const G4MaterialCutsCouple*);279 inline G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple*);280 inline G4double GetCSDARange(G4double& kineticEnergy, const G4MaterialCutsCouple*);281 inline G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple*);282 inline G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple*);283 inline G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple*);284 285 inline G4bool TablesAreBuilt() const;286 287 //------------------------------------------------------------------------288 // Define and access particle type289 //------------------------------------------------------------------------290 291 inline void SetBaseParticle(const G4ParticleDefinition* p);292 inline const G4ParticleDefinition* Particle() const;293 inline const G4ParticleDefinition* BaseParticle() const;294 inline const G4ParticleDefinition* SecondaryParticle() const;295 296 //------------------------------------------------------------------------297 // Specific methods to set, access, modify models298 //------------------------------------------------------------------------299 300 // Add EM model coupled with fluctuation model for the region301 inline void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel* fluc = 0,302 const G4Region* region = 0);303 304 // Assign a model to a process305 inline void SetEmModel(G4VEmModel*, G4int index=1);306 307 // return the assigned model308 inline G4VEmModel* EmModel(G4int index=1);309 310 // Assign a fluctuation model to a process311 inline void SetFluctModel(G4VEmFluctuationModel*);312 313 // return the assigned fluctuation model314 inline G4VEmFluctuationModel* FluctModel();315 316 // Define new energy range for the model identified by the name317 inline void UpdateEmModel(const G4String&, G4double, G4double);318 319 // Access to models320 inline G4VEmModel* GetModelByIndex(G4int idx = 0);321 322 inline G4int NumberOfModels();323 324 //------------------------------------------------------------------------325 // Get/set parameters used for simulation of energy loss326 //------------------------------------------------------------------------327 328 inline void SetLossFluctuations(G4bool val);329 inline void SetRandomStep(G4bool val);330 inline void SetIntegral(G4bool val);331 inline G4bool IsIntegral() const;332 333 // Set/Get flag "isIonisation"334 inline void SetIonisation(G4bool val);335 inline G4bool IsIonisationProcess() const;336 337 // Redefine parameteters for stepping control338 //339 inline void SetLinearLossLimit(G4double val);340 inline void SetMinSubRange(G4double val);341 inline void SetStepFunction(G4double v1, G4double v2);342 inline void SetLambdaFactor(G4double val);343 344 345 // Add subcutoff option for the region346 void ActivateSubCutoff(G4bool val, const G4Region* region = 0);347 348 inline G4int NumberOfSubCutoffRegions() const;349 350 // Activate deexcitation code351 virtual void ActivateDeexcitation(G4bool, const G4Region* region = 0);352 353 418 //------------------------------------------------------------------------ 354 419 // Run time method for simulation of ionisation 355 420 //------------------------------------------------------------------------ 356 421 422 // sample range at the end of a step 357 423 inline G4double SampleRange(); 358 424 359 inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idx) const; 360 361 362 // Set scaling parameters 425 // Set scaling parameters for ions is needed to G4EmCalculator 363 426 inline void SetDynamicMassCharge(G4double massratio, G4double charge2ratio); 364 427 365 // Helper functions366 inline G4double MeanFreePath(const G4Track& track);367 368 inline G4double ContinuousStepLimit(const G4Track& track,369 G4double previousStepSize,370 G4double currentMinimumStep,371 G4double& currentSafety);372 373 protected:374 375 G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*,376 G4double cut);377 378 inline virtual void InitialiseMassCharge(const G4Track&);379 380 inline void SetParticle(const G4ParticleDefinition* p);381 382 inline void SetSecondaryParticle(const G4ParticleDefinition* p);383 384 inline G4VEmModel* SelectModel(G4double kinEnergy);385 386 inline size_t CurrentMaterialCutsCoupleIndex() const;387 388 inline G4double GetCurrentRange() const;389 390 428 private: 391 429 392 // Clear tables 393 void Clear(); 394 395 inline void InitialiseStep(const G4Track&); 396 430 // define material and indexes 397 431 inline void DefineMaterial(const G4MaterialCutsCouple* couple); 398 432 399 // Returnd values for scaled energy and base particles mass 400 // 433 //------------------------------------------------------------------------ 434 // Compute values using scaling relation, mass and charge of based particle 435 //------------------------------------------------------------------------ 436 401 437 inline G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy); 402 438 inline G4double GetSubDEDXForScaledEnergy(G4double scaledKinEnergy); … … 405 441 inline G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy); 406 442 inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy); 443 inline G4double ScaledKinEnergyForLoss(G4double range); 407 444 inline G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy); 408 inline G4double ScaledKinEnergyForLoss(G4double range);409 445 inline void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy); 410 446 411 447 // hide assignment operator 412 413 448 G4VEnergyLossProcess(G4VEnergyLossProcess &); 414 449 G4VEnergyLossProcess & operator=(const G4VEnergyLossProcess &right); 415 450 416 // ===================================================================== 417 418 protected: 419 420 G4ParticleChangeForLoss fParticleChange; 421 422 private: 423 424 G4EmModelManager* modelManager; 451 // ======== Parameters of the class fixed at construction ========= 452 453 G4EmModelManager* modelManager; 454 G4SafetyHelper* safetyHelper; 455 456 const G4ParticleDefinition* secondaryParticle; 457 const G4ParticleDefinition* theElectron; 458 const G4ParticleDefinition* thePositron; 459 const G4ParticleDefinition* theGenericIon; 460 461 G4PhysicsVector* vstrag; 462 463 // ======== Parameters of the class fixed at initialisation ======= 464 425 465 std::vector<G4VEmModel*> emModels; 426 466 G4VEmFluctuationModel* fluctModel; 427 467 std::vector<const G4Region*> scoffRegions; 468 std::vector<const G4Region*> deRegions; 428 469 G4int nSCoffRegions; 429 G4int* idxSCoffRegions; 430 std::vector<G4DynamicParticle*> secParticles; 431 std::vector<G4Track*> scTracks; 470 G4int nDERegions; 471 G4bool* idxSCoffRegions; 472 G4bool* idxDERegions; 473 432 474 std::vector<G4VEnergyLossProcess*> scProcesses; 433 475 G4int nProcesses; … … 453 495 const G4DataVector* theSubCuts; 454 496 455 G4SafetyHelper* safetyHelper;456 457 const G4ParticleDefinition* particle;458 497 const G4ParticleDefinition* baseParticle; 459 const G4ParticleDefinition* secondaryParticle;460 const G4ParticleDefinition* theElectron;461 const G4ParticleDefinition* thePositron;462 463 G4PhysicsVector* vstrag;464 465 // cash466 const G4Material* currentMaterial;467 const G4MaterialCutsCouple* currentCouple;468 size_t currentMaterialIndex;469 498 470 499 G4int nBins; 471 500 G4int nBinsCSDA; 472 G4int nWarnings;473 501 474 502 G4double lowestKinEnergy; … … 477 505 G4double maxKinEnergyCSDA; 478 506 479 G4double massRatio;480 G4double reduceFactor;481 G4double chargeSquare;482 G4double chargeSqRatio;483 484 G4double preStepLambda;485 G4double fRange;486 G4double preStepKinEnergy;487 G4double preStepScaledEnergy;488 507 G4double linLossLimit; 489 508 G4double minSubRange; … … 491 510 G4double finalRange; 492 511 G4double lambdaFactor; 493 G4double mfpKinEnergy;494 495 G4GPILSelection aGPILSelection;496 512 497 513 G4bool lossFluctuationFlag; … … 499 515 G4bool tablesAreBuilt; 500 516 G4bool integral; 517 G4bool isIon; 501 518 G4bool isIonisation; 502 519 G4bool useSubCutoff; 520 G4bool useDeexcitation; 521 522 protected: 523 524 G4ParticleChangeForLoss fParticleChange; 525 526 // ======== Cashed values - may be state dependent ================ 527 528 private: 529 530 std::vector<G4DynamicParticle*> secParticles; 531 std::vector<G4Track*> scTracks; 532 533 const G4ParticleDefinition* particle; 534 535 G4VEmModel* currentModel; 536 const G4Material* currentMaterial; 537 const G4MaterialCutsCouple* currentCouple; 538 size_t currentMaterialIndex; 539 540 G4int nWarnings; 541 542 G4double massRatio; 543 G4double reduceFactor; 544 G4double chargeSqRatio; 545 546 G4double preStepLambda; 547 G4double fRange; 548 G4double preStepKinEnergy; 549 G4double preStepScaledEnergy; 550 G4double mfpKinEnergy; 551 552 G4GPILSelection aGPILSelection; 553 503 554 }; 504 555 … … 506 557 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 507 558 508 inline void G4VEnergyLossProcess::DefineMaterial( 509 const G4MaterialCutsCouple* couple) 510 { 511 if(couple != currentCouple) { 512 currentCouple = couple; 513 currentMaterial = couple->GetMaterial(); 514 currentMaterialIndex = couple->GetIndex(); 515 mfpKinEnergy = DBL_MAX; 516 } 517 } 518 519 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 520 521 inline void G4VEnergyLossProcess::InitialiseStep(const G4Track& track) 522 { 523 InitialiseMassCharge(track); 524 preStepKinEnergy = track.GetKineticEnergy(); 525 preStepScaledEnergy = preStepKinEnergy*massRatio; 526 DefineMaterial(track.GetMaterialCutsCouple()); 527 if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX; 528 } 529 530 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 531 532 inline void G4VEnergyLossProcess::InitialiseMassCharge(const G4Track&) 533 {} 559 inline G4ParticleChangeForLoss* G4VEnergyLossProcess::GetParticleChange() 560 { 561 return &fParticleChange; 562 } 563 564 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 565 566 inline size_t G4VEnergyLossProcess::CurrentMaterialCutsCoupleIndex() const 567 { 568 return currentMaterialIndex; 569 } 570 571 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 572 573 inline G4double G4VEnergyLossProcess::GetCurrentRange() const 574 { 575 return fRange; 576 } 577 578 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 579 580 inline void G4VEnergyLossProcess::SelectModel(G4double kinEnergy) 581 { 582 currentModel = modelManager->SelectModel(kinEnergy, currentMaterialIndex); 583 currentModel->SetCurrentCouple(currentCouple); 584 } 585 586 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 587 588 inline G4VEmModel* G4VEnergyLossProcess::SelectModelForMaterial( 589 G4double kinEnergy, size_t& idx) const 590 { 591 return modelManager->SelectModel(kinEnergy, idx); 592 } 593 594 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 595 596 inline 597 void G4VEnergyLossProcess::AddEmModel(G4int order, G4VEmModel* p, 598 G4VEmFluctuationModel* fluc, 599 const G4Region* region) 600 { 601 modelManager->AddEmModel(order, p, fluc, region); 602 if(p) p->SetParticleChange(pParticleChange, fluc); 603 } 604 605 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 606 607 inline void G4VEnergyLossProcess::UpdateEmModel(const G4String& nam, 608 G4double emin, G4double emax) 609 { 610 modelManager->UpdateEmModel(nam, emin, emax); 611 } 612 613 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 614 615 inline void G4VEnergyLossProcess::SetEmModel(G4VEmModel* p, G4int index) 616 { 617 G4int n = emModels.size(); 618 if(index >= n) for(G4int i=n; i<index+1; i++) {emModels.push_back(0);} 619 emModels[index] = p; 620 } 621 622 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 623 624 inline G4VEmModel* G4VEnergyLossProcess::EmModel(G4int index) 625 { 626 G4VEmModel* p = 0; 627 if(index >= 0 && index < G4int(emModels.size())) p = emModels[index]; 628 return p; 629 } 630 631 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 632 633 inline 634 G4VEmModel* G4VEnergyLossProcess::GetModelByIndex(G4int idx, G4bool ver) 635 { 636 return modelManager->GetModel(idx, ver); 637 } 638 639 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 640 641 inline G4int G4VEnergyLossProcess::NumberOfModels() 642 { 643 return modelManager->NumberOfModels(); 644 } 645 646 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 647 648 inline void G4VEnergyLossProcess::SetFluctModel(G4VEmFluctuationModel* p) 649 { 650 fluctModel = p; 651 } 652 653 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 654 655 inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel() 656 { 657 return fluctModel; 658 } 659 660 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 661 662 inline void G4VEnergyLossProcess::SetParticle(const G4ParticleDefinition* p) 663 { 664 particle = p; 665 } 666 667 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 668 669 inline void G4VEnergyLossProcess::SetSecondaryParticle(const G4ParticleDefinition* p) 670 { 671 secondaryParticle = p; 672 } 673 674 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 675 676 inline void G4VEnergyLossProcess::SetBaseParticle(const G4ParticleDefinition* p) 677 { 678 baseParticle = p; 679 } 680 681 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 682 683 inline const G4ParticleDefinition* G4VEnergyLossProcess::Particle() const 684 { 685 return particle; 686 } 687 688 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 689 690 inline const G4ParticleDefinition* G4VEnergyLossProcess::BaseParticle() const 691 { 692 return baseParticle; 693 } 694 695 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 696 697 inline const G4ParticleDefinition* G4VEnergyLossProcess::SecondaryParticle() const 698 { 699 return secondaryParticle; 700 } 701 702 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 703 704 inline void G4VEnergyLossProcess::SetLossFluctuations(G4bool val) 705 { 706 lossFluctuationFlag = val; 707 } 708 709 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 710 711 inline void G4VEnergyLossProcess::SetRandomStep(G4bool val) 712 { 713 rndmStepFlag = val; 714 } 715 716 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 717 718 inline void G4VEnergyLossProcess::SetIntegral(G4bool val) 719 { 720 integral = val; 721 } 722 723 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 724 725 inline G4bool G4VEnergyLossProcess::IsIntegral() const 726 { 727 return integral; 728 } 729 730 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 731 732 inline void G4VEnergyLossProcess::SetIonisation(G4bool val) 733 { 734 isIonisation = val; 735 if(val) aGPILSelection = CandidateForSelection; 736 else aGPILSelection = NotCandidateForSelection; 737 } 738 739 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 740 741 inline G4bool G4VEnergyLossProcess::IsIonisationProcess() const 742 { 743 return isIonisation; 744 } 745 746 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 747 748 inline void G4VEnergyLossProcess::SetLinearLossLimit(G4double val) 749 { 750 linLossLimit = val; 751 } 752 753 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 754 755 inline void G4VEnergyLossProcess::SetMinSubRange(G4double val) 756 { 757 minSubRange = val; 758 } 759 760 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 761 762 inline void G4VEnergyLossProcess::SetLambdaFactor(G4double val) 763 { 764 if(val > 0.0 && val <= 1.0) lambdaFactor = val; 765 } 766 767 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 768 769 void G4VEnergyLossProcess::SetStepFunction(G4double v1, G4double v2) 770 { 771 dRoverRange = v1; 772 finalRange = v2; 773 if (dRoverRange > 0.999) dRoverRange = 1.0; 774 currentCouple = 0; 775 mfpKinEnergy = DBL_MAX; 776 } 777 778 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 779 780 inline G4int G4VEnergyLossProcess::NumberOfSubCutoffRegions() const 781 { 782 return nSCoffRegions; 783 } 784 785 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 786 787 inline G4int G4VEnergyLossProcess::NumberOfDERegions() const 788 { 789 return nDERegions; 790 } 791 792 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 793 794 inline void G4VEnergyLossProcess::SetDEDXBinning(G4int nbins) 795 { 796 nBins = nbins; 797 } 798 799 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 800 801 inline void G4VEnergyLossProcess::SetLambdaBinning(G4int nbins) 802 { 803 nBins = nbins; 804 } 805 806 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 807 808 inline void G4VEnergyLossProcess::SetDEDXBinningForCSDARange(G4int nbins) 809 { 810 nBinsCSDA = nbins; 811 } 812 813 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 814 815 inline void G4VEnergyLossProcess::SetMinKinEnergy(G4double e) 816 { 817 minKinEnergy = e; 818 } 819 820 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 821 822 inline G4double G4VEnergyLossProcess::MinKinEnergy() const 823 { 824 return minKinEnergy; 825 } 826 827 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 828 829 inline void G4VEnergyLossProcess::SetMaxKinEnergy(G4double e) 830 { 831 maxKinEnergy = e; 832 if(e < maxKinEnergyCSDA) maxKinEnergyCSDA = e; 833 } 834 835 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 836 837 inline G4double G4VEnergyLossProcess::MaxKinEnergy() const 838 { 839 return maxKinEnergy; 840 } 841 842 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 843 844 inline void G4VEnergyLossProcess::SetMaxKinEnergyForCSDARange(G4double e) 845 { 846 maxKinEnergyCSDA = e; 847 } 534 848 535 849 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... … … 549 863 DefineMaterial(couple); 550 864 return GetSubDEDXForScaledEnergy(kineticEnergy*massRatio); 551 }552 553 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....554 555 inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e)556 {557 G4bool b;558 G4double x =559 ((*theDEDXTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;560 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);561 return x;562 }563 564 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....565 566 inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e)567 {568 G4bool b;569 G4double x =570 ((*theDEDXSubTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;571 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);572 return x;573 }574 575 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....576 577 inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(G4double e)578 {579 G4bool b;580 G4double x = 0.0;581 // if(theIonisationTable) {582 x = ((*theIonisationTable)[currentMaterialIndex]->GetValue(e, b))583 *chargeSqRatio;584 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);585 //}586 return x;587 }588 589 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....590 591 inline592 G4double G4VEnergyLossProcess::GetSubIonisationForScaledEnergy(G4double e)593 {594 G4bool b;595 G4double x = 0.0;596 //if(theIonisationSubTable) {597 x = ((*theIonisationSubTable)[currentMaterialIndex]->GetValue(e, b))598 *chargeSqRatio;599 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);600 //}601 return x;602 865 } 603 866 … … 634 897 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 635 898 899 inline G4double G4VEnergyLossProcess::GetRangeForLoss( 900 G4double& kineticEnergy, 901 const G4MaterialCutsCouple* couple) 902 { 903 DefineMaterial(couple); 904 G4double x = DBL_MAX; 905 if(theRangeTableForLoss) 906 x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor; 907 // G4cout << "Range from " << GetProcessName() 908 // << " e= " << kineticEnergy << " r= " << x << G4endl; 909 return x; 910 } 911 912 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 913 914 inline G4double G4VEnergyLossProcess::GetKineticEnergy( 915 G4double& range, 916 const G4MaterialCutsCouple* couple) 917 { 918 DefineMaterial(couple); 919 G4double r = range/reduceFactor; 920 G4double e = ScaledKinEnergyForLoss(r)/massRatio; 921 return e; 922 } 923 924 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 925 926 inline G4double G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy, 927 const G4MaterialCutsCouple* couple) 928 { 929 DefineMaterial(couple); 930 G4double x = 0.0; 931 if(theLambdaTable) x = GetLambdaForScaledEnergy(kineticEnergy*massRatio); 932 return x; 933 } 934 935 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 936 937 inline G4bool G4VEnergyLossProcess::TablesAreBuilt() const 938 { 939 return tablesAreBuilt; 940 } 941 942 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 943 944 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const 945 { 946 return theDEDXTable; 947 } 948 949 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 950 951 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTableForSubsec() const 952 { 953 return theDEDXSubTable; 954 } 955 956 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 957 958 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const 959 { 960 return theDEDXunRestrictedTable; 961 } 962 963 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 964 965 inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTable() const 966 { 967 G4PhysicsTable* t = theDEDXTable; 968 if(theIonisationTable) t = theIonisationTable; 969 return t; 970 } 971 972 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 973 974 inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTableForSubsec() const 975 { 976 G4PhysicsTable* t = theDEDXSubTable; 977 if(theIonisationSubTable) t = theIonisationSubTable; 978 return t; 979 } 980 981 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 982 983 inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const 984 { 985 return theCSDARangeTable; 986 } 987 988 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 989 990 inline G4PhysicsTable* G4VEnergyLossProcess::RangeTableForLoss() const 991 { 992 return theRangeTableForLoss; 993 } 994 995 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 996 997 inline G4PhysicsTable* G4VEnergyLossProcess::InverseRangeTable() const 998 { 999 return theInverseRangeTable; 1000 } 1001 1002 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1003 1004 inline G4PhysicsTable* G4VEnergyLossProcess::LambdaTable() 1005 { 1006 return theLambdaTable; 1007 } 1008 1009 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1010 1011 inline G4PhysicsTable* G4VEnergyLossProcess::SubLambdaTable() 1012 { 1013 return theSubLambdaTable; 1014 } 1015 1016 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1017 1018 inline G4double G4VEnergyLossProcess::SampleRange() 1019 { 1020 G4double e = amu_c2*preStepKinEnergy/particle->GetPDGMass(); 1021 G4bool b; 1022 G4double s = fRange*std::pow(10.,vstrag->GetValue(e,b)); 1023 G4double x = fRange + G4RandGauss::shoot(0.0,s); 1024 if(x > 0.0) fRange = x; 1025 return fRange; 1026 } 1027 1028 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1029 1030 inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio, 1031 G4double charge2ratio) 1032 { 1033 massRatio = massratio; 1034 chargeSqRatio = charge2ratio; 1035 reduceFactor = 1.0/(chargeSqRatio*massRatio); 1036 } 1037 1038 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1039 1040 inline void G4VEnergyLossProcess::DefineMaterial( 1041 const G4MaterialCutsCouple* couple) 1042 { 1043 if(couple != currentCouple) { 1044 currentCouple = couple; 1045 currentMaterial = couple->GetMaterial(); 1046 currentMaterialIndex = couple->GetIndex(); 1047 mfpKinEnergy = DBL_MAX; 1048 } 1049 } 1050 1051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1052 1053 inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e) 1054 { 1055 G4bool b; 1056 G4double x = 1057 ((*theDEDXTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio; 1058 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); 1059 return x; 1060 } 1061 1062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1063 1064 inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e) 1065 { 1066 G4bool b; 1067 G4double x = 1068 ((*theDEDXSubTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio; 1069 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); 1070 return x; 1071 } 1072 1073 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1074 1075 inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(G4double e) 1076 { 1077 G4bool b; 1078 G4double x = 0.0; 1079 // if(theIonisationTable) { 1080 x = ((*theIonisationTable)[currentMaterialIndex]->GetValue(e, b)) 1081 *chargeSqRatio; 1082 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); 1083 //} 1084 return x; 1085 } 1086 1087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1088 1089 inline 1090 G4double G4VEnergyLossProcess::GetSubIonisationForScaledEnergy(G4double e) 1091 { 1092 G4bool b; 1093 G4double x = 0.0; 1094 //if(theIonisationSubTable) { 1095 x = ((*theIonisationSubTable)[currentMaterialIndex]->GetValue(e, b)) 1096 *chargeSqRatio; 1097 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); 1098 //} 1099 return x; 1100 } 1101 1102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1103 1104 inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e) 1105 { 1106 G4bool b; 1107 G4double x = ((*theRangeTableForLoss)[currentMaterialIndex])->GetValue(e, b); 1108 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); 1109 return x; 1110 } 1111 1112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1113 636 1114 inline G4double G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy( 637 1115 G4double e) … … 648 1126 } 649 1127 return x; 650 }651 652 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....653 654 inline G4double G4VEnergyLossProcess::GetRangeForLoss(655 G4double& kineticEnergy,656 const G4MaterialCutsCouple* couple)657 {658 DefineMaterial(couple);659 G4double x = DBL_MAX;660 if(theRangeTableForLoss)661 x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;662 // G4cout << "Range from " << GetProcessName()663 // << " e= " << kineticEnergy << " r= " << x << G4endl;664 return x;665 }666 667 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....668 669 inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e)670 {671 G4bool b;672 G4double x = ((*theRangeTableForLoss)[currentMaterialIndex])->GetValue(e, b);673 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);674 return x;675 }676 677 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....678 679 inline G4double G4VEnergyLossProcess::GetKineticEnergy(680 G4double& range,681 const G4MaterialCutsCouple* couple)682 {683 DefineMaterial(couple);684 G4double r = range/reduceFactor;685 G4double e = ScaledKinEnergyForLoss(r)/massRatio;686 return e;687 1128 } 688 1129 … … 702 1143 } 703 1144 return e; 704 }705 706 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....707 708 inline G4double G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy,709 const G4MaterialCutsCouple* couple)710 {711 DefineMaterial(couple);712 G4double x = 0.0;713 if(theLambdaTable) x = GetLambdaForScaledEnergy(kineticEnergy*massRatio);714 return x;715 1145 } 716 1146 … … 749 1179 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 750 1180 751 inline G4double G4VEnergyLossProcess::ContinuousStepLimit(752 const G4Track& track, G4double x, G4double y, G4double& z)753 {754 G4GPILSelection sel;755 return AlongStepGetPhysicalInteractionLength(track, x, y, z, &sel);756 }757 758 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....759 760 inline G4double G4VEnergyLossProcess::SampleRange()761 {762 G4double e = amu_c2*preStepKinEnergy/particle->GetPDGMass();763 G4bool b;764 G4double s = fRange*std::pow(10.,vstrag->GetValue(e,b));765 G4double x = fRange + G4RandGauss::shoot(0.0,s);766 if(x > 0.0) fRange = x;767 return fRange;768 }769 770 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....771 772 inline G4double G4VEnergyLossProcess::MeanFreePath(const G4Track& track)773 {774 DefineMaterial(track.GetMaterialCutsCouple());775 preStepLambda = GetLambdaForScaledEnergy(track.GetKineticEnergy()*massRatio);776 G4double x = DBL_MAX;777 if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda;778 return x;779 }780 781 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....782 783 inline G4double G4VEnergyLossProcess::MinPrimaryEnergy(784 const G4ParticleDefinition*, const G4Material*, G4double cut)785 {786 return cut;787 }788 789 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....790 791 inline G4VEmModel* G4VEnergyLossProcess::SelectModel(G4double kinEnergy)792 {793 return modelManager->SelectModel(kinEnergy, currentMaterialIndex);794 }795 796 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....797 798 inline G4VEmModel* G4VEnergyLossProcess::SelectModelForMaterial(799 G4double kinEnergy, size_t& idx) const800 {801 return modelManager->SelectModel(kinEnergy, idx);802 }803 804 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....805 806 inline const G4ParticleDefinition* G4VEnergyLossProcess::Particle() const807 {808 return particle;809 }810 811 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....812 813 inline const G4ParticleDefinition* G4VEnergyLossProcess::BaseParticle() const814 {815 return baseParticle;816 }817 818 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....819 820 inline const G4ParticleDefinition* G4VEnergyLossProcess::SecondaryParticle() const821 {822 return secondaryParticle;823 }824 825 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....826 827 inline void G4VEnergyLossProcess::CorrectionsAlongStep(828 const G4MaterialCutsCouple*,829 const G4DynamicParticle*,830 G4double&,831 G4double&)832 {}833 834 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....835 836 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const837 {838 return theDEDXTable;839 }840 841 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....842 843 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTableForSubsec() const844 {845 return theDEDXSubTable;846 }847 848 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....849 850 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const851 {852 return theDEDXunRestrictedTable;853 }854 855 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....856 857 inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTable() const858 {859 G4PhysicsTable* t = theDEDXTable;860 if(theIonisationTable) t = theIonisationTable;861 return t;862 }863 864 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....865 866 inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTableForSubsec() const867 {868 G4PhysicsTable* t = theDEDXSubTable;869 if(theIonisationSubTable) t = theIonisationSubTable;870 return t;871 }872 873 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....874 875 inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const876 {877 return theCSDARangeTable;878 }879 880 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....881 882 inline G4PhysicsTable* G4VEnergyLossProcess::RangeTableForLoss() const883 {884 return theRangeTableForLoss;885 }886 887 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....888 889 inline G4PhysicsTable* G4VEnergyLossProcess::InverseRangeTable() const890 {891 return theInverseRangeTable;892 }893 894 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....895 896 inline G4PhysicsTable* G4VEnergyLossProcess::LambdaTable()897 {898 return theLambdaTable;899 }900 901 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....902 903 inline G4PhysicsTable* G4VEnergyLossProcess::SubLambdaTable()904 {905 return theSubLambdaTable;906 }907 908 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....909 910 inline G4bool G4VEnergyLossProcess::IsIntegral() const911 {912 return integral;913 }914 915 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....916 917 inline size_t G4VEnergyLossProcess::CurrentMaterialCutsCoupleIndex() const918 {919 return currentMaterialIndex;920 }921 922 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....923 924 inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio,925 G4double charge2ratio)926 {927 massRatio = massratio;928 chargeSqRatio = charge2ratio;929 chargeSquare = charge2ratio*eplus*eplus;930 if(chargeSqRatio > 0.0) reduceFactor = 1.0/(chargeSqRatio*massRatio);931 }932 933 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....934 935 inline G4double G4VEnergyLossProcess::GetCurrentRange() const936 {937 return fRange;938 }939 940 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....941 942 void G4VEnergyLossProcess::AddEmModel(G4int order, G4VEmModel* p,943 G4VEmFluctuationModel* fluc,944 const G4Region* region)945 {946 modelManager->AddEmModel(order, p, fluc, region);947 if(p) p->SetParticleChange(pParticleChange, fluc);948 }949 950 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....951 952 inline G4VEmModel* G4VEnergyLossProcess::GetModelByIndex(G4int idx)953 {954 return modelManager->GetModel(idx);955 }956 957 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....958 959 inline G4int G4VEnergyLossProcess::NumberOfModels()960 {961 return modelManager->NumberOfModels();962 }963 964 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....965 966 inline void G4VEnergyLossProcess::SetEmModel(G4VEmModel* p, G4int index)967 {968 G4int n = emModels.size();969 if(index >= n) for(G4int i=n; i<index+1; i++) {emModels.push_back(0);}970 emModels[index] = p;971 }972 973 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....974 975 inline G4VEmModel* G4VEnergyLossProcess::EmModel(G4int index)976 {977 G4VEmModel* p = 0;978 if(index >= 0 && index < G4int(emModels.size())) p = emModels[index];979 return p;980 }981 982 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....983 984 inline void G4VEnergyLossProcess::SetFluctModel(G4VEmFluctuationModel* p)985 {986 fluctModel = p;987 }988 989 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....990 991 inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel()992 {993 return fluctModel;994 }995 996 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....997 998 inline void G4VEnergyLossProcess::UpdateEmModel(const G4String& nam,999 G4double emin, G4double emax)1000 {1001 modelManager->UpdateEmModel(nam, emin, emax);1002 }1003 1004 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1005 1006 inline void G4VEnergyLossProcess::SetIntegral(G4bool val)1007 {1008 integral = val;1009 }1010 1011 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1012 1013 inline void G4VEnergyLossProcess::SetParticle(const G4ParticleDefinition* p)1014 {1015 particle = p;1016 }1017 1018 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1019 1020 inline void G4VEnergyLossProcess::SetBaseParticle(const G4ParticleDefinition* p)1021 {1022 baseParticle = p;1023 }1024 1025 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1026 1027 inline void G4VEnergyLossProcess::SetSecondaryParticle(const G4ParticleDefinition* p)1028 {1029 secondaryParticle = p;1030 }1031 1032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1033 1034 inline void G4VEnergyLossProcess::SetLinearLossLimit(G4double val)1035 {1036 linLossLimit = val;1037 }1038 1039 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1040 1041 inline void G4VEnergyLossProcess::SetLossFluctuations(G4bool val)1042 {1043 lossFluctuationFlag = val;1044 }1045 1046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1047 1048 inline void G4VEnergyLossProcess::SetRandomStep(G4bool val)1049 {1050 rndmStepFlag = val;1051 }1052 1053 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1054 1055 inline void G4VEnergyLossProcess::SetMinSubRange(G4double val)1056 {1057 minSubRange = val;1058 }1059 1060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1061 1062 inline G4bool G4VEnergyLossProcess::TablesAreBuilt() const1063 {1064 return tablesAreBuilt;1065 }1066 1067 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1068 1069 inline G4int G4VEnergyLossProcess::NumberOfSubCutoffRegions() const1070 {1071 return nSCoffRegions;1072 }1073 1074 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1075 1076 inline void G4VEnergyLossProcess::SetDEDXBinning(G4int nbins)1077 {1078 nBins = nbins;1079 }1080 1081 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1082 1083 inline void G4VEnergyLossProcess::SetLambdaBinning(G4int nbins)1084 {1085 nBins = nbins;1086 }1087 1088 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1089 1090 inline void G4VEnergyLossProcess::SetDEDXBinningForCSDARange(G4int nbins)1091 {1092 nBinsCSDA = nbins;1093 }1094 1095 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1096 1097 inline G4double G4VEnergyLossProcess::MinKinEnergy() const1098 {1099 return minKinEnergy;1100 }1101 1102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1103 1104 inline void G4VEnergyLossProcess::SetMinKinEnergy(G4double e)1105 {1106 minKinEnergy = e;1107 }1108 1109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1110 1111 inline void G4VEnergyLossProcess::SetMaxKinEnergy(G4double e)1112 {1113 maxKinEnergy = e;1114 if(e < maxKinEnergyCSDA) maxKinEnergyCSDA = e;1115 }1116 1117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1118 1119 inline void G4VEnergyLossProcess::SetMaxKinEnergyForCSDARange(G4double e)1120 {1121 maxKinEnergyCSDA = e;1122 }1123 1124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1125 1126 inline G4double G4VEnergyLossProcess::MaxKinEnergy() const1127 {1128 return maxKinEnergy;1129 }1130 1131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1132 1133 inline void G4VEnergyLossProcess::SetLambdaFactor(G4double val)1134 {1135 if(val > 0.0 && val <= 1.0) lambdaFactor = val;1136 }1137 1138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1139 1140 inline void G4VEnergyLossProcess::SetIonisation(G4bool val)1141 {1142 isIonisation = val;1143 if(val) aGPILSelection = CandidateForSelection;1144 else aGPILSelection = NotCandidateForSelection;1145 }1146 1147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1148 1149 inline G4bool G4VEnergyLossProcess::IsIonisationProcess() const1150 {1151 return isIonisation;1152 }1153 1154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1155 1156 void G4VEnergyLossProcess::SetStepFunction(G4double v1, G4double v2)1157 {1158 dRoverRange = v1;1159 finalRange = v2;1160 if (dRoverRange > 0.999) dRoverRange = 1.0;1161 currentCouple = 0;1162 mfpKinEnergy = DBL_MAX;1163 }1164 1165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....1166 1167 1181 #endif -
trunk/source/processes/electromagnetic/utils/include/G4VMultipleScattering.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VMultipleScattering.hh,v 1. 48 2007/10/29 08:38:58vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4VMultipleScattering.hh,v 1.55 2009/02/18 12:19:33 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 63 63 // 12-02-07 Add get/set skin (V.Ivanchenko) 64 64 // 27-10-07 Virtual functions moved to source (V.Ivanchenko) 65 // 15-07-08 Reorder class members for further multi-thread development (VI) 65 66 // 66 67 … … 72 73 73 74 #include "G4VContinuousDiscreteProcess.hh" 74 #include "G4LossTableManager.hh"75 75 #include "globals.hh" 76 76 #include "G4Material.hh" … … 95 95 96 96 G4VMultipleScattering(const G4String& name = "msc", 97 G4ProcessType type = fElectromagnetic);97 G4ProcessType type = fElectromagnetic); 98 98 99 99 virtual ~G4VMultipleScattering(); … … 104 104 105 105 virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0; 106 // True for all charged particles107 106 108 107 virtual void PrintInfo() = 0; … … 112 111 virtual void InitialiseProcess(const G4ParticleDefinition*) = 0; 113 112 114 //------------------------------------------------------------------------115 // Methods with standard implementation; may be overwritten if needed116 //------------------------------------------------------------------------117 113 public: 118 114 … … 138 134 G4bool StorePhysicsTable(const G4ParticleDefinition*, 139 135 const G4String& directory, 140 G4bool ascii = false);136 G4bool ascii = false); 141 137 142 138 // Retrieve Physics from a file. … … 147 143 G4bool RetrievePhysicsTable(const G4ParticleDefinition*, 148 144 const G4String& directory, 149 G4bool ascii); 150 151 //------------------------------------------------------------------------ 152 // Specific methods for msc processes 153 //------------------------------------------------------------------------ 145 G4bool ascii); 154 146 155 147 // The function overloads the corresponding function of the base … … 158 150 G4double AlongStepGetPhysicalInteractionLength( 159 151 const G4Track&, 160 G4double previousStepSize,161 G4double currentMinimalStep,162 G4double& currentSafety,163 G4GPILSelection* selection);152 G4double previousStepSize, 153 G4double currentMinimalStep, 154 G4double& currentSafety, 155 G4GPILSelection* selection); 164 156 165 157 // The function overloads the corresponding function of the base … … 188 180 inline void SetMinKinEnergy(G4double e); 189 181 inline G4double MinKinEnergy() const; 190 // Print out of the class parameters191 182 192 183 inline void SetMaxKinEnergy(G4double e); … … 197 188 inline G4PhysicsTable* LambdaTable() const; 198 189 199 //------------------------------------------------------------------------ 200 // Define and access particle type 201 //------------------------------------------------------------------------ 202 190 // access particle type 203 191 inline const G4ParticleDefinition* Particle() const; 204 inline void SetParticle(const G4ParticleDefinition*);205 192 206 193 //------------------------------------------------------------------------ … … 208 195 //------------------------------------------------------------------------ 209 196 210 inline void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0); 211 197 protected: 198 // Select model in run time 199 inline G4VEmModel* SelectModel(G4double kinEnergy); 200 201 public: 202 // Select model in run time 212 203 inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, 213 204 size_t& idxRegion) const; 214 205 215 // Access to models 216 inline G4VEmModel* GetModelByIndex(G4int idx = 0); 217 218 //------------------------------------------------------------------------ 219 // Parameters for simulation of multiple scattering 220 //------------------------------------------------------------------------ 221 206 // Add model for region, smaller value of order defines which 207 // model will be selected for a given energy interval 208 inline void AddEmModel(G4int order, G4VEmModel*, const G4Region* region = 0); 209 210 // Access to models by index 211 inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false); 212 213 //------------------------------------------------------------------------ 214 // Get/Set parameters for simulation of multiple scattering 215 //------------------------------------------------------------------------ 216 217 inline G4bool LateralDisplasmentFlag() const; 222 218 inline void SetLateralDisplasmentFlag(G4bool val); 223 // lateral displacement to be/not to be computed 224 219 220 inline G4double Skin() const; 225 221 inline void SetSkin(G4double val); 226 // skin parameter 227 222 223 inline G4double RangeFactor() const; 228 224 inline void SetRangeFactor(G4double val); 229 // FactorRange parameter 230 225 226 inline G4double GeomFactor() const; 231 227 inline void SetGeomFactor(G4double val); 232 // FactorRange parameter 233 228 229 inline G4double PolarAngleLimit() const; 230 inline void SetPolarAngleLimit(G4double val); 231 232 inline G4MscStepLimitType StepLimitType() const; 234 233 inline void SetStepLimitType(G4MscStepLimitType val); 235 // FactorRange parameter 234 235 //------------------------------------------------------------------------ 236 // Run time methods 237 //------------------------------------------------------------------------ 236 238 237 239 protected: … … 241 243 G4double, 242 244 G4ForceCondition* condition); 243 244 //------------------------------------------------------------------------245 // Run time methods246 //------------------------------------------------------------------------247 245 248 246 // This method is not used for tracking, it returns step limit … … 252 250 G4double& currentSafety); 253 251 254 inline G4double GetLambda(const G4ParticleDefinition* p, G4double& kineticEnergy); 252 inline G4double GetLambda(const G4ParticleDefinition* p, 253 G4double& kineticEnergy); 255 254 256 255 // This method is used for tracking, it returns step limit 257 256 inline G4double GetMscContinuousStepLimit(const G4Track& track, 258 G4double previousStepSize,257 G4double scaledKinEnergy, 259 258 G4double currentMinimalStep, 260 259 G4double& currentSafety); 261 260 262 inline G4VEmModel* SelectModel(G4double kinEnergy);263 // Select concrete model261 // define current material 262 inline void DefineMaterial(const G4MaterialCutsCouple* couple); 264 263 265 264 inline const G4MaterialCutsCouple* CurrentMaterialCutsCouple() const; 266 // Return current G4MaterialCutsCouple 267 268 inline void DefineMaterial(const G4MaterialCutsCouple* couple); 269 // define current material 270 271 //------------------------------------------------------------------------ 272 // Parameters for simulation of multiple scattering 273 //------------------------------------------------------------------------ 274 275 inline G4double Skin() const; 276 277 inline G4double RangeFactor() const; 278 279 inline G4double GeomFactor() const; 280 281 inline G4MscStepLimitType StepLimitType() const; 282 283 inline G4bool LateralDisplasmentFlag() const; 265 266 inline G4ParticleChangeForMSC* GetParticleChange(); 267 284 268 285 269 private: 286 270 287 271 // hide assignment operator 288 289 272 G4VMultipleScattering(G4VMultipleScattering &); 290 273 G4VMultipleScattering & operator=(const G4VMultipleScattering &right); 291 274 292 // ===================================================================== 293 294 protected: 295 296 G4GPILSelection valueGPILSelectionMSC; 297 G4ParticleChangeForMSC fParticleChange; 298 299 private: 275 // ======== Parameters of the class fixed at construction ========= 300 276 301 277 G4EmModelManager* modelManager; 302 G4VEmModel* currentModel; 278 G4bool buildLambdaTable; 279 280 // ======== Parameters of the class fixed at initialisation ======= 281 303 282 G4PhysicsTable* theLambdaTable; 304 305 // cache306 283 const G4ParticleDefinition* firstParticle; 307 const G4ParticleDefinition* currentParticle;308 const G4MaterialCutsCouple* currentCouple;309 size_t currentMaterialIndex;310 311 G4int nBins;312 284 313 285 G4MscStepLimitType stepLimit; … … 318 290 G4double facrange; 319 291 G4double facgeom; 292 G4double polarAngleLimit; 293 294 G4int nBins; 320 295 321 296 G4bool latDisplasment; 322 G4bool buildLambdaTable; 297 298 // ======== Cashed values - may be state dependent ================ 299 300 protected: 301 302 G4GPILSelection valueGPILSelectionMSC; 303 G4ParticleChangeForMSC fParticleChange; 304 305 private: 306 307 G4VEmModel* currentModel; 308 309 // cache 310 const G4ParticleDefinition* currentParticle; 311 const G4MaterialCutsCouple* currentCouple; 312 size_t currentMaterialIndex; 313 323 314 }; 324 315 325 316 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 326 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....327 328 inline void G4VMultipleScattering::DefineMaterial(const G4MaterialCutsCouple* couple)329 {330 if(couple != currentCouple) {331 currentCouple = couple;332 currentMaterialIndex = couple->GetIndex();333 }334 }335 336 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....337 338 inline G4double G4VMultipleScattering::GetMscContinuousStepLimit(339 const G4Track& track,340 G4double,341 G4double currentMinimalStep,342 G4double&)343 {344 G4double x = currentMinimalStep;345 G4double e = track.GetKineticEnergy();346 DefineMaterial(track.GetMaterialCutsCouple());347 currentModel = SelectModel(e);348 if(x > 0.0 && e > 0.0) {349 G4double tPathLength =350 currentModel->ComputeTruePathLengthLimit(track, theLambdaTable, x);351 if (tPathLength < x) valueGPILSelectionMSC = CandidateForSelection;352 x = currentModel->ComputeGeomPathLength(tPathLength);353 // G4cout << "tPathLength= " << tPathLength354 // << " stepLimit= " << x355 // << " currentMinimalStep= " << currentMinimalStep<< G4endl;356 }357 return x;358 }359 360 317 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 361 318 … … 367 324 { 368 325 return GetMscContinuousStepLimit(track,previousStepSize,currentMinimalStep, 369 currentSafety); 370 } 371 372 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 373 374 inline G4double G4VMultipleScattering::GetLambda(const G4ParticleDefinition* p, G4double& e) 326 currentSafety); 327 } 328 329 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 330 331 inline void G4VMultipleScattering::SetBinning(G4int nbins) 332 { 333 nBins = nbins; 334 } 335 336 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 337 338 inline G4int G4VMultipleScattering::Binning() const 339 { 340 return nBins; 341 } 342 343 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 344 345 inline void G4VMultipleScattering::SetMinKinEnergy(G4double e) 346 { 347 minKinEnergy = e; 348 } 349 350 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 351 352 inline G4double G4VMultipleScattering::MinKinEnergy() const 353 { 354 return minKinEnergy; 355 } 356 357 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 358 359 inline void G4VMultipleScattering::SetMaxKinEnergy(G4double e) 360 { 361 maxKinEnergy = e; 362 } 363 364 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 365 366 inline G4double G4VMultipleScattering::MaxKinEnergy() const 367 { 368 return maxKinEnergy; 369 } 370 371 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 372 373 inline void G4VMultipleScattering::SetBuildLambdaTable(G4bool val) 374 { 375 buildLambdaTable = val; 376 } 377 378 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 379 380 inline G4PhysicsTable* G4VMultipleScattering::LambdaTable() const 381 { 382 return theLambdaTable; 383 } 384 385 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 386 387 inline const G4ParticleDefinition* G4VMultipleScattering::Particle() const 388 { 389 return currentParticle; 390 } 391 392 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 393 394 inline void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p, 395 const G4Region* region) 396 { 397 G4VEmFluctuationModel* fm = 0; 398 modelManager->AddEmModel(order, p, fm, region); 399 if(p) p->SetParticleChange(pParticleChange); 400 } 401 402 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 403 404 inline G4VEmModel* G4VMultipleScattering::SelectModel(G4double kinEnergy) 405 { 406 return modelManager->SelectModel(kinEnergy, currentMaterialIndex); 407 } 408 409 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 410 411 inline G4VEmModel* G4VMultipleScattering::SelectModelForMaterial( 412 G4double kinEnergy, size_t& idxRegion) const 413 { 414 return modelManager->SelectModel(kinEnergy, idxRegion); 415 } 416 417 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 418 419 inline 420 G4VEmModel* G4VMultipleScattering::GetModelByIndex(G4int idx, G4bool ver) 421 { 422 return modelManager->GetModel(idx, ver); 423 } 424 425 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 426 427 inline G4bool G4VMultipleScattering::LateralDisplasmentFlag() const 428 { 429 return latDisplasment; 430 } 431 432 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 433 434 inline void G4VMultipleScattering::SetLateralDisplasmentFlag(G4bool val) 435 { 436 latDisplasment = val; 437 } 438 439 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 440 441 inline G4double G4VMultipleScattering::Skin() const 442 { 443 return skin; 444 } 445 446 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 447 448 inline void G4VMultipleScattering::SetSkin(G4double val) 449 { 450 if(val < 1.0) skin = 0.0; 451 else skin = val; 452 } 453 454 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 455 456 inline G4double G4VMultipleScattering::RangeFactor() const 457 { 458 return facrange; 459 } 460 461 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 462 463 inline void G4VMultipleScattering::SetRangeFactor(G4double val) 464 { 465 if(val > 0.0) facrange = val; 466 } 467 468 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 469 470 inline G4double G4VMultipleScattering::GeomFactor() const 471 { 472 return facgeom; 473 } 474 475 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 476 477 inline void G4VMultipleScattering::SetGeomFactor(G4double val) 478 { 479 if(val > 0.0) facgeom = val; 480 } 481 482 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 483 484 inline G4double G4VMultipleScattering::PolarAngleLimit() const 485 { 486 return polarAngleLimit; 487 } 488 489 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 490 491 inline void G4VMultipleScattering::SetPolarAngleLimit(G4double val) 492 { 493 if(val < 0.0) polarAngleLimit = 0.0; 494 else if(val > pi) polarAngleLimit = pi; 495 else polarAngleLimit = val; 496 } 497 498 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 499 500 inline G4MscStepLimitType G4VMultipleScattering::StepLimitType() const 501 { 502 return stepLimit; 503 } 504 505 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 506 507 inline void G4VMultipleScattering::SetStepLimitType(G4MscStepLimitType val) 508 { 509 stepLimit = val; 510 if(val == fMinimal) facrange = 0.2; 511 } 512 513 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 514 515 inline 516 G4double G4VMultipleScattering::GetLambda(const G4ParticleDefinition* p, 517 G4double& e) 375 518 { 376 519 G4double x; … … 388 531 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 389 532 390 inline G4VEmModel* G4VMultipleScattering::SelectModel(G4double kinEnergy) 391 { 392 return modelManager->SelectModel(kinEnergy, currentMaterialIndex); 393 } 394 395 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 396 397 inline G4VEmModel* G4VMultipleScattering::SelectModelForMaterial( 398 G4double kinEnergy, size_t& idxRegion) const 399 { 400 return modelManager->SelectModel(kinEnergy, idxRegion); 401 } 402 403 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 404 405 inline void G4VMultipleScattering::SetBinning(G4int nbins) 406 { 407 nBins = nbins; 408 } 409 410 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 411 412 inline G4int G4VMultipleScattering::Binning() const 413 { 414 return nBins; 415 } 416 417 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 418 419 inline void G4VMultipleScattering::SetMinKinEnergy(G4double e) 420 { 421 minKinEnergy = e; 422 } 423 424 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 425 426 inline G4double G4VMultipleScattering::MinKinEnergy() const 427 { 428 return minKinEnergy; 429 } 430 431 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 432 433 inline void G4VMultipleScattering::SetMaxKinEnergy(G4double e) 434 { 435 maxKinEnergy = e; 436 } 437 438 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 439 440 inline G4double G4VMultipleScattering::MaxKinEnergy() const 441 { 442 return maxKinEnergy; 443 } 444 445 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 446 447 inline G4bool G4VMultipleScattering::LateralDisplasmentFlag() const 448 { 449 return latDisplasment; 450 } 451 452 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 453 454 inline void G4VMultipleScattering::SetLateralDisplasmentFlag(G4bool val) 455 { 456 latDisplasment = val; 457 } 458 459 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 460 461 inline G4double G4VMultipleScattering::Skin() const 462 { 463 return skin; 464 } 465 466 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 467 468 inline void G4VMultipleScattering::SetSkin(G4double val) 469 { 470 if(val <= 0.99999) { 471 skin = 0.0; 472 stepLimit = fUseSafety; 473 } else { 474 skin = val; 475 stepLimit = fUseDistanceToBoundary; 533 inline G4double G4VMultipleScattering::GetMscContinuousStepLimit( 534 const G4Track& track, 535 G4double scaledKinEnergy, 536 G4double currentMinimalStep, 537 G4double&) 538 { 539 G4double x = currentMinimalStep; 540 DefineMaterial(track.GetMaterialCutsCouple()); 541 currentModel = SelectModel(scaledKinEnergy); 542 if(x > 0.0 && scaledKinEnergy > 0.0) { 543 G4double tPathLength = 544 currentModel->ComputeTruePathLengthLimit(track, theLambdaTable, x); 545 if (tPathLength < x) valueGPILSelectionMSC = CandidateForSelection; 546 x = currentModel->ComputeGeomPathLength(tPathLength); 547 // G4cout << "tPathLength= " << tPathLength 548 // << " stepLimit= " << x 549 // << " currentMinimalStep= " << currentMinimalStep<< G4endl; 476 550 } 477 } 478 479 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 480 481 inline G4double G4VMultipleScattering::RangeFactor() const 482 { 483 return facrange; 484 } 485 486 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 487 488 inline void G4VMultipleScattering::SetRangeFactor(G4double val) 489 { 490 if(val > 0.0) facrange = val; 491 } 492 493 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 494 495 inline G4double G4VMultipleScattering::GeomFactor() const 496 { 497 return facgeom; 498 } 499 500 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 501 502 inline void G4VMultipleScattering::SetGeomFactor(G4double val) 503 { 504 if(val > 0.0) facgeom = val; 505 } 506 507 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 508 509 inline G4MscStepLimitType G4VMultipleScattering::StepLimitType() const 510 { 511 return stepLimit; 512 } 513 514 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 515 516 inline void G4VMultipleScattering::SetStepLimitType(G4MscStepLimitType val) 517 { 518 stepLimit = val; 519 if(val == fMinimal) { 520 skin = 0; 521 facrange = 0.2; 522 } else if(val == fUseSafety) { 523 skin = 0; 551 return x; 552 } 553 554 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 555 556 inline 557 void G4VMultipleScattering::DefineMaterial(const G4MaterialCutsCouple* couple) 558 { 559 if(couple != currentCouple) { 560 currentCouple = couple; 561 currentMaterialIndex = couple->GetIndex(); 524 562 } 525 563 } … … 527 565 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 528 566 529 inline void G4VMultipleScattering::SetBuildLambdaTable(G4bool val) 530 { 531 buildLambdaTable = val; 532 } 533 534 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 535 536 inline const G4ParticleDefinition* G4VMultipleScattering::Particle() const 537 { 538 return currentParticle; 539 } 540 541 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 542 543 inline G4PhysicsTable* G4VMultipleScattering::LambdaTable() const 544 { 545 return theLambdaTable; 546 } 547 548 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 549 550 inline 551 const G4MaterialCutsCouple* G4VMultipleScattering::CurrentMaterialCutsCouple() const 567 inline const G4MaterialCutsCouple* 568 G4VMultipleScattering::CurrentMaterialCutsCouple() const 552 569 { 553 570 return currentCouple; … … 556 573 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 557 574 558 inline void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p, 559 const G4Region* region) 560 { 561 G4VEmFluctuationModel* fm = 0; 562 modelManager->AddEmModel(order, p, fm, region); 563 if(p)p->SetParticleChange(pParticleChange); 564 } 565 566 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 567 568 inline G4VEmModel* G4VMultipleScattering::GetModelByIndex(G4int idx) 569 { 570 return modelManager->GetModel(idx); 575 inline G4ParticleChangeForMSC* G4VMultipleScattering::GetParticleChange() 576 { 577 return &fParticleChange; 571 578 } 572 579 -
trunk/source/processes/electromagnetic/utils/include/G4ionEffectiveCharge.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4ionEffectiveCharge.hh,v 1. 8 2006/08/15 16:21:39vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4ionEffectiveCharge.hh,v 1.12 2008/09/20 19:39:34 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 56 56 57 57 #include "globals.hh" 58 #include "G4ParticleDefinition.hh" 58 59 59 60 class G4Material; 60 class G4 ParticleDefinition;61 class G4NistManager; 61 62 62 63 class G4ionEffectiveCharge … … 84 85 G4ionEffectiveCharge(const G4ionEffectiveCharge&); 85 86 87 G4NistManager* nist; 88 89 const G4ParticleDefinition* lastPart; 90 const G4Material* lastMat; 91 G4double lastKinEnergy; 92 86 93 G4double chargeCorrection; 94 G4double effCharge; 95 87 96 G4double energyHighLimit; 88 97 G4double energyLowLimit; … … 100 109 G4double kineticEnergy) 101 110 { 102 G4double charge = EffectiveCharge(p,material,kineticEnergy)/eplus; 103 charge *= chargeCorrection; 111 G4double charge = effCharge; 112 if( kineticEnergy != lastKinEnergy || material != lastMat || p != lastPart) { 113 charge = EffectiveCharge(p,material,kineticEnergy); 114 } 115 charge *= chargeCorrection/CLHEP::eplus; 104 116 105 117 return charge*charge;
Note:
See TracChangeset
for help on using the changeset viewer.
