52constexpr G4double G4AdjointCSManager::fTmin;
53constexpr G4double G4AdjointCSManager::fTmax;
54constexpr G4int G4AdjointCSManager::fNbins;
59 if(fInstance ==
nullptr)
68G4AdjointCSManager::G4AdjointCSManager()
78 for (
auto& p : fAdjointCSMatricesForProdToProj) {
87 fAdjointCSMatricesForProdToProj.clear();
89 for (
auto& p : fAdjointCSMatricesForScatProjToProj) {
98 fAdjointCSMatricesForScatProjToProj.clear();
100 for (
auto p : fAdjointModels) {
106 fAdjointModels.clear();
108 for (
auto p : fTotalAdjSigmaTable) {
109 p->clearAndDestroy();
113 fTotalAdjSigmaTable.clear();
115 for (
auto p : fSigmaTableForAdjointModelScatProjToProj) {
116 p->clearAndDestroy();
120 fSigmaTableForAdjointModelScatProjToProj.clear();
122 for (
auto p : fSigmaTableForAdjointModelProdToProj) {
123 p->clearAndDestroy();
127 fSigmaTableForAdjointModelProdToProj.clear();
129 for (
auto p : fTotalFwdSigmaTable) {
130 p->clearAndDestroy();
134 fTotalFwdSigmaTable.clear();
136 for (
auto p : fForwardProcesses) {
140 fForwardProcesses.clear();
142 for (
auto p : fForwardLossProcesses) {
146 fForwardLossProcesses.clear();
152 fAdjointModels.push_back(aModel);
153 fSigmaTableForAdjointModelScatProjToProj.push_back(
new G4PhysicsTable);
154 fSigmaTableForAdjointModelProdToProj.push_back(
new G4PhysicsTable);
155 return fAdjointModels.size() - 1;
164 if(anAdjPartDef && aProcess)
168 for(std::size_t i = 0; i < fAdjointParticlesInAction.size(); ++i)
171 fAdjointParticlesInAction[i]->GetParticleName())
172 fForwardProcesses[i]->push_back(aProcess);
183 if(anAdjPartDef && aProcess)
186 for(std::size_t i = 0; i < fAdjointParticlesInAction.size(); ++i)
189 fAdjointParticlesInAction[i]->GetParticleName())
190 fForwardLossProcesses[i]->push_back(aProcess);
200 for(
auto p : fAdjointParticlesInAction)
209 fForwardLossProcesses.push_back(
new std::vector<G4VEnergyLossProcess*>());
212 fForwardProcesses.push_back(
new std::vector<G4VEmProcess*>());
213 fAdjointParticlesInAction.push_back(aPartDef);
214 fEminForFwdSigmaTables.push_back(std::vector<G4double>());
215 fEminForAdjSigmaTables.push_back(std::vector<G4double>());
216 fEkinofFwdSigmaMax.push_back(std::vector<G4double>());
217 fEkinofAdjSigmaMax.push_back(std::vector<G4double>());
244 fAdjointCSMatricesForScatProjToProj.clear();
245 fAdjointCSMatricesForProdToProj.clear();
249 G4cout <<
"========== Computation of cross section matrices for adjoint "
252 for(
const auto& aModel : fAdjointModels)
254 G4cout <<
"Build adjoint cross section matrices for " << aModel->GetName()
256 if(aModel->GetUseMatrix())
258 std::vector<G4AdjointCSMatrix*>* aListOfMat1 =
259 new std::vector<G4AdjointCSMatrix*>();
260 std::vector<G4AdjointCSMatrix*>* aListOfMat2 =
261 new std::vector<G4AdjointCSMatrix*>();
262 if(aModel->GetUseMatrixPerElement())
264 if(aModel->GetUseOnlyOneMatrixForAllElements())
266 std::vector<G4AdjointCSMatrix*> two_matrices =
267 BuildCrossSectionsModelAndElement(aModel, 1, 1, 80);
268 aListOfMat1->push_back(two_matrices[0]);
269 aListOfMat2->push_back(two_matrices[1]);
273 for(
const auto& anElement : *theElementTable)
277 std::vector<G4AdjointCSMatrix*> two_matrices =
278 BuildCrossSectionsModelAndElement(aModel,
Z,
A, 40);
279 aListOfMat1->push_back(two_matrices[0]);
280 aListOfMat2->push_back(two_matrices[1]);
286 for(
const auto& aMaterial : *theMaterialTable)
288 std::vector<G4AdjointCSMatrix*> two_matrices =
289 BuildCrossSectionsModelAndMaterial(aModel, aMaterial, 40);
290 aListOfMat1->push_back(two_matrices[0]);
291 aListOfMat2->push_back(two_matrices[1]);
294 fAdjointCSMatricesForProdToProj.push_back(*aListOfMat1);
295 fAdjointCSMatricesForScatProjToProj.push_back(*aListOfMat2);
296 aModel->SetCSMatrices(aListOfMat1, aListOfMat2);
300 G4cout <<
"The model " << aModel->GetName()
301 <<
" does not use cross section matrices" <<
G4endl;
302 std::vector<G4AdjointCSMatrix*> two_empty_matrices;
303 fAdjointCSMatricesForProdToProj.push_back(two_empty_matrices);
304 fAdjointCSMatricesForScatProjToProj.push_back(two_empty_matrices);
307 G4cout <<
" All adjoint cross section matrices are computed!"
310 <<
"======================================================================"
313 fCSMatricesBuilt =
true;
326 for(std::size_t i = 0; i < fAdjointModels.size(); ++i)
328 fSigmaTableForAdjointModelScatProjToProj[i]->clearAndDestroy();
329 fSigmaTableForAdjointModelProdToProj[i]->clearAndDestroy();
330 for(std::size_t j = 0; j < theCoupleTable->
GetTableSize(); ++j)
332 fSigmaTableForAdjointModelScatProjToProj[i]->push_back(
334 fSigmaTableForAdjointModelProdToProj[i]->push_back(
339 for(std::size_t i = 0; i < fAdjointParticlesInAction.size(); ++i)
342 DefineCurrentParticle(thePartDef);
343 fTotalFwdSigmaTable[i]->clearAndDestroy();
344 fTotalAdjSigmaTable[i]->clearAndDestroy();
345 fEminForFwdSigmaTables[i].clear();
346 fEminForAdjSigmaTables[i].clear();
347 fEkinofFwdSigmaMax[i].clear();
348 fEkinofAdjSigmaMax[i].clear();
350 for(std::size_t j = 0; j < theCoupleTable->
GetTableSize(); ++j)
357 G4bool Emin_found =
false;
360 for(std::size_t l = 0; l < fNbins; ++l)
364 for(std::size_t k = 0; k < fForwardProcesses[i]->size(); ++k)
366 totCS += (*fForwardProcesses[i])[k]->GetCrossSection(e, couple);
368 for(std::size_t k = 0; k < fForwardLossProcesses[i]->size(); ++k)
370 if(thePartDef == fAdjIon)
372 std::size_t mat_index = couple->
GetIndex();
374 (*fForwardLossProcesses[i])[k]->SelectModelForMaterial(e,
378 (*fForwardLossProcesses[i])[k]->SetDynamicMassCharge(fMassRatio,
382 totCS += (*fForwardLossProcesses[i])[k]->GetLambda(e1, couple);
385 if(totCS > sigma_max)
390 if(totCS > 0 && !Emin_found)
392 fEminForFwdSigmaTables[i].push_back(e);
397 fEkinofFwdSigmaMax[i].push_back(e_sigma_max);
400 fEminForFwdSigmaTables[i].push_back(fTmax);
402 fTotalFwdSigmaTable[i]->push_back(aVector);
408 for(std::size_t eindex = 0; eindex < fNbins; ++eindex)
413 e * 0.9999999 / fMassRatio);
415 if(totCS > sigma_max)
420 if(totCS > 0 && !Emin_found)
422 fEminForAdjSigmaTables[i].push_back(e);
426 fEkinofAdjSigmaMax[i].push_back(e_sigma_max);
428 fEminForAdjSigmaTables[i].push_back(fTmax);
430 fTotalAdjSigmaTable[i]->push_back(aVector1);
433 fSigmaTableBuilt =
true;
441 DefineCurrentMaterial(aCouple);
442 DefineCurrentParticle(aPartDef);
443 return (((*fTotalAdjSigmaTable[fCurrentParticleIndex])[fCurrentMatIndex])
444 ->Value(Ekin * fMassRatio));
452 DefineCurrentMaterial(aCouple);
453 DefineCurrentParticle(aPartDef);
454 return (((*fTotalFwdSigmaTable[fCurrentParticleIndex])[fCurrentMatIndex])
455 ->Value(Ekin * fMassRatio));
460 G4double Ekin_nuc, std::size_t index_model,
G4bool is_scat_proj_to_proj,
463 DefineCurrentMaterial(aCouple);
464 if(is_scat_proj_to_proj)
465 return (((*fSigmaTableForAdjointModelScatProjToProj[index_model])
466 [fCurrentMatIndex])->Value(Ekin_nuc));
469 ((*fSigmaTableForAdjointModelProdToProj[index_model])[fCurrentMatIndex])
479 DefineCurrentMaterial(aCouple);
480 DefineCurrentParticle(aPartDef);
481 emin_adj = fEminForAdjSigmaTables[fCurrentParticleIndex][fCurrentMatIndex] /
483 emin_fwd = fEminForFwdSigmaTables[fCurrentParticleIndex][fCurrentMatIndex] /
493 DefineCurrentMaterial(aCouple);
494 DefineCurrentParticle(aPartDef);
495 e_sigma_max = fEkinofFwdSigmaMax[fCurrentParticleIndex][fCurrentMatIndex];
496 sigma_max = ((*fTotalFwdSigmaTable[fCurrentParticleIndex])[fCurrentMatIndex])
497 ->Value(e_sigma_max);
498 e_sigma_max /= fMassRatio;
507 DefineCurrentMaterial(aCouple);
508 DefineCurrentParticle(aPartDef);
509 e_sigma_max = fEkinofAdjSigmaMax[fCurrentParticleIndex][fCurrentMatIndex];
510 sigma_max = ((*fTotalAdjSigmaTable[fCurrentParticleIndex])[fCurrentMatIndex])
511 ->Value(e_sigma_max);
512 e_sigma_max /= fMassRatio;
524 if(fForwardCSMode && aPartDef)
526 if(lastEkin != PreStepEkin || aPartDef != lastPartDef ||
527 aCouple != fCurrentCouple)
529 DefineCurrentMaterial(aCouple);
532 lastEkin = PreStepEkin;
533 lastPartDef = aPartDef;
534 if(prefwdCS > 0. && preadjCS > 0.)
536 fForwardCSUsed =
true;
537 fLastCSCorrectionFactor = prefwdCS / preadjCS;
541 fForwardCSUsed =
false;
542 fLastCSCorrectionFactor = 1.;
545 corr_fac = fLastCSCorrectionFactor;
549 fForwardCSUsed =
false;
550 fLastCSCorrectionFactor = 1.;
552 fwd_is_used = fForwardCSUsed;
564 if(!fForwardCSUsed || pre_adjCS == 0. || after_fwdCS == 0.)
567 corr_fac *= std::exp((pre_adjCS - pre_fwdCS) * step_length);
568 fLastCSCorrectionFactor = 1.;
572 fLastCSCorrectionFactor = after_fwdCS / pre_adjCS;
580 return 1. / fLastCSCorrectionFactor;
586 G4double Tcut,
G4bool isScatProjToProj, std::vector<G4double>& CS_Vs_Element)
591 static G4double lastPrimaryEnergy = 0.;
605 if(EminSec >= EmaxSec)
608 G4bool need_to_compute =
false;
609 if(aMaterial != lastMaterial || PrimEnergy != lastPrimaryEnergy ||
612 lastMaterial = aMaterial;
613 lastPrimaryEnergy = PrimEnergy;
615 fIndexOfAdjointEMModelInAction.clear();
616 fIsScatProjToProj.clear();
617 fLastAdjointCSVsModelsAndElements.clear();
618 need_to_compute =
true;
624 need_to_compute =
true;
625 for(std::size_t i = 0; i < fIndexOfAdjointEMModelInAction.size(); ++i)
627 std::size_t ind1 = fIndexOfAdjointEMModelInAction[i];
628 if(aModel == fAdjointModels[ind1] &&
629 isScatProjToProj == fIsScatProjToProj[i])
631 need_to_compute =
false;
632 CS_Vs_Element = fLastAdjointCSVsModelsAndElements[ind];
640 std::size_t ind_model = 0;
641 for(std::size_t i = 0; i < fAdjointModels.size(); ++i)
643 if(aModel == fAdjointModels[i])
650 if(!fAdjointModels[ind_model]->GetApplyCutInRange())
651 Tlow = fAdjointModels[ind_model]->GetLowEnergyLimit();
652 fIndexOfAdjointEMModelInAction.push_back(ind_model);
653 fIsScatProjToProj.push_back(isScatProjToProj);
654 CS_Vs_Element.clear();
658 fCurrentCouple, PrimEnergy, isScatProjToProj));
668 theCSMatrix = fAdjointCSMatricesForScatProjToProj[ind_model][0];
671 theCSMatrix = fAdjointCSMatricesForProdToProj[ind_model][0];
673 if(PrimEnergy > Tlow)
682 CS_Vs_Element.push_back(CS);
693 fAdjointCSMatricesForScatProjToProj[ind_model][ind_el];
696 theCSMatrix = fAdjointCSMatricesForProdToProj[ind_model][ind_el];
698 if(PrimEnergy > Tlow)
700 CS_Vs_Element.push_back(CS *
707 std::size_t ind_mat = aMaterial->
GetIndex();
711 theCSMatrix = fAdjointCSMatricesForScatProjToProj[ind_model][ind_mat];
714 theCSMatrix = fAdjointCSMatricesForProdToProj[ind_model][ind_mat];
716 if(PrimEnergy > Tlow)
718 CS_Vs_Element.push_back(CS);
720 fLastAdjointCSVsModelsAndElements.push_back(CS_Vs_Element);
724 for(
const auto& cs_vs_el : CS_Vs_Element)
738 std::vector<G4double> CS_Vs_Element;
740 isScatProjToProj, CS_Vs_Element);
743 for(std::size_t i = 0; i < CS_Vs_Element.size(); ++i)
745 SumCS += CS_Vs_Element[i];
763 DefineCurrentMaterial(aCouple);
765 std::vector<G4double> CS_Vs_Element;
768 for(std::size_t i = 0; i < fAdjointModels.size(); ++i)
771 adjModel = fAdjointModels[i];
778 std::size_t idx = 56;
787 const std::vector<G4double>* aVec =
790 Tlow = (*aVec)[aCouple->
GetIndex()];
793 if(Ekin <= adjModel->GetHighEnergyLimit() &&
802 (*fSigmaTableForAdjointModelScatProjToProj[i])[fCurrentMatIndex]
803 ->PutValue(fNbins, CS);
811 (*fSigmaTableForAdjointModelProdToProj[i])[fCurrentMatIndex]->PutValue(
817 (*fSigmaTableForAdjointModelScatProjToProj[i])[fCurrentMatIndex]
818 ->PutValue(fNbins, 0.);
819 (*fSigmaTableForAdjointModelProdToProj[i])[fCurrentMatIndex]->PutValue(
827std::vector<G4AdjointCSMatrix*>
830 G4int nbin_pro_decade)
842 EkinMaxForProd = EkinMaxForProd / 2.;
845 G4double dE = std::pow(10., 1. / nbin_pro_decade);
847 std::pow(10.,
double(
int(std::log10(EkinMin) * nbin_pro_decade) + 1) /
848 nbin_pro_decade) / dE;
851 while(E1 < EkinMaxForProd)
853 E1 = std::max(EkinMin, E2);
854 E1 = std::min(EkinMaxForProd, E1);
855 std::vector<std::vector<double>*> aMat =
860 std::vector<double>* log_ESecVec = aMat[0];
861 std::vector<double>* log_CSVec = aMat[1];
862 G4double log_adjointCS = log_CSVec->back();
864 for(std::size_t j = 0; j < log_CSVec->size(); ++j)
867 (*log_CSVec)[j] = 0.;
870 std::log(1. - std::exp((*log_CSVec)[j] - log_adjointCS) + 1e-50);
872 (*log_CSVec)[log_CSVec->size() - 1] =
873 (*log_CSVec)[log_CSVec->size() - 2] - std::log(1000.);
874 theCSMatForProdToProjBackwardScattering->
AddData(
875 std::log(E1), log_adjointCS, log_ESecVec, log_CSVec, 0);
882 E2 = std::pow(10.,
G4double(
int(std::log10(EkinMin) * nbin_pro_decade) + 1) /
883 nbin_pro_decade) / dE;
886 while(E1 < EkinMaxForScat)
888 E1 = std::max(EkinMin, E2);
889 E1 = std::min(EkinMaxForScat, E1);
890 std::vector<std::vector<G4double>*> aMat =
892 E1,
Z,
A, nbin_pro_decade);
895 std::vector<G4double>* log_ESecVec = aMat[0];
896 std::vector<G4double>* log_CSVec = aMat[1];
897 G4double log_adjointCS = log_CSVec->back();
899 for(std::size_t j = 0; j < log_CSVec->size(); ++j)
902 (*log_CSVec)[j] = 0.;
905 std::log(1. - std::exp((*log_CSVec)[j] - log_adjointCS) + 1e-50);
907 (*log_CSVec)[log_CSVec->size() - 1] =
908 (*log_CSVec)[log_CSVec->size() - 2] - std::log(1000.);
909 theCSMatForScatProjToProjBackwardScattering->
AddData(
910 std::log(E1), log_adjointCS, log_ESecVec, log_CSVec, 0);
916 std::vector<G4AdjointCSMatrix*> res;
917 res.push_back(theCSMatForProdToProjBackwardScattering);
918 res.push_back(theCSMatForScatProjToProjBackwardScattering);
924std::vector<G4AdjointCSMatrix*>
925G4AdjointCSManager::BuildCrossSectionsModelAndMaterial(
937 EkinMaxForProd /= 2.;
940 G4double dE = std::pow(10., 1. / nbin_pro_decade);
942 std::pow(10.,
double(
int(std::log10(EkinMin) * nbin_pro_decade) + 1) /
943 nbin_pro_decade) / dE;
946 while(E1 < EkinMaxForProd)
948 E1 = std::max(EkinMin, E2);
949 E1 = std::min(EkinMaxForProd, E1);
950 std::vector<std::vector<G4double>*> aMat =
952 aMaterial, E1, nbin_pro_decade);
955 std::vector<G4double>* log_ESecVec = aMat[0];
956 std::vector<G4double>* log_CSVec = aMat[1];
957 G4double log_adjointCS = log_CSVec->back();
960 for(std::size_t j = 0; j < log_CSVec->size(); ++j)
963 (*log_CSVec)[j] = 0.;
966 std::log(1. - std::exp((*log_CSVec)[j] - log_adjointCS));
968 (*log_CSVec)[log_CSVec->size() - 1] =
969 (*log_CSVec)[log_CSVec->size() - 2] - std::log(1000.);
970 theCSMatForProdToProjBackwardScattering->
AddData(
971 std::log(E1), log_adjointCS, log_ESecVec, log_CSVec, 0);
980 std::pow(10.,
G4double(
G4int(std::log10(EkinMin) * nbin_pro_decade) + 1) /
984 while(E1 < EkinMaxForScat)
986 E1 = std::max(EkinMin, E2);
987 E1 = std::min(EkinMaxForScat, E1);
988 std::vector<std::vector<G4double>*> aMat =
990 aMaterial, E1, nbin_pro_decade);
993 std::vector<G4double>* log_ESecVec = aMat[0];
994 std::vector<G4double>* log_CSVec = aMat[1];
995 G4double log_adjointCS = log_CSVec->back();
997 for(std::size_t j = 0; j < log_CSVec->size(); ++j)
1000 (*log_CSVec)[j] = 0.;
1003 std::log(1. - std::exp((*log_CSVec)[j] - log_adjointCS));
1005 (*log_CSVec)[log_CSVec->size() - 1] =
1006 (*log_CSVec)[log_CSVec->size() - 2] - std::log(1000.);
1008 theCSMatForScatProjToProjBackwardScattering->
AddData(
1009 std::log(E1), log_adjointCS, log_ESecVec, log_CSVec, 0);
1015 std::vector<G4AdjointCSMatrix*> res;
1016 res.push_back(theCSMatForProdToProjBackwardScattering);
1017 res.push_back(theCSMatForScatProjToProjBackwardScattering);
1032 else if(theFwdPartDef == fFwdIon)
1047 else if(theAdjPartDef == fAdjIon)
1053void G4AdjointCSManager::DefineCurrentMaterial(
1056 if(couple != fCurrentCouple)
1060 fCurrentMatIndex = couple->
GetIndex();
1061 fLastCSCorrectionFactor = 1.;
1066void G4AdjointCSManager::DefineCurrentParticle(
1071 if(aPartDef != currentParticleDef)
1075 if(aPartDef == fAdjIon)
1076 fMassRatio = proton_mass_c2 / aPartDef->
GetPDGMass();
1077 fCurrentParticleIndex = 1000000;
1078 for(std::size_t i = 0; i < fAdjointParticlesInAction.size(); ++i)
1080 if(aPartDef == fAdjointParticlesInAction[i])
1081 fCurrentParticleIndex = i;
1090 std::vector<double>* theLogPrimEnergyVector =
1092 if(theLogPrimEnergyVector->empty())
1094 G4cout <<
"No data are contained in the given AdjointCSMatrix!" <<
G4endl;
1097 G4double log_Tcut = std::log(Tcut);
1098 G4double log_E = std::log(aPrimEnergy);
1100 if(aPrimEnergy <= Tcut || log_E > theLogPrimEnergyVector->back())
1107 G4double aLogPrimEnergy1, aLogPrimEnergy2;
1110 std::vector<G4double>* aLogSecondEnergyVector1 =
nullptr;
1111 std::vector<G4double>* aLogSecondEnergyVector2 =
nullptr;
1112 std::vector<G4double>* aLogProbVector1 =
nullptr;
1113 std::vector<G4double>* aLogProbVector2 =
nullptr;
1114 std::vector<std::size_t>* aLogProbVectorIndex1 =
nullptr;
1115 std::vector<std::size_t>* aLogProbVectorIndex2 =
nullptr;
1117 anAdjointCSMatrix->
GetData((
G4int)ind, aLogPrimEnergy1, aLogCS1, log01,
1118 aLogSecondEnergyVector1, aLogProbVector1,
1119 aLogProbVectorIndex1);
1120 anAdjointCSMatrix->
GetData(
G4int(ind + 1), aLogPrimEnergy2, aLogCS2, log02,
1121 aLogSecondEnergyVector2, aLogProbVector2,
1122 aLogProbVectorIndex2);
1123 if (! (aLogProbVector1 && aLogProbVector2 &&
1124 aLogSecondEnergyVector1 && aLogSecondEnergyVector2)){
1130 G4double log_minimum_prob1, log_minimum_prob2;
1132 log_Tcut, *aLogSecondEnergyVector1, *aLogProbVector1);
1134 log_Tcut, *aLogSecondEnergyVector2, *aLogProbVector2);
1135 aLogCS1 += log_minimum_prob1;
1136 aLogCS2 += log_minimum_prob2;
1140 log_E, aLogPrimEnergy1, aLogPrimEnergy2, aLogCS1, aLogCS2);
1141 return std::exp(log_adjointCS);
std::vector< G4Element * > G4ElementTable
std::vector< G4Material * > G4MaterialTable
G4GLOB_DLL std::ostream G4cout
void BuildTotalSigmaTables()
void RegisterAdjointParticle(G4ParticleDefinition *aPartDef)
G4ParticleDefinition * GetForwardParticleEquivalent(G4ParticleDefinition *theAdjPartDef)
void GetMaxAdjTotalCS(G4ParticleDefinition *aPartDef, const G4MaterialCutsCouple *aCouple, G4double &e_sigma_max, G4double &sigma_max)
G4double GetCrossSectionCorrection(G4ParticleDefinition *aPartDef, G4double PreStepEkin, const G4MaterialCutsCouple *aCouple, G4bool &fwd_is_used)
G4double GetTotalForwardCS(G4ParticleDefinition *aPartDef, G4double Ekin, const G4MaterialCutsCouple *aCouple)
G4double ComputeTotalAdjointCS(const G4MaterialCutsCouple *aMatCutCouple, G4ParticleDefinition *aPart, G4double PrimEnergy)
G4double ComputeAdjointCS(G4Material *aMaterial, G4VEmAdjointModel *aModel, G4double PrimEnergy, G4double Tcut, G4bool isScatProjToProj, std::vector< G4double > &AdjointCS_for_each_element)
G4ParticleDefinition * GetAdjointParticleEquivalent(G4ParticleDefinition *theFwdPartDef)
G4Element * SampleElementFromCSMatrices(G4Material *aMaterial, G4VEmAdjointModel *aModel, G4double PrimEnergy, G4double Tcut, G4bool isScatProjToProj)
G4double GetContinuousWeightCorrection(G4ParticleDefinition *aPartDef, G4double PreStepEkin, G4double AfterStepEkin, const G4MaterialCutsCouple *aCouple, G4double step_length)
G4double GetPostStepWeightCorrection()
void GetEminForTotalCS(G4ParticleDefinition *aPartDef, const G4MaterialCutsCouple *aCouple, G4double &emin_adj, G4double &emin_fwd)
static G4AdjointCSManager * GetAdjointCSManager()
G4double GetTotalAdjointCS(G4ParticleDefinition *aPartDef, G4double Ekin, const G4MaterialCutsCouple *aCouple)
G4double GetAdjointSigma(G4double Ekin_nuc, std::size_t index_model, G4bool is_scat_proj_to_proj, const G4MaterialCutsCouple *aCouple)
void RegisterEmProcess(G4VEmProcess *aProcess, G4ParticleDefinition *aPartDef)
std::size_t RegisterEmAdjointModel(G4VEmAdjointModel *)
void BuildCrossSectionMatrices()
void RegisterEnergyLossProcess(G4VEnergyLossProcess *aProcess, G4ParticleDefinition *aPartDef)
void GetMaxFwdTotalCS(G4ParticleDefinition *aPartDef, const G4MaterialCutsCouple *aCouple, G4double &e_sigma_max, G4double &sigma_max)
G4bool IsScatProjToProj()
G4bool GetData(unsigned int i, G4double &aPrimEnergy, G4double &aCS, G4double &log0, std::vector< double > *&aLogSecondEnergyVector, std::vector< double > *&aLogProbVector, std::vector< size_t > *&aLogProbVectorIndex)
std::vector< double > * GetLogPrimEnergyVector()
void AddData(G4double aPrimEnergy, G4double aCS, std::vector< double > *aLogSecondEnergyVector, std::vector< double > *aLogProbVector, size_t n_pro_decade=0)
static G4AdjointElectron * AdjointElectron()
static G4AdjointGamma * AdjointGamma()
G4double LinearInterpolation(G4double &x, G4double &x1, G4double &x2, G4double &y1, G4double &y2)
static G4AdjointInterpolator * GetInstance()
size_t FindPositionForLogVector(G4double &x, std::vector< G4double > &x_vec)
G4double InterpolateForLogVector(G4double &x, std::vector< G4double > &x_vec, std::vector< G4double > &y_vec)
static G4AdjointProton * AdjointProton()
static G4Electron * Electron()
static G4ElementTable * GetElementTable()
const G4Material * GetMaterial() const
const G4Element * GetElement(G4int iel) const
size_t GetNumberOfElements() const
const G4double * GetVecNbOfAtomsPerVolume() const
static G4MaterialTable * GetMaterialTable()
G4double GetPDGMass() const
const G4String & GetParticleName() const
void PutValue(const std::size_t index, const G4double value)
G4double Energy(const std::size_t index) const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
const std::vector< G4double > * GetEnergyCutsVector(std::size_t pcIdx) const
static G4ProductionCutsTable * GetProductionCutsTable()
static G4Proton * Proton()
virtual G4double GetSecondAdjEnergyMaxForProdToProj(G4double primAdjEnergy)
G4bool GetSecondPartOfSameType()
G4bool GetUseOnlyOneMatrixForAllElements()
virtual G4double GetSecondAdjEnergyMinForScatProjToProj(G4double primAdjEnergy, G4double tcut=0.)
virtual G4double GetSecondAdjEnergyMaxForScatProjToProj(G4double primAdjEnergy)
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerAtomForSecond(G4double kinEnergyProd, G4double Z, G4double A=0., G4int nbin_pro_decade=10)
G4ParticleDefinition * GetAdjointEquivalentOfDirectPrimaryParticleDefinition()
G4double GetLowEnergyLimit()
G4ParticleDefinition * GetAdjointEquivalentOfDirectSecondaryParticleDefinition()
G4bool GetApplyCutInRange()
virtual G4double AdjointCrossSection(const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool isScatProjToProj)
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerVolumeForSecond(G4Material *aMaterial, G4double kinEnergyProd, G4int nbin_pro_decade=10)
G4bool GetUseMatrixPerElement()
virtual G4double GetSecondAdjEnergyMinForProdToProj(G4double primAdjEnergy)
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerVolumeForScatProj(G4Material *aMaterial, G4double kinEnergyProd, G4int nbin_pro_decade=10)
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerAtomForScatProj(G4double kinEnergyProd, G4double Z, G4double A=0., G4int nbin_pro_decade=10)
G4double GetHighEnergyLimit()
virtual G4double GetChargeSquareRatio(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)