112 G4cout <<
"MicroElec inelastic model is constructed " <<
G4endl;
117 fAtomDeexcitation = 0;
133 TCSMap::iterator pos2;
134 for (pos2 = tableTCS.begin(); pos2 != tableTCS.end(); ++pos2) {
135 MapData* tableData = pos2->second;
136 std::map< G4String, G4MicroElecCrossSectionDataSet_new*, std::less<G4String> >::iterator pos;
137 for (pos = tableData->begin(); pos != tableData->end(); ++pos)
146 dataDiffCSMap::iterator iterator_proba;
149 for (iterator_proba = eNrjTransStorage.begin(); iterator_proba != eNrjTransStorage.end(); ++iterator_proba) {
150 vector<TriDimensionMap>* eNrjTransfData = iterator_proba->second;
151 eNrjTransfData->clear();
152 delete eNrjTransfData;
154 eNrjTransStorage.clear();
156 for (iterator_proba = pNrjTransStorage.begin(); iterator_proba != pNrjTransStorage.end(); ++iterator_proba) {
157 vector<TriDimensionMap>* pNrjTransfData = iterator_proba->second;
158 pNrjTransfData->clear();
159 delete pNrjTransfData;
161 pNrjTransStorage.clear();
164 for (iterator_proba = eDiffDatatable.begin(); iterator_proba != eDiffDatatable.end(); ++iterator_proba) {
165 vector<TriDimensionMap>* eDiffCrossSectionData = iterator_proba->second;
166 eDiffCrossSectionData->clear();
167 delete eDiffCrossSectionData;
169 eDiffDatatable.clear();
171 for (iterator_proba = pDiffDatatable.begin(); iterator_proba != pDiffDatatable.end(); ++iterator_proba) {
172 vector<TriDimensionMap>* pDiffCrossSectionData = iterator_proba->second;
173 pDiffCrossSectionData->clear();
174 delete pDiffCrossSectionData;
176 pDiffDatatable.clear();
179 dataProbaShellMap::iterator iterator_probaShell;
181 for (iterator_probaShell = eProbaShellStorage.begin(); iterator_probaShell != eProbaShellStorage.end(); ++iterator_probaShell) {
182 vector<VecMap>* eProbaShellMap = iterator_probaShell->second;
183 eProbaShellMap->clear();
184 delete eProbaShellMap;
186 eProbaShellStorage.clear();
188 for (iterator_probaShell = pProbaShellStorage.begin(); iterator_probaShell != pProbaShellStorage.end(); ++iterator_probaShell) {
189 vector<VecMap>* pProbaShellMap = iterator_probaShell->second;
190 pProbaShellMap->clear();
191 delete pProbaShellMap;
193 pProbaShellStorage.clear();
196 TranfEnergyMap::iterator iterator_nrjtransf;
197 for (iterator_nrjtransf = eVecmStorage.begin(); iterator_nrjtransf != eVecmStorage.end(); ++iterator_nrjtransf) {
198 VecMap* eVecm = iterator_nrjtransf->second;
202 eVecmStorage.clear();
203 for (iterator_nrjtransf = pVecmStorage.begin(); iterator_nrjtransf != pVecmStorage.end(); ++iterator_nrjtransf) {
204 VecMap* pVecm = iterator_nrjtransf->second;
208 pVecmStorage.clear();
211 incidentEnergyMap::iterator iterator_energy;
212 for (iterator_energy = eIncidentEnergyStorage.begin(); iterator_energy != eIncidentEnergyStorage.end(); ++iterator_energy) {
213 std::vector<G4double>* eTdummyVec = iterator_energy->second;
217 eIncidentEnergyStorage.clear();
219 for (iterator_energy = pIncidentEnergyStorage.begin(); iterator_energy != pIncidentEnergyStorage.end(); ++iterator_energy) {
220 std::vector<G4double>* pTdummyVec = iterator_energy->second;
224 pIncidentEnergyStorage.clear();
227 MapStructure::iterator iterator_matStructure;
228 for (iterator_matStructure = tableMaterialsStructures.begin(); iterator_matStructure != tableMaterialsStructures.end(); ++iterator_matStructure) {
229 currentMaterialStructure = iterator_matStructure->second;
230 delete currentMaterialStructure;
232 tableMaterialsStructures.clear();
233 currentMaterialStructure =
nullptr;
241 if (isInitialised) {
return; }
243 if (verboseLevel > 3)
244 G4cout <<
"Calling G4MicroElecInelasticModel_new::Initialise()" <<
G4endl;
246 char* path = std::getenv(
"G4LEDATA");
266 lowEnergyLimit[electron] = 2 * eV;
267 highEnergyLimit[electron] = 10.0 * MeV;
273 for (
G4int i = 0; i < numOfCouples; ++i) {
275 G4cout <<
"Material " << i + 1 <<
" / " << numOfCouples <<
" : " << material->
GetName() <<
G4endl;
276 if (material->
GetName() ==
"Vacuum")
continue;
278 MapData* tableData =
new MapData;
281 tableMaterialsStructures[mat] = currentMaterialStructure;
282 if (particle == electronDef) {
284 G4String fileElectron(
"Inelastic/" + modelName +
"_sigma_inelastic_e-_" + mat);
288 tableData->insert(make_pair(electron, tableE));
291 std::ostringstream eFullFileName;
293 eFullFileName << path <<
"/microelec/Inelastic/cumulated_" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat";
295 G4cout <<
"Inelastic/cumulated_" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat" <<
G4endl;
298 eFullFileName << path <<
"/microelec/Inelastic/" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat";
300 G4cout <<
"Inelastic/" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat" <<
G4endl;
303 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
304 if (!eDiffCrossSection)
306 std::stringstream ss;
307 ss <<
"Missing data " << eFullFileName.str().c_str();
308 std::string sortieString = ss.str();
310 if (fasterCode)
G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
314 G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
315 FatalException,
"Missing data file:/microelec/sigmadiff_inelastic_e_Si.dat");
324 vector<TriDimensionMap>* eDiffCrossSectionData =
new vector<TriDimensionMap>;
325 vector<TriDimensionMap>* eNrjTransfData =
new vector<TriDimensionMap>;
326 vector<VecMap>* eProbaShellMap =
new vector<VecMap>;
327 vector<G4double>* eTdummyVec =
new vector<G4double>;
328 VecMap* eVecm =
new VecMap;
330 for (
int j = 0; j < currentMaterialStructure->
NumberOfLevels(); j++)
332 eDiffCrossSectionData->push_back(TriDimensionMap());
333 eNrjTransfData->push_back(TriDimensionMap());
334 eProbaShellMap->push_back(VecMap());
337 eTdummyVec->push_back(0.);
338 while (!eDiffCrossSection.eof())
342 eDiffCrossSection >> tDummy >> eDummy;
343 if (tDummy != eTdummyVec->back()) eTdummyVec->push_back(tDummy);
346 for (
int j = 0; j < currentMaterialStructure->
NumberOfLevels(); j++)
348 eDiffCrossSection >> tmp;
349 (*eDiffCrossSectionData)[j][tDummy][eDummy] = tmp;
353 (*eNrjTransfData)[j][tDummy][(*eDiffCrossSectionData)[j][tDummy][eDummy]] = eDummy;
354 (*eProbaShellMap)[j][tDummy].push_back((*eDiffCrossSectionData)[j][tDummy][eDummy]);
357 if (!eDiffCrossSection.eof()) (*eDiffCrossSectionData)[j][tDummy][eDummy] *= scaleFactor;
358 (*eVecm)[tDummy].push_back(eDummy);
367 eNrjTransStorage[mat] = eNrjTransfData;
368 eProbaShellStorage[mat] = eProbaShellMap;
371 eDiffDatatable[mat] = eDiffCrossSectionData;
372 eVecmStorage[mat] = eVecm;
374 eIncidentEnergyStorage[mat] = eTdummyVec;
378 if (particle == protonDef)
381 G4String fileProton(
"Inelastic/" + modelName +
"_sigma_inelastic_p_" + mat);
G4cout << fileProton <<
G4endl;
384 tableData->insert(make_pair(proton, tableP));
387 std::ostringstream pFullFileName;
389 pFullFileName << path <<
"/microelec/Inelastic/cumulated_" + modelName +
"_sigmadiff_inelastic_p_" + mat +
".dat";
391 G4cout <<
"Inelastic/cumulated_" + modelName +
"_sigmadiff_inelastic_p_" + mat +
".dat" <<
G4endl;
394 pFullFileName << path <<
"/microelec/Inelastic/" + modelName +
"_sigmadiff_inelastic_p_" + mat +
".dat";
396 G4cout <<
"Inelastic/" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat" <<
G4endl;
399 std::ifstream pDiffCrossSection(pFullFileName.str().c_str());
400 if (!pDiffCrossSection)
402 if (fasterCode)
G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
403 FatalException,
"Missing data file:/microelec/sigmadiff_cumulated_inelastic_p_Si.dat");
405 G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
406 FatalException,
"Missing data file:/microelec/sigmadiff_inelastic_p_Si.dat");
416 vector<TriDimensionMap>* pDiffCrossSectionData =
new vector<TriDimensionMap>;
417 vector<TriDimensionMap>* pNrjTransfData =
new vector<TriDimensionMap>;
418 vector<VecMap>* pProbaShellMap =
new vector<VecMap>;
419 vector<G4double>* pTdummyVec =
new vector<G4double>;
420 VecMap* eVecm =
new VecMap;
422 for (
int j = 0; j < currentMaterialStructure->
NumberOfLevels(); j++)
426 pDiffCrossSectionData->push_back(TriDimensionMap());
427 pNrjTransfData->push_back(TriDimensionMap());
428 pProbaShellMap->push_back(VecMap());
431 pTdummyVec->push_back(0.);
432 while (!pDiffCrossSection.eof())
436 pDiffCrossSection >> tDummy >> eDummy;
437 if (tDummy != pTdummyVec->back()) pTdummyVec->push_back(tDummy);
440 for (
int j = 0; j < currentMaterialStructure->
NumberOfLevels(); j++)
442 pDiffCrossSection >> tmp;
443 (*pDiffCrossSectionData)[j][tDummy][eDummy] = tmp;
450 (*pNrjTransfData)[j][tDummy][(*pDiffCrossSectionData)[j][tDummy][eDummy]] = eDummy;
451 (*pProbaShellMap)[j][tDummy].push_back((*pDiffCrossSectionData)[j][tDummy][eDummy]);
454 if (!pDiffCrossSection.eof()) (*pDiffCrossSectionData)[j][tDummy][eDummy] *= scaleFactor;
455 (*eVecm)[tDummy].push_back(eDummy);
465 pNrjTransStorage[mat] = pNrjTransfData;
466 pProbaShellStorage[mat] = pProbaShellMap;
469 pDiffDatatable[mat] = pDiffCrossSectionData;
470 pVecmStorage[mat] = eVecm;
472 pIncidentEnergyStorage[mat] = pTdummyVec;
476 tableTCS[mat] = tableData;}
477 if (particle==electronDef)
483 if (particle==protonDef)
491 G4cout <<
"MicroElec Inelastic model is initialized " <<
G4endl
496 <<
" with mass (amu) " << particle->
GetPDGMass()/proton_mass_c2
504 isInitialised =
true;
515 if (verboseLevel > 3)
G4cout <<
"Calling CrossSectionPerVolume() of G4MicroElecInelasticModel" <<
G4endl;
519 currentMaterial = material->
GetName().substr(3, material->
GetName().size());
521 MapStructure::iterator structPos;
522 structPos = tableMaterialsStructures.find(currentMaterial);
525 TCSMap::iterator tablepos;
526 tablepos = tableTCS.find(currentMaterial);
528 if (tablepos == tableTCS.end() )
531 str += currentMaterial +
" TCS Table not found!";
535 else if(structPos == tableMaterialsStructures.end())
538 str += currentMaterial +
" Structure not found!";
543 MapData* tableData = tablepos->second;
544 currentMaterialStructure = structPos->second;
553 G4double Zeff = 1.0, Zeff2 = Zeff*Zeff;
556 if (Mion_c2 > proton_mass_c2)
558 ekin *= proton_mass_c2 / Mion_c2;
559 nameLocal =
"proton";
565 if (ekin >= lowLim && ekin < highLim)
567 std::map< G4String, G4MicroElecCrossSectionDataSet_new*, std::less<G4String> >::iterator pos;
568 pos = tableData->find(nameLocal);
570 if (pos != tableData->end())
577 if (Mion_c2 > proton_mass_c2) {
580 Zeff =
BKZ(ekin / (proton_mass_c2 / Mion_c2), Mion_c2 / c_squared, Z, currentMaterialStructure->
Energy(i));
595 G4Exception(
"G4MicroElecInelasticModel_new::CrossSectionPerVolume",
597 "Model not applicable to particle type.");
605 if (verboseLevel > 3)
607 G4cout <<
"---> Kinetic energy (eV)=" << ekin / eV <<
G4endl;
608 G4cout <<
" - Cross section per Si atom (cm^2)=" << sigma / cm2 <<
G4endl;
609 G4cout <<
" - Cross section per Si atom (cm^-1)=" << sigma*density / (1. / cm) <<
G4endl;
612 return (sigma)*density;}
625 if (verboseLevel > 3)
626 G4cout <<
"Calling SampleSecondaries() of G4MicroElecInelasticModel" <<
G4endl;
637 G4String nameLocal2 = particleName ;
639 G4double originalMass = particleMass;
642 if (particleMass > proton_mass_c2)
644 k *= proton_mass_c2/particleMass ;
646 nameLocal2 =
"proton" ;
649 if (k >= lowLim && k < highLim)
652 G4double totalEnergy = ekin + particleMass;
653 G4double pSquare = ekin * (totalEnergy + particleMass);
654 G4double totalMomentum = std::sqrt(pSquare);
658 Shell = RandomSelect(k,nameLocal2,originalMass, originalZ);
663 if (verboseLevel > 3)
665 G4cout <<
"---> Kinetic energy (eV)=" << k/eV <<
G4endl ;
666 G4cout <<
"Shell: " << Shell <<
", energy: " << bindingEnergy/eV <<
G4endl;
671 G4int secNumberInit = 0;
672 G4int secNumberFinal = 0;
676 if (k<limitEnergy)
return;
678 G4int Z = currentMaterialStructure->
GetZ(Shell);
682 if(fAtomDeexcitation && shellEnum >=0) {
686 secNumberInit = fvect->size();
688 secNumberFinal = fvect->size();
694 secondaryKinetic = RandomizeEjectedElectronEnergy(PartDef, k, Shell, originalMass, originalZ);
697 secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(PartDef, k, Shell) ;
700 if (verboseLevel > 3)
703 G4cout <<
"Shell: " << Shell <<
" Kin. energy (eV)=" << k/eV
704 <<
" Sec. energy (eV)=" << secondaryKinetic/eV <<
G4endl;
713 G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
715 G4double finalPx = totalMomentum*primaryDirection.
x() - deltaTotalMomentum*deltaDirection.
x();
716 G4double finalPy = totalMomentum*primaryDirection.
y() - deltaTotalMomentum*deltaDirection.
y();
717 G4double finalPz = totalMomentum*primaryDirection.
z() - deltaTotalMomentum*deltaDirection.
z();
718 G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
719 finalPx /= finalMomentum;
720 finalPy /= finalMomentum;
721 finalPz /= finalMomentum;
724 direction.
set(finalPx,finalPy,finalPz);
732 for (
G4int j=secNumberInit; j < secNumberFinal; j++) {
733 deexSecEnergy = deexSecEnergy + (*fvect)[j]->GetKineticEnergy();}
739 if (secondaryKinetic>0)
742 fvect->push_back(dp);
749G4double G4MicroElecInelasticModel_new::RandomizeEjectedElectronEnergy(
753 G4double secondaryElectronKineticEnergy=0.;
759 G4double maxEnergy = maximumEnergyTransfer;
760 G4int nEnergySteps = 100;
763 G4double stpEnergy(std::pow(maxEnergy/value, 1./
static_cast<G4double>(nEnergySteps-1)));
764 G4int step(nEnergySteps);
770 crossSectionMaximum = std::max(crossSectionMaximum, differentialCrossSection);
777 (maximumEnergyTransfer-currentMaterialStructure->
GetLimitEnergy(shell));
780 (secondaryElectronKineticEnergy+currentMaterialStructure->
GetLimitEnergy(shell)),shell));
786 currentMaterialStructure->
Energy(shell),
787 originalMass/c_squared, electron_mass_c2/c_squared);
792 G4double maxEnergy = maximumEnergyTransfer;
793 G4int nEnergySteps = 100;
796 G4double stpEnergy(std::pow(maxEnergy/value, 1./
static_cast<G4double>(nEnergySteps-1)));
797 G4int step(nEnergySteps);
804 crossSectionMaximum = std::max(crossSectionMaximum, differentialCrossSection);
815 secondaryElectronKineticEnergy =
819 return std::max(secondaryElectronKineticEnergy, 0.0);
824G4double G4MicroElecInelasticModel_new::RandomizeEjectedElectronEnergyFromCumulatedDcs(
827 G4double secondaryElectronKineticEnergy = 0.;
830 secondaryElectronKineticEnergy = TransferedEnergy(particleDefinition, k, shell, random)
833 if (secondaryElectronKineticEnergy < 0.) {
834 secondaryElectronKineticEnergy = 0.;
836 return secondaryElectronKineticEnergy;
839G4double G4MicroElecInelasticModel_new::TransferedEnergy(
842 G4int ionizationLevelIndex,
857 G4double maximumEnergyTransfer1 = 0;
858 G4double maximumEnergyTransfer2 = 0;
859 G4double maximumEnergyTransferP = 4.* (electron_mass_c2 / proton_mass_c2) * k;
864 dataDiffCSMap::iterator iterator_Nrj;
865 iterator_Nrj = eNrjTransStorage.find(currentMaterial);
867 dataProbaShellMap::iterator iterator_Proba;
868 iterator_Proba = eProbaShellStorage.find(currentMaterial);
870 incidentEnergyMap::iterator iterator_Tdummy;
871 iterator_Tdummy = eIncidentEnergyStorage.find(currentMaterial);
873 if(iterator_Nrj == eNrjTransStorage.end() || iterator_Proba == eProbaShellStorage.end() ||
874 iterator_Tdummy == eIncidentEnergyStorage.end())
877 str += currentMaterial +
" not found!";
878 G4Exception(
"G4MicroElecInelasticModel_new::TransferedEnergy",
"em0002",
882 vector<TriDimensionMap>* eNrjTransfData = iterator_Nrj->second;
883 vector<VecMap>* eProbaShellMap = iterator_Proba->second;
884 vector<G4double>* eTdummyVec = iterator_Tdummy->second;
887 std::vector<G4double>::iterator k2 = std::upper_bound(eTdummyVec->begin(),
890 std::vector<G4double>::iterator k1 = k2 - 1;
893 if (random <= (*eProbaShellMap)[ionizationLevelIndex][(*k1)].back()
894 && random <= (*eProbaShellMap)[ionizationLevelIndex][(*k2)].back())
896 std::vector<G4double>::iterator prob12 =
897 std::upper_bound((*eProbaShellMap)[ionizationLevelIndex][(*k1)].begin(),
898 (*eProbaShellMap)[ionizationLevelIndex][(*k1)].end(),
901 std::vector<G4double>::iterator prob11 = prob12 - 1;
903 std::vector<G4double>::iterator prob22 =
904 std::upper_bound((*eProbaShellMap)[ionizationLevelIndex][(*k2)].begin(),
905 (*eProbaShellMap)[ionizationLevelIndex][(*k2)].end(),
908 std::vector<G4double>::iterator prob21 = prob22 - 1;
912 valuePROB21 = *prob21;
913 valuePROB22 = *prob22;
914 valuePROB12 = *prob12;
915 valuePROB11 = *prob11;
919 else nrjTransf11 = (*eNrjTransfData)[ionizationLevelIndex][valueK1][valuePROB11];
920 if (valuePROB12 == 1)
922 if ((valueK1 + bindingEnergy) / 2. > valueK1) maximumEnergyTransfer1 = valueK1;
923 else maximumEnergyTransfer1 = (valueK1 +
bindingEnergy) / 2.;
927 nrjTransf12 = maximumEnergyTransfer1;
929 else nrjTransf12 = (*eNrjTransfData)[ionizationLevelIndex][valueK1][valuePROB12];
932 else nrjTransf21 = (*eNrjTransfData)[ionizationLevelIndex][valueK2][valuePROB21];
933 if (valuePROB22 == 1)
935 if ((valueK2 + bindingEnergy) / 2. > valueK2) maximumEnergyTransfer2 = valueK2;
936 else maximumEnergyTransfer2 = (valueK2 +
bindingEnergy) / 2.;
938 nrjTransf22 = maximumEnergyTransfer2;
940 else nrjTransf22 = (*eNrjTransfData)[ionizationLevelIndex][valueK2][valuePROB22];
944 if (random > (*eProbaShellMap)[ionizationLevelIndex][(*k1)].back())
946 std::vector<G4double>::iterator prob22 =
947 std::upper_bound((*eProbaShellMap)[ionizationLevelIndex][(*k2)].begin(),
948 (*eProbaShellMap)[ionizationLevelIndex][(*k2)].end(),
951 std::vector<G4double>::iterator prob21 = prob22 - 1;
955 valuePROB21 = *prob21;
956 valuePROB22 = *prob22;
958 nrjTransf21 = (*eNrjTransfData)[ionizationLevelIndex][valueK2][valuePROB21];
959 nrjTransf22 = (*eNrjTransfData)[ionizationLevelIndex][valueK2][valuePROB22];
961 G4double interpolatedvalue2 = Interpolate(valuePROB21,
968 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
977 dataDiffCSMap::iterator iterator_Nrj;
978 iterator_Nrj = pNrjTransStorage.find(currentMaterial);
980 dataProbaShellMap::iterator iterator_Proba;
981 iterator_Proba = pProbaShellStorage.find(currentMaterial);
983 incidentEnergyMap::iterator iterator_Tdummy;
984 iterator_Tdummy = pIncidentEnergyStorage.find(currentMaterial);
986 if (iterator_Nrj == pNrjTransStorage.end() || iterator_Proba == pProbaShellStorage.end() ||
987 iterator_Tdummy == pIncidentEnergyStorage.end())
990 str += currentMaterial +
" not found!";
991 G4Exception(
"G4MicroElecInelasticModel_new::TransferedEnergy",
"em0002",
996 vector<TriDimensionMap>* pNrjTransfData = iterator_Nrj->second;
997 vector<VecMap>* pProbaShellMap = iterator_Proba->second;
998 vector<G4double>* pTdummyVec = iterator_Tdummy->second;
1000 std::vector<G4double>::iterator k2 = std::upper_bound(pTdummyVec->begin(),
1004 std::vector<G4double>::iterator k1 = k2 - 1;
1008 if (random <= (*pProbaShellMap)[ionizationLevelIndex][(*k1)].back()
1009 && random <= (*pProbaShellMap)[ionizationLevelIndex][(*k2)].back())
1011 std::vector<G4double>::iterator prob12 =
1012 std::upper_bound((*pProbaShellMap)[ionizationLevelIndex][(*k1)].begin(),
1013 (*pProbaShellMap)[ionizationLevelIndex][(*k1)].end(),
1016 std::vector<G4double>::iterator prob11 = prob12 - 1;
1018 std::vector<G4double>::iterator prob22 =
1019 std::upper_bound((*pProbaShellMap)[ionizationLevelIndex][(*k2)].begin(),
1020 (*pProbaShellMap)[ionizationLevelIndex][(*k2)].end(),
1023 std::vector<G4double>::iterator prob21 = prob22 - 1;
1027 valuePROB21 = *prob21;
1028 valuePROB22 = *prob22;
1029 valuePROB12 = *prob12;
1030 valuePROB11 = *prob11;
1035 else nrjTransf11 = (*pNrjTransfData)[ionizationLevelIndex][valueK1][valuePROB11];
1037 if (valuePROB12 == 1) nrjTransf12 = maximumEnergyTransferP;
1038 else nrjTransf12 = (*pNrjTransfData)[ionizationLevelIndex][valueK1][valuePROB12];
1041 else nrjTransf21 = (*pNrjTransfData)[ionizationLevelIndex][valueK2][valuePROB21];
1043 if (valuePROB22 == 1) nrjTransf22 = maximumEnergyTransferP;
1044 else nrjTransf22 = (*pNrjTransfData)[ionizationLevelIndex][valueK2][valuePROB22];
1049 if (random > (*pProbaShellMap)[ionizationLevelIndex][(*k1)].back())
1051 std::vector<G4double>::iterator prob22 =
1052 std::upper_bound((*pProbaShellMap)[ionizationLevelIndex][(*k2)].begin(),
1053 (*pProbaShellMap)[ionizationLevelIndex][(*k2)].end(),
1056 std::vector<G4double>::iterator prob21 = prob22 - 1;
1060 valuePROB21 = *prob21;
1061 valuePROB22 = *prob22;
1063 nrjTransf21 = (*pNrjTransfData)[ionizationLevelIndex][valueK2][valuePROB21];
1064 nrjTransf22 = (*pNrjTransfData)[ionizationLevelIndex][valueK2][valuePROB22];
1066 G4double interpolatedvalue2 = Interpolate(valuePROB21,
1073 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
1081 G4double nrjTransfProduct = nrjTransf11 * nrjTransf12 * nrjTransf21 * nrjTransf22;
1083 if (nrjTransfProduct != 0.)
1085 nrj = QuadInterpolator(valuePROB11,
1110 if (energyTransfer >= currentMaterialStructure->
GetLimitEnergy(LevelIndex))
1127 dataDiffCSMap::iterator iterator_Proba;
1128 iterator_Proba = eDiffDatatable.find(currentMaterial);
1130 incidentEnergyMap::iterator iterator_Nrj;
1131 iterator_Nrj = eIncidentEnergyStorage.find(currentMaterial);
1133 TranfEnergyMap::iterator iterator_TransfNrj;
1134 iterator_TransfNrj = eVecmStorage.find(currentMaterial);
1136 if (iterator_Proba != eDiffDatatable.end() && iterator_Nrj != eIncidentEnergyStorage.end()
1137 && iterator_TransfNrj!= eVecmStorage.end())
1139 vector<TriDimensionMap>* eDiffCrossSectionData = (iterator_Proba->second);
1140 vector<G4double>* eTdummyVec = iterator_Nrj->second;
1141 VecMap* eVecm = iterator_TransfNrj->second;
1145 std::vector<G4double>::iterator t2 = std::upper_bound(eTdummyVec->begin(), eTdummyVec->end(), k);
1146 std::vector<G4double>::iterator t1 = t2 - 1;
1148 if (energyTransfer <= (*eVecm)[(*t1)].back() && energyTransfer <= (*eVecm)[(*t2)].back())
1150 std::vector<G4double>::iterator e12 = std::upper_bound((*eVecm)[(*t1)].begin(), (*eVecm)[(*t1)].end(), energyTransfer);
1151 std::vector<G4double>::iterator e11 = e12 - 1;
1153 std::vector<G4double>::iterator e22 = std::upper_bound((*eVecm)[(*t2)].begin(), (*eVecm)[(*t2)].end(), energyTransfer);
1154 std::vector<G4double>::iterator e21 = e22 - 1;
1163 xs11 = (*eDiffCrossSectionData)[LevelIndex][valueT1][valueE11];
1164 xs12 = (*eDiffCrossSectionData)[LevelIndex][valueT1][valueE12];
1165 xs21 = (*eDiffCrossSectionData)[LevelIndex][valueT2][valueE21];
1166 xs22 = (*eDiffCrossSectionData)[LevelIndex][valueT2][valueE22];
1171 str += currentMaterial +
" not found!";
1179 dataDiffCSMap::iterator iterator_Proba;
1180 iterator_Proba = pDiffDatatable.find(currentMaterial);
1182 incidentEnergyMap::iterator iterator_Nrj;
1183 iterator_Nrj = pIncidentEnergyStorage.find(currentMaterial);
1185 TranfEnergyMap::iterator iterator_TransfNrj;
1186 iterator_TransfNrj = pVecmStorage.find(currentMaterial);
1188 if (iterator_Proba != pDiffDatatable.end() && iterator_Nrj != pIncidentEnergyStorage.end()
1189 && iterator_TransfNrj != pVecmStorage.end())
1191 vector<TriDimensionMap>* pDiffCrossSectionData = (iterator_Proba->second);
1192 vector<G4double>* pTdummyVec = iterator_Nrj->second;
1193 VecMap* pVecm = iterator_TransfNrj->second;
1197 std::vector<G4double>::iterator t2 =
1198 std::upper_bound(pTdummyVec->begin(), pTdummyVec->end(), k);
1199 std::vector<G4double>::iterator t1 = t2 - 1;
1200 if (energyTransfer <= (*pVecm)[(*t1)].back() && energyTransfer <= (*pVecm)[(*t2)].back())
1202 std::vector<G4double>::iterator e12 = std::upper_bound((*pVecm)[(*t1)].begin(), (*pVecm)[(*t1)].end(), energyTransfer);
1203 std::vector<G4double>::iterator e11 = e12 - 1;
1205 std::vector<G4double>::iterator e22 = std::upper_bound((*pVecm)[(*t2)].begin(), (*pVecm)[(*t2)].end(), energyTransfer);
1206 std::vector<G4double>::iterator e21 = e22 - 1;
1215 xs11 = (*pDiffCrossSectionData)[LevelIndex][valueT1][valueE11];
1216 xs12 = (*pDiffCrossSectionData)[LevelIndex][valueT1][valueE12];
1217 xs21 = (*pDiffCrossSectionData)[LevelIndex][valueT2][valueE21];
1218 xs22 = (*pDiffCrossSectionData)[LevelIndex][valueT2][valueE22];
1223 str += currentMaterial +
" not found!";
1228 G4double xsProduct = xs11 * xs12 * xs21 * xs22;
1229 if (xsProduct != 0.)
1231 sigma = QuadInterpolator( valueE11, valueE12,
1253 G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
1254 G4double b = std::log10(xs2) - a*std::log10(e2);
1255 G4double sigma = a*std::log10(e) + b;
1256 G4double value = (std::pow(10.,sigma));
1270 G4double interpolatedvalue1 = Interpolate(e11, e12, e, xs11, xs12);
1271 G4double interpolatedvalue2 = Interpolate(e21, e22, e, xs21, xs22);
1272 G4double value = Interpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
1282 TCSMap::iterator tablepos;
1283 tablepos = tableTCS.find(currentMaterial);
1284 MapData* tableData = tablepos->second;
1286 std::map< G4String,G4MicroElecCrossSectionDataSet_new*,std::less<G4String> >::iterator
pos;
1287 pos = tableData->find(particle);
1289 std::vector<G4double> Zeff(currentMaterialStructure->
NumberOfLevels(), 1.0);
1290 if(originalMass>proton_mass_c2) {
1292 Zeff[nl] =
BKZ(k/(proton_mass_c2/originalMass), originalMass/c_squared, originalZ, currentMaterialStructure->
Energy(nl));
1296 if (pos != tableData->end())
1311 value += valuesBuffer[i];
1321 if (valuesBuffer[i] > value)
1323 delete[] valuesBuffer;
1326 value -= valuesBuffer[i];
1329 if (valuesBuffer)
delete[] valuesBuffer;
1335 G4Exception(
"G4MicroElecInelasticModel_new::RandomSelect",
"em0002",
FatalException,
"Model not applicable to particle type.");
1345 return c_light*std::sqrt(x*(x + 2.0))/(x + 1.0);
1354 G4double v2f = 2*M1/(M1+M2)*v1i + (M2-M1)/(M1+M2)*-1*v2i;
1355 G4double vtransfer2a = v2f*v2f-v2i*v2i;
1357 v2f = 2*M1/(M1+M2)*v1i + (M2-M1)/(M1+M2)*v2i;
1358 G4double vtransfer2b = v2f*v2f-v2i*v2i;
1360 G4double vtransfer2 = std::max(vtransfer2a, vtransfer2b);
1361 return 0.5*M2*vtransfer2;
1367 return (x < 0.) ? 1.0 : 0.0;
1373 G4double r = vF*( std::pow(v/vF+1., 3.) - fabs(std::pow(v/vF-1., 3.)) + 4.*(v/vF)*(v/vF) ) +
stepFunc(v/vF-1.) * (3./2.*v/vF - 4.*(v/vF)*(v/vF) + 3.*std::pow(v/vF, 3.) - 0.5*std::pow(v/vF, 5.));
1374 return r/(10.*v/vF);
1382 G4double hbar = hbar_Planck, hbar2 = hbar*hbar, me = electron_mass_c2/c_squared, Ry = me*elm_coupling*elm_coupling/(2*hbar2);
1383 G4double hartree = 2*Ry,
a0 = Bohr_radius, velocity =
a0*hartree/hbar;
1389 G4double a = std::pow(4./9./CLHEP::pi, 1./3.);
1390 G4double vF = std::pow(wp*wp/(3.*a*a*a), 1./3.);
1393 G4double yr = vr/std::pow(Zp, 2./3.);
1395 if(Zp==2) q = 1-exp(-c*vr/(Zp-5./16.));
1396 else q = 1.-exp(-c*(yr-0.07));
1399 if(Neq<=2) l0 = 3./(Zp-0.3*(Neq-1))/2.;
1400 else l0 = 0.48*std::pow(Neq, 2./3.)/(Zp-Neq/7.);
1403 return Zp*(q + c*(1.-q)/vF/vF/2.0 * log(1.+std::pow(2.*l0*vF,2.)));
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
void set(double x, double y, double z)
const G4ThreeVector & GetMomentumDirection() const
const G4ParticleDefinition * GetParticleDefinition() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
static G4Electron * ElectronDefinition()
static G4Electron * Electron()
static G4LossTableManager * Instance()
G4VAtomDeexcitation * AtomDeexcitation()
const G4Material * GetMaterial() const
G4double GetTotNbOfAtomsPerVolume() const
const G4String & GetName() const
G4double FindShellValue(G4double argEnergy, G4int shell) const
const G4VEMDataSet * GetComponent(G4int componentId) const override
size_t NumberOfComponents(void) const override
G4bool LoadData(const G4String &argFileName) override
G4double FindValue(G4double e, G4int componentId=0) const override
G4double DifferentialCrossSection(const G4ParticleDefinition *aParticleDefinition, G4double k, G4double energyTransfer, G4int shell)
G4double stepFunc(G4double x)
G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax) override
~G4MicroElecInelasticModel_new() override
G4MicroElecInelasticModel_new(const G4ParticleDefinition *p=0, const G4String &nam="MicroElecInelasticModel")
G4double ComputeElasticQmax(G4double T1i, G4double T2i, G4double m1, G4double m2)
G4ParticleChangeForGamma * fParticleChangeForGamma
G4double BKZ(G4double Ep, G4double mp, G4int Zp, G4double EF)
void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
G4double ComputeRelativistVelocity(G4double E, G4double mass)
void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
G4double vrkreussler(G4double v, G4double vF)
G4double GetInelasticModelHighLimit(G4int pdg)
G4String GetMaterialName()
G4bool IsShellWeaklyBound(G4int level)
G4double GetLimitEnergy(G4int level)
G4int GetEADL_Enumerator(G4int shell)
G4double GetZ(G4int Shell)
G4double Energy(G4int level)
G4double GetInelasticModelLowLimit(G4int pdg)
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4int GetAtomicNumber() const
G4double GetPDGMass() const
G4int GetPDGEncoding() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()
static G4Proton * ProtonDefinition()
virtual const G4AtomicShell * GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)=0
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
virtual G4double FindValue(G4double x, G4int componentId=0) const =0
virtual G4ThreeVector & SampleDirectionForShell(const G4DynamicParticle *dp, G4double finalTotalEnergy, G4int Z, G4int shellID, const G4Material *)
void SetHighEnergyLimit(G4double)
G4VEmAngularDistribution * GetAngularDistribution()
G4ParticleChangeForGamma * GetParticleChangeForGamma()
G4double LowEnergyLimit() const
G4double HighEnergyLimit() const
void SetLowEnergyLimit(G4double)
void SetDeexcitationFlag(G4bool val)
void SetAngularDistribution(G4VEmAngularDistribution *)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4double bindingEnergy(G4int A, G4int Z)