42 fKillBelowEnergy = 10*eV;
71 G4cout <<
"Calling G4DNAPTBElasticModel::Initialise()" <<
G4endl;
81 if(particle == electronDef)
88 "dna/sigma_elastic_e-_PTB_N2",
89 "dna/sigmadiff_cumulated_elastic_e-_PTB_N2",
97 "dna/sigma_elastic_e-_PTB_THF",
98 "dna/sigmadiff_cumulated_elastic_e-_PTB_THF",
105 "dna/sigma_elastic_e-_PTB_PY",
106 "dna/sigmadiff_cumulated_elastic_e-_PTB_PY",
113 "dna/sigma_elastic_e-_PTB_PU",
114 "dna/sigmadiff_cumulated_elastic_e-_PTB_PU",
121 "dna/sigma_elastic_e-_PTB_TMP",
122 "dna/sigmadiff_cumulated_elastic_e-_PTB_TMP",
129 "dna/sigma_elastic_e_champion",
130 "dna/sigmadiff_cumulated_elastic_e_champion",
139 "dna/sigma_elastic_e-_PTB_THF",
140 "dna/sigmadiff_cumulated_elastic_e-_PTB_THF",
147 "dna/sigma_elastic_e-_PTB_PY",
148 "dna/sigmadiff_cumulated_elastic_e-_PTB_PY",
155 "dna/sigma_elastic_e-_PTB_PY",
156 "dna/sigmadiff_cumulated_elastic_e-_PTB_PY",
163 "dna/sigma_elastic_e-_PTB_PU",
164 "dna/sigmadiff_cumulated_elastic_e-_PTB_PU",
171 "dna/sigma_elastic_e-_PTB_PU",
172 "dna/sigmadiff_cumulated_elastic_e-_PTB_PU",
179 "dna/sigma_elastic_e-_PTB_TMP",
180 "dna/sigmadiff_cumulated_elastic_e-_PTB_TMP",
196 if (verboseLevel > 2)
197 G4cout <<
"Loaded cross section files for PTB Elastic model" <<
G4endl;
201 G4cout <<
"PTB Elastic model is initialized " <<
G4endl;
207void G4DNAPTBElasticModel::ReadDiffCSFile(
const G4String& materialName,
220 G4Exception(
"G4DNAPTBElasticModel::ReadAllDiffCSFiles",
"em0006",
226 std::ostringstream fullFileName;
227 fullFileName << path <<
"/"<< file<<
".dat";
230 std::ifstream diffCrossSection (fullFileName.str().c_str());
232 std::stringstream endPath;
233 if (!diffCrossSection)
235 endPath <<
"Missing data file: "<<file;
236 G4Exception(
"G4DNAPTBElasticModel::Initialise",
"em0003",
240 tValuesVec[materialName][particleName].push_back(0.);
245 while(std::getline(diffCrossSection, line))
249 std::istringstream testIss(line);
259 else if(line.empty())
268 std::istringstream iss(line);
286 if (tDummy != tValuesVec[materialName][particleName].back())
289 tValuesVec[materialName][particleName].push_back(tDummy);
292 eValuesVect[materialName][particleName][tDummy].push_back(0.);
296 iss>>diffCrossSectionData[materialName][particleName][tDummy][eDummy];
299 if (eDummy != eValuesVect[materialName][particleName][tDummy].back()) eValuesVect[materialName][particleName][tDummy].push_back(eDummy);
312 if (verboseLevel > 3)
313 G4cout <<
"Calling CrossSectionPerVolume() of G4DNAPTBElasticModel" <<
G4endl;
319 fKillBelowEnergy =
GetLowELimit(materialName, particleName);
332 if (ekin < fKillBelowEnergy)
return DBL_MAX;
338 sigma = (*tableData)[materialName][particleName]->FindValue(ekin);
341 if (verboseLevel > 2)
343 G4cout <<
"__________________________________" <<
G4endl;
344 G4cout <<
"°°° G4DNAPTBElasticModel - XS INFO START" <<
G4endl;
345 G4cout <<
"°°° Kinetic energy(eV)=" << ekin/eV <<
" particle : " << particleName <<
G4endl;
346 G4cout <<
"°°° Cross section per molecule (cm^2)=" << sigma/cm/cm <<
G4endl;
347 G4cout <<
"°°° G4DNAPTBElasticModel - XS INFO END" <<
G4endl;
364 if (verboseLevel > 3)
365 G4cout <<
"Calling SampleSecondaries() of G4DNAPTBElasticModel" <<
G4endl;
372 fKillBelowEnergy =
GetLowELimit(materialName, particleName);
375 if (electronEnergy0 < fKillBelowEnergy)
382 else if (electronEnergy0>= fKillBelowEnergy && electronEnergy0 <
GetHighELimit(materialName, particleName) )
385 G4double cosTheta = RandomizeCosTheta(electronEnergy0, materialName);
394 G4double xDir = std::sqrt(1. - cosTheta*cosTheta);
396 xDir *= std::cos(phi);
397 yDir *= std::sin(phi);
400 G4ThreeVector zPrikeVers((xDir*xVers + yDir*yVers + cosTheta*zVers));
430 std::vector<double>::iterator t2 = std::upper_bound(tValuesVec[materialName][particleName].begin(),tValuesVec[materialName][particleName].end(), k);
431 std::vector<double>::iterator t1 = t2-1;
433 std::vector<double>::iterator e12 = std::upper_bound(eValuesVect[materialName][particleName][(*t1)].begin(),eValuesVect[materialName][particleName][(*t1)].end(), integrDiff);
434 std::vector<double>::iterator e11 = e12-1;
436 std::vector<double>::iterator e22 = std::upper_bound(eValuesVect[materialName][particleName][(*t2)].begin(),eValuesVect[materialName][particleName][(*t2)].end(), integrDiff);
437 std::vector<double>::iterator e21 = e22-1;
446 xs11 = diffCrossSectionData[materialName][particleName][valueT1][valueE11];
447 xs12 = diffCrossSectionData[materialName][particleName][valueT1][valueE12];
448 xs21 = diffCrossSectionData[materialName][particleName][valueT2][valueE21];
449 xs22 = diffCrossSectionData[materialName][particleName][valueT2][valueE22];
452 if (xs11==0 && xs12==0 && xs21==0 && xs22==0)
return (0.);
454 theta = QuadInterpolator ( valueE11, valueE12,
474 G4double value = std::exp(d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
488 G4double value = (d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
500 G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
501 G4double b = std::log10(xs2) - a*std::log10(e2);
502 G4double sigma = a*std::log10(e) + b;
503 G4double value = (std::pow(10.,sigma));
530 G4double interpolatedvalue1 = LinLinInterpolate(e11, e12, e, xs11, xs12);
531 G4double interpolatedvalue2 = LinLinInterpolate(e21, e22, e, xs21, xs22);
532 G4double value = LinLinInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
543 integrdiff = uniformRand;
549 cosTheta= std::cos(theta*pi/180);
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
Hep3Vector orthogonal() const
Hep3Vector cross(const Hep3Vector &) const
virtual G4double CrossSectionPerVolume(const G4Material *material, const G4String &materialName, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax)
CrossSectionPerVolume This method is mandatory for any model class. It finds and return the cross sec...
G4DNAPTBElasticModel(const G4String &applyToMaterial="all", const G4ParticleDefinition *p=0, const G4String &nam="DNAPTBElasticModel")
G4DNAPTBElasticModel Constructor.
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4String &materialName, const G4DynamicParticle *, G4ParticleChangeForGamma *particleChangeForGamma, G4double tmin, G4double tmax)
SampleSecondaries Method called after CrossSectionPerVolume if the process is the one which is select...
virtual ~G4DNAPTBElasticModel()
~G4DNAPTBElasticModel Destructor
virtual void Initialise(const G4ParticleDefinition *particle, const G4DataVector &, G4ParticleChangeForGamma *fpChangeForGamme=nullptr)
Initialise Mandatory method for every model class. The material/particle for which the model can be u...
const G4ThreeVector & GetMomentumDirection() const
const G4ParticleDefinition * GetParticleDefinition() const
G4double GetKineticEnergy() const
static G4Electron * ElectronDefinition()
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
const G4String & GetParticleName() const
TableMapData * GetTableData()
GetTableData.
void SetHighELimit(const G4String &material, const G4String &particle, G4double lim)
SetHighEnergyLimit.
std::map< G4String, std::map< G4String, G4DNACrossSectionDataSet *, std::less< G4String > > > TableMapData
void AddCrossSectionData(G4String materialName, G4String particleName, G4String fileCS, G4String fileDiffCS, G4double scaleFactor)
AddCrossSectionData Method used during the initialization of the model class to add a new material....
void SetLowELimit(const G4String &material, const G4String &particle, G4double lim)
SetLowEnergyLimit.
G4double GetHighELimit(const G4String &material, const G4String &particle)
GetHighEnergyLimit.
void LoadCrossSectionData(const G4String &particleName)
LoadCrossSectionData Method to loop on all the registered materials in the model and load the corresp...
G4double GetLowELimit(const G4String &material, const G4String &particle)
GetLowEnergyLimit.
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)