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