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 virtual ~G4WentzelVIModel(); 73 73 74 void Initialise(const G4ParticleDefinition*, << 74 virtual void Initialise(const G4ParticleDefinition*, >> 75 const G4DataVector&) override; 75 76 76 void InitialiseLocal(const G4ParticleDefinit << 77 virtual void InitialiseLocal(const G4ParticleDefinition*, 77 G4VEmModel* masterModel) override; << 78 G4VEmModel* masterModel) override; 78 79 79 void StartTracking(G4Track*) override; << 80 virtual void StartTracking(G4Track*) override; 80 81 81 G4double ComputeCrossSectionPerAtom(const G4 << 82 virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*, 82 G4double KineticEnergy, << 83 G4double KineticEnergy, 83 G4double AtomicNumber, << 84 G4double AtomicNumber, 84 G4double AtomicWeight=0., << 85 G4double AtomicWeight=0., 85 G4double cut = DBL_MAX, << 86 G4double cut = DBL_MAX, 86 G4double emax= DBL_MAX) override << 87 G4double emax= DBL_MAX) override; 87 88 88 G4ThreeVector& SampleScattering(const G4Thre << 89 virtual G4ThreeVector& SampleScattering(const G4ThreeVector&, 89 G4double safety) override; << 90 G4double safety) override; 90 91 91 G4double << 92 virtual G4double 92 ComputeTruePathLengthLimit(const G4Track& tr 93 ComputeTruePathLengthLimit(const G4Track& track, 93 G4double& currentMinimalStep) overr 94 G4double& currentMinimalStep) override; 94 95 95 G4double ComputeGeomPathLength(G4double true << 96 virtual G4double ComputeGeomPathLength(G4double truePathLength) override; 96 97 97 G4double ComputeTrueStepLength(G4double geom << 98 virtual G4double ComputeTrueStepLength(G4double geomStepLength) override; 98 99 99 // defines low energy limit on energy transf 100 // defines low energy limit on energy transfer to atomic electron 100 void SetFixedCut(G4double); << 101 inline void SetFixedCut(G4double); 101 102 102 // low energy limit on energy transfer to at 103 // low energy limit on energy transfer to atomic electron 103 G4double GetFixedCut() const; << 104 inline G4double GetFixedCut() const; 104 105 105 // access to cross section class 106 // access to cross section class 106 void SetWVICrossSection(G4WentzelOKandVIxSec << 107 inline void SetWVICrossSection(G4WentzelOKandVIxSection*); 107 108 108 G4WentzelOKandVIxSection* GetWVICrossSection << 109 inline G4WentzelOKandVIxSection* GetWVICrossSection(); 109 110 110 void SetUseSecondMoment(G4bool); << 111 inline void SetUseSecondMoment(G4bool); 111 112 112 G4bool UseSecondMoment() const; << 113 inline G4bool UseSecondMoment() const; 113 114 114 G4PhysicsTable* GetSecondMomentTable(); << 115 inline G4PhysicsTable* GetSecondMomentTable(); 115 116 116 G4double SecondMoment(const G4ParticleDefini << 117 inline G4double SecondMoment(const G4ParticleDefinition*, 117 const G4MaterialCutsCouple*, << 118 const G4MaterialCutsCouple*, 118 G4double kineticEnergy); << 119 G4double kineticEnergy); 119 120 120 void SetSingleScatteringFactor(G4double); 121 void SetSingleScatteringFactor(G4double); 121 122 122 void DefineMaterial(const G4MaterialCutsCoup 123 void DefineMaterial(const G4MaterialCutsCouple*); 123 124 124 G4WentzelVIModel & operator=(const G4Wentzel << 125 G4WentzelVIModel(const G4WentzelVIModel&) = << 126 << 127 protected: 125 protected: 128 126 129 G4double ComputeTransportXSectionPerVolume(G 127 G4double ComputeTransportXSectionPerVolume(G4double cosTheta); 130 128 131 inline void SetupParticle(const G4ParticleDe 129 inline void SetupParticle(const G4ParticleDefinition*); 132 130 133 private: 131 private: 134 132 135 G4double ComputeSecondMoment(const G4Particl 133 G4double ComputeSecondMoment(const G4ParticleDefinition*, 136 G4double kineticEnergy); 134 G4double kineticEnergy); 137 135 >> 136 // hide assignment operator >> 137 G4WentzelVIModel & operator=(const G4WentzelVIModel &right) = delete; >> 138 G4WentzelVIModel(const G4WentzelVIModel&) = delete; >> 139 138 protected: 140 protected: 139 141 140 G4WentzelOKandVIxSection* wokvi; 142 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 143 149 G4double lowEnergyLimit; << 150 G4double tlimitminfix; 144 G4double tlimitminfix; 151 G4double ssFactor = 1.05; << 145 G4double ssFactor; 152 G4double invssFactor = 1.0; << 146 G4double invssFactor; 153 147 154 // cache kinematics 148 // cache kinematics 155 G4double preKinEnergy = 0.0; << 149 G4double preKinEnergy; 156 G4double tPathLength = 0.0; << 150 G4double tPathLength; 157 G4double zPathLength = 0.0; << 151 G4double zPathLength; 158 G4double lambdaeff = 0.0; << 152 G4double lambdaeff; 159 G4double currentRange = 0.0; << 153 G4double currentRange; 160 G4double cosTetMaxNuc = 0.0; << 154 G4double cosTetMaxNuc; >> 155 >> 156 // cache material >> 157 G4int currentMaterialIndex; >> 158 const G4MaterialCutsCouple* currentCouple; >> 159 const G4Material* currentMaterial; >> 160 >> 161 const G4ParticleDefinition* particle; >> 162 G4ParticleChangeForMSC* fParticleChange; >> 163 const G4DataVector* currentCuts; 161 164 162 G4double fixedCut = -1.0; << 165 G4double invsqrt12; >> 166 G4double fixedCut; 163 167 164 // cache kinematics 168 // cache kinematics 165 G4double effKinEnergy = 0.0; << 169 G4double effKinEnergy; 166 170 167 // single scattering parameters 171 // single scattering parameters 168 G4double cosThetaMin = 1.0; << 172 G4double cosThetaMin; 169 G4double cosThetaMax = -1.0; << 173 G4double cosThetaMax; 170 G4double xtsec = 0.0; << 171 174 172 G4int currentMaterialIndex = 0; << 175 G4PhysicsTable* fSecondMoments; 173 size_t idx2 = 0; << 176 size_t idx2; 174 177 175 // data for single scattering mode 178 // data for single scattering mode 176 G4int nelments = 0; << 179 G4int minNCollisions; >> 180 G4int nelments; >> 181 std::vector<G4double> xsecn; >> 182 std::vector<G4double> prob; >> 183 >> 184 G4double xtsec; >> 185 G4double numlimit; >> 186 >> 187 // projectile >> 188 G4double lowEnergyLimit; 177 189 178 // flags 190 // flags 179 G4bool singleScatteringMode; 191 G4bool singleScatteringMode; 180 G4bool isCombined; 192 G4bool isCombined; 181 G4bool useSecondMoment; 193 G4bool useSecondMoment; 182 << 183 std::vector<G4double> xsecn; << 184 std::vector<G4double> prob; << 185 }; 194 }; 186 195 187 //....oooOO0OOooo........oooOO0OOooo........oo 196 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 188 //....oooOO0OOooo........oooOO0OOooo........oo 197 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 189 198 190 inline void G4WentzelVIModel::SetupParticle(co 199 inline void G4WentzelVIModel::SetupParticle(const G4ParticleDefinition* p) 191 { 200 { 192 // Initialise mass and charge 201 // Initialise mass and charge 193 if(p != particle) { 202 if(p != particle) { 194 particle = p; 203 particle = p; 195 wokvi->SetupParticle(p); 204 wokvi->SetupParticle(p); 196 } 205 } 197 } 206 } 198 207 199 //....oooOO0OOooo........oooOO0OOooo........oo 208 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 200 209 201 inline void G4WentzelVIModel::SetFixedCut(G4do 210 inline void G4WentzelVIModel::SetFixedCut(G4double val) 202 { 211 { 203 fixedCut = val; 212 fixedCut = val; 204 } 213 } 205 214 206 //....oooOO0OOooo........oooOO0OOooo........oo 215 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 207 216 208 inline G4double G4WentzelVIModel::GetFixedCut( 217 inline G4double G4WentzelVIModel::GetFixedCut() const 209 { 218 { 210 return fixedCut; 219 return fixedCut; 211 } 220 } 212 221 213 //....oooOO0OOooo........oooOO0OOooo........oo 222 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 214 223 215 inline void G4WentzelVIModel::SetWVICrossSecti 224 inline void G4WentzelVIModel::SetWVICrossSection(G4WentzelOKandVIxSection* ptr) 216 { 225 { 217 if(ptr != wokvi) { 226 if(ptr != wokvi) { 218 delete wokvi; 227 delete wokvi; 219 wokvi = ptr; 228 wokvi = ptr; 220 } 229 } 221 } 230 } 222 231 223 //....oooOO0OOooo........oooOO0OOooo........oo 232 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 224 233 225 inline G4WentzelOKandVIxSection* G4WentzelVIMo 234 inline G4WentzelOKandVIxSection* G4WentzelVIModel::GetWVICrossSection() 226 { 235 { 227 return wokvi; 236 return wokvi; 228 } 237 } 229 238 230 //....oooOO0OOooo........oooOO0OOooo........oo 239 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 231 240 232 inline void G4WentzelVIModel::SetUseSecondMome 241 inline void G4WentzelVIModel::SetUseSecondMoment(G4bool val) 233 { 242 { 234 useSecondMoment = val; 243 useSecondMoment = val; 235 } 244 } 236 245 237 //....oooOO0OOooo........oooOO0OOooo........oo 246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 238 247 239 inline G4bool G4WentzelVIModel::UseSecondMomen 248 inline G4bool G4WentzelVIModel::UseSecondMoment() const 240 { 249 { 241 return useSecondMoment; 250 return useSecondMoment; 242 } 251 } 243 252 244 //....oooOO0OOooo........oooOO0OOooo........oo 253 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 245 254 246 inline G4PhysicsTable* G4WentzelVIModel::GetSe 255 inline G4PhysicsTable* G4WentzelVIModel::GetSecondMomentTable() 247 { 256 { 248 return fSecondMoments; 257 return fSecondMoments; 249 } 258 } 250 259 251 //....oooOO0OOooo........oooOO0OOooo........oo 260 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 252 261 253 inline G4double 262 inline G4double 254 G4WentzelVIModel::SecondMoment(const G4Particl 263 G4WentzelVIModel::SecondMoment(const G4ParticleDefinition* part, 255 const G4MaterialCutsCouple* coupl 264 const G4MaterialCutsCouple* couple, 256 G4double ekin) 265 G4double ekin) 257 { 266 { 258 G4double x = 0.0; 267 G4double x = 0.0; 259 if(useSecondMoment) { 268 if(useSecondMoment) { 260 DefineMaterial(couple); 269 DefineMaterial(couple); 261 x = (fSecondMoments) ? 270 x = (fSecondMoments) ? 262 (*fSecondMoments)[(*theDensityIdx)[curre 271 (*fSecondMoments)[(*theDensityIdx)[currentMaterialIndex]]->Value(ekin, idx2) 263 *(*theDensityFactor)[currentMaterialInde 272 *(*theDensityFactor)[currentMaterialIndex]/(ekin*ekin) 264 : ComputeSecondMoment(part, ekin); 273 : ComputeSecondMoment(part, ekin); 265 } 274 } 266 return x; 275 return x; 267 } 276 } 268 277 269 //....oooOO0OOooo........oooOO0OOooo........oo 278 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 270 279 271 #endif 280 #endif 272 281 273 282