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