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: G4WentzelVIModel.hh,v 1.29 2010-05-27 14:22:05 vnivanch Exp $ >> 27 // GEANT4 tag $Name: not supported by cvs2svn $ 26 // 28 // 27 // ------------------------------------------- 29 // ------------------------------------------------------------------- 28 // 30 // 29 // 31 // 30 // GEANT4 Class header file 32 // GEANT4 Class header file 31 // 33 // 32 // 34 // 33 // File name: G4WentzelVIModel 35 // File name: G4WentzelVIModel 34 // 36 // 35 // Author: V.Ivanchenko 37 // Author: V.Ivanchenko 36 // 38 // 37 // Creation date: 09.04.2008 from G4MuMscModel 39 // Creation date: 09.04.2008 from G4MuMscModel 38 // 40 // 39 // Modifications: 41 // Modifications: 40 // 27-05-2010 V.Ivanchenko added G4WentzelOKan 42 // 27-05-2010 V.Ivanchenko added G4WentzelOKandVIxSection class to 41 // compute cross sections and sam 43 // compute cross sections and sample scattering angle 42 // 44 // 43 // Class Description: 45 // Class Description: 44 // 46 // 45 // Implementation of the model of multiple sca 47 // Implementation of the model of multiple scattering based on 46 // G.Wentzel, Z. Phys. 40 (1927) 590. 48 // G.Wentzel, Z. Phys. 40 (1927) 590. 47 // H.W.Lewis, Phys Rev 78 (1950) 526. 49 // H.W.Lewis, Phys Rev 78 (1950) 526. 48 // J.M. Fernandez-Varea et al., NIM B73 (1993) 50 // J.M. Fernandez-Varea et al., NIM B73 (1993) 447. 49 // L.Urban, CERN-OPEN-2006-077. 51 // L.Urban, CERN-OPEN-2006-077. 50 52 51 // ------------------------------------------- 53 // ------------------------------------------------------------------- 52 // 54 // 53 55 54 #ifndef G4WentzelVIModel_h 56 #ifndef G4WentzelVIModel_h 55 #define G4WentzelVIModel_h 1 57 #define G4WentzelVIModel_h 1 56 58 57 //....oooOO0OOooo........oooOO0OOooo........oo 59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 58 60 59 #include "G4VMscModel.hh" 61 #include "G4VMscModel.hh" >> 62 #include "G4PhysicsTable.hh" 60 #include "G4MaterialCutsCouple.hh" 63 #include "G4MaterialCutsCouple.hh" 61 #include "G4WentzelOKandVIxSection.hh" 64 #include "G4WentzelOKandVIxSection.hh" 62 65 >> 66 class G4ParticleDefinition; >> 67 class G4LossTableManager; >> 68 class G4NistManager; >> 69 class G4Pow; >> 70 63 //....oooOO0OOooo........oooOO0OOooo........oo 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 64 72 65 class G4WentzelVIModel : public G4VMscModel 73 class G4WentzelVIModel : public G4VMscModel 66 { 74 { 67 75 68 public: 76 public: 69 77 70 explicit G4WentzelVIModel(G4bool comb=true, << 78 G4WentzelVIModel(const G4String& nam = "WentzelVIUni"); 71 << 72 ~G4WentzelVIModel() override; << 73 << 74 void Initialise(const G4ParticleDefinition*, << 75 << 76 void InitialiseLocal(const G4ParticleDefinit << 77 G4VEmModel* masterModel) override; << 78 << 79 void StartTracking(G4Track*) override; << 80 << 81 G4double ComputeCrossSectionPerAtom(const G4 << 82 G4double KineticEnergy, << 83 G4double AtomicNumber, << 84 G4double AtomicWeight=0., << 85 G4double cut = DBL_MAX, << 86 G4double emax= DBL_MAX) override << 87 << 88 G4ThreeVector& SampleScattering(const G4Thre << 89 G4double safety) override; << 90 << 91 G4double << 92 ComputeTruePathLengthLimit(const G4Track& tr << 93 G4double& currentMinimalStep) overr << 94 << 95 G4double ComputeGeomPathLength(G4double true << 96 << 97 G4double ComputeTrueStepLength(G4double geom << 98 79 99 // defines low energy limit on energy transf << 80 virtual ~G4WentzelVIModel(); 100 void SetFixedCut(G4double); << 101 81 102 // low energy limit on energy transfer to at << 82 virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&); 103 G4double GetFixedCut() const; << 104 83 105 // access to cross section class << 84 virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*, 106 void SetWVICrossSection(G4WentzelOKandVIxSec << 85 G4double KineticEnergy, >> 86 G4double AtomicNumber, >> 87 G4double AtomicWeight=0., >> 88 G4double cut = DBL_MAX, >> 89 G4double emax= DBL_MAX); 107 90 108 G4WentzelOKandVIxSection* GetWVICrossSection << 91 virtual void SampleScattering(const G4DynamicParticle*, G4double safety); 109 92 110 void SetUseSecondMoment(G4bool); << 93 virtual G4double ComputeTruePathLengthLimit(const G4Track& track, >> 94 G4PhysicsTable* theLambdaTable, >> 95 G4double currentMinimalStep); 111 96 112 G4bool UseSecondMoment() const; << 97 virtual G4double ComputeGeomPathLength(G4double truePathLength); 113 98 114 G4PhysicsTable* GetSecondMomentTable(); << 99 virtual G4double ComputeTrueStepLength(G4double geomStepLength); 115 100 116 G4double SecondMoment(const G4ParticleDefini << 101 private: 117 const G4MaterialCutsCouple*, << 118 G4double kineticEnergy); << 119 << 120 void SetSingleScatteringFactor(G4double); << 121 << 122 void DefineMaterial(const G4MaterialCutsCoup << 123 << 124 G4WentzelVIModel & operator=(const G4Wentzel << 125 G4WentzelVIModel(const G4WentzelVIModel&) = << 126 102 127 protected: << 103 G4double ComputeXSectionPerVolume(); 128 104 129 G4double ComputeTransportXSectionPerVolume(G << 105 inline G4double GetLambda(G4double kinEnergy); 130 106 131 inline void SetupParticle(const G4ParticleDe 107 inline void SetupParticle(const G4ParticleDefinition*); 132 108 133 private: << 109 inline void DefineMaterial(const G4MaterialCutsCouple*); 134 << 135 G4double ComputeSecondMoment(const G4Particl << 136 G4double kineticEnergy); << 137 << 138 protected: << 139 110 >> 111 // hide assignment operator >> 112 G4WentzelVIModel & operator=(const G4WentzelVIModel &right); >> 113 G4WentzelVIModel(const G4WentzelVIModel&); >> 114 >> 115 G4LossTableManager* theManager; >> 116 G4NistManager* fNistManager; >> 117 G4ParticleChangeForMSC* fParticleChange; 140 G4WentzelOKandVIxSection* wokvi; 118 G4WentzelOKandVIxSection* wokvi; 141 const G4MaterialCutsCouple* currentCouple = << 119 G4Pow* fG4pow; 142 const G4Material* currentMaterial = nullptr; << 143 120 144 const G4ParticleDefinition* particle = nullp << 121 G4PhysicsTable* theLambdaTable; 145 G4ParticleChangeForMSC* fParticleChange = nu << 122 const G4DataVector* currentCuts; 146 const G4DataVector* currentCuts = nullptr; << 147 G4PhysicsTable* fSecondMoments = nullptr; << 148 123 149 G4double lowEnergyLimit; << 150 G4double tlimitminfix; 124 G4double tlimitminfix; 151 G4double ssFactor = 1.05; << 125 G4double invsqrt12; 152 G4double invssFactor = 1.0; << 153 126 154 // cache kinematics 127 // cache kinematics 155 G4double preKinEnergy = 0.0; << 128 G4double preKinEnergy; 156 G4double tPathLength = 0.0; << 129 G4double tPathLength; 157 G4double zPathLength = 0.0; << 130 G4double zPathLength; 158 G4double lambdaeff = 0.0; << 131 G4double lambdaeff; 159 G4double currentRange = 0.0; << 132 G4double currentRange; 160 G4double cosTetMaxNuc = 0.0; << 161 133 162 G4double fixedCut = -1.0; << 134 // data for single scattering mode >> 135 G4double xtsec; >> 136 std::vector<G4double> xsecn; >> 137 std::vector<G4double> prob; >> 138 G4int nelments; 163 139 164 // cache kinematics << 140 G4double numlimit; 165 G4double effKinEnergy = 0.0; << 166 141 167 // single scattering parameters << 142 // cache material 168 G4double cosThetaMin = 1.0; << 143 G4int currentMaterialIndex; 169 G4double cosThetaMax = -1.0; << 144 const G4MaterialCutsCouple* currentCouple; 170 G4double xtsec = 0.0; << 145 const G4Material* currentMaterial; 171 146 172 G4int currentMaterialIndex = 0; << 147 // single scattering parameters 173 size_t idx2 = 0; << 148 G4double cosThetaMin; >> 149 G4double cosThetaMax; >> 150 G4double cosTetMaxNuc; 174 151 175 // data for single scattering mode << 152 // projectile 176 G4int nelments = 0; << 153 const G4ParticleDefinition* particle; >> 154 G4double lowEnergyLimit; 177 155 178 // flags 156 // flags 179 G4bool singleScatteringMode; << 157 G4bool isInitialized; 180 G4bool isCombined; << 158 G4bool inside; 181 G4bool useSecondMoment; << 182 << 183 std::vector<G4double> xsecn; << 184 std::vector<G4double> prob; << 185 }; 159 }; 186 160 187 //....oooOO0OOooo........oooOO0OOooo........oo 161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 188 //....oooOO0OOooo........oooOO0OOooo........oo 162 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 189 163 190 inline void G4WentzelVIModel::SetupParticle(co << 164 inline 191 { << 165 void G4WentzelVIModel::DefineMaterial(const G4MaterialCutsCouple* cup) 192 // Initialise mass and charge << 166 { 193 if(p != particle) { << 167 if(cup != currentCouple) { 194 particle = p; << 168 currentCouple = cup; 195 wokvi->SetupParticle(p); << 169 currentMaterial = cup->GetMaterial(); >> 170 currentMaterialIndex = currentCouple->GetIndex(); 196 } 171 } 197 } 172 } 198 173 199 //....oooOO0OOooo........oooOO0OOooo........oo << 174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 200 << 201 inline void G4WentzelVIModel::SetFixedCut(G4do << 202 { << 203 fixedCut = val; << 204 } << 205 << 206 //....oooOO0OOooo........oooOO0OOooo........oo << 207 << 208 inline G4double G4WentzelVIModel::GetFixedCut( << 209 { << 210 return fixedCut; << 211 } << 212 << 213 //....oooOO0OOooo........oooOO0OOooo........oo << 214 175 215 inline void G4WentzelVIModel::SetWVICrossSecti << 176 inline >> 177 G4double G4WentzelVIModel::GetLambda(G4double e) 216 { 178 { 217 if(ptr != wokvi) { << 179 G4double x; 218 delete wokvi; << 180 if(theLambdaTable) { x = ((*theLambdaTable)[currentMaterialIndex])->Value(e); } 219 wokvi = ptr; << 181 else { x = CrossSection(currentCouple,particle,e, >> 182 (*currentCuts)[currentMaterialIndex]); 220 } 183 } >> 184 if(x > DBL_MIN) { x = 1./x; } >> 185 else { x = DBL_MAX; } >> 186 return x; 221 } 187 } 222 188 223 //....oooOO0OOooo........oooOO0OOooo........oo 189 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 224 190 225 inline G4WentzelOKandVIxSection* G4WentzelVIMo << 191 inline void G4WentzelVIModel::SetupParticle(const G4ParticleDefinition* p) 226 { << 227 return wokvi; << 228 } << 229 << 230 //....oooOO0OOooo........oooOO0OOooo........oo << 231 << 232 inline void G4WentzelVIModel::SetUseSecondMome << 233 { << 234 useSecondMoment = val; << 235 } << 236 << 237 //....oooOO0OOooo........oooOO0OOooo........oo << 238 << 239 inline G4bool G4WentzelVIModel::UseSecondMomen << 240 { << 241 return useSecondMoment; << 242 } << 243 << 244 //....oooOO0OOooo........oooOO0OOooo........oo << 245 << 246 inline G4PhysicsTable* G4WentzelVIModel::GetSe << 247 { << 248 return fSecondMoments; << 249 } << 250 << 251 //....oooOO0OOooo........oooOO0OOooo........oo << 252 << 253 inline G4double << 254 G4WentzelVIModel::SecondMoment(const G4Particl << 255 const G4MaterialCutsCouple* coupl << 256 G4double ekin) << 257 { 192 { 258 G4double x = 0.0; << 193 // Initialise mass and charge 259 if(useSecondMoment) { << 194 if(p != particle) { 260 DefineMaterial(couple); << 195 particle = p; 261 x = (fSecondMoments) ? << 196 wokvi->SetupParticle(p); 262 (*fSecondMoments)[(*theDensityIdx)[curre << 263 *(*theDensityFactor)[currentMaterialInde << 264 : ComputeSecondMoment(part, ekin); << 265 } 197 } 266 return x; << 267 } 198 } 268 199 269 //....oooOO0OOooo........oooOO0OOooo........oo 200 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 270 201 271 #endif 202 #endif 272 203 273 204