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,11 +23,14 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AdjointCSManager.hh,v 1.4 2009/11/20 10:31:20 ldesorgh Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
/////////////////////////////////////////////////////////////////////////////////
// Module: G4AdjointCSManager.hh
// Class: G4AdjointCSManager
// Author: L. Desorgher
// Date: 1st April 2007
// Organisation: SpaceIT GmbH
// Contract: ESA contract 21435/08/NL/AT
// Customer: ESA/ESTEC
/////////////////////////////////////////////////////////////////////////////////
//
@@ -35,11 +38,14 @@
// --------------
// ChangeHistory:
// 1st April 2007 creation by L. Desorgher
//
// September-October 2009. Implementation of the mode where the adjoint cross sections are scaled such that the total used adjoint cross sections is in
// most of the cases equal to the total forward cross section. L.Desorgher
//
//-------------------------------------------------------------
// Documentation:
// Is responsible for the management of all adjoint cross sections matrices, and for the computation of the total forward and adjoint cross sections.
// Total adjoint and forward cross sections are needed to correct continuously the weight of a particle after a tracking step.
// Total adjoint and forward cross sections are needed to correct the weight of a particle after a tracking step or after the occurence of a reverse reaction.
// It is also used to sample an adjoint secondary from a given adjoint cross section matrix.
//
#ifndef G4AdjointCSManager_h
@@ -81,47 +87,77 @@ class G4AdjointCSManager
void RegisterAdjointParticle(G4ParticleDefinition* aPartDef);
//Building of thr CS Matrices and Total Forward and Adjoint LambdaTables
//Building of the CS Matrices and Total Forward and Adjoint LambdaTables
//----------------------------------------------------------------------
void BuildCrossSectionMatrices();
void BuildTotalSigmaTables();
//Get TotalCrossSections form Total Lambda Tables
//Get TotalCrossSections form Total Lambda Tables, Needed for Weight correction and scaling of the
//-------------------------------------------------
G4double GetTotalAdjointCS(G4ParticleDefinition* aPartDef, G4double Ekin,
const G4MaterialCutsCouple* aCouple);
G4double GetTotalForwardCS(G4ParticleDefinition* aPartDef, G4double Ekin,
const G4MaterialCutsCouple* aCouple);
const G4MaterialCutsCouple* aCouple);
void GetEminForTotalCS(G4ParticleDefinition* aPartDef,
const G4MaterialCutsCouple* aCouple, G4double& emin_adj, G4double& emin_fwd);
void GetMaxFwdTotalCS(G4ParticleDefinition* aPartDef,
const G4MaterialCutsCouple* aCouple, G4double& e_sigma_max, G4double& sigma_max);
void GetMaxAdjTotalCS(G4ParticleDefinition* aPartDef,
const G4MaterialCutsCouple* aCouple, G4double& e_sigma_max, G4double& sigma_max);
//CrossSection Correction 1 or FwdCS/AdjCS following the G4boolean value of forward_CS_is_used and forward_CS_mode
//-------------------------------------------------
G4double GetCrossSectionCorrection(G4ParticleDefinition* aPartDef,G4double PreStepEkin,const G4MaterialCutsCouple* aCouple, G4bool& fwd_is_used, G4double& fwd_TotCS);
//Cross section mode
//------------------
inline void SetFwdCrossSectionMode(G4bool aBool){forward_CS_mode=aBool;}
//Weight correction
//------------------
G4double GetContinuousWeightCorrection(G4ParticleDefinition* aPartDef, G4double PreStepEkin,G4double AfterStepEkin,
const G4MaterialCutsCouple* aCouple, G4double step_length);
G4double GetPostStepWeightCorrection(G4ParticleDefinition* aPrimPartDef, G4ParticleDefinition* aSecondPartDef,
G4double EkinPrim,G4double EkinSecond,
const G4MaterialCutsCouple* aCouple);
G4double GetPostStepWeightCorrection();
double ComputeAdjointCS(G4Material* aMaterial,
//Method Called by the adjoint model to get there CS, if not precised otherwise
//-------------------------------
G4double ComputeAdjointCS(G4Material* aMaterial,
G4VEmAdjointModel* aModel,
G4double PrimEnergy,
G4double Tcut,
G4bool IsScatProjToProjCase,
std::vector<double>&
std::vector<G4double>&
AdjointCS_for_each_element);
//Method Called by the adjoint model to sample the secondary energy form the CS matrix
//--------------------------------------------------------------------------------
G4Element* SampleElementFromCSMatrices(G4Material* aMaterial,
G4VEmAdjointModel* aModel,
G4double PrimEnergy,
G4double Tcut,
G4bool IsScatProjToProjCase);
G4double ComputeTotalAdjointCS(const G4MaterialCutsCouple* aMatCutCouple,G4ParticleDefinition* aPart,G4double PrimEnergy);
//Total Adjoint CS is computed at initialisation phase
//-----------------------------------------------------
G4double ComputeTotalAdjointCS(const G4MaterialCutsCouple* aMatCutCouple,G4ParticleDefinition* aPart,G4double PrimEnergy);
G4ParticleDefinition* GetAdjointParticleEquivalent(G4ParticleDefinition* theFwdPartDef);
G4ParticleDefinition* GetForwardParticleEquivalent(G4ParticleDefinition* theAdjPartDef);
@@ -129,14 +165,8 @@ class G4AdjointCSManager
inline void SetTmin(G4double aVal){Tmin=aVal;}
inline void SetTmax(G4double aVal){Tmax=aVal;}
inline void SetNbins(G4int aInt){nbins=aInt;}
//inline
inline void ConsiderContinuousWeightCorrection(G4bool aBool){consider_continuous_weight_correction=aBool;}
inline void ConsiderPoststepWeightCorrection(G4bool aBool){consider_poststep_weight_correction=aBool;}
inline void SetIon(G4ParticleDefinition* adjIon,
G4ParticleDefinition* fwdIon) {theAdjIon=adjIon; theFwdIon =fwdIon;}
private:
@@ -162,13 +192,22 @@ class G4AdjointCSManager
G4double lastTcut;
std::vector< size_t> listOfIndexOfAdjointEMModelInAction;
std::vector< G4bool> listOfIsScatProjToProjCase;
std::vector< std::vector<double> > lastAdjointCSVsModelsAndElements;
std::vector< std::vector<G4double> > lastAdjointCSVsModelsAndElements;
G4bool CrossSectionMatrixesAreBuilt;
size_t currentParticleIndex;
G4ParticleDefinition* currentParticleDef;
//total adjoint and total forward cross section table in function of material and in function of adjoint particle type
//--------------------------------------------------------------------------------------------------------------------
std::vector<G4PhysicsTable*> theTotalForwardSigmaTableVector;
std::vector<G4PhysicsTable*> theTotalAdjointSigmaTableVector;
std::vector< std::vector<G4double> > EminForFwdSigmaTables;
std::vector< std::vector<G4double> > EminForAdjSigmaTables;
std::vector< std::vector<G4double> > EkinofFwdSigmaMax;
std::vector< std::vector<G4double> > EkinofAdjSigmaMax;
//list of forward G4VEMLossProcess and of G4VEMProcess for the different adjoint particle
//--------------------------------------------------------------
@@ -176,7 +215,7 @@ class G4AdjointCSManager
std::vector< std::vector<G4VEnergyLossProcess*>* > listOfForwardEnergyLossProcess;
//list of adjoint particles considered
//--------------------------------------------------------------
std::vector< G4ParticleDefinition*> theListOfAdjointParticlesInAction;
@@ -190,18 +229,42 @@ class G4AdjointCSManager
G4Material* currentMaterial;
size_t currentMatIndex;
int verbose;
G4int verbose;
//Two CS mode are possible :forward_CS_mode = false the Adjoint CS are used as it is implying a AlongStep Weight Correction.
// :forward_CS_mode = true the Adjoint CS are scaled to have the total adjoint CS eual to the fwd one implying a PostStep Weight Correction.
// For energy range where the total FwdCS or the total adjoint CS are null, the scaling is not possble and
// forward_CS_is_used is set to false
//--------------------------------------------
G4bool forward_CS_is_used;
G4bool forward_CS_mode;
//Adj and Fwd CS values for re-use
//------------------------
G4double PreadjCS,PostadjCS;
G4double PrefwdCS,PostfwdCS;
G4double LastEkinForCS;
G4double LastCSCorrectionFactor;
G4ParticleDefinition* lastPartDefForCS;
//Ion
//----------------
G4ParticleDefinition* theAdjIon; //at the moment Only one ion can be considered by simulation
G4ParticleDefinition* theFwdIon;
G4double massRatio;
//Weight correction
//------------------
G4bool consider_continuous_weight_correction;
G4bool consider_poststep_weight_correction;
private:
G4AdjointCSManager();
void DefineCurrentMaterial(const G4MaterialCutsCouple* couple);
double ComputeAdjointCS(G4double aPrimEnergy, G4AdjointCSMatrix* anAdjointCSMatrix, G4double Tcut);
void DefineCurrentParticle(const G4ParticleDefinition* aPartDef);
G4double ComputeAdjointCS(G4double aPrimEnergy, G4AdjointCSMatrix* anAdjointCSMatrix, G4double Tcut);
};
#endif