Import Geant4 9.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:15:05 +02:00
parent b79225fb37
commit 74cad5e589
3877 changed files with 234205 additions and 167127 deletions
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AdjointPhotoElectricModel.cc,v 1.5 2009/12/16 17:50:05 gunter Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
#include "G4AdjointPhotoElectricModel.hh"
#include "G4AdjointCSManager.hh"
@@ -34,14 +37,22 @@
#include "G4Gamma.hh"
#include "G4AdjointGamma.hh"
////////////////////////////////////////////////////////////////////////////////
//
G4AdjointPhotoElectricModel::G4AdjointPhotoElectricModel():
G4VEmAdjointModel("AdjointPEEffect")
{ SetUseMatrix(false);
SetApplyCutInRange(false);
current_eEnergy =0.;
totAdjointCS=0.;
theAdjEquivOfDirectPrimPartDef =G4AdjointGamma::AdjointGamma();
theAdjEquivOfDirectSecondPartDef=G4AdjointElectron::AdjointElectron();
theDirectPrimaryPartDef=G4Gamma::Gamma();
second_part_of_same_type=false;
theDirectPEEffectModel = new G4PEEffectModel();
}
////////////////////////////////////////////////////////////////////////////////
//
@@ -56,47 +67,32 @@ void G4AdjointPhotoElectricModel::SampleSecondaries(const G4Track& aTrack,
{ if (IsScatProjToProjCase) return ;
//Compute the totAdjointCS vectors if not already done for the current couple and electron energy
//-----------------------------------------------------------------------------------------------
const G4MaterialCutsCouple* aCouple = aTrack.GetMaterialCutsCouple();
const G4DynamicParticle* aDynPart = aTrack.GetDynamicParticle() ;
G4double electronEnergy = aDynPart->GetKineticEnergy();
G4ThreeVector electronDirection= aDynPart->GetMomentumDirection() ;
totAdjointCS = AdjointCrossSection(aCouple, electronEnergy,IsScatProjToProjCase);
pre_step_AdjointCS = totAdjointCS; //The last computed CS was at pre step point
G4double adjCS;
adjCS = AdjointCrossSection(aCouple, electronEnergy,IsScatProjToProjCase);
post_step_AdjointCS = totAdjointCS;
//Sample gamma energy
//-------------
/////////////////////////////////////////////////////////////////////////////////
// Module: G4ContinuousGainOfEnergy.hh
// Author: L. Desorgher
// Date: 1 September 2007
// Organisation: SpaceIT GmbH
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
// ChangeHistory:
// 1 September 2007 creation by L. Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Modell for the adjoint compton scattering
//
//Sample element
//-------------
const G4ElementVector* theElementVector = currentMaterial->GetElementVector();
const G4double* theAtomNumDensityVector = currentMaterial->GetVecNbOfAtomsPerVolume();
size_t nelm = currentMaterial->GetNumberOfElements();
G4double rand_CS= totAdjointCS*G4UniformRand();
G4double rand_CS= G4UniformRand()*xsec[nelm-1];
for (index_element=0; index_element<nelm-1; index_element++){
if (rand_CS<xsec[index_element]) break;
}
//Sample shell and binding energy
//-------------
rand_CS= totAdjointCS*G4UniformRand()/theAtomNumDensityVector[index_element];
G4int nShells = (*theElementVector)[index_element]->GetNbOfAtomicShells();
rand_CS= shell_prob[index_element][nShells-1]*G4UniformRand();
G4int i = 0;
for (i=0; i<nShells-1; i++){
if (rand_CS<shell_prob[index_element][i]) break;
@@ -140,7 +136,7 @@ void G4AdjointPhotoElectricModel::SampleSecondaries(const G4Track& aTrack,
//Weight correction
//-----------------------
CorrectPostStepWeight(fParticleChange, aTrack.GetWeight(), electronEnergy,gammaEnergy);
CorrectPostStepWeight(fParticleChange, aTrack.GetWeight(), electronEnergy,gammaEnergy,IsScatProjToProjCase);
@@ -148,13 +144,36 @@ void G4AdjointPhotoElectricModel::SampleSecondaries(const G4Track& aTrack,
//--------------------------------------------
G4DynamicParticle* anAdjointGamma = new G4DynamicParticle (
G4AdjointGamma::AdjointGamma(),adjoint_gammaDirection, gammaEnergy);
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->AddSecondary(anAdjointGamma);
fParticleChange->AddSecondary(anAdjointGamma);
}
////////////////////////////////////////////////////////////////////////////////
//
void G4AdjointPhotoElectricModel::CorrectPostStepWeight(G4ParticleChange* fParticleChange,
G4double old_weight,
G4double adjointPrimKinEnergy,
G4double projectileKinEnergy ,
G4bool )
{
G4double new_weight=old_weight;
G4double w_corr =G4AdjointCSManager::GetAdjointCSManager()->GetPostStepWeightCorrection()/factorCSBiasing;
w_corr*=post_step_AdjointCS/pre_step_AdjointCS;
new_weight*=w_corr;
new_weight*=projectileKinEnergy/adjointPrimKinEnergy;
fParticleChange->SetParentWeightByProcess(false);
fParticleChange->SetSecondaryWeightByProcess(false);
fParticleChange->ProposeParentWeight(new_weight);
}
////////////////////////////////////////////////////////////////////////////////
@@ -163,21 +182,33 @@ void G4AdjointPhotoElectricModel::SampleSecondaries(const G4Track& aTrack,
G4double G4AdjointPhotoElectricModel::AdjointCrossSection(const G4MaterialCutsCouple* aCouple,
G4double electronEnergy,
G4bool IsScatProjToProjCase)
{ if (IsScatProjToProjCase) return 0.;
{
if (IsScatProjToProjCase) return 0.;
if (aCouple !=currentCouple || current_eEnergy !=electronEnergy) {
totAdjointCS = 0.;
DefineCurrentMaterialAndElectronEnergy(aCouple, electronEnergy);
const G4ElementVector* theElementVector = currentMaterial->GetElementVector();
const G4double* theAtomNumDensityVector = currentMaterial->GetVecNbOfAtomsPerVolume();
const double* theAtomNumDensityVector = currentMaterial->GetVecNbOfAtomsPerVolume();
size_t nelm = currentMaterial->GetNumberOfElements();
for (index_element=0;index_element<nelm;index_element++){
totAdjointCS +=AdjointCrossSectionPerAtom((*theElementVector)[index_element],electronEnergy)*theAtomNumDensityVector[index_element];
xsec[index_element] = totAdjointCS;
}
}
return totAdjointCS;
totBiasedAdjointCS=std::min(totAdjointCS,0.01);
// totBiasedAdjointCS=totAdjointCS;
factorCSBiasing = totBiasedAdjointCS/totAdjointCS;
lastCS=totBiasedAdjointCS;
}
return totBiasedAdjointCS;
}
////////////////////////////////////////////////////////////////////////////////
@@ -187,25 +218,28 @@ G4double G4AdjointPhotoElectricModel::AdjointCrossSectionPerAtom(const G4Element
{
G4int nShells = anElement->GetNbOfAtomicShells();
G4double Z= anElement->GetZ();
G4double N= anElement->GetN();
G4int i = 0;
G4double B0=anElement->GetAtomicShell(0);
G4double gammaEnergy = electronEnergy+B0;
G4double adjointCS = theDirectPEEffectModel->ComputeCrossSectionPerAtom(G4Gamma::Gamma(),gammaEnergy,Z,N,0.,0.)*electronEnergy/gammaEnergy;
G4double CS= theDirectPEEffectModel->ComputeCrossSectionPerAtom(G4Gamma::Gamma(),gammaEnergy,Z,0.,0.,0.);
G4double adjointCS =0.;
if (CS >0) adjointCS += CS/gammaEnergy;
shell_prob[index_element][0] = adjointCS;
for (i=1;i<nShells;i++){
//G4cout<<i<<std::endl;
//G4cout<<i<<G4endl;
G4double Bi_= anElement->GetAtomicShell(i-1);
G4double Bi = anElement->GetAtomicShell(i);
//G4cout<<Bi_<<'\t'<<Bi<<std::endl;
//G4cout<<Bi_<<'\t'<<Bi<<G4endl;
if (electronEnergy <Bi_-Bi) {
gammaEnergy = electronEnergy+Bi;
adjointCS +=theDirectPEEffectModel->ComputeCrossSectionPerAtom(G4Gamma::Gamma(),gammaEnergy,anElement->GetZ(),N,0.,0.)*electronEnergy/gammaEnergy;
CS=theDirectPEEffectModel->ComputeCrossSectionPerAtom(G4Gamma::Gamma(),gammaEnergy,Z,0.,0.,0.);
if (CS>0) adjointCS +=CS/gammaEnergy;
}
shell_prob[index_element][i] = adjointCS;
}
adjointCS*=electronEnergy;
return adjointCS;
}