62 if(theInstance ==
nullptr) {
71G4AdjointCSManager::G4AdjointCSManager()
72{ CrossSectionMatrixesAreBuilt=
false;
73 TotalSigmaTableAreBuilt=
false;
74 theTotalForwardSigmaTableVector.clear();
75 theTotalAdjointSigmaTableVector.clear();
76 listOfForwardEmProcess.clear();
77 listOfForwardEnergyLossProcess.clear();
78 theListOfAdjointParticlesInAction.clear();
79 EminForFwdSigmaTables.clear();
80 EminForAdjSigmaTables.clear();
81 EkinofFwdSigmaMax.clear();
82 EkinofAdjSigmaMax.clear();
83 listSigmaTableForAdjointModelScatProjToProj.clear();
84 listSigmaTableForAdjointModelProdToProj.clear();
94 currentParticleIndex = 0;
98 lastPartDefForCS =
nullptr;
99 LastEkinForCS = lastPrimaryEnergy = lastTcut = 0.;
100 LastCSCorrectionFactor = massRatio = 1.;
102 forward_CS_is_used =
true;
103 forward_CS_mode =
true;
105 currentParticleDef =
nullptr;
106 currentCouple =
nullptr;
107 currentMaterial=
nullptr;
108 lastMaterial=
nullptr;
113 PreadjCS = PostadjCS = PrefwdCS = PostfwdCS = 0.0;
123{listOfAdjointEMModel.push_back(aModel);
124 listSigmaTableForAdjointModelScatProjToProj.push_back(
new G4PhysicsTable);
125 listSigmaTableForAdjointModelProdToProj.push_back(
new G4PhysicsTable);
126 return listOfAdjointEMModel.size() -1;
134 if (anAdjPartDef && aProcess){
138 for (
size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
139 if (anAdjPartDef->
GetParticleName() == theListOfAdjointParticlesInAction[i]->GetParticleName()) index=i;
141 listOfForwardEmProcess[index]->push_back(aProcess);
149 if (anAdjPartDef && aProcess){
152 for (
size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
153 if (anAdjPartDef->
GetParticleName() == theListOfAdjointParticlesInAction[i]->GetParticleName()) index=i;
155 listOfForwardEnergyLossProcess[index]->push_back(aProcess);
162 for (
size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
163 if (aPartDef->
GetParticleName() == theListOfAdjointParticlesInAction[i]->GetParticleName()) index=i;
167 listOfForwardEnergyLossProcess.push_back(
new std::vector<G4VEnergyLossProcess*>());
170 listOfForwardEmProcess.push_back(
new std::vector<G4VEmProcess*>());
171 theListOfAdjointParticlesInAction.push_back(aPartDef);
172 EminForFwdSigmaTables.push_back(std::vector<G4double> ());
173 EminForAdjSigmaTables.push_back(std::vector<G4double> ());
174 EkinofFwdSigmaMax.push_back(std::vector<G4double> ());
175 EkinofAdjSigmaMax.push_back(std::vector<G4double> ());
183 if (CrossSectionMatrixesAreBuilt)
return;
203 theAdjointCSMatricesForScatProjToProj.clear();
204 theAdjointCSMatricesForProdToProj.clear();
208 G4cout<<
"========== Computation of cross section matrices for adjoint models =========="<<
G4endl;
209 for (
size_t i=0; i<listOfAdjointEMModel.size();i++){
213 std::vector<G4AdjointCSMatrix*>* aListOfMat1 =
new std::vector<G4AdjointCSMatrix*>();
214 std::vector<G4AdjointCSMatrix*>* aListOfMat2 =
new std::vector<G4AdjointCSMatrix*>();
215 aListOfMat1->clear();
216 aListOfMat2->clear();
219 std::vector<G4AdjointCSMatrix*>
220 two_matrices=BuildCrossSectionsMatricesForAGivenModelAndElement(aModel,1, 1, 80);
221 aListOfMat1->push_back(two_matrices[0]);
222 aListOfMat2->push_back(two_matrices[1]);
225 for (
size_t j=0; j<theElementTable->size();j++){
226 G4Element* anElement=(*theElementTable)[j];
229 std::vector<G4AdjointCSMatrix*>
230 two_matrices=BuildCrossSectionsMatricesForAGivenModelAndElement(aModel,Z,
A, 40);
231 aListOfMat1->push_back(two_matrices[0]);
232 aListOfMat2->push_back(two_matrices[1]);
237 for (
size_t j=0; j<theMaterialTable->size();j++){
239 std::vector<G4AdjointCSMatrix*>
240 two_matrices=BuildCrossSectionsMatricesForAGivenModelAndMaterial(aModel,aMaterial, 40);
241 aListOfMat1->push_back(two_matrices[0]);
242 aListOfMat2->push_back(two_matrices[1]);
246 theAdjointCSMatricesForProdToProj.push_back(*aListOfMat1);
247 theAdjointCSMatricesForScatProjToProj.push_back(*aListOfMat2);
250 else {
G4cout<<
"The model "<<aModel->
GetName()<<
" does not use cross section matrices"<<
G4endl;
251 std::vector<G4AdjointCSMatrix*> two_empty_matrices;
252 theAdjointCSMatricesForProdToProj.push_back(two_empty_matrices);
253 theAdjointCSMatricesForScatProjToProj.push_back(two_empty_matrices);
257 G4cout<<
" All adjoint cross section matrices are computed!"<<
G4endl;
258 G4cout<<
"======================================================================"<<
G4endl;
260 CrossSectionMatrixesAreBuilt =
true;
269{
if (TotalSigmaTableAreBuilt)
return;
276 for (
size_t i=0; i<listOfAdjointEMModel.size();i++){
277 listSigmaTableForAdjointModelScatProjToProj[i]->clearAndDestroy();
278 listSigmaTableForAdjointModelProdToProj[i]->clearAndDestroy();
280 listSigmaTableForAdjointModelScatProjToProj[i]->push_back(
new G4PhysicsLogVector(Tmin, Tmax, nbins));
281 listSigmaTableForAdjointModelProdToProj[i]->push_back(
new G4PhysicsLogVector(Tmin, Tmax, nbins));
287 for (
size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
289 DefineCurrentParticle(thePartDef);
290 theTotalForwardSigmaTableVector[i]->clearAndDestroy();
291 theTotalAdjointSigmaTableVector[i]->clearAndDestroy();
292 EminForFwdSigmaTables[i].clear();
293 EminForAdjSigmaTables[i].clear();
294 EkinofFwdSigmaMax[i].clear();
295 EkinofAdjSigmaMax[i].clear();
325 for (
size_t k=0; k<listOfForwardEmProcess[i]->size(); k++){
326 totCS+=(*listOfForwardEmProcess[i])[k]->GetLambda(e, couple);
328 for (
size_t k=0; k<listOfForwardEnergyLossProcess[i]->size(); k++){
329 if (thePartDef == theAdjIon) {
330 size_t mat_index = couple->
GetIndex();
331 G4VEmModel* currentModel = (*listOfForwardEnergyLossProcess[i])[k]->SelectModelForMaterial(e,mat_index);
333 (*listOfForwardEnergyLossProcess[i])[k]->SetDynamicMassCharge(massRatio,chargeSqRatio);
336 totCS+=(*listOfForwardEnergyLossProcess[i])[k]->GetLambda(e1, couple);
339 if (totCS>sigma_max){
346 if (totCS>0 && !Emin_found) {
347 EminForFwdSigmaTables[i].push_back(e);
355 EkinofFwdSigmaMax[i].push_back(e_sigma_max);
358 if(!Emin_found) EminForFwdSigmaTables[i].push_back(Tmax);
360 theTotalForwardSigmaTableVector[i]->push_back(aVector);
371 if (totCS>sigma_max){
377 if (totCS>0 && !Emin_found) {
378 EminForAdjSigmaTables[i].push_back(e);
384 EkinofAdjSigmaMax[i].push_back(e_sigma_max);
385 if(!Emin_found) EminForAdjSigmaTables[i].push_back(Tmax);
387 theTotalAdjointSigmaTableVector[i]->push_back(aVector1);
391 TotalSigmaTableAreBuilt =
true;
398{ DefineCurrentMaterial(aCouple);
399 DefineCurrentParticle(aPartDef);
401 return (((*theTotalAdjointSigmaTableVector[currentParticleIndex])[currentMatIndex])->GetValue(Ekin*massRatio, b));
410{ DefineCurrentMaterial(aCouple);
411 DefineCurrentParticle(aPartDef);
413 return (((*theTotalForwardSigmaTableVector[currentParticleIndex])[currentMatIndex])->GetValue(Ekin*massRatio, b));
421{ DefineCurrentMaterial(aCouple);
423 if (is_scat_proj_to_proj)
return (((*listSigmaTableForAdjointModelScatProjToProj[index_model])[currentMatIndex])->GetValue(Ekin_nuc, b));
424 else return (((*listSigmaTableForAdjointModelProdToProj[index_model])[currentMatIndex])->GetValue(Ekin_nuc, b));
430{ DefineCurrentMaterial(aCouple);
431 DefineCurrentParticle(aPartDef);
432 emin_adj = EminForAdjSigmaTables[currentParticleIndex][currentMatIndex]/massRatio;
433 emin_fwd = EminForFwdSigmaTables[currentParticleIndex][currentMatIndex]/massRatio;
442{ DefineCurrentMaterial(aCouple);
443 DefineCurrentParticle(aPartDef);
444 e_sigma_max = EkinofFwdSigmaMax[currentParticleIndex][currentMatIndex];
446 sigma_max =((*theTotalForwardSigmaTableVector[currentParticleIndex])[currentMatIndex])->GetValue(e_sigma_max, b);
447 e_sigma_max/=massRatio;
455{ DefineCurrentMaterial(aCouple);
456 DefineCurrentParticle(aPartDef);
457 e_sigma_max = EkinofAdjSigmaMax[currentParticleIndex][currentMatIndex];
459 sigma_max =((*theTotalAdjointSigmaTableVector[currentParticleIndex])[currentMatIndex])->GetValue(e_sigma_max, b);
460 e_sigma_max/=massRatio;
469 if (forward_CS_mode && aPartDef ) {
471 if (LastEkinForCS != PreStepEkin || aPartDef != lastPartDefForCS || aCouple!=currentCouple) {
472 DefineCurrentMaterial(aCouple);
475 LastEkinForCS = PreStepEkin;
476 lastPartDefForCS = aPartDef;
477 if (PrefwdCS >0. && PreadjCS >0.) {
478 forward_CS_is_used =
true;
479 LastCSCorrectionFactor = PrefwdCS/PreadjCS;
482 forward_CS_is_used =
false;
483 LastCSCorrectionFactor = 1.;
488 corr_fac =LastCSCorrectionFactor;
494 forward_CS_is_used =
false;
495 LastCSCorrectionFactor = 1.;
498 fwd_is_used = forward_CS_is_used;
510 if (!forward_CS_is_used || pre_adjCS ==0. || after_fwdCS==0.) {
511 forward_CS_is_used=
false;
513 corr_fac *=std::exp((pre_adjCS-pre_fwdCS)*step_length);
514 LastCSCorrectionFactor = 1.;
517 LastCSCorrectionFactor = after_fwdCS/pre_adjCS;
528 return 1./LastCSCorrectionFactor;
537 G4bool IsScatProjToProjCase,
538 std::vector<G4double>& CS_Vs_Element)
544 if (IsScatProjToProjCase){
552 if (EminSec >= EmaxSec)
return 0.;
555 G4bool need_to_compute=
false;
556 if ( aMaterial!= lastMaterial || PrimEnergy != lastPrimaryEnergy || Tcut != lastTcut){
557 lastMaterial =aMaterial;
558 lastPrimaryEnergy = PrimEnergy;
560 listOfIndexOfAdjointEMModelInAction.clear();
561 listOfIsScatProjToProjCase.clear();
562 lastAdjointCSVsModelsAndElements.clear();
563 need_to_compute=
true;
567 if (!need_to_compute){
568 need_to_compute=
true;
569 for (
size_t i=0;i<listOfIndexOfAdjointEMModelInAction.size();i++){
570 size_t ind1=listOfIndexOfAdjointEMModelInAction[i];
571 if (aModel == listOfAdjointEMModel[ind1] && IsScatProjToProjCase == listOfIsScatProjToProjCase[i]){
572 need_to_compute=
false;
573 CS_Vs_Element = lastAdjointCSVsModelsAndElements[ind];
579 if (need_to_compute){
581 for (
size_t i=0;i<listOfAdjointEMModel.size();i++){
582 if (aModel == listOfAdjointEMModel[i]){
588 if (!listOfAdjointEMModel[ind_model]->GetApplyCutInRange()) Tlow =listOfAdjointEMModel[ind_model]->GetLowEnergyLimit();
589 listOfIndexOfAdjointEMModelInAction.push_back(ind_model);
590 listOfIsScatProjToProjCase.push_back(IsScatProjToProjCase);
591 CS_Vs_Element.clear();
593 CS_Vs_Element.push_back(aModel->
AdjointCrossSection(currentCouple,PrimEnergy,IsScatProjToProjCase));
601 if (IsScatProjToProjCase){
602 theCSMatrix=theAdjointCSMatricesForScatProjToProj[ind_model][0];
604 else theCSMatrix=theAdjointCSMatricesForProdToProj[ind_model][0];
606 if (PrimEnergy > Tlow)
609 for (
size_t i=0;i<n_el;i++){
614 CS_Vs_Element.push_back(CS);
618 for (
size_t i=0;i<n_el;i++){
622 if (IsScatProjToProjCase){
623 theCSMatrix=theAdjointCSMatricesForScatProjToProj[ind_model][ind_el];
625 else theCSMatrix=theAdjointCSMatricesForProdToProj[ind_model][ind_el];
627 if (PrimEnergy > Tlow)
636 size_t ind_mat = aMaterial->
GetIndex();
638 if (IsScatProjToProjCase){
639 theCSMatrix=theAdjointCSMatricesForScatProjToProj[ind_model][ind_mat];
641 else theCSMatrix=theAdjointCSMatricesForProdToProj[ind_model][ind_mat];
643 if (PrimEnergy > Tlow)
645 CS_Vs_Element.push_back(CS);
649 lastAdjointCSVsModelsAndElements.push_back(CS_Vs_Element);
655 for (
size_t i=0;i<CS_Vs_Element.size();i++){
656 CS+=CS_Vs_Element[i];
667 G4bool IsScatProjToProjCase)
668{ std::vector<G4double> CS_Vs_Element;
673 for (
size_t i=0;i<CS_Vs_Element.size();i++){
674 SumCS+=CS_Vs_Element[i];
675 if (rand_var<=SumCS/CS){
694 DefineCurrentMaterial(aCouple);
697 std::vector<G4double> CS_Vs_Element;
699 for (
size_t i=0; i<listOfAdjointEMModel.size();i++){
702 if (!listOfAdjointEMModel[i]->GetApplyCutInRange()) Tlow =listOfAdjointEMModel[i]->GetLowEnergyLimit();
717 if ( Ekin<=listOfAdjointEMModel[i]->GetHighEnergyLimit() && Ekin>=listOfAdjointEMModel[i]->GetLowEnergyLimit()){
718 if (aPartDef == listOfAdjointEMModel[i]->GetAdjointEquivalentOfDirectPrimaryParticleDefinition()){
720 listOfAdjointEMModel[i],
721 Ekin, Tlow,
true,CS_Vs_Element);
723 (*listSigmaTableForAdjointModelScatProjToProj[i])[currentMatIndex]->PutValue(eindex,CS);
725 if (aPartDef == listOfAdjointEMModel[i]->GetAdjointEquivalentOfDirectSecondaryParticleDefinition()){
727 listOfAdjointEMModel[i],
728 Ekin, Tlow,
false, CS_Vs_Element);
730 (*listSigmaTableForAdjointModelProdToProj[i])[currentMatIndex]->PutValue(eindex,CS);
735 (*listSigmaTableForAdjointModelScatProjToProj[i])[currentMatIndex]->PutValue(eindex,0.);
736 (*listSigmaTableForAdjointModelProdToProj[i])[currentMatIndex]->PutValue(eindex,0.);
746std::vector<G4AdjointCSMatrix*>
748 G4int nbin_pro_decade)
764 G4double fE=std::pow(10.,1./nbin_pro_decade);
765 G4double E2=std::pow(10.,
double(
int(std::log10(EkinMin)*nbin_pro_decade)+1)/nbin_pro_decade)/fE;
768 while (E1 <EkinMaxForProd){
769 E1=std::max(EkinMin,E2);
770 E1=std::min(EkinMaxForProd,E1);
772 if (aMat.size()>=2) {
773 std::vector< double>* log_ESecVec=aMat[0];
774 std::vector< double>* log_CSVec=aMat[1];
775 G4double log_adjointCS=log_CSVec->back();
777 for (
size_t j=0;j<log_CSVec->size();j++) {
778 if (j==0) (*log_CSVec)[j] = 0.;
779 else (*log_CSVec)[j]=std::log(1.-std::exp((*log_CSVec)[j]-log_adjointCS) +1e-50);
781 (*log_CSVec)[log_CSVec->size()-1]=(*log_CSVec)[log_CSVec->size()-2]-std::log(1000.);
782 theCSMatForProdToProjBackwardScattering->
AddData(std::log(E1),log_adjointCS,log_ESecVec,log_CSVec,0);
791 E2=std::pow(10.,
double(
int(std::log10(EkinMin)*nbin_pro_decade)+1)/nbin_pro_decade)/fE;
794 while (E1 <EkinMaxForScat){
795 E1=std::max(EkinMin,E2);
796 E1=std::min(EkinMaxForScat,E1);
798 if (aMat.size()>=2) {
799 std::vector< double>* log_ESecVec=aMat[0];
800 std::vector< double>* log_CSVec=aMat[1];
801 G4double log_adjointCS=log_CSVec->back();
803 for (
size_t j=0;j<log_CSVec->size();j++) {
804 if (j==0) (*log_CSVec)[j] = 0.;
805 else (*log_CSVec)[j]=std::log(1.-std::exp((*log_CSVec)[j]-log_adjointCS)+1e-50);
807 (*log_CSVec)[log_CSVec->size()-1]=(*log_CSVec)[log_CSVec->size()-2]-std::log(1000.);
808 theCSMatForScatProjToProjBackwardScattering->
AddData(std::log(E1),log_adjointCS,log_ESecVec,log_CSVec,0);
815 std::vector<G4AdjointCSMatrix*> res;
817 res.push_back(theCSMatForProdToProjBackwardScattering);
818 res.push_back(theCSMatForScatProjToProjBackwardScattering);
839std::vector<G4AdjointCSMatrix*>
840G4AdjointCSManager::BuildCrossSectionsMatricesForAGivenModelAndMaterial(
G4VEmAdjointModel* aModel,
842 G4int nbin_pro_decade)
863 G4double fE=std::pow(10.,1./nbin_pro_decade);
864 G4double E2=std::pow(10.,
double(
int(std::log10(EkinMin)*nbin_pro_decade)+1)/nbin_pro_decade)/fE;
867 while (E1 <EkinMaxForProd){
868 E1=std::max(EkinMin,E2);
869 E1=std::min(EkinMaxForProd,E1);
871 if (aMat.size()>=2) {
872 std::vector< double>* log_ESecVec=aMat[0];
873 std::vector< double>* log_CSVec=aMat[1];
874 G4double log_adjointCS=log_CSVec->back();
877 for (
size_t j=0;j<log_CSVec->size();j++) {
879 if (j==0) (*log_CSVec)[j] = 0.;
880 else (*log_CSVec)[j]=std::log(1.-std::exp((*log_CSVec)[j]-log_adjointCS));
883 (*log_CSVec)[log_CSVec->size()-1]=(*log_CSVec)[log_CSVec->size()-2]-std::log(1000.);
884 theCSMatForProdToProjBackwardScattering->
AddData(std::log(E1),log_adjointCS,log_ESecVec,log_CSVec,0);
896 E2=std::pow(10.,
double(
int(std::log10(EkinMin)*nbin_pro_decade)+1)/nbin_pro_decade)/fE;
899 while (E1 <EkinMaxForScat){
900 E1=std::max(EkinMin,E2);
901 E1=std::min(EkinMaxForScat,E1);
903 if (aMat.size()>=2) {
904 std::vector< double>* log_ESecVec=aMat[0];
905 std::vector< double>* log_CSVec=aMat[1];
906 G4double log_adjointCS=log_CSVec->back();
908 for (
size_t j=0;j<log_CSVec->size();j++) {
910 if (j==0) (*log_CSVec)[j] = 0.;
911 else (*log_CSVec)[j]=std::log(1.-std::exp((*log_CSVec)[j]-log_adjointCS));
915 (*log_CSVec)[log_CSVec->size()-1]=(*log_CSVec)[log_CSVec->size()-2]-std::log(1000.);
917 theCSMatForScatProjToProjBackwardScattering->
AddData(std::log(E1),log_adjointCS,log_ESecVec,log_CSVec,0);
929 std::vector<G4AdjointCSMatrix*> res;
932 res.push_back(theCSMatForProdToProjBackwardScattering);
933 res.push_back(theCSMatForScatProjToProjBackwardScattering);
953 else if (theFwdPartDef ==theFwdIon)
return theAdjIon;
964 else if (theAdjPartDef == theAdjIon)
return theFwdIon;
971 if(couple != currentCouple) {
974 currentMatIndex = couple->
GetIndex();
977 LastCSCorrectionFactor =1.;
985 if(aPartDef != currentParticleDef) {
989 if (aPartDef == theAdjIon) massRatio = proton_mass_c2/aPartDef->
GetPDGMass();
990 currentParticleIndex=1000000;
991 for (
size_t i=0;i<theListOfAdjointParticlesInAction.size();i++){
992 if (aPartDef == theListOfAdjointParticlesInAction[i]) currentParticleIndex=i;
1006 if (theLogPrimEnergyVector->size() ==0){
1007 G4cout<<
"No data are contained in the given AdjointCSMatrix!"<<
G4endl;
1012 G4double log_Tcut = std::log(Tcut);
1013 G4double log_E =std::log(aPrimEnergy);
1015 if (aPrimEnergy <= Tcut || log_E > theLogPrimEnergyVector->back())
return 0.;
1022 G4double aLogPrimEnergy1,aLogPrimEnergy2;
1025 std::vector< double>* aLogSecondEnergyVector1 =0;
1026 std::vector< double>* aLogSecondEnergyVector2 =0;
1027 std::vector< double>* aLogProbVector1=0;
1028 std::vector< double>* aLogProbVector2=0;
1029 std::vector< size_t>* aLogProbVectorIndex1=0;
1030 std::vector< size_t>* aLogProbVectorIndex2=0;
1033 anAdjointCSMatrix->
GetData(ind, aLogPrimEnergy1,aLogCS1,log01, aLogSecondEnergyVector1,aLogProbVector1,aLogProbVectorIndex1);
1034 anAdjointCSMatrix->
GetData(ind+1, aLogPrimEnergy2,aLogCS2,log02, aLogSecondEnergyVector2,aLogProbVector2,aLogProbVectorIndex2);
1036 G4double log_minimum_prob1, log_minimum_prob2;
1037 log_minimum_prob1=theInterpolator->
InterpolateForLogVector(log_Tcut,*aLogSecondEnergyVector1,*aLogProbVector1);
1038 log_minimum_prob2=theInterpolator->
InterpolateForLogVector(log_Tcut,*aLogSecondEnergyVector2,*aLogProbVector2);
1039 aLogCS1+= log_minimum_prob1;
1040 aLogCS2+= log_minimum_prob2;
1044 return std::exp(log_adjointCS);
double A(double temperature)
std::vector< G4Element * > G4ElementTable
std::vector< G4Material * > G4MaterialTable
G4GLOB_DLL std::ostream G4cout
void BuildTotalSigmaTables()
size_t RegisterEmAdjointModel(G4VEmAdjointModel *)
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 &fwd_TotCS)
G4double GetTotalForwardCS(G4ParticleDefinition *aPartDef, G4double Ekin, const G4MaterialCutsCouple *aCouple)
G4double ComputeTotalAdjointCS(const G4MaterialCutsCouple *aMatCutCouple, G4ParticleDefinition *aPart, G4double PrimEnergy)
G4ParticleDefinition * GetAdjointParticleEquivalent(G4ParticleDefinition *theFwdPartDef)
G4Element * SampleElementFromCSMatrices(G4Material *aMaterial, G4VEmAdjointModel *aModel, G4double PrimEnergy, G4double Tcut, G4bool IsScatProjToProjCase)
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, size_t index_model, G4bool is_scat_proj_to_proj, const G4MaterialCutsCouple *aCouple)
void RegisterEmProcess(G4VEmProcess *aProcess, G4ParticleDefinition *aPartDef)
void BuildCrossSectionMatrices()
void RegisterEnergyLossProcess(G4VEnergyLossProcess *aProcess, G4ParticleDefinition *aPartDef)
void GetMaxFwdTotalCS(G4ParticleDefinition *aPartDef, const G4MaterialCutsCouple *aCouple, G4double &e_sigma_max, G4double &sigma_max)
G4double ComputeAdjointCS(G4Material *aMaterial, G4VEmAdjointModel *aModel, G4double PrimEnergy, G4double Tcut, G4bool IsScatProjToProjCase, std::vector< G4double > &AdjointCS_for_each_element)
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()
G4bool IsScatProjToProjCase()
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
G4double GetLowEdgeEnergy(std::size_t binNumber) const
void PutValue(std::size_t index, G4double theValue)
std::size_t GetVectorLength() 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()
G4bool GetSecondPartOfSameType()
void SetCSMatrices(std::vector< G4AdjointCSMatrix * > *Vec1CSMatrix, std::vector< G4AdjointCSMatrix * > *Vec2CSMatrix)
G4bool GetUseOnlyOneMatrixForAllElements()
virtual G4double GetSecondAdjEnergyMaxForProdToProjCase(G4double PrimAdjEnergy)
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerAtomForSecond(G4double kinEnergyProd, G4double Z, G4double A=0., G4int nbin_pro_decade=10)
G4double GetLowEnergyLimit()
G4bool GetApplyCutInRange()
virtual G4double GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy)
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerVolumeForSecond(G4Material *aMaterial, G4double kinEnergyProd, G4int nbin_pro_decade=10)
virtual G4double GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy)
G4bool GetUseMatrixPerElement()
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerVolumeForScatProj(G4Material *aMaterial, G4double kinEnergyProd, G4int nbin_pro_decade=10)
virtual G4double AdjointCrossSection(const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool IsScatProjToProjCase)
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerAtomForScatProj(G4double kinEnergyProd, G4double Z, G4double A=0., G4int nbin_pro_decade=10)
G4double GetHighEnergyLimit()
virtual G4double GetSecondAdjEnergyMinForScatProjToProjCase(G4double PrimAdjEnergy, G4double Tcut=0)
virtual G4double GetChargeSquareRatio(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)