63 if(theInstance ==
nullptr) {
72 G4AdjointCSManager::G4AdjointCSManager()
73 { CrossSectionMatrixesAreBuilt=
false;
74 TotalSigmaTableAreBuilt=
false;
75 theTotalForwardSigmaTableVector.clear();
76 theTotalAdjointSigmaTableVector.clear();
77 listOfForwardEmProcess.clear();
78 listOfForwardEnergyLossProcess.clear();
79 theListOfAdjointParticlesInAction.clear();
80 EminForFwdSigmaTables.clear();
81 EminForAdjSigmaTables.clear();
82 EkinofFwdSigmaMax.clear();
83 EkinofAdjSigmaMax.clear();
84 listSigmaTableForAdjointModelScatProjToProj.clear();
85 listSigmaTableForAdjointModelProdToProj.clear();
95 currentParticleIndex = 0;
99 lastPartDefForCS =
nullptr;
100 LastEkinForCS = lastPrimaryEnergy = lastTcut = 0.;
101 LastCSCorrectionFactor = massRatio = 1.;
103 forward_CS_is_used =
true;
104 forward_CS_mode =
true;
106 currentParticleDef =
nullptr;
107 currentCouple =
nullptr;
108 currentMaterial=
nullptr;
109 lastMaterial=
nullptr;
114 PreadjCS = PostadjCS = PrefwdCS = PostfwdCS = 0.0;
124 {listOfAdjointEMModel.push_back(aModel);
125 listSigmaTableForAdjointModelScatProjToProj.push_back(
new G4PhysicsTable);
126 listSigmaTableForAdjointModelProdToProj.push_back(
new G4PhysicsTable);
127 return listOfAdjointEMModel.size() -1;
135 if (anAdjPartDef && aProcess){
139 for (
size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
140 if (anAdjPartDef->
GetParticleName() == theListOfAdjointParticlesInAction[i]->GetParticleName()) index=i;
142 listOfForwardEmProcess[index]->push_back(aProcess);
150 if (anAdjPartDef && aProcess){
153 for (
size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
154 if (anAdjPartDef->
GetParticleName() == theListOfAdjointParticlesInAction[i]->GetParticleName()) index=i;
156 listOfForwardEnergyLossProcess[index]->push_back(aProcess);
163 for (
size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
164 if (aPartDef->
GetParticleName() == theListOfAdjointParticlesInAction[i]->GetParticleName()) index=i;
168 listOfForwardEnergyLossProcess.push_back(
new std::vector<G4VEnergyLossProcess*>());
171 listOfForwardEmProcess.push_back(
new std::vector<G4VEmProcess*>());
172 theListOfAdjointParticlesInAction.push_back(aPartDef);
173 EminForFwdSigmaTables.push_back(std::vector<G4double> ());
174 EminForAdjSigmaTables.push_back(std::vector<G4double> ());
175 EkinofFwdSigmaMax.push_back(std::vector<G4double> ());
176 EkinofAdjSigmaMax.push_back(std::vector<G4double> ());
184 if (CrossSectionMatrixesAreBuilt)
return;
204 theAdjointCSMatricesForScatProjToProj.clear();
205 theAdjointCSMatricesForProdToProj.clear();
209 G4cout<<
"========== Computation of cross section matrices for adjoint models =========="<<
G4endl;
210 for (
size_t i=0; i<listOfAdjointEMModel.size();i++){
214 std::vector<G4AdjointCSMatrix*>* aListOfMat1 =
new std::vector<G4AdjointCSMatrix*>();
215 std::vector<G4AdjointCSMatrix*>* aListOfMat2 =
new std::vector<G4AdjointCSMatrix*>();
216 aListOfMat1->clear();
217 aListOfMat2->clear();
220 std::vector<G4AdjointCSMatrix*>
221 two_matrices=BuildCrossSectionsMatricesForAGivenModelAndElement(aModel,1, 1, 80);
222 aListOfMat1->push_back(two_matrices[0]);
223 aListOfMat2->push_back(two_matrices[1]);
226 for (
size_t j=0; j<theElementTable->size();j++){
227 G4Element* anElement=(*theElementTable)[j];
230 std::vector<G4AdjointCSMatrix*>
231 two_matrices=BuildCrossSectionsMatricesForAGivenModelAndElement(aModel,Z, A, 40);
232 aListOfMat1->push_back(two_matrices[0]);
233 aListOfMat2->push_back(two_matrices[1]);
238 for (
size_t j=0; j<theMaterialTable->size();j++){
240 std::vector<G4AdjointCSMatrix*>
241 two_matrices=BuildCrossSectionsMatricesForAGivenModelAndMaterial(aModel,aMaterial, 40);
242 aListOfMat1->push_back(two_matrices[0]);
243 aListOfMat2->push_back(two_matrices[1]);
247 theAdjointCSMatricesForProdToProj.push_back(*aListOfMat1);
248 theAdjointCSMatricesForScatProjToProj.push_back(*aListOfMat2);
251 else {
G4cout<<
"The model "<<aModel->
GetName()<<
" does not use cross section matrices"<<
G4endl;
252 std::vector<G4AdjointCSMatrix*> two_empty_matrices;
253 theAdjointCSMatricesForProdToProj.push_back(two_empty_matrices);
254 theAdjointCSMatricesForScatProjToProj.push_back(two_empty_matrices);
258 G4cout<<
" All adjoint cross section matrices are computed!"<<
G4endl;
259 G4cout<<
"======================================================================"<<
G4endl;
261 CrossSectionMatrixesAreBuilt =
true;
270 {
if (TotalSigmaTableAreBuilt)
return;
277 for (
size_t i=0; i<listOfAdjointEMModel.size();i++){
278 listSigmaTableForAdjointModelScatProjToProj[i]->clearAndDestroy();
279 listSigmaTableForAdjointModelProdToProj[i]->clearAndDestroy();
281 listSigmaTableForAdjointModelScatProjToProj[i]->push_back(
new G4PhysicsLogVector(Tmin, Tmax, nbins));
282 listSigmaTableForAdjointModelProdToProj[i]->push_back(
new G4PhysicsLogVector(Tmin, Tmax, nbins));
288 for (
size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
290 DefineCurrentParticle(thePartDef);
291 theTotalForwardSigmaTableVector[i]->clearAndDestroy();
292 theTotalAdjointSigmaTableVector[i]->clearAndDestroy();
293 EminForFwdSigmaTables[i].clear();
294 EminForAdjSigmaTables[i].clear();
295 EkinofFwdSigmaMax[i].clear();
296 EkinofAdjSigmaMax[i].clear();
326 for (
size_t k=0; k<listOfForwardEmProcess[i]->size(); k++){
327 totCS+=(*listOfForwardEmProcess[i])[k]->GetLambda(e, couple);
329 for (
size_t k=0; k<listOfForwardEnergyLossProcess[i]->size(); k++){
330 if (thePartDef == theAdjIon) {
331 size_t mat_index = couple->
GetIndex();
332 G4VEmModel* currentModel = (*listOfForwardEnergyLossProcess[i])[k]->SelectModelForMaterial(e,mat_index);
334 (*listOfForwardEnergyLossProcess[i])[k]->SetDynamicMassCharge(massRatio,chargeSqRatio);
337 totCS+=(*listOfForwardEnergyLossProcess[i])[k]->GetLambda(e1, couple);
340 if (totCS>sigma_max){
347 if (totCS>0 && !Emin_found) {
348 EminForFwdSigmaTables[i].push_back(e);
356 EkinofFwdSigmaMax[i].push_back(e_sigma_max);
359 if(!Emin_found) EminForFwdSigmaTables[i].push_back(Tmax);
361 theTotalForwardSigmaTableVector[i]->push_back(aVector);
372 if (totCS>sigma_max){
378 if (totCS>0 && !Emin_found) {
379 EminForAdjSigmaTables[i].push_back(e);
385 EkinofAdjSigmaMax[i].push_back(e_sigma_max);
386 if(!Emin_found) EminForAdjSigmaTables[i].push_back(Tmax);
388 theTotalAdjointSigmaTableVector[i]->push_back(aVector1);
392 TotalSigmaTableAreBuilt =
true;
399 { DefineCurrentMaterial(aCouple);
400 DefineCurrentParticle(aPartDef);
402 return (((*theTotalAdjointSigmaTableVector[currentParticleIndex])[currentMatIndex])->GetValue(Ekin*massRatio, b));
411 { DefineCurrentMaterial(aCouple);
412 DefineCurrentParticle(aPartDef);
414 return (((*theTotalForwardSigmaTableVector[currentParticleIndex])[currentMatIndex])->GetValue(Ekin*massRatio, b));
422 { DefineCurrentMaterial(aCouple);
424 if (is_scat_proj_to_proj)
return (((*listSigmaTableForAdjointModelScatProjToProj[index_model])[currentMatIndex])->GetValue(Ekin_nuc, b));
425 else return (((*listSigmaTableForAdjointModelProdToProj[index_model])[currentMatIndex])->GetValue(Ekin_nuc, b));
431 { DefineCurrentMaterial(aCouple);
432 DefineCurrentParticle(aPartDef);
433 emin_adj = EminForAdjSigmaTables[currentParticleIndex][currentMatIndex]/massRatio;
434 emin_fwd = EminForFwdSigmaTables[currentParticleIndex][currentMatIndex]/massRatio;
443 { DefineCurrentMaterial(aCouple);
444 DefineCurrentParticle(aPartDef);
445 e_sigma_max = EkinofFwdSigmaMax[currentParticleIndex][currentMatIndex];
447 sigma_max =((*theTotalForwardSigmaTableVector[currentParticleIndex])[currentMatIndex])->GetValue(e_sigma_max, b);
448 e_sigma_max/=massRatio;
456 { DefineCurrentMaterial(aCouple);
457 DefineCurrentParticle(aPartDef);
458 e_sigma_max = EkinofAdjSigmaMax[currentParticleIndex][currentMatIndex];
460 sigma_max =((*theTotalAdjointSigmaTableVector[currentParticleIndex])[currentMatIndex])->GetValue(e_sigma_max, b);
461 e_sigma_max/=massRatio;
470 if (forward_CS_mode && aPartDef ) {
472 if (LastEkinForCS != PreStepEkin || aPartDef != lastPartDefForCS || aCouple!=currentCouple) {
473 DefineCurrentMaterial(aCouple);
476 LastEkinForCS = PreStepEkin;
477 lastPartDefForCS = aPartDef;
478 if (PrefwdCS >0. && PreadjCS >0.) {
479 forward_CS_is_used =
true;
480 LastCSCorrectionFactor = PrefwdCS/PreadjCS;
483 forward_CS_is_used =
false;
484 LastCSCorrectionFactor = 1.;
489 corr_fac =LastCSCorrectionFactor;
495 forward_CS_is_used =
false;
496 LastCSCorrectionFactor = 1.;
499 fwd_is_used = forward_CS_is_used;
511 if (!forward_CS_is_used || pre_adjCS ==0. || after_fwdCS==0.) {
512 forward_CS_is_used=
false;
514 corr_fac *=std::exp((pre_adjCS-pre_fwdCS)*step_length);
515 LastCSCorrectionFactor = 1.;
518 LastCSCorrectionFactor = after_fwdCS/pre_adjCS;
529 return 1./LastCSCorrectionFactor;
538 G4bool IsScatProjToProjCase,
539 std::vector<G4double>& CS_Vs_Element)
545 if (IsScatProjToProjCase){
553 if (EminSec >= EmaxSec)
return 0.;
556 G4bool need_to_compute=
false;
557 if ( aMaterial!= lastMaterial || PrimEnergy != lastPrimaryEnergy || Tcut != lastTcut){
558 lastMaterial =aMaterial;
559 lastPrimaryEnergy = PrimEnergy;
561 listOfIndexOfAdjointEMModelInAction.clear();
562 listOfIsScatProjToProjCase.clear();
563 lastAdjointCSVsModelsAndElements.clear();
564 need_to_compute=
true;
568 if (!need_to_compute){
569 need_to_compute=
true;
570 for (
size_t i=0;i<listOfIndexOfAdjointEMModelInAction.size();i++){
571 size_t ind1=listOfIndexOfAdjointEMModelInAction[i];
572 if (aModel == listOfAdjointEMModel[ind1] && IsScatProjToProjCase == listOfIsScatProjToProjCase[i]){
573 need_to_compute=
false;
574 CS_Vs_Element = lastAdjointCSVsModelsAndElements[ind];
580 if (need_to_compute){
582 for (
size_t i=0;i<listOfAdjointEMModel.size();i++){
583 if (aModel == listOfAdjointEMModel[i]){
589 if (!listOfAdjointEMModel[ind_model]->GetApplyCutInRange()) Tlow =listOfAdjointEMModel[ind_model]->GetLowEnergyLimit();
590 listOfIndexOfAdjointEMModelInAction.push_back(ind_model);
591 listOfIsScatProjToProjCase.push_back(IsScatProjToProjCase);
592 CS_Vs_Element.clear();
594 CS_Vs_Element.push_back(aModel->
AdjointCrossSection(currentCouple,PrimEnergy,IsScatProjToProjCase));
602 if (IsScatProjToProjCase){
603 theCSMatrix=theAdjointCSMatricesForScatProjToProj[ind_model][0];
605 else theCSMatrix=theAdjointCSMatricesForProdToProj[ind_model][0];
607 if (PrimEnergy > Tlow)
610 for (
size_t i=0;i<n_el;i++){
615 CS_Vs_Element.push_back(CS);
619 for (
size_t i=0;i<n_el;i++){
623 if (IsScatProjToProjCase){
624 theCSMatrix=theAdjointCSMatricesForScatProjToProj[ind_model][ind_el];
626 else theCSMatrix=theAdjointCSMatricesForProdToProj[ind_model][ind_el];
628 if (PrimEnergy > Tlow)
637 size_t ind_mat = aMaterial->
GetIndex();
639 if (IsScatProjToProjCase){
640 theCSMatrix=theAdjointCSMatricesForScatProjToProj[ind_model][ind_mat];
642 else theCSMatrix=theAdjointCSMatricesForProdToProj[ind_model][ind_mat];
644 if (PrimEnergy > Tlow)
646 CS_Vs_Element.push_back(CS);
650 lastAdjointCSVsModelsAndElements.push_back(CS_Vs_Element);
656 for (
size_t i=0;i<CS_Vs_Element.size();i++){
657 CS+=CS_Vs_Element[i];
668 G4bool IsScatProjToProjCase)
669 { std::vector<G4double> CS_Vs_Element;
674 for (
size_t i=0;i<CS_Vs_Element.size();i++){
675 SumCS+=CS_Vs_Element[i];
676 if (rand_var<=SumCS/CS){
695 DefineCurrentMaterial(aCouple);
698 std::vector<G4double> CS_Vs_Element;
700 for (
size_t i=0; i<listOfAdjointEMModel.size();i++){
703 if (!listOfAdjointEMModel[i]->GetApplyCutInRange()) Tlow =listOfAdjointEMModel[i]->GetLowEnergyLimit();
718 if ( Ekin<=listOfAdjointEMModel[i]->GetHighEnergyLimit() && Ekin>=listOfAdjointEMModel[i]->GetLowEnergyLimit()){
719 if (aPartDef == listOfAdjointEMModel[i]->GetAdjointEquivalentOfDirectPrimaryParticleDefinition()){
721 listOfAdjointEMModel[i],
722 Ekin, Tlow,
true,CS_Vs_Element);
724 (*listSigmaTableForAdjointModelScatProjToProj[i])[currentMatIndex]->PutValue(eindex,CS);
726 if (aPartDef == listOfAdjointEMModel[i]->GetAdjointEquivalentOfDirectSecondaryParticleDefinition()){
728 listOfAdjointEMModel[i],
729 Ekin, Tlow,
false, CS_Vs_Element);
731 (*listSigmaTableForAdjointModelProdToProj[i])[currentMatIndex]->PutValue(eindex,CS);
736 (*listSigmaTableForAdjointModelScatProjToProj[i])[currentMatIndex]->PutValue(eindex,0.);
737 (*listSigmaTableForAdjointModelProdToProj[i])[currentMatIndex]->PutValue(eindex,0.);
747 std::vector<G4AdjointCSMatrix*>
749 G4int nbin_pro_decade)
765 G4double fE=std::pow(10.,1./nbin_pro_decade);
766 G4double E2=std::pow(10.,
double(
int(std::log10(EkinMin)*nbin_pro_decade)+1)/nbin_pro_decade)/fE;
769 while (E1 <EkinMaxForProd){
773 if (aMat.size()>=2) {
774 std::vector< double>* log_ESecVec=aMat[0];
775 std::vector< double>* log_CSVec=aMat[1];
776 G4double log_adjointCS=log_CSVec->back();
778 for (
size_t j=0;j<log_CSVec->size();j++) {
779 if (j==0) (*log_CSVec)[j] = 0.;
780 else (*log_CSVec)[j]=std::log(1.-std::exp((*log_CSVec)[j]-log_adjointCS) +1e-50);
782 (*log_CSVec)[log_CSVec->size()-1]=(*log_CSVec)[log_CSVec->size()-2]-std::log(1000.);
783 theCSMatForProdToProjBackwardScattering->
AddData(std::log(E1),log_adjointCS,log_ESecVec,log_CSVec,0);
792 E2=std::pow(10.,
double(
int(std::log10(EkinMin)*nbin_pro_decade)+1)/nbin_pro_decade)/fE;
795 while (E1 <EkinMaxForScat){
799 if (aMat.size()>=2) {
800 std::vector< double>* log_ESecVec=aMat[0];
801 std::vector< double>* log_CSVec=aMat[1];
802 G4double log_adjointCS=log_CSVec->back();
804 for (
size_t j=0;j<log_CSVec->size();j++) {
805 if (j==0) (*log_CSVec)[j] = 0.;
806 else (*log_CSVec)[j]=std::log(1.-std::exp((*log_CSVec)[j]-log_adjointCS)+1e-50);
808 (*log_CSVec)[log_CSVec->size()-1]=(*log_CSVec)[log_CSVec->size()-2]-std::log(1000.);
809 theCSMatForScatProjToProjBackwardScattering->
AddData(std::log(E1),log_adjointCS,log_ESecVec,log_CSVec,0);
816 std::vector<G4AdjointCSMatrix*> res;
818 res.push_back(theCSMatForProdToProjBackwardScattering);
819 res.push_back(theCSMatForScatProjToProjBackwardScattering);
840 std::vector<G4AdjointCSMatrix*>
841 G4AdjointCSManager::BuildCrossSectionsMatricesForAGivenModelAndMaterial(
G4VEmAdjointModel* aModel,
843 G4int nbin_pro_decade)
864 G4double fE=std::pow(10.,1./nbin_pro_decade);
865 G4double E2=std::pow(10.,
double(
int(std::log10(EkinMin)*nbin_pro_decade)+1)/nbin_pro_decade)/fE;
868 while (E1 <EkinMaxForProd){
872 if (aMat.size()>=2) {
873 std::vector< double>* log_ESecVec=aMat[0];
874 std::vector< double>* log_CSVec=aMat[1];
875 G4double log_adjointCS=log_CSVec->back();
878 for (
size_t j=0;j<log_CSVec->size();j++) {
880 if (j==0) (*log_CSVec)[j] = 0.;
881 else (*log_CSVec)[j]=std::log(1.-std::exp((*log_CSVec)[j]-log_adjointCS));
884 (*log_CSVec)[log_CSVec->size()-1]=(*log_CSVec)[log_CSVec->size()-2]-std::log(1000.);
885 theCSMatForProdToProjBackwardScattering->
AddData(std::log(E1),log_adjointCS,log_ESecVec,log_CSVec,0);
897 E2=std::pow(10.,
double(
int(std::log10(EkinMin)*nbin_pro_decade)+1)/nbin_pro_decade)/fE;
900 while (E1 <EkinMaxForScat){
904 if (aMat.size()>=2) {
905 std::vector< double>* log_ESecVec=aMat[0];
906 std::vector< double>* log_CSVec=aMat[1];
907 G4double log_adjointCS=log_CSVec->back();
909 for (
size_t j=0;j<log_CSVec->size();j++) {
911 if (j==0) (*log_CSVec)[j] = 0.;
912 else (*log_CSVec)[j]=std::log(1.-std::exp((*log_CSVec)[j]-log_adjointCS));
916 (*log_CSVec)[log_CSVec->size()-1]=(*log_CSVec)[log_CSVec->size()-2]-std::log(1000.);
918 theCSMatForScatProjToProjBackwardScattering->
AddData(std::log(E1),log_adjointCS,log_ESecVec,log_CSVec,0);
930 std::vector<G4AdjointCSMatrix*> res;
933 res.push_back(theCSMatForProdToProjBackwardScattering);
934 res.push_back(theCSMatForScatProjToProjBackwardScattering);
954 else if (theFwdPartDef ==theFwdIon)
return theAdjIon;
965 else if (theAdjPartDef == theAdjIon)
return theFwdIon;
972 if(couple != currentCouple) {
975 currentMatIndex = couple->
GetIndex();
978 LastCSCorrectionFactor =1.;
986 if(aPartDef != currentParticleDef) {
991 currentParticleIndex=1000000;
992 for (
size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
993 if (aPartDef == theListOfAdjointParticlesInAction[i]) currentParticleIndex=i;
1007 if (theLogPrimEnergyVector->size() ==0){
1008 G4cout<<
"No data are contained in the given AdjointCSMatrix!"<<
G4endl;
1013 G4double log_Tcut = std::log(Tcut);
1014 G4double log_E =std::log(aPrimEnergy);
1016 if (aPrimEnergy <= Tcut || log_E > theLogPrimEnergyVector->back())
return 0.;
1023 G4double aLogPrimEnergy1,aLogPrimEnergy2;
1026 std::vector< double>* aLogSecondEnergyVector1 =0;
1027 std::vector< double>* aLogSecondEnergyVector2 =0;
1028 std::vector< double>* aLogProbVector1=0;
1029 std::vector< double>* aLogProbVector2=0;
1030 std::vector< size_t>* aLogProbVectorIndex1=0;
1031 std::vector< size_t>* aLogProbVectorIndex2=0;
1034 anAdjointCSMatrix->
GetData(ind, aLogPrimEnergy1,aLogCS1,log01, aLogSecondEnergyVector1,aLogProbVector1,aLogProbVectorIndex1);
1035 anAdjointCSMatrix->
GetData(ind+1, aLogPrimEnergy2,aLogCS2,log02, aLogSecondEnergyVector2,aLogProbVector2,aLogProbVectorIndex2);
1037 G4double log_minimum_prob1, log_minimum_prob2;
1038 log_minimum_prob1=theInterpolator->
InterpolateForLogVector(log_Tcut,*aLogSecondEnergyVector1,*aLogProbVector1);
1039 log_minimum_prob2=theInterpolator->
InterpolateForLogVector(log_Tcut,*aLogSecondEnergyVector2,*aLogProbVector2);
1040 aLogCS1+= log_minimum_prob1;
1041 aLogCS2+= log_minimum_prob2;
1045 return std::exp(log_adjointCS);
static G4AdjointGamma * AdjointGamma()
G4double GetTotalAdjointCS(G4ParticleDefinition *aPartDef, G4double Ekin, const G4MaterialCutsCouple *aCouple)
G4double GetCrossSectionCorrection(G4ParticleDefinition *aPartDef, G4double PreStepEkin, const G4MaterialCutsCouple *aCouple, G4bool &fwd_is_used, G4double &fwd_TotCS)
G4double GetAdjointSigma(G4double Ekin_nuc, size_t index_model, G4bool is_scat_proj_to_proj, const G4MaterialCutsCouple *aCouple)
const std::vector< G4double > * GetEnergyCutsVector(size_t pcIdx) const
G4double ComputeTotalAdjointCS(const G4MaterialCutsCouple *aMatCutCouple, G4ParticleDefinition *aPart, G4double PrimEnergy)
virtual G4double GetSecondAdjEnergyMaxForProdToProjCase(G4double PrimAdjEnergy)
G4bool GetData(unsigned int i, G4double &aPrimEnergy, G4double &aCS, G4double &log0, std::vector< double > *&aLogSecondEnergyVector, std::vector< double > *&aLogProbVector, std::vector< size_t > *&aLogProbVectorIndex)
static constexpr double proton_mass_c2
G4double GetPostStepWeightCorrection()
void GetMaxFwdTotalCS(G4ParticleDefinition *aPartDef, const G4MaterialCutsCouple *aCouple, G4double &e_sigma_max, G4double &sigma_max)
size_t RegisterEmAdjointModel(G4VEmAdjointModel *)
static G4MaterialTable * GetMaterialTable()
std::vector< G4Material * > G4MaterialTable
static G4AdjointElectron * AdjointElectron()
G4bool GetUseOnlyOneMatrixForAllElements()
void RegisterEnergyLossProcess(G4VEnergyLossProcess *aProcess, G4ParticleDefinition *aPartDef)
size_t GetVectorLength() const
G4double GetLowEdgeEnergy(size_t binNumber) const
const G4Element * GetElement(G4int iel) const
void AddData(G4double aPrimEnergy, G4double aCS, std::vector< double > *aLogSecondEnergyVector, std::vector< double > *aLogProbVector, size_t n_pro_decade=0)
const G4String & GetParticleName() const
virtual G4double GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy)
G4double InterpolateForLogVector(G4double &x, std::vector< G4double > &x_vec, std::vector< G4double > &y_vec)
static constexpr double TeV
void RegisterAdjointParticle(G4ParticleDefinition *aPartDef)
const G4double * GetVecNbOfAtomsPerVolume() const
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
G4bool GetUseMatrixPerElement()
virtual G4double GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy)
size_t GetTableSize() const
G4ParticleDefinition * GetAdjointParticleEquivalent(G4ParticleDefinition *theFwdPartDef)
std::vector< double > * GetLogPrimEnergyVector()
void PutValue(size_t index, G4double theValue)
size_t FindPositionForLogVector(G4double &x, std::vector< G4double > &x_vec)
static G4Proton * Proton()
G4double GetLowEnergyLimit()
void SetCSMatrices(std::vector< G4AdjointCSMatrix * > *Vec1CSMatrix, std::vector< G4AdjointCSMatrix * > *Vec2CSMatrix)
G4double GetTotalForwardCS(G4ParticleDefinition *aPartDef, G4double Ekin, const G4MaterialCutsCouple *aCouple)
void GetEminForTotalCS(G4ParticleDefinition *aPartDef, const G4MaterialCutsCouple *aCouple, G4double &emin_adj, G4double &emin_fwd)
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerAtomForScatProj(G4double kinEnergyProd, G4double Z, G4double A=0., G4int nbin_pro_decade=10)
G4bool IsScatProjToProjCase()
G4ParticleDefinition * GetForwardParticleEquivalent(G4ParticleDefinition *theAdjPartDef)
virtual G4double GetChargeSquareRatio(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
virtual G4double AdjointCrossSection(const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool IsScatProjToProjCase)
static G4ProductionCutsTable * GetProductionCutsTable()
G4double GetContinuousWeightCorrection(G4ParticleDefinition *aPartDef, G4double PreStepEkin, G4double AfterStepEkin, const G4MaterialCutsCouple *aCouple, G4double step_length)
void RegisterEmProcess(G4VEmProcess *aProcess, G4ParticleDefinition *aPartDef)
G4double GetPDGMass() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
static G4AdjointProton * AdjointProton()
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerAtomForSecond(G4double kinEnergyProd, G4double Z, G4double A=0., G4int nbin_pro_decade=10)
virtual G4double GetSecondAdjEnergyMinForScatProjToProjCase(G4double PrimAdjEnergy, G4double Tcut=0)
G4double GetHighEnergyLimit()
G4double LinearInterpolation(G4double &x, G4double &x1, G4double &x2, G4double &y1, G4double &y2)
void BuildTotalSigmaTables()
void GetMaxAdjTotalCS(G4ParticleDefinition *aPartDef, const G4MaterialCutsCouple *aCouple, G4double &e_sigma_max, G4double &sigma_max)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerVolumeForSecond(G4Material *aMaterial, G4double kinEnergyProd, G4int nbin_pro_decade=10)
G4bool GetApplyCutInRange()
static G4AdjointInterpolator * GetInstance()
G4bool GetSecondPartOfSameType()
static G4Electron * Electron()
size_t GetNumberOfElements() const
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerVolumeForScatProj(G4Material *aMaterial, G4double kinEnergyProd, G4int nbin_pro_decade=10)
void BuildCrossSectionMatrices()
std::vector< G4Element * > G4ElementTable
G4Element * SampleElementFromCSMatrices(G4Material *aMaterial, G4VEmAdjointModel *aModel, G4double PrimEnergy, G4double Tcut, G4bool IsScatProjToProjCase)
static G4ElementTable * GetElementTable()
static constexpr double keV
static G4AdjointCSManager * GetAdjointCSManager()
const G4Material * GetMaterial() const
G4double ComputeAdjointCS(G4Material *aMaterial, G4VEmAdjointModel *aModel, G4double PrimEnergy, G4double Tcut, G4bool IsScatProjToProjCase, std::vector< G4double > &AdjointCS_for_each_element)