50 killBelowEnergy = 100 * eV;
51 lowEnergyLimit = 0 * eV;
52 highEnergyLimit = 1 * MeV;
66 G4cout <<
"Ion elastic model is constructed " <<
G4endl<<
"Energy range: "
67 << lowEnergyLimit / eV <<
" eV - "
68 << highEnergyLimit / MeV <<
" MeV"
73 fpMolWaterDensity =
nullptr;
74 fpTableData =
nullptr;
100 G4cout <<
"Calling G4DNAIonElasticModel::Initialise()" <<
G4endl;
107 G4cout <<
"G4DNAIonElasticModel: low energy limit increased from " <<
114 G4cout <<
"G4DNAIonElasticModel: high energy limit decreased from " <<
127 G4Exception(
"G4IonElasticModel::Initialise",
"em0006",
133 std::ostringstream fullFileName;
143 G4String proton, hydrogen, helium, alphaplus, alphaplusplus;
146 (particleDefinition == protonDef && protonDef !=
nullptr)
148 (particleDefinition == hydrogenDef && hydrogenDef !=
nullptr)
153 totalXSFile =
"dna/sigma_elastic_proton_HTran";
156 fullFileName << path <<
"/dna/sigmadiff_cumulated_elastic_proton_HTran.dat";
160 (particleDefinition == instance->
GetIon(
"helium") && (heliumDef !=
nullptr))
162 (particleDefinition == instance->
GetIon(
"alpha+") && (alphaplusDef !=
nullptr))
164 (particleDefinition == instance->
GetIon(
"alpha++") && (alphaplusplusDef !=
nullptr))
169 totalXSFile =
"dna/sigma_elastic_alpha_HTran";
172 fullFileName << path <<
"/dna/sigmadiff_cumulated_elastic_alpha_HTran.dat";
177 std::ifstream diffCrossSection(fullFileName.str().c_str());
179 if (!diffCrossSection)
182 description <<
"Missing data file:"
183 <<fullFileName.str().c_str()<<
G4endl;
184 G4Exception(
"G4IonElasticModel::Initialise",
"em0003",
193 fDiffCrossSectionData.clear();
197 eTdummyVec.push_back(0.);
199 while(!diffCrossSection.eof())
203 diffCrossSection>>tDummy>>eDummy;
207 if (tDummy != eTdummyVec.back())
209 eTdummyVec.push_back(tDummy);
210 eVecm[tDummy].push_back(0.);
213 diffCrossSection>>fDiffCrossSectionData[tDummy][eDummy];
215 if (eDummy != eVecm[tDummy].back()) eVecm[tDummy].push_back(eDummy);
222 if (verboseLevel > 2)
224 G4cout <<
"Loaded cross section files for ion elastic model" <<
G4endl;
238 if (isInitialised)
return;
240 isInitialised =
true;
252 G4cout <<
"Calling CrossSectionPerVolume() of G4DNAIonElasticModel"
264 if (ekin <= highEnergyLimit)
267 if (ekin < killBelowEnergy)
return DBL_MAX;
270 if (fpTableData !=
nullptr)
276 G4Exception(
"G4DNAIonElasticModel::ComputeCrossSectionPerVolume",
"em0002",
281 if (verboseLevel > 2)
283 G4cout <<
"__________________________________" <<
G4endl;
284 G4cout <<
"G4DNAIonElasticModel - XS INFO START" <<
G4endl;
285 G4cout <<
"Kinetic energy(eV)=" << ekin/eV <<
" particle : " << particleName <<
G4endl;
286 G4cout <<
"Cross section per water molecule (cm^2)=" << sigma/cm/cm <<
G4endl;
287 G4cout <<
"Cross section per water molecule (cm^-1)=" << sigma*waterDensity/(1./cm) <<
G4endl;
288 G4cout <<
"G4DNAIonElasticModel - XS INFO END" <<
G4endl;
291 return sigma*waterDensity;
298 std::vector<G4DynamicParticle*>* ,
305 G4cout <<
"Calling SampleSecondaries() of G4DNAIonElasticModel" <<
G4endl;
310 if (particleEnergy0 < killBelowEnergy)
318 if (particleEnergy0>= killBelowEnergy && particleEnergy0 <= highEnergyLimit)
326 G4double theta = std::atan(std::sin(thetaCM*CLHEP::pi/180)
327 /(fParticle_Mass/water_mass+std::cos(thetaCM*CLHEP::pi/180)));
339 G4double xDir = std::sqrt(1. - cosTheta*cosTheta);
341 xDir *= std::cos(phi);
342 yDir *= std::sin(phi);
344 G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers));
351 depositEnergyCM = 4. * particleEnergy0 * fParticle_Mass * water_mass *
352 (1-std::cos(thetaCM*CLHEP::pi/180))
353 / (2 * std::pow((fParticle_Mass+water_mass),2));
356 if (!statCode && (particleEnergy0 >= depositEnergyCM) )
385 if (k==eTdummyVec.back()) k=k*(1.-1e-12);
388 auto t2 = std::upper_bound(eTdummyVec.begin(),
389 eTdummyVec.end(), k);
392 auto e12 = std::upper_bound(eVecm[(*t1)].begin(),
397 auto e22 = std::upper_bound(eVecm[(*t2)].begin(),
409 xs11 = fDiffCrossSectionData[valueT1][valueE11];
410 xs12 = fDiffCrossSectionData[valueT1][valueE12];
411 xs21 = fDiffCrossSectionData[valueT2][valueE21];
412 xs22 = fDiffCrossSectionData[valueT2][valueE22];
414 if(xs11 == 0 && xs12 == 0 && xs21 == 0 && xs22 == 0)
return (0.);
416 theta = QuadInterpolator(valueE11, valueE12, valueE21, valueE22, xs11, xs12,
417 xs21, xs22, valueT1, valueT2, k, integrDiff);
430 G4double value = (d1 + (d2 - d1) * (e - e1) / (e2 - e1));
442 G4double value =
G4Exp(d1 + (d2 - d1) * (e - e1) / (e2 - e1));
452 G4double a = (std::log10(xs2) - std::log10(xs1))
453 / (std::log10(e2) - std::log10(e1));
454 G4double b = std::log10(xs2) - a * std::log10(e2);
455 G4double sigma = a * std::log10(e) + b;
456 G4double value = (std::pow(10., sigma));
485 G4double interpolatedvalue1 = LinLinInterpolate(e11, e12, e, xs11, xs12);
486 G4double interpolatedvalue2 = LinLinInterpolate(e21, e22, e, xs21, xs22);
487 G4double value = LinLinInterpolate(t1, t2, t, interpolatedvalue1,
496G4DNAIonElasticModel::RandomizeThetaCM (
500 return Theta(particleDefinition, k / eV, integrdiff);
508 killBelowEnergy = threshold;
510 if(killBelowEnergy < 100 * eV)
512 G4cout <<
"*** WARNING : the G4DNAIonElasticModel class is not "
513 "activated below 100 eV !"
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4GLOB_DLL std::ostream G4cout
Hep3Vector orthogonal() const
Hep3Vector cross(const Hep3Vector &) const
G4bool LoadData(const G4String &argFileName) override
G4double FindValue(G4double e, G4int componentId=0) const override
static G4DNAGenericIonsManager * Instance()
G4ParticleDefinition * GetIon(const G4String &name)
void SetKillBelowThreshold(G4double threshold)
void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
G4DNAIonElasticModel(const G4ParticleDefinition *p=nullptr, const G4String &nam="DNAIonElasticModel")
G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax) override
void Initialise(const G4ParticleDefinition *particuleDefinition, const G4DataVector &) override
G4ParticleChangeForGamma * fParticleChangeForGamma
~G4DNAIonElasticModel() override
static G4DNAMolecularMaterial * Instance()
const G4ThreeVector & GetMomentumDirection() const
G4ParticleDefinition * GetDefinition() 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
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
void SetHighEnergyLimit(G4double)
G4ParticleChangeForGamma * GetParticleChangeForGamma()
G4double LowEnergyLimit() const
G4double HighEnergyLimit() const
void SetLowEnergyLimit(G4double)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)