Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4DNARPWBAExcitationModel.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// Reference:
27// A.D. Dominguez-Munoz, M.I. Gallardo, M.C. Bordage,
28// Z. Francis, S. Incerti, M.A. Cortes-Giraldo,
29// Radiat. Phys. Chem. 199 (2022) 110363.
30//
31// Class authors:
32// A.D. Dominguez-Munoz
33// M.A. Cortes-Giraldo (miancortes -at- us.es)
34//
35// Class creation: 2022-03-03
36//
37//
38
40#include "G4SystemOfUnits.hh"
43#include <map>
44using namespace std;
45
46//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
47
49 const G4ParticleDefinition*, const G4String& nam)
50 : G4VEmModel(nam)
51{
52 // Verbosity scale:
53 // 0 = nothing
54 // 1 = warning for energy non-conservation
55 // 2 = details of energy budget
56 // 3 = calculation of cross sections, file openings, sampling of atoms
57 // 4 = entering in methods
58 if(verboseLevel > 0)
59 {
60 G4cout << "RPWBA excitation model is constructed " << G4endl;
61 }
62}
63
64//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
65
67
68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
69
71 const G4DataVector& /*cuts*/)
72{
73 if(isInitialised)
74 {
75 return;
76 }
77 if(verboseLevel > 3)
78 {
79 G4cout << "Calling G4DNARPWBAExcitationModel::Initialise()" << G4endl;
80 }
81
82 if(fParticleDefinition != nullptr && fParticleDefinition != particle)
83 {
84 G4Exception("G4DNARPWBAExcitationModel::Initialise", "em0001",
86 "Model already initialized for another particle type.");
87 }
88
89 fTableFile = "dna/sigma_excitation_p_RPWBA";
90 fLowEnergy = 100. * MeV;
91 fHighEnergy = 300. * MeV;
92
93 if(LowEnergyLimit() < fLowEnergy || HighEnergyLimit() > fHighEnergy)
94 {
96 ed << "Model is applicable from "<<fLowEnergy<<" to "<<fHighEnergy;
97 G4Exception("G4DNARPWBAExcitationModel::Initialise", "em0004",
98 FatalException, ed);
99 }
100
101 G4double scaleFactor = 1 * cm * cm;
102 fTableData = make_unique<G4DNACrossSectionDataSet>(new G4LogLogInterpolation,
103 eV, scaleFactor);
104 fTableData->LoadData(fTableFile);
105
106 if(verboseLevel > 0)
107 {
108 G4cout << "RPWBA excitation model is initialized " << G4endl
109 << "Energy range: " << LowEnergyLimit() / eV << " eV - "
110 << HighEnergyLimit() / keV << " keV for "
111 << particle->GetParticleName() << G4endl;
112 }
113
114 // Initialize water density pointer
115 if(G4Material::GetMaterial("G4_WATER") != nullptr){
116 fpMolWaterDensity =
118 G4Material::GetMaterial("G4_WATER"));
119 }else{
120 G4ExceptionDescription exceptionDescription;
121 exceptionDescription << "G4_WATER does not exist :";
122 G4Exception("G4DNARPWBAIonisationModel::Initialise", "em00020",
123 FatalException, exceptionDescription);
124 }
126 isInitialised = true;
127}
128
129//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
130
132 const G4Material* material, const G4ParticleDefinition* particleDefinition,
134{
135 if(verboseLevel > 3)
136 {
137 G4cout << "Calling CrossSectionPerVolume() of G4DNARPWBAExcitationModel"
138 << G4endl;
139 }
140
141 if(fTableData == nullptr)
142 {
143 G4ExceptionDescription exceptionDescription;
144 exceptionDescription << "No cross section data ";
145 G4Exception("G4DNARPWBAIonisationModel::CrossSectionPerVolume", "em00120",
146 FatalException, exceptionDescription);
147 }
148
149 if(particleDefinition != fParticleDefinition)
150 return 0;
151
152 // Calculate total cross section for model
153
154 G4double sigma = 0;
155
156 G4double waterDensity = (*fpMolWaterDensity)[material->GetIndex()];
157
158 if(ekin >= fLowEnergy && ekin <= fHighEnergy)
159 {
160 sigma = fTableData->FindValue(ekin);
161 }
162
163 if(verboseLevel > 2)
164 {
165 G4cout << "__________________________________" << G4endl;
166 G4cout << "G4DNARPWBAExcitationModel - XS INFO START" << G4endl;
167 G4cout << "Kinetic energy(eV)=" << ekin / eV
168 << " particle : " << particleDefinition->GetParticleName() << G4endl;
169 G4cout << "Cross section per water molecule (cm^2)=" << sigma / cm / cm
170 << G4endl;
171 G4cout << "Cross section per water molecule (cm^-1)="
172 << sigma * waterDensity / (1. / cm) << G4endl;
173 G4cout << "G4DNARPWBAExcitationModel - XS INFO END" << G4endl;
174 }
175
176 return sigma * waterDensity;
177}
178
179//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
180
182 std::vector<G4DynamicParticle*>* /*fvect*/,
183 const G4MaterialCutsCouple* /*couple*/,
184 const G4DynamicParticle* aDynamicParticle, G4double, G4double)
185{
186 if(verboseLevel > 3)
187 {
188 G4cout << "Calling SampleSecondaries() of G4DNARPWBAExcitationModel"
189 << G4endl;
190 }
191
192 G4double k = aDynamicParticle->GetKineticEnergy();
193
194 G4int level = RandomSelect(k);
195 G4double excitationEnergy = waterStructure.ExcitationEnergy(level);
196 G4double newEnergy = k - excitationEnergy;
197
198 if(newEnergy > 0)
199 {
201 aDynamicParticle->GetMomentumDirection());
202
203 if(!statCode){
205 }
206 else{
208 }
210 }
211
212 const G4Track* theIncomingTrack = fParticleChangeForGamma->GetCurrentTrack();
214 eExcitedMolecule, level, theIncomingTrack);
215}
216
217//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
218
220 const G4Material*, G4int level, const G4ParticleDefinition* particle,
221 G4double kineticEnergy)
222{
223 if(fParticleDefinition != particle)
224 {
225 G4Exception("G4DNARPWBAExcitationModel::GetPartialCrossSection",
226 "RPWBAParticleType", FatalException,
227 "Model initialized for another particle type.");
228 }
229
230 return fTableData->GetComponent(level)->FindValue(kineticEnergy);
231}
232
233//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
234
235G4int G4DNARPWBAExcitationModel::RandomSelect(G4double k)
236{
237 G4int level = 0;
238
239 auto valuesBuffer = new G4double[fTableData->NumberOfComponents()];
240 const auto n = (G4int)fTableData->NumberOfComponents();
241 G4int i(n);
242 G4double value = 0.;
243
244 while(i > 0)
245 {
246 --i;
247 valuesBuffer[i] = fTableData->GetComponent(i)->FindValue(k);
248 value += valuesBuffer[i];
249 }
250
251 value *= G4UniformRand();
252 i = n;
253
254 while(i > 0)
255 {
256 --i;
257
258 if(valuesBuffer[i] > value)
259 {
260 delete[] valuesBuffer;
261 return i;
262 }
263 value -= valuesBuffer[i];
264 }
265 delete[] valuesBuffer;
266
267 return level;
268}
@ eExcitedMolecule
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
#define G4UniformRand()
Definition Randomize.hh:52
static G4DNAChemistryManager * Instance()
void CreateWaterMolecule(ElectronicModification, G4int, const G4Track *)
const std::vector< G4double > * GetNumMolPerVolTableFor(const G4Material *) const
Retrieve a table of molecular densities (number of molecules per unit volume) in the G4 unit system f...
static G4DNAMolecularMaterial * Instance()
G4DNARPWBAExcitationModel(const G4ParticleDefinition *p=nullptr, const G4String &nam="DNARPWBAExcitationModel")
void Initialise(const G4ParticleDefinition *, const G4DataVector &= *(new G4DataVector())) override
~G4DNARPWBAExcitationModel() override
G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax) override
G4ParticleChangeForGamma * fParticleChangeForGamma
G4double GetPartialCrossSection(const G4Material *, G4int level, const G4ParticleDefinition *, G4double kineticEnergy) override
void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
std::size_t GetIndex() const
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
const G4String & GetParticleName() const
G4ParticleChangeForGamma * GetParticleChangeForGamma()
G4double LowEnergyLimit() const
G4double HighEnergyLimit() const
const G4Track * GetCurrentTrack() const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)