60 G4bool IsScatProjToProjCase)
85 G4bool IsScatProjToProjCase)
88 IsScatProjToProjCase);
123 if (kinEnergyProj>Emin_proj && kinEnergyProj<=Emax_proj){
134 dSigmadEprod=(sigma1-sigma2)/dE;
149 {
G4double kinEnergyProd = kinEnergyProj - kinEnergyScatProj;
151 if (kinEnergyProd <=0) dSigmadEprod=0;
170 if (kinEnergyProj>Emin_proj && kinEnergyProj<=Emax_proj){
178 dSigmadEprod=(sigma1-sigma2)/dE;
192 {
G4double kinEnergyProd = kinEnergyProj - kinEnergyScatProj;
194 if (kinEnergyProd <=0) dSigmadEprod=0;
242 G4int nbin_pro_decade)
255 std::vector< double>* log_ESec_vector =
new std::vector< double>();
256 std::vector< double>* log_Prob_vector =
new std::vector< double>();
257 log_ESec_vector->clear();
258 log_Prob_vector->clear();
259 log_ESec_vector->push_back(std::log(E1));
260 log_Prob_vector->push_back(-50.);
262 G4double E2=std::pow(10.,
double(
int(std::log10(minEProj)*nbin_pro_decade)+1)/nbin_pro_decade);
263 G4double fE=std::pow(10.,1./nbin_pro_decade);
266 if (std::pow(fE,5.)>(maxEProj/minEProj)) fE = std::pow(maxEProj/minEProj,0.2);
268 while (E1 <maxEProj*0.9999999){
271 int_cross_section +=integral.
Simpson(
this,
273 log_ESec_vector->push_back(std::log(std::min(E2,maxEProj)));
274 log_Prob_vector->push_back(std::log(int_cross_section));
279 std::vector< std::vector<G4double>* > res_mat;
281 if (int_cross_section >0.) {
282 res_mat.push_back(log_ESec_vector);
283 res_mat.push_back(log_Prob_vector);
295 G4int nbin_pro_decade)
306 G4double dEmax=maxEProj-kinEnergyScatProj;
312 std::vector< double>* log_ESec_vector =
new std::vector< double>();
313 std::vector< double>* log_Prob_vector =
new std::vector< double>();
314 log_ESec_vector->push_back(std::log(dEmin));
315 log_Prob_vector->push_back(-50.);
316 G4int nbins=std::max(
int(std::log10(dEmax/dEmin))*nbin_pro_decade,5);
317 G4double fE=std::pow(dEmax/dEmin,1./nbins);
325 while (dE1 <dEmax*0.9999999999999){
327 int_cross_section +=integral.
Simpson(
this,
330 log_ESec_vector->push_back(std::log(std::min(dE2,maxEProj-minEProj)));
331 log_Prob_vector->push_back(std::log(int_cross_section));
337 std::vector< std::vector<G4double> *> res_mat;
339 if (int_cross_section >0.) {
340 res_mat.push_back(log_ESec_vector);
341 res_mat.push_back(log_Prob_vector);
351 G4int nbin_pro_decade)
361 std::vector< double>* log_ESec_vector =
new std::vector< double>();
362 std::vector< double>* log_Prob_vector =
new std::vector< double>();
363 log_ESec_vector->clear();
364 log_Prob_vector->clear();
365 log_ESec_vector->push_back(std::log(E1));
366 log_Prob_vector->push_back(-50.);
368 G4double E2=std::pow(10.,
double(
int(std::log10(minEProj)*nbin_pro_decade)+1)/nbin_pro_decade);
369 G4double fE=std::pow(10.,1./nbin_pro_decade);
372 if (std::pow(fE,5.)>(maxEProj/minEProj)) fE = std::pow(maxEProj/minEProj,0.2);
374 while (E1 <maxEProj*0.9999999){
376 int_cross_section +=integral.
Simpson(
this,
378 log_ESec_vector->push_back(std::log(std::min(E2,maxEProj)));
379 log_Prob_vector->push_back(std::log(int_cross_section));
384 std::vector< std::vector<G4double>* > res_mat;
387 if (int_cross_section >0.) {
388 res_mat.push_back(log_ESec_vector);
389 res_mat.push_back(log_Prob_vector);
402 G4int nbin_pro_decade)
414 G4double dEmax=maxEProj-kinEnergyScatProj;
420 std::vector< double>* log_ESec_vector =
new std::vector< double>();
421 std::vector< double>* log_Prob_vector =
new std::vector< double>();
422 log_ESec_vector->push_back(std::log(dEmin));
423 log_Prob_vector->push_back(-50.);
424 G4int nbins=std::max(
int(std::log10(dEmax/dEmin))*nbin_pro_decade,5);
425 G4double fE=std::pow(dEmax/dEmin,1./nbins);
429 while (dE1 <dEmax*0.9999999999999){
431 int_cross_section +=integral.
Simpson(
this,
433 log_ESec_vector->push_back(std::log(std::min(dE2,maxEProj-minEProj)));
434 log_Prob_vector->push_back(std::log(int_cross_section));
443 std::vector< std::vector<G4double> *> res_mat;
445 if (int_cross_section >0.) {
446 res_mat.push_back(log_ESec_vector);
447 res_mat.push_back(log_Prob_vector);
458 G4AdjointCSMatrix* theMatrix= (*pOnCSMatrixForProdToProjBackwardScattering)[MatrixIndex];
459 if (IsScatProjToProjCase) theMatrix= (*pOnCSMatrixForScatProjToProjBackwardScattering)[MatrixIndex];
462 if (theLogPrimEnergyVector->size() ==0){
463 G4cout<<
"No data are contained in the given AdjointCSMatrix!"<<
G4endl;
464 G4cout<<
"The sampling procedure will be stopped."<<
G4endl;
470 G4double aLogPrimEnergy = std::log(aPrimEnergy);
474 G4double aLogPrimEnergy1,aLogPrimEnergy2;
477 std::vector< double>* aLogSecondEnergyVector1 =0;
478 std::vector< double>* aLogSecondEnergyVector2 =0;
479 std::vector< double>* aLogProbVector1=0;
480 std::vector< double>* aLogProbVector2=0;
481 std::vector< size_t>* aLogProbVectorIndex1=0;
482 std::vector< size_t>* aLogProbVectorIndex2=0;
484 theMatrix->
GetData(ind, aLogPrimEnergy1,aLogCS1,log01, aLogSecondEnergyVector1,aLogProbVector1,aLogProbVectorIndex1);
485 theMatrix->
GetData(ind+1, aLogPrimEnergy2,aLogCS2,log02, aLogSecondEnergyVector2,aLogProbVector2,aLogProbVectorIndex2);
488 G4double log_rand_var= std::log(rand_var);
492 G4double log_rand_var1,log_rand_var2;
494 log_rand_var1=log_rand_var;
495 log_rand_var2=log_rand_var;
507 log_rand_var1=log_rand_var+theInterpolator->
InterpolateForLogVector(log_Tcut,*aLogSecondEnergyVector1,*aLogProbVector1);
508 log_rand_var2=log_rand_var+theInterpolator->
InterpolateForLogVector(log_Tcut,*aLogSecondEnergyVector2,*aLogProbVector2);
511 log_dE1 = theInterpolator->
Interpolate(log_rand_var1,*aLogProbVector1,*aLogSecondEnergyVector1,
"Lin");
512 log_dE2 = theInterpolator->
Interpolate(log_rand_var2,*aLogProbVector2,*aLogSecondEnergyVector2,
"Lin");
513 dE=std::exp(theInterpolator->
LinearInterpolation(aLogPrimEnergy,aLogPrimEnergy1,aLogPrimEnergy2,log_dE1,log_dE2));
516 Esec = aPrimEnergy +dE;
517 Esec=std::max(Esec,Emin);
518 Esec=std::min(Esec,Emax);
523 log_E1 = theInterpolator->
Interpolate(log_rand_var,*aLogProbVector1,*aLogSecondEnergyVector1,
"Lin");
524 log_E2 = theInterpolator->
Interpolate(log_rand_var,*aLogProbVector2,*aLogSecondEnergyVector2,
"Lin");
526 Esec = std::exp(theInterpolator->
LinearInterpolation(aLogPrimEnergy,aLogPrimEnergy1,aLogPrimEnergy2,log_E1,log_E2));
529 Esec=std::max(Esec,Emin);
530 Esec=std::min(Esec,Emax);
557 if ( !IsScatProjToProjCase) {
564 for (
size_t i=0;i<CS_Vs_Element->size();i++){
565 SumCS+=(*CS_Vs_Element)[i];
566 if (rand_var<=SumCS/
lastCS){
583 if ( IsScatProjToProjCase){
591 x = 1./(q*(1./xmin -1.) +1.);
607 x = std::pow(xmin, q);
628 G4bool IsScatProjToProjCase)
639 ,IsScatProjToProjCase );
640 if (post_stepCS>0 &&
lastCS>0) w_corr*=post_stepCS/
lastCS;
646 new_weight*=projectileKinEnergy/adjointPrimKinEnergy;