G4AdjointPhotoElectricModel Class Reference

#include <G4AdjointPhotoElectricModel.hh>

Inheritance diagram for G4AdjointPhotoElectricModel:

G4VEmAdjointModel

Public Member Functions

 G4AdjointPhotoElectricModel ()
 ~G4AdjointPhotoElectricModel ()
virtual void SampleSecondaries (const G4Track &aTrack, G4bool IsScatProjToProjCase, G4ParticleChange *fParticleChange)
virtual G4double AdjointCrossSection (const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool IsScatProjToProjCase)
virtual G4double GetAdjointCrossSection (const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool IsScatProjToProjCase)
G4double AdjointCrossSectionPerAtom (const G4Element *anElement, G4double electronEnergy)
void SetTheDirectPEEffectModel (G4PEEffectModel *aModel)
virtual void CorrectPostStepWeight (G4ParticleChange *fParticleChange, G4double old_weight, G4double adjointPrimKinEnergy, G4double projectileKinEnergy, G4bool IsScatProjToProjCase)

Detailed Description

Definition at line 62 of file G4AdjointPhotoElectricModel.hh.


Constructor & Destructor Documentation

G4AdjointPhotoElectricModel::G4AdjointPhotoElectricModel (  ) 

Definition at line 42 of file G4AdjointPhotoElectricModel.cc.

References G4AdjointElectron::AdjointElectron(), G4AdjointGamma::AdjointGamma(), G4Gamma::Gamma(), G4VEmAdjointModel::second_part_of_same_type, G4VEmAdjointModel::SetApplyCutInRange(), G4VEmAdjointModel::SetUseMatrix(), G4VEmAdjointModel::theAdjEquivOfDirectPrimPartDef, G4VEmAdjointModel::theAdjEquivOfDirectSecondPartDef, and G4VEmAdjointModel::theDirectPrimaryPartDef.

00042                                                         :
00043  G4VEmAdjointModel("AdjointPEEffect")
00044 
00045 { SetUseMatrix(false);
00046   SetApplyCutInRange(false);
00047 
00048   //Initialization
00049   current_eEnergy =0.;
00050   totAdjointCS=0.;
00051   factorCSBiasing =1.;
00052   post_step_AdjointCS =0.;
00053   pre_step_AdjointCS =0.;
00054   totBiasedAdjointCS =0.;
00055 
00056   index_element=0;
00057 
00058   theAdjEquivOfDirectPrimPartDef =G4AdjointGamma::AdjointGamma();
00059   theAdjEquivOfDirectSecondPartDef=G4AdjointElectron::AdjointElectron();
00060   theDirectPrimaryPartDef=G4Gamma::Gamma();
00061   second_part_of_same_type=false;
00062   theDirectPEEffectModel = new G4PEEffectModel();
00063 }

G4AdjointPhotoElectricModel::~G4AdjointPhotoElectricModel (  ) 

Definition at line 66 of file G4AdjointPhotoElectricModel.cc.

00067 {;}


Member Function Documentation

G4double G4AdjointPhotoElectricModel::AdjointCrossSection ( const G4MaterialCutsCouple aCouple,
G4double  primEnergy,
G4bool  IsScatProjToProjCase 
) [virtual]

Reimplemented from G4VEmAdjointModel.

Definition at line 188 of file G4AdjointPhotoElectricModel.cc.

References AdjointCrossSectionPerAtom(), G4VEmAdjointModel::currentCouple, G4VEmAdjointModel::currentMaterial, G4Material::GetElementVector(), G4Material::GetNumberOfElements(), G4Material::GetVecNbOfAtomsPerVolume(), and G4VEmAdjointModel::lastCS.

Referenced by GetAdjointCrossSection(), and SampleSecondaries().

00191 { 
00192   
00193 
00194   if (IsScatProjToProjCase)  return 0.;
00195 
00196         
00197   if (aCouple !=currentCouple || current_eEnergy !=electronEnergy) {
00198         totAdjointCS = 0.;
00199         DefineCurrentMaterialAndElectronEnergy(aCouple, electronEnergy);
00200         const G4ElementVector* theElementVector = currentMaterial->GetElementVector();
00201         const double* theAtomNumDensityVector = currentMaterial->GetVecNbOfAtomsPerVolume();
00202         size_t nelm =  currentMaterial->GetNumberOfElements();
00203         for (index_element=0;index_element<nelm;index_element++){
00204                 
00205                 totAdjointCS +=AdjointCrossSectionPerAtom((*theElementVector)[index_element],electronEnergy)*theAtomNumDensityVector[index_element];
00206                 xsec[index_element] = totAdjointCS;
00207         } 
00208 
00209         totBiasedAdjointCS=std::min(totAdjointCS,0.01);
00210 //      totBiasedAdjointCS=totAdjointCS;
00211         factorCSBiasing = totBiasedAdjointCS/totAdjointCS;
00212         lastCS=totBiasedAdjointCS;
00213         
00214         
00215   }
00216   return totBiasedAdjointCS;
00217 
00218   
00219 }

G4double G4AdjointPhotoElectricModel::AdjointCrossSectionPerAtom ( const G4Element anElement,
G4double  electronEnergy 
)

Definition at line 231 of file G4AdjointPhotoElectricModel.cc.

References G4PEEffectModel::ComputeCrossSectionPerAtom(), G4Gamma::Gamma(), G4Element::GetAtomicShell(), G4Element::GetNbOfAtomicShells(), and G4Element::GetZ().

Referenced by AdjointCrossSection().

00232 { 
00233   G4int nShells = anElement->GetNbOfAtomicShells();
00234   G4double Z= anElement->GetZ();
00235   G4int i  = 0;  
00236   G4double B0=anElement->GetAtomicShell(0);
00237   G4double gammaEnergy = electronEnergy+B0;
00238   G4double CS= theDirectPEEffectModel->ComputeCrossSectionPerAtom(G4Gamma::Gamma(),gammaEnergy,Z,0.,0.,0.);
00239   G4double adjointCS =0.;
00240   if (CS >0) adjointCS += CS/gammaEnergy; 
00241   shell_prob[index_element][0] = adjointCS;                                          
00242   for (i=1;i<nShells;i++){
00243         //G4cout<<i<<G4endl;
00244         G4double Bi_= anElement->GetAtomicShell(i-1);
00245         G4double Bi = anElement->GetAtomicShell(i);
00246         //G4cout<<Bi_<<'\t'<<Bi<<G4endl;
00247         if (electronEnergy <Bi_-Bi) {
00248                 gammaEnergy = electronEnergy+Bi;
00249                 
00250                 CS=theDirectPEEffectModel->ComputeCrossSectionPerAtom(G4Gamma::Gamma(),gammaEnergy,Z,0.,0.,0.);
00251                 if (CS>0) adjointCS +=CS/gammaEnergy;
00252         }
00253         shell_prob[index_element][i] = adjointCS;       
00254   
00255   }
00256   adjointCS*=electronEnergy;
00257   return adjointCS;
00258   
00259 }                               

void G4AdjointPhotoElectricModel::CorrectPostStepWeight ( G4ParticleChange fParticleChange,
G4double  old_weight,
G4double  adjointPrimKinEnergy,
G4double  projectileKinEnergy,
G4bool  IsScatProjToProjCase 
) [virtual]

Reimplemented from G4VEmAdjointModel.

Definition at line 168 of file G4AdjointPhotoElectricModel.cc.

References G4AdjointCSManager::GetAdjointCSManager(), G4AdjointCSManager::GetPostStepWeightCorrection(), G4VParticleChange::ProposeParentWeight(), G4VParticleChange::SetParentWeightByProcess(), and G4VParticleChange::SetSecondaryWeightByProcess().

Referenced by SampleSecondaries().

00173 {
00174  G4double new_weight=old_weight;
00175 
00176  G4double w_corr =G4AdjointCSManager::GetAdjointCSManager()->GetPostStepWeightCorrection()/factorCSBiasing;
00177  w_corr*=post_step_AdjointCS/pre_step_AdjointCS; 
00178  new_weight*=w_corr; 
00179  new_weight*=projectileKinEnergy/adjointPrimKinEnergy;
00180  fParticleChange->SetParentWeightByProcess(false);
00181  fParticleChange->SetSecondaryWeightByProcess(false);
00182  fParticleChange->ProposeParentWeight(new_weight);      
00183 }       

G4double G4AdjointPhotoElectricModel::GetAdjointCrossSection ( const G4MaterialCutsCouple aCouple,
G4double  primEnergy,
G4bool  IsScatProjToProjCase 
) [virtual]

Reimplemented from G4VEmAdjointModel.

Definition at line 223 of file G4AdjointPhotoElectricModel.cc.

References AdjointCrossSection().

00226 {       return AdjointCrossSection(aCouple,electronEnergy,IsScatProjToProjCase);
00227 }

void G4AdjointPhotoElectricModel::SampleSecondaries ( const G4Track aTrack,
G4bool  IsScatProjToProjCase,
G4ParticleChange fParticleChange 
) [virtual]

Implements G4VEmAdjointModel.

Definition at line 71 of file G4AdjointPhotoElectricModel.cc.

References G4ParticleChange::AddSecondary(), AdjointCrossSection(), G4AdjointGamma::AdjointGamma(), CorrectPostStepWeight(), G4VEmAdjointModel::currentMaterial, fStopAndKill, G4UniformRand, G4Track::GetDynamicParticle(), G4Material::GetElementVector(), G4DynamicParticle::GetKineticEnergy(), G4Track::GetMaterialCutsCouple(), G4DynamicParticle::GetMomentumDirection(), G4Material::GetNumberOfElements(), G4Track::GetWeight(), and G4VParticleChange::ProposeTrackStatus().

00074 { if (IsScatProjToProjCase) return ;
00075 
00076   //Compute the totAdjointCS vectors if not already done for the current couple and electron energy
00077   //-----------------------------------------------------------------------------------------------
00078   const G4MaterialCutsCouple* aCouple = aTrack.GetMaterialCutsCouple();
00079   const G4DynamicParticle* aDynPart =  aTrack.GetDynamicParticle() ;
00080   G4double electronEnergy = aDynPart->GetKineticEnergy();
00081   G4ThreeVector electronDirection= aDynPart->GetMomentumDirection() ;
00082   pre_step_AdjointCS = totAdjointCS; //The last computed CS was  at pre step point
00083   post_step_AdjointCS = AdjointCrossSection(aCouple, electronEnergy,IsScatProjToProjCase);
00084   post_step_AdjointCS = totAdjointCS; 
00085                                 
00086 
00087 
00088 
00089   //Sample element
00090   //-------------
00091    const G4ElementVector* theElementVector = currentMaterial->GetElementVector();
00092    size_t nelm =  currentMaterial->GetNumberOfElements();
00093    G4double rand_CS= G4UniformRand()*xsec[nelm-1];
00094    for (index_element=0; index_element<nelm-1; index_element++){
00095         if (rand_CS<xsec[index_element]) break;
00096    }
00097         
00098    //Sample shell and binding energy
00099    //-------------
00100    G4int nShells = (*theElementVector)[index_element]->GetNbOfAtomicShells();
00101    rand_CS= shell_prob[index_element][nShells-1]*G4UniformRand();
00102    G4int i  = 0;  
00103    for (i=0; i<nShells-1; i++){
00104         if (rand_CS<shell_prob[index_element][i]) break;
00105    }
00106    G4double gammaEnergy= electronEnergy+(*theElementVector)[index_element]->GetAtomicShell(i);
00107         
00108   //Sample cos theta
00109   //Copy of the G4PEEffectModel cos theta sampling method ElecCosThetaDistribution.   
00110   //This method cannot be used directly from G4PEEffectModel because it is a friend method. I should ask Vladimir to change that  
00111   //------------------------------------------------------------------------------------------------    
00112   //G4double cos_theta = theDirectPEEffectModel->ElecCosThetaDistribution(electronEnergy);
00113         
00114    G4double  cos_theta = 1.;
00115    G4double gamma   = 1. + electronEnergy/electron_mass_c2;
00116    if (gamma <= 5.) {
00117         G4double beta  = std::sqrt(gamma*gamma-1.)/gamma;
00118         G4double b     = 0.5*gamma*(gamma-1.)*(gamma-2);
00119 
00120         G4double rndm,term,greject,grejsup;
00121         if (gamma < 2.) grejsup = gamma*gamma*(1.+b-beta*b);
00122         else            grejsup = gamma*gamma*(1.+b+beta*b);
00123 
00124         do {    rndm = 1.-2*G4UniformRand();
00125                 cos_theta = (rndm+beta)/(rndm*beta+1.);
00126                 term = 1.-beta*cos_theta;
00127                 greject = (1.-cos_theta*cos_theta)*(1.+b*term)/(term*term);
00128         } while(greject < G4UniformRand()*grejsup);
00129   }
00130         
00131   // direction of the adjoint gamma electron
00132   //---------------------------------------
00133   
00134      
00135   G4double sin_theta = std::sqrt(1.-cos_theta*cos_theta);
00136   G4double Phi     = twopi * G4UniformRand();
00137   G4double dirx = sin_theta*std::cos(Phi),diry = sin_theta*std::sin(Phi),dirz = cos_theta;
00138   G4ThreeVector adjoint_gammaDirection(dirx,diry,dirz);
00139   adjoint_gammaDirection.rotateUz(electronDirection);
00140   
00141   
00142   
00143   //Weight correction
00144  //-----------------------                                         
00145   CorrectPostStepWeight(fParticleChange, aTrack.GetWeight(), electronEnergy,gammaEnergy,IsScatProjToProjCase);  
00146  
00147   
00148   
00149   //Create secondary and modify fParticleChange 
00150   //--------------------------------------------
00151   G4DynamicParticle* anAdjointGamma = new G4DynamicParticle (
00152                        G4AdjointGamma::AdjointGamma(),adjoint_gammaDirection, gammaEnergy);
00153   
00154   
00155   
00156  
00157   
00158   fParticleChange->ProposeTrackStatus(fStopAndKill);
00159   fParticleChange->AddSecondary(anAdjointGamma);    
00160         
00161 
00162   
00163 
00164 }

void G4AdjointPhotoElectricModel::SetTheDirectPEEffectModel ( G4PEEffectModel aModel  )  [inline]

Definition at line 86 of file G4AdjointPhotoElectricModel.hh.

References G4VEmAdjointModel::DefineDirectEMModel().

00086                                                                 {theDirectPEEffectModel = aModel; 
00087                                                        DefineDirectEMModel(aModel);}                                  


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:51:25 2013 for Geant4 by  doxygen 1.4.7