52 post_step_AdjointCS =0.;
53 pre_step_AdjointCS =0.;
54 totBiasedAdjointCS =0.;
72 G4bool IsScatProjToProjCase,
74 {
if (IsScatProjToProjCase) return ;
82 pre_step_AdjointCS = totAdjointCS;
84 post_step_AdjointCS = totAdjointCS;
94 for (index_element=0; index_element<nelm-1; index_element++){
95 if (rand_CS<xsec[index_element])
break;
100 G4int nShells = (*theElementVector)[index_element]->GetNbOfAtomicShells();
101 rand_CS= shell_prob[index_element][nShells-1]*
G4UniformRand();
103 for (i=0; i<nShells-1; i++){
104 if (rand_CS<shell_prob[index_element][i])
break;
106 G4double gammaEnergy= electronEnergy+(*theElementVector)[index_element]->GetAtomicShell(i);
117 G4double beta = std::sqrt(gamma*gamma-1.)/gamma;
118 G4double b = 0.5*gamma*(gamma-1.)*(gamma-2);
121 if (gamma < 2.) grejsup = gamma*gamma*(1.+b-beta*
b);
122 else grejsup = gamma*gamma*(1.+b+beta*
b);
125 cos_theta = (rndm+beta)/(rndm*beta+1.);
126 term = 1.-beta*cos_theta;
127 greject = (1.-cos_theta*cos_theta)*(1.+b*term)/(term*term);
135 G4double sin_theta = std::sqrt(1.-cos_theta*cos_theta);
137 G4double dirx = sin_theta*std::cos(Phi),diry = sin_theta*std::sin(Phi),dirz = cos_theta;
139 adjoint_gammaDirection.
rotateUz(electronDirection);
177 w_corr*=post_step_AdjointCS/pre_step_AdjointCS;
179 new_weight*=projectileKinEnergy/adjointPrimKinEnergy;
190 G4bool IsScatProjToProjCase)
194 if (IsScatProjToProjCase)
return 0.;
197 if (aCouple !=
currentCouple || current_eEnergy !=electronEnergy) {
199 DefineCurrentMaterialAndElectronEnergy(aCouple, electronEnergy);
203 for (index_element=0;index_element<nelm;index_element++){
205 totAdjointCS +=
AdjointCrossSectionPerAtom((*theElementVector)[index_element],electronEnergy)*theAtomNumDensityVector[index_element];
206 xsec[index_element] = totAdjointCS;
209 totBiasedAdjointCS=std::min(totAdjointCS,0.01);
211 factorCSBiasing = totBiasedAdjointCS/totAdjointCS;
212 lastCS=totBiasedAdjointCS;
216 return totBiasedAdjointCS;
225 G4bool IsScatProjToProjCase)
237 G4double gammaEnergy = electronEnergy+B0;
240 if (CS >0) adjointCS += CS/gammaEnergy;
241 shell_prob[index_element][0] = adjointCS;
242 for (i=1;i<nShells;i++){
247 if (electronEnergy <Bi_-Bi) {
248 gammaEnergy = electronEnergy+Bi;
251 if (CS>0) adjointCS +=CS/gammaEnergy;
253 shell_prob[index_element][i] = adjointCS;
256 adjointCS*=electronEnergy;
268 current_eEnergy = anEnergy;