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