Geant4-11
G4WentzelVIRelModel.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// -------------------------------------------------------------------
28//
29// GEANT4 Class file
30//
31//
32// File name: G4WentzelVIRelModel
33//
34// Author: V.Ivanchenko
35//
36// Creation date: 08.06.2012 from G4WentzelVIRelModel
37//
38// Modifications:
39//
40// Class Description:
41//
42// Implementation of the model of multiple scattering based on
43// G.Wentzel, Z. Phys. 40 (1927) 590.
44// H.W.Lewis, Phys Rev 78 (1950) 526.
45// J.M. Fernandez-Varea et al., NIM B73 (1993) 447.
46// L.Urban, CERN-OPEN-2006-077.
47
48// -------------------------------------------------------------------
49//
50
51//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
52//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53
58#include "G4SystemOfUnits.hh"
59#include "G4Material.hh"
60#include "G4ElementVector.hh"
62#include "G4NistManager.hh"
63#include "G4EmParameters.hh"
64
65//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66
67std::vector<G4double> G4WentzelVIRelModel::effMass;
68
69#ifdef G4MULTITHREADED
70G4Mutex G4WentzelVIRelModel::WentzelVIRelModelMutex = G4MUTEX_INITIALIZER;
71#endif
72
74 G4WentzelVIModel(true, "WentzelVIRel")
75{
79}
80
81//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82
84{}
85
86//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87
89 const G4DataVector& cuts)
90{
91 // Access to materials
92 const G4ProductionCutsTable* theCoupleTable =
94 if(theCoupleTable->GetTableSize() != effMass.size()) {
96 }
97
99}
100
101//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
102
104{
105 if(cup != currentCouple) {
106 currentCouple = cup;
107 SetCurrentCouple(cup);
111 }
112}
113
114//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
115
117 const G4ParticleDefinition* p,
118 G4double kinEnergy,
120 G4double cutEnergy, G4double)
121{
122 G4double cross = 0.0;
123 if(p != particle) { SetupParticle(p); }
124 if(kinEnergy < lowEnergyLimit) { return cross; }
125 if(nullptr == CurrentCouple()) {
126 G4Exception("G4WentzelVIRelModel::ComputeCrossSectionPerAtom", "em0011",
127 FatalException, " G4MaterialCutsCouple is not defined");
128 return cross;
129 }
131 G4int iz = G4lrint(Z);
132 G4double tmass = (1 == iz) ? CLHEP::proton_mass_c2
134 wokvi->SetTargetMass(tmass);
136 if(cosTetMaxNuc < 1.0) {
137 G4double cost = wokvi->SetupTarget(iz, cutEnergy);
139 /*
140 //if(p->GetParticleName() == "e-")
141 G4cout << "G4WentzelVIRelModel::CS: Z= " << G4int(Z)
142 << " e(MeV)= " << kinEnergy
143 << " 1-cosN= " << 1 - cosTetMaxNuc << " cross(bn)= " << cross/barn
144 << " " << particle->GetParticleName() << G4endl;
145 */
146 }
147 return cross;
148}
149
150//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
151
153{
154 const G4ProductionCutsTable* theCoupleTable =
156 size_t ncouples = theCoupleTable->GetTableSize();
157#ifdef G4MULTITHREADED
158 G4MUTEXLOCK(&G4WentzelVIRelModel::WentzelVIRelModelMutex);
159 if(ncouples != effMass.size()) {
160#endif
161 effMass.resize(ncouples, 0.0);
162 for(size_t i=0; i<ncouples; ++i) {
163 const G4Material* mat =
164 theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial();
165 const G4ElementVector* elmVector = mat->GetElementVector();
166 G4int nelm = mat->GetNumberOfElements();
167 G4double sum = 0.0;
168 G4double norm= 0.0;
169 for(G4int j=0; j<nelm; ++j) {
170 G4int Z = (*elmVector)[j]->GetZasInt();
172 G4int Z2 = Z*Z;
173 sum += mass*Z2;
174 norm += Z2;
175 }
176 effMass[i] = sum/norm;
177 }
178#ifdef G4MULTITHREADED
179 }
180 G4MUTEXUNLOCK(&G4WentzelVIRelModel::WentzelVIRelModelMutex);
181#endif
182}
183
184//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::vector< const G4Element * > G4ElementVector
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
#define G4MUTEX_INITIALIZER
Definition: G4Threading.hh:85
#define G4MUTEXLOCK(mutex)
Definition: G4Threading.hh:251
#define G4MUTEXUNLOCK(mutex)
Definition: G4Threading.hh:254
std::mutex G4Mutex
Definition: G4Threading.hh:81
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
const G4Material * GetMaterial() const
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:186
size_t GetNumberOfElements() const
Definition: G4Material.hh:182
static G4NistManager * Instance()
G4double GetAtomicMassAmu(const G4String &symb) const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()
void SetCurrentCouple(const G4MaterialCutsCouple *)
Definition: G4VEmModel.hh:472
const G4MaterialCutsCouple * CurrentCouple() const
Definition: G4VEmModel.hh:490
G4double SetupTarget(G4int Z, G4double cut)
G4double ComputeTransportCrossSectionPerAtom(G4double CosThetaMax)
virtual G4double SetupKinematic(G4double kinEnergy, const G4Material *mat)
const G4MaterialCutsCouple * currentCouple
void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
void SetWVICrossSection(G4WentzelOKandVIxSection *)
G4WentzelOKandVIxSection * GetWVICrossSection()
const G4ParticleDefinition * particle
const G4Material * currentMaterial
void SetupParticle(const G4ParticleDefinition *)
G4WentzelOKandVIxSection * wokvi
void DefineMaterial(const G4MaterialCutsCouple *cup)
G4NistManager * fNistManager
static std::vector< G4double > effMass
G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double KineticEnergy, G4double AtomicNumber, G4double AtomicWeight=0., G4double cut=DBL_MAX, G4double emax=DBL_MAX) override
void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
static constexpr double amu_c2
static constexpr double proton_mass_c2
float amu_c2
Definition: hepunit.py:276
int G4lrint(double ad)
Definition: templates.hh:134