Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 // $Id: G4VMscModel.hh,v 1.4 2008/03/10 10:39:28 vnivanch Exp $ >> 27 // GEANT4 tag $Name: geant4-09-02-patch-01 $ >> 28 // 26 // ------------------------------------------- 29 // ------------------------------------------------------------------- 27 // 30 // 28 // GEANT4 Class header file 31 // GEANT4 Class header file 29 // 32 // 30 // 33 // 31 // File name: G4VMscModel 34 // File name: G4VMscModel 32 // 35 // 33 // Author: Vladimir Ivanchenko 36 // Author: Vladimir Ivanchenko 34 // 37 // 35 // Creation date: 07.03.2008 38 // Creation date: 07.03.2008 36 // 39 // 37 // Modifications: 40 // Modifications: 38 // 07.04.2009 V.Ivanchenko moved msc methods f << 41 // 39 // 26.03.2012 V.Ivanchenko added transport x-s << 40 // 42 // 41 // Class Description: 43 // Class Description: 42 // 44 // 43 // General interface to msc models 45 // General interface to msc models 44 46 45 // ------------------------------------------- 47 // ------------------------------------------------------------------- 46 // 48 // >> 49 47 #ifndef G4VMscModel_h 50 #ifndef G4VMscModel_h 48 #define G4VMscModel_h 1 51 #define G4VMscModel_h 1 49 52 50 #include <CLHEP/Units/SystemOfUnits.h> << 51 << 52 #include "G4VEmModel.hh" 53 #include "G4VEmModel.hh" 53 #include "G4MscStepLimitType.hh" 54 #include "G4MscStepLimitType.hh" 54 #include "globals.hh" 55 #include "globals.hh" 55 #include "G4ThreeVector.hh" << 56 #include "G4Track.hh" << 57 #include "G4SafetyHelper.hh" << 58 #include "G4PhysicsTable.hh" << 59 #include "G4ThreeVector.hh" << 60 #include <vector> << 61 << 62 class G4ParticleChangeForMSC; << 63 class G4ParticleDefinition; << 64 class G4VEnergyLossProcess; << 65 56 66 class G4VMscModel : public G4VEmModel 57 class G4VMscModel : public G4VEmModel 67 { 58 { 68 59 69 public: 60 public: 70 61 71 explicit G4VMscModel(const G4String& nam); << 62 G4VMscModel(const G4String& nam); 72 << 73 ~G4VMscModel() override; << 74 << 75 virtual G4double ComputeTruePathLengthLimit( << 76 G4double& stepLimit) = 0; << 77 << 78 virtual G4double ComputeGeomPathLength(G4dou << 79 << 80 virtual G4double ComputeTrueStepLength(G4dou << 81 << 82 virtual G4ThreeVector& SampleScattering(cons << 83 G4double safety) = 0; << 84 << 85 void InitialiseParameters(const G4ParticleDe << 86 << 87 void DumpParameters(std::ostream& out) const << 88 63 89 // empty method << 64 virtual ~G4VMscModel(); 90 void SampleSecondaries(std::vector<G4Dynamic << 91 const G4MaterialCutsCouple*, << 92 const G4DynamicParticle*, << 93 G4double tmin, G4double tmax) override; << 94 65 95 //========================================== << 96 // Set parameters of multiple scattering mo << 97 //========================================== << 98 << 99 inline void SetStepLimitType(G4MscStepLimitT 66 inline void SetStepLimitType(G4MscStepLimitType); 100 67 101 inline void SetLateralDisplasmentFlag(G4bool 68 inline void SetLateralDisplasmentFlag(G4bool val); 102 69 103 inline void SetRangeFactor(G4double); 70 inline void SetRangeFactor(G4double); 104 71 105 inline void SetGeomFactor(G4double); 72 inline void SetGeomFactor(G4double); 106 73 107 inline void SetSkin(G4double); 74 inline void SetSkin(G4double); 108 75 109 inline void SetLambdaLimit(G4double); << 110 << 111 inline void SetSafetyFactor(G4double); << 112 << 113 inline void SetSampleZ(G4bool); << 114 << 115 //========================================== << 116 // Get/Set access to Physics Tables << 117 //========================================== << 118 << 119 inline G4VEnergyLossProcess* GetIonisation() << 120 << 121 inline void SetIonisation(G4VEnergyLossProce << 122 const G4ParticleDefinition* part); << 123 << 124 //========================================== << 125 // Run time methods << 126 //========================================== << 127 << 128 protected: << 129 << 130 // initialisation of the ParticleChange for << 131 // initialisation of interface with geometry << 132 G4ParticleChangeForMSC* << 133 GetParticleChangeForMSC(const G4ParticleDefi << 134 << 135 // convert true length to geometry length << 136 inline G4double ConvertTrueToGeom(G4double& << 137 << 138 // should be set before initialisation << 139 inline void SetUseSplineForMSC(G4bool val); << 140 << 141 public: << 142 << 143 // compute safety << 144 inline G4double ComputeSafety(const G4ThreeV << 145 G4double limit= DBL_MAX); << 146 << 147 // compute linear distance to a geometry bou << 148 inline G4double ComputeGeomLimit(const G4Tra << 149 G4double limit); << 150 << 151 G4double GetDEDX(const G4ParticleDefinition* << 152 G4double kineticEner << 153 const G4MaterialCuts << 154 << 155 G4double GetDEDX(const G4ParticleDefinition* << 156 G4double kineticEner << 157 const G4MaterialCuts << 158 G4double logKineticE << 159 << 160 G4double GetRange(const G4ParticleDefinition << 161 G4double kineticEne << 162 const G4MaterialCut << 163 << 164 G4double GetRange(const G4ParticleDefinition << 165 G4double kineticEne << 166 const G4MaterialCut << 167 G4double logKinetic << 168 << 169 G4double GetEnergy(const G4ParticleDefinitio << 170 G4double range, << 171 const G4MaterialCutsCouple* couple); << 172 << 173 // G4MaterialCutsCouple should be defined be << 174 inline << 175 G4double GetTransportMeanFreePath(const G4Pa << 176 G4double k << 177 << 178 inline << 179 G4double GetTransportMeanFreePath(const G4Pa << 180 G4double k << 181 G4double l << 182 << 183 // hide assignment operator << 184 G4VMscModel & operator=(const G4VMscModel & << 185 G4VMscModel(const G4VMscModel&) = delete; << 186 << 187 private: 76 private: 188 77 189 G4SafetyHelper* safetyHelper = nullptr; << 78 // hide assignment operator 190 G4VEnergyLossProcess* ionisation = nullptr; << 79 G4VMscModel & operator=(const G4VMscModel &right); 191 const G4ParticleDefinition* currentPart = nu << 80 G4VMscModel(const G4VMscModel&); 192 << 193 G4double dedx = 0.0; << 194 G4double localtkin = 0.0; << 195 G4double localrange = DBL_MAX; << 196 81 197 protected: 82 protected: 198 83 199 G4double facrange = 0.04; << 84 G4double facrange; 200 G4double facgeom = 2.5; << 85 G4double facgeom; 201 G4double facsafety = 0.6; << 86 G4double facsafety; 202 G4double skin = 1.0; << 87 G4double skin; 203 G4double dtrl = 0.05; << 88 G4double dtrl; 204 G4double lambdalimit; 89 G4double lambdalimit; 205 G4double geomMin; << 206 G4double geomMax; << 207 90 208 G4ThreeVector fDisplacement; << 209 G4MscStepLimitType steppingAlgorithm; 91 G4MscStepLimitType steppingAlgorithm; 210 92 211 G4bool samplez = false; << 93 G4bool samplez; 212 G4bool latDisplasment = true; << 94 G4bool latDisplasment; 213 << 214 private: << 215 95 216 G4bool useSpline = true; << 217 }; 96 }; 218 97 219 //....oooOO0OOooo........oooOO0OOooo........oo 98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 220 //....oooOO0OOooo........oooOO0OOooo........oo 99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 221 100 222 inline void G4VMscModel::SetLateralDisplasment 101 inline void G4VMscModel::SetLateralDisplasmentFlag(G4bool val) 223 { 102 { 224 if(!IsLocked()) { latDisplasment = val; } << 103 latDisplasment = val; 225 } 104 } 226 105 227 //....oooOO0OOooo........oooOO0OOooo........oo 106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 228 107 229 inline void G4VMscModel::SetSkin(G4double val) 108 inline void G4VMscModel::SetSkin(G4double val) 230 { 109 { 231 if(!IsLocked()) { skin = val; } << 110 skin = val; 232 } 111 } 233 112 234 //....oooOO0OOooo........oooOO0OOooo........oo 113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 235 114 236 inline void G4VMscModel::SetRangeFactor(G4doub 115 inline void G4VMscModel::SetRangeFactor(G4double val) 237 { 116 { 238 if(!IsLocked()) { facrange = val; } << 117 facrange = val; 239 } 118 } 240 119 241 //....oooOO0OOooo........oooOO0OOooo........oo 120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 242 121 243 inline void G4VMscModel::SetGeomFactor(G4doubl 122 inline void G4VMscModel::SetGeomFactor(G4double val) 244 { 123 { 245 if(!IsLocked()) { facgeom = val; } << 124 facgeom = val; 246 } << 247 << 248 //....oooOO0OOooo........oooOO0OOooo........oo << 249 << 250 inline void G4VMscModel::SetLambdaLimit(G4doub << 251 { << 252 if(!IsLocked()) { lambdalimit = val; } << 253 } << 254 << 255 //....oooOO0OOooo........oooOO0OOooo........oo << 256 << 257 inline void G4VMscModel::SetSafetyFactor(G4dou << 258 { << 259 if(!IsLocked()) { facsafety = val; } << 260 } 125 } 261 126 262 //....oooOO0OOooo........oooOO0OOooo........oo 127 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 263 128 264 inline void G4VMscModel::SetStepLimitType(G4Ms 129 inline void G4VMscModel::SetStepLimitType(G4MscStepLimitType val) 265 { 130 { 266 if(!IsLocked()) { steppingAlgorithm = val; } << 131 steppingAlgorithm = val; 267 } << 268 << 269 //....oooOO0OOooo........oooOO0OOooo........oo << 270 << 271 inline void G4VMscModel::SetSampleZ(G4bool val << 272 { << 273 if(!IsLocked()) { samplez = val; } << 274 } << 275 << 276 //....oooOO0OOooo........oooOO0OOooo........oo << 277 << 278 inline G4double G4VMscModel::ComputeSafety(con << 279 G4double limit) << 280 { << 281 return safetyHelper->ComputeSafety(position << 282 } << 283 << 284 //....oooOO0OOooo........oooOO0OOooo........oo << 285 << 286 inline G4double G4VMscModel::ConvertTrueToGeom << 287 G4double& glength) << 288 { << 289 glength = ComputeGeomPathLength(tlength); << 290 // should return true length << 291 return tlength; << 292 } << 293 << 294 //....oooOO0OOooo........oooOO0OOooo........oo << 295 << 296 inline G4double G4VMscModel::ComputeGeomLimit( << 297 G4double& presafety, << 298 G4double limit) << 299 { << 300 return safetyHelper->CheckNextStep( << 301 track.GetStep()->GetPreStepPoint()-> << 302 track.GetMomentumDirection(), << 303 limit, presafety); << 304 } << 305 << 306 //....oooOO0OOooo........oooOO0OOooo........oo << 307 << 308 inline G4VEnergyLossProcess* G4VMscModel::GetI << 309 { << 310 return ionisation; << 311 } << 312 << 313 //....oooOO0OOooo........oooOO0OOooo........oo << 314 << 315 inline void G4VMscModel::SetIonisation(G4VEner << 316 const G4ParticleDefinition* par << 317 { << 318 ionisation = p; << 319 currentPart = part; << 320 } << 321 << 322 //....oooOO0OOooo........oooOO0OOooo........oo << 323 << 324 inline G4double << 325 G4VMscModel::GetTransportMeanFreePath(const G4 << 326 G4double << 327 { << 328 G4double x; << 329 if (nullptr != xSectionTable) { << 330 x = pFactor*(*xSectionTable)[basedCoupleIn << 331 } else { << 332 x = pFactor*CrossSectionPerVolume(pBaseMat << 333 } << 334 return (x > 0.0) ? 1.0/x : DBL_MAX; << 335 } << 336 << 337 //....oooOO0OOooo........oooOO0OOooo........oo << 338 << 339 inline G4double << 340 G4VMscModel::GetTransportMeanFreePath(const G4 << 341 G4double << 342 { << 343 G4double x; << 344 if (nullptr != xSectionTable) { << 345 x = pFactor*(*xSectionTable)[basedCoupleIn << 346 } else { << 347 x = pFactor*CrossSectionPerVolume(pBaseMat << 348 } << 349 return (x > 0.0) ? 1.0/x : DBL_MAX; << 350 } << 351 << 352 //....oooOO0OOooo........oooOO0OOooo........oo << 353 << 354 inline void G4VMscModel::SetUseSplineForMSC(G4 << 355 { << 356 useSpline = val; << 357 } 132 } 358 133 359 //....oooOO0OOooo........oooOO0OOooo........oo 134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 360 135 361 #endif 136 #endif >> 137 362 138