Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4AdjointBremsstrahlungModel Class Reference

#include <G4AdjointBremsstrahlungModel.hh>

Inheritance diagram for G4AdjointBremsstrahlungModel:
G4VEmAdjointModel

Public Member Functions

 G4AdjointBremsstrahlungModel (G4VEmModel *aModel)
 
 G4AdjointBremsstrahlungModel ()
 
 ~G4AdjointBremsstrahlungModel ()
 
virtual void SampleSecondaries (const G4Track &aTrack, G4bool IsScatProjToProjCase, G4ParticleChange *fParticleChange)
 
void RapidSampleSecondaries (const G4Track &aTrack, G4bool IsScatProjToProjCase, G4ParticleChange *fParticleChange)
 
virtual G4double DiffCrossSectionPerVolumePrimToSecond (const G4Material *aMaterial, G4double kinEnergyProj, G4double kinEnergyProd)
 
G4double DiffCrossSectionPerVolumePrimToSecondApproximated1 (const G4Material *aMaterial, G4double kinEnergyProj, G4double kinEnergyProd)
 
G4double DiffCrossSectionPerVolumePrimToSecondApproximated2 (const G4Material *aMaterial, G4double kinEnergyProj, G4double kinEnergyProd)
 
virtual G4double AdjointCrossSection (const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool IsScatProjToProjCase)
 
virtual G4double GetAdjointCrossSection (const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool IsScatProjToProjCase)
 
- Public Member Functions inherited from G4VEmAdjointModel
 G4VEmAdjointModel (const G4String &nam)
 
virtual ~G4VEmAdjointModel ()
 
virtual G4double DiffCrossSectionPerAtomPrimToSecond (G4double kinEnergyProj, G4double kinEnergyProd, G4double Z, G4double A=0.)
 
virtual G4double DiffCrossSectionPerAtomPrimToScatPrim (G4double kinEnergyProj, G4double kinEnergyScatProj, G4double Z, G4double A=0.)
 
virtual G4double DiffCrossSectionPerVolumePrimToScatPrim (const G4Material *aMaterial, G4double kinEnergyProj, G4double kinEnergyScatProj)
 
virtual G4double GetSecondAdjEnergyMaxForScatProjToProjCase (G4double PrimAdjEnergy)
 
virtual G4double GetSecondAdjEnergyMinForScatProjToProjCase (G4double PrimAdjEnergy, G4double Tcut=0)
 
virtual G4double GetSecondAdjEnergyMaxForProdToProjCase (G4double PrimAdjEnergy)
 
virtual G4double GetSecondAdjEnergyMinForProdToProjCase (G4double PrimAdjEnergy)
 
void DefineCurrentMaterial (const G4MaterialCutsCouple *couple)
 
std::vector< std::vector
< double > * > 
ComputeAdjointCrossSectionVectorPerAtomForSecond (G4double kinEnergyProd, G4double Z, G4double A=0., G4int nbin_pro_decade=10)
 
std::vector< std::vector
< double > * > 
ComputeAdjointCrossSectionVectorPerAtomForScatProj (G4double kinEnergyProd, G4double Z, G4double A=0., G4int nbin_pro_decade=10)
 
std::vector< std::vector
< double > * > 
ComputeAdjointCrossSectionVectorPerVolumeForSecond (G4Material *aMaterial, G4double kinEnergyProd, G4int nbin_pro_decade=10)
 
std::vector< std::vector
< double > * > 
ComputeAdjointCrossSectionVectorPerVolumeForScatProj (G4Material *aMaterial, G4double kinEnergyProd, G4int nbin_pro_decade=10)
 
void SetCSMatrices (std::vector< G4AdjointCSMatrix * > *Vec1CSMatrix, std::vector< G4AdjointCSMatrix * > *Vec2CSMatrix)
 
G4ParticleDefinitionGetAdjointEquivalentOfDirectPrimaryParticleDefinition ()
 
G4ParticleDefinitionGetAdjointEquivalentOfDirectSecondaryParticleDefinition ()
 
G4double GetHighEnergyLimit ()
 
G4double GetLowEnergyLimit ()
 
void SetHighEnergyLimit (G4double aVal)
 
void SetLowEnergyLimit (G4double aVal)
 
void DefineDirectEMModel (G4VEmModel *aModel)
 
void SetAdjointEquivalentOfDirectPrimaryParticleDefinition (G4ParticleDefinition *aPart)
 
void SetAdjointEquivalentOfDirectSecondaryParticleDefinition (G4ParticleDefinition *aPart)
 
void SetSecondPartOfSameType (G4bool aBool)
 
G4bool GetSecondPartOfSameType ()
 
void SetUseMatrix (G4bool aBool)
 
void SetUseMatrixPerElement (G4bool aBool)
 
void SetUseOnlyOneMatrixForAllElements (G4bool aBool)
 
void SetApplyCutInRange (G4bool aBool)
 
G4bool GetUseMatrix ()
 
G4bool GetUseMatrixPerElement ()
 
G4bool GetUseOnlyOneMatrixForAllElements ()
 
G4bool GetApplyCutInRange ()
 
G4String GetName ()
 
virtual void SetCSBiasingFactor (G4double aVal)
 

Additional Inherited Members

- Protected Member Functions inherited from G4VEmAdjointModel
G4double DiffCrossSectionFunction1 (G4double kinEnergyProj)
 
G4double DiffCrossSectionFunction2 (G4double kinEnergyProj)
 
G4double DiffCrossSectionPerVolumeFunctionForIntegrationOverEkinProj (G4double EkinProd)
 
G4double SampleAdjSecEnergyFromCSMatrix (size_t MatrixIndex, G4double prim_energy, G4bool IsScatProjToProjCase)
 
G4double SampleAdjSecEnergyFromCSMatrix (G4double prim_energy, G4bool IsScatProjToProjCase)
 
void SelectCSMatrix (G4bool IsScatProjToProjCase)
 
virtual G4double SampleAdjSecEnergyFromDiffCrossSectionPerAtom (G4double prim_energy, G4bool IsScatProjToProjCase)
 
virtual void CorrectPostStepWeight (G4ParticleChange *fParticleChange, G4double old_weight, G4double adjointPrimKinEnergy, G4double projectileKinEnergy, G4bool IsScatProjToProjCase)
 
- Protected Attributes inherited from G4VEmAdjointModel
G4VEmModeltheDirectEMModel
 
G4VParticleChangepParticleChange
 
const G4String name
 
G4int ASelectedNucleus
 
G4int ZSelectedNucleus
 
G4MaterialSelectedMaterial
 
G4double kinEnergyProdForIntegration
 
G4double kinEnergyScatProjForIntegration
 
G4double kinEnergyProjForIntegration
 
std::vector< G4AdjointCSMatrix * > * pOnCSMatrixForProdToProjBackwardScattering
 
std::vector< G4AdjointCSMatrix * > * pOnCSMatrixForScatProjToProjBackwardScattering
 
std::vector< G4doubleCS_Vs_ElementForScatProjToProjCase
 
std::vector< G4doubleCS_Vs_ElementForProdToProjCase
 
G4double lastCS
 
G4double lastAdjointCSForScatProjToProjCase
 
G4double lastAdjointCSForProdToProjCase
 
G4ParticleDefinitiontheAdjEquivOfDirectPrimPartDef
 
G4ParticleDefinitiontheAdjEquivOfDirectSecondPartDef
 
G4ParticleDefinitiontheDirectPrimaryPartDef
 
G4bool second_part_of_same_type
 
G4double preStepEnergy
 
G4MaterialcurrentMaterial
 
G4MaterialCutsCouplecurrentCouple
 
size_t currentMaterialIndex
 
size_t currentCoupleIndex
 
G4double currentTcutForDirectPrim
 
G4double currentTcutForDirectSecond
 
G4bool ApplyCutInRange
 
G4double mass_ratio_product
 
G4double mass_ratio_projectile
 
G4double HighEnergyLimit
 
G4double LowEnergyLimit
 
G4double CS_biasing_factor
 
G4bool UseMatrix
 
G4bool UseMatrixPerElement
 
G4bool UseOnlyOneMatrixForAllElements
 
size_t indexOfUsedCrossSectionMatrix
 
size_t model_index
 

Detailed Description

Definition at line 61 of file G4AdjointBremsstrahlungModel.hh.

Constructor & Destructor Documentation

G4AdjointBremsstrahlungModel::G4AdjointBremsstrahlungModel ( G4VEmModel aModel)

Definition at line 46 of file G4AdjointBremsstrahlungModel.cc.

References G4EmModelManager::AddEmModel(), G4AdjointElectron::AdjointElectron(), G4AdjointGamma::AdjointGamma(), G4Electron::Electron(), python.hepunit::GeV, python.hepunit::keV, G4VEmAdjointModel::second_part_of_same_type, G4VEmAdjointModel::SetApplyCutInRange(), G4VEmAdjointModel::SetUseMatrix(), G4VEmAdjointModel::SetUseMatrixPerElement(), G4VEmAdjointModel::theAdjEquivOfDirectPrimPartDef, G4VEmAdjointModel::theAdjEquivOfDirectSecondPartDef, G4VEmAdjointModel::theDirectEMModel, and G4VEmAdjointModel::theDirectPrimaryPartDef.

46  :
47  G4VEmAdjointModel("AdjointeBremModel")
48 {
49  SetUseMatrix(false);
51 
52  theDirectStdBremModel = aModel;
53  theDirectEMModel=theDirectStdBremModel;
54  theEmModelManagerForFwdModels = new G4EmModelManager();
55  isDirectModelInitialised = false;
57  G4Region* r=0;
58  theEmModelManagerForFwdModels->AddEmModel(1, theDirectStdBremModel, f, r);
59 
60  SetApplyCutInRange(true);
61  highKinEnergy= 1.*GeV;
62  lowKinEnergy = 1.0*keV;
63 
64  lastCZ =0.;
65 
66 
71 
72 
73  /*UsePenelopeModel=false;
74  if (UsePenelopeModel) {
75  G4PenelopeBremsstrahlungModel* thePenelopeModel = new G4PenelopeBremsstrahlungModel(G4Electron::Electron(),"PenelopeBrem");
76  theEmModelManagerForFwdModels = new G4EmModelManager();
77  isPenelopeModelInitialised = false;
78  G4VEmFluctuationModel* f=0;
79  G4Region* r=0;
80  theDirectEMModel=thePenelopeModel;
81  theEmModelManagerForFwdModels->AddEmModel(1, thePenelopeModel, f, r);
82  }
83  */
84 
85 
86 
87 }
static G4AdjointGamma * AdjointGamma()
G4ParticleDefinition * theDirectPrimaryPartDef
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *, const G4Region *)
static G4AdjointElectron * AdjointElectron()
G4ParticleDefinition * theAdjEquivOfDirectPrimPartDef
void SetUseMatrixPerElement(G4bool aBool)
G4VEmModel * theDirectEMModel
G4VEmAdjointModel(const G4String &nam)
void SetUseMatrix(G4bool aBool)
static G4Electron * Electron()
Definition: G4Electron.cc:94
G4ParticleDefinition * theAdjEquivOfDirectSecondPartDef
void SetApplyCutInRange(G4bool aBool)
G4AdjointBremsstrahlungModel::G4AdjointBremsstrahlungModel ( )

Definition at line 90 of file G4AdjointBremsstrahlungModel.cc.

References G4EmModelManager::AddEmModel(), G4AdjointElectron::AdjointElectron(), G4AdjointGamma::AdjointGamma(), G4Electron::Electron(), python.hepunit::GeV, python.hepunit::keV, G4VEmAdjointModel::second_part_of_same_type, G4VEmAdjointModel::SetApplyCutInRange(), G4VEmAdjointModel::SetUseMatrix(), G4VEmAdjointModel::SetUseMatrixPerElement(), G4VEmAdjointModel::theAdjEquivOfDirectPrimPartDef, G4VEmAdjointModel::theAdjEquivOfDirectSecondPartDef, G4VEmAdjointModel::theDirectEMModel, and G4VEmAdjointModel::theDirectPrimaryPartDef.

90  :
91  G4VEmAdjointModel("AdjointeBremModel")
92 {
93  SetUseMatrix(false);
95 
96  theDirectStdBremModel = new G4SeltzerBergerModel();
97  theDirectEMModel=theDirectStdBremModel;
98  theEmModelManagerForFwdModels = new G4EmModelManager();
99  isDirectModelInitialised = false;
101  G4Region* r=0;
102  theEmModelManagerForFwdModels->AddEmModel(1, theDirectStdBremModel, f, r);
103  // theDirectPenelopeBremModel =0;
104  SetApplyCutInRange(true);
105  highKinEnergy= 1.*GeV;
106  lowKinEnergy = 1.0*keV;
107  lastCZ =0.;
112 
113 }
static G4AdjointGamma * AdjointGamma()
G4ParticleDefinition * theDirectPrimaryPartDef
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *, const G4Region *)
static G4AdjointElectron * AdjointElectron()
G4ParticleDefinition * theAdjEquivOfDirectPrimPartDef
void SetUseMatrixPerElement(G4bool aBool)
G4VEmModel * theDirectEMModel
G4VEmAdjointModel(const G4String &nam)
void SetUseMatrix(G4bool aBool)
static G4Electron * Electron()
Definition: G4Electron.cc:94
G4ParticleDefinition * theAdjEquivOfDirectSecondPartDef
void SetApplyCutInRange(G4bool aBool)
G4AdjointBremsstrahlungModel::~G4AdjointBremsstrahlungModel ( )

Definition at line 116 of file G4AdjointBremsstrahlungModel.cc.

117 {if (theDirectStdBremModel) delete theDirectStdBremModel;
118  if (theEmModelManagerForFwdModels) delete theEmModelManagerForFwdModels;
119 }

Member Function Documentation

G4double G4AdjointBremsstrahlungModel::AdjointCrossSection ( const G4MaterialCutsCouple aCouple,
G4double  primEnergy,
G4bool  IsScatProjToProjCase 
)
virtual

Reimplemented from G4VEmAdjointModel.

Definition at line 400 of file G4AdjointBremsstrahlungModel.cc.

References G4VEmAdjointModel::AdjointCrossSection(), G4VEmModel::CrossSectionPerVolume(), G4VEmAdjointModel::CS_biasing_factor, G4VEmAdjointModel::currentTcutForDirectSecond, G4VEmAdjointModel::DefineCurrentMaterial(), G4Electron::Electron(), G4Gamma::Gamma(), G4MaterialCutsCouple::GetMaterial(), G4VEmAdjointModel::GetSecondAdjEnergyMaxForProdToProjCase(), G4VEmAdjointModel::GetSecondAdjEnergyMaxForScatProjToProjCase(), G4VEmAdjointModel::GetSecondAdjEnergyMinForProdToProjCase(), G4VEmAdjointModel::GetSecondAdjEnergyMinForScatProjToProjCase(), G4EmModelManager::Initialise(), python.hepunit::MeV, G4VEmAdjointModel::theDirectEMModel, G4VEmAdjointModel::theDirectPrimaryPartDef, and G4VEmAdjointModel::UseMatrix.

Referenced by GetAdjointCrossSection().

403 { if (!isDirectModelInitialised) {
404  theEmModelManagerForFwdModels->Initialise(G4Electron::Electron(),G4Gamma::Gamma(),1.,0);
405  isDirectModelInitialised =true;
406  }
407  if (UseMatrix) return G4VEmAdjointModel::AdjointCrossSection(aCouple,primEnergy,IsScatProjToProjCase);
408  DefineCurrentMaterial(aCouple);
409  G4double Cross=0.;
410  lastCZ=theDirectEMModel->CrossSectionPerVolume(aCouple->GetMaterial(),theDirectPrimaryPartDef,100.*MeV,100.*MeV/std::exp(1.));//this give the constant above
411 
412  if (!IsScatProjToProjCase ){
413  G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProjCase(primEnergy);
414  G4double Emin_proj = GetSecondAdjEnergyMinForProdToProjCase(primEnergy);
415  if (Emax_proj>Emin_proj && primEnergy > currentTcutForDirectSecond) Cross= 100.*CS_biasing_factor*lastCZ*std::log(Emax_proj/Emin_proj);
416  }
417  else {
420  if (Emax_proj>Emin_proj) Cross= lastCZ*std::log((Emax_proj-primEnergy)*Emin_proj/Emax_proj/(Emin_proj-primEnergy));
421 
422  }
423  return Cross;
424 }
virtual G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.cc:245
virtual G4double GetSecondAdjEnergyMaxForProdToProjCase(G4double PrimAdjEnergy)
G4ParticleDefinition * theDirectPrimaryPartDef
virtual G4double GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy)
G4VEmModel * theDirectEMModel
virtual G4double GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy)
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
void DefineCurrentMaterial(const G4MaterialCutsCouple *couple)
const G4DataVector * Initialise(const G4ParticleDefinition *part, const G4ParticleDefinition *secPart, G4double minSubRange, G4int verb)
virtual G4double AdjointCrossSection(const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool IsScatProjToProjCase)
virtual G4double GetSecondAdjEnergyMinForScatProjToProjCase(G4double PrimAdjEnergy, G4double Tcut=0)
static G4Electron * Electron()
Definition: G4Electron.cc:94
G4double currentTcutForDirectSecond
double G4double
Definition: G4Types.hh:76
const G4Material * GetMaterial() const
G4double G4AdjointBremsstrahlungModel::DiffCrossSectionPerVolumePrimToSecond ( const G4Material aMaterial,
G4double  kinEnergyProj,
G4double  kinEnergyProd 
)
virtual

Reimplemented from G4VEmAdjointModel.

Definition at line 311 of file G4AdjointBremsstrahlungModel.cc.

References DiffCrossSectionPerVolumePrimToSecondApproximated2(), G4Electron::Electron(), G4Gamma::Gamma(), and G4EmModelManager::Initialise().

Referenced by RapidSampleSecondaries().

315 {if (!isDirectModelInitialised) {
316  theEmModelManagerForFwdModels->Initialise(G4Electron::Electron(),G4Gamma::Gamma(),1.,0);
317  isDirectModelInitialised =true;
318  }
319 
321  kinEnergyProj,
322  kinEnergyProd);
323  /*return G4VEmAdjointModel::DiffCrossSectionPerVolumePrimToSecond(aMaterial,
324  kinEnergyProj,
325  kinEnergyProd);*/
326 }
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
const G4DataVector * Initialise(const G4ParticleDefinition *part, const G4ParticleDefinition *secPart, G4double minSubRange, G4int verb)
G4double DiffCrossSectionPerVolumePrimToSecondApproximated2(const G4Material *aMaterial, G4double kinEnergyProj, G4double kinEnergyProd)
static G4Electron * Electron()
Definition: G4Electron.cc:94
G4double G4AdjointBremsstrahlungModel::DiffCrossSectionPerVolumePrimToSecondApproximated1 ( const G4Material aMaterial,
G4double  kinEnergyProj,
G4double  kinEnergyProd 
)

Definition at line 330 of file G4AdjointBremsstrahlungModel.cc.

References G4VEmModel::CrossSectionPerVolume(), G4VEmAdjointModel::GetSecondAdjEnergyMaxForProdToProjCase(), G4VEmAdjointModel::GetSecondAdjEnergyMinForProdToProjCase(), python.hepunit::keV, G4VEmAdjointModel::theDirectEMModel, and G4VEmAdjointModel::theDirectPrimaryPartDef.

335 {
336  G4double dCrossEprod=0.;
337  G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProjCase(kinEnergyProd);
338  G4double Emin_proj = GetSecondAdjEnergyMinForProdToProjCase(kinEnergyProd);
339 
340 
341  //In this approximation we consider that the secondary gammas are sampled with 1/Egamma energy distribution
342  //This is what is applied in the discrete standard model before the rejection test that make a correction
343  //The application of the same rejection function is not possible here.
344  //The differentiation of the CS over Ecut does not produce neither a good differential CS. That is due to the
345  // fact that in the discrete model the differential CS and the integrated CS are both fitted but separatly and
346  // therefore do not allow a correct numerical differentiation of the integrated CS to get the differential one.
347  // In the future we plan to use the brem secondary spectra from the G4Penelope implementation
348 
349  if (kinEnergyProj>Emin_proj && kinEnergyProj<=Emax_proj){
351  dCrossEprod=sigma/kinEnergyProd/std::log(kinEnergyProj/keV);
352  }
353  return dCrossEprod;
354 
355 }
virtual G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.cc:245
virtual G4double GetSecondAdjEnergyMaxForProdToProjCase(G4double PrimAdjEnergy)
G4ParticleDefinition * theDirectPrimaryPartDef
G4VEmModel * theDirectEMModel
virtual G4double GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy)
double G4double
Definition: G4Types.hh:76
G4double G4AdjointBremsstrahlungModel::DiffCrossSectionPerVolumePrimToSecondApproximated2 ( const G4Material aMaterial,
G4double  kinEnergyProj,
G4double  kinEnergyProd 
)

Definition at line 359 of file G4AdjointBremsstrahlungModel.cc.

References C1, G4VEmModel::ComputeCrossSectionPerAtom(), G4Material::GetAtomicNumDensityVector(), G4Material::GetElementVector(), G4Material::GetNumberOfElements(), G4VEmAdjointModel::theDirectEMModel, and G4VEmAdjointModel::theDirectPrimaryPartDef.

Referenced by DiffCrossSectionPerVolumePrimToSecond().

364 {
365  //In this approximation we derive the direct cross section over Tcut=gamma energy, en after apply the Migdla correction factor
366  //used in the direct model
367 
368  G4double dCrossEprod=0.;
369 
370  const G4ElementVector* theElementVector = material->GetElementVector();
371  const double* theAtomNumDensityVector = material->GetAtomicNumDensityVector();
372  G4double dum=0.;
373  G4double E1=kinEnergyProd,E2=kinEnergyProd*1.001;
374  G4double dE=E2-E1;
375  for (size_t i=0; i<material->GetNumberOfElements(); i++) {
376  G4double C1=theDirectEMModel->ComputeCrossSectionPerAtom(theDirectPrimaryPartDef,kinEnergyProj,(*theElementVector)[i]->GetZ(),dum ,E1);
377  G4double C2=theDirectEMModel->ComputeCrossSectionPerAtom(theDirectPrimaryPartDef,kinEnergyProj,(*theElementVector)[i]->GetZ(),dum,E2);
378  dCrossEprod += theAtomNumDensityVector[i] * (C1-C2)/dE;
379 
380  }
381 
382  //Now the Migdal correction
383 /*
384  G4double totalEnergy = kinEnergyProj+electron_mass_c2 ;
385  G4double kp2 = MigdalConstant*totalEnergy*totalEnergy
386  *(material->GetElectronDensity());
387 
388 
389  G4double MigdalFactor = 1./(1.+kp2/(kinEnergyProd*kinEnergyProd)); // its seems that the factor used in the CS compuation i the direct
390  //model is different than the one used in the secondary sampling by a
391  //factor (1.+kp2) To be checked!
392 
393  dCrossEprod*=MigdalFactor;
394  */
395  return dCrossEprod;
396 
397 }
std::vector< G4Element * > G4ElementVector
G4ParticleDefinition * theDirectPrimaryPartDef
string material
Definition: eplot.py:19
G4VEmModel * theDirectEMModel
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0., G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.cc:300
#define C1
double G4double
Definition: G4Types.hh:76
G4double G4AdjointBremsstrahlungModel::GetAdjointCrossSection ( const G4MaterialCutsCouple aCouple,
G4double  primEnergy,
G4bool  IsScatProjToProjCase 
)
virtual

Reimplemented from G4VEmAdjointModel.

Definition at line 426 of file G4AdjointBremsstrahlungModel.cc.

References AdjointCrossSection(), G4VEmModel::CrossSectionPerVolume(), G4VEmAdjointModel::GetAdjointCrossSection(), G4MaterialCutsCouple::GetMaterial(), python.hepunit::MeV, G4VEmAdjointModel::theDirectEMModel, and G4VEmAdjointModel::theDirectPrimaryPartDef.

429 {
430  return AdjointCrossSection(aCouple, primEnergy,IsScatProjToProjCase);
431  lastCZ=theDirectEMModel->CrossSectionPerVolume(aCouple->GetMaterial(),theDirectPrimaryPartDef,100.*MeV,100.*MeV/std::exp(1.));//this give the constant above
432  return G4VEmAdjointModel::GetAdjointCrossSection(aCouple, primEnergy,IsScatProjToProjCase);
433 
434 }
virtual G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.cc:245
virtual G4double AdjointCrossSection(const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool IsScatProjToProjCase)
G4ParticleDefinition * theDirectPrimaryPartDef
virtual G4double GetAdjointCrossSection(const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool IsScatProjToProjCase)
G4VEmModel * theDirectEMModel
const G4Material * GetMaterial() const
void G4AdjointBremsstrahlungModel::RapidSampleSecondaries ( const G4Track aTrack,
G4bool  IsScatProjToProjCase,
G4ParticleChange fParticleChange 
)

Definition at line 201 of file G4AdjointBremsstrahlungModel.cc.

References G4ParticleChange::AddSecondary(), CLHEP::Hep3Vector::angle(), G4VEmAdjointModel::CS_biasing_factor, G4VEmAdjointModel::currentMaterial, G4VEmAdjointModel::currentTcutForDirectSecond, G4VEmAdjointModel::DefineCurrentMaterial(), DiffCrossSectionPerVolumePrimToSecond(), python.hepunit::electron_mass_c2, fStopAndKill, G4UniformRand, G4AdjointCSManager::GetAdjointCSManager(), G4Track::GetDynamicParticle(), G4DynamicParticle::GetKineticEnergy(), G4Track::GetMaterialCutsCouple(), G4DynamicParticle::GetMomentumDirection(), G4ParticleDefinition::GetPDGMass(), G4AdjointCSManager::GetPostStepWeightCorrection(), G4VEmAdjointModel::GetSecondAdjEnergyMaxForProdToProjCase(), G4VEmAdjointModel::GetSecondAdjEnergyMaxForScatProjToProjCase(), G4VEmAdjointModel::GetSecondAdjEnergyMinForProdToProjCase(), G4VEmAdjointModel::GetSecondAdjEnergyMinForScatProjToProjCase(), G4DynamicParticle::GetTotalEnergy(), G4Track::GetWeight(), G4VEmAdjointModel::HighEnergyLimit, G4ParticleChange::ProposeEnergy(), G4ParticleChange::ProposeMomentumDirection(), G4VParticleChange::ProposeParentWeight(), G4VParticleChange::ProposeTrackStatus(), CLHEP::Hep3Vector::rotateUz(), G4VParticleChange::SetParentWeightByProcess(), G4VParticleChange::SetSecondaryWeightByProcess(), G4VEmAdjointModel::theAdjEquivOfDirectPrimPartDef, python.hepunit::twopi, and CLHEP::Hep3Vector::unit().

Referenced by SampleSecondaries().

204 {
205 
206  const G4DynamicParticle* theAdjointPrimary =aTrack.GetDynamicParticle();
208 
209 
210  G4double adjointPrimKinEnergy = theAdjointPrimary->GetKineticEnergy();
211  G4double adjointPrimTotalEnergy = theAdjointPrimary->GetTotalEnergy();
212 
213  if (adjointPrimKinEnergy>HighEnergyLimit*0.999){
214  return;
215  }
216 
217  G4double projectileKinEnergy =0.;
218  G4double gammaEnergy=0.;
219  G4double diffCSUsed=0.;
220  if (!IsScatProjToProjCase){
221  gammaEnergy=adjointPrimKinEnergy;
222  G4double Emax = GetSecondAdjEnergyMaxForProdToProjCase(adjointPrimKinEnergy);
223  G4double Emin= GetSecondAdjEnergyMinForProdToProjCase(adjointPrimKinEnergy);;
224  if (Emin>=Emax) return;
225  projectileKinEnergy=Emin*std::pow(Emax/Emin,G4UniformRand());
226  diffCSUsed=100.*CS_biasing_factor*lastCZ/projectileKinEnergy;
227 
228  }
229  else { G4double Emax = GetSecondAdjEnergyMaxForScatProjToProjCase(adjointPrimKinEnergy);
231  if (Emin>=Emax) return;
232  G4double f1=(Emin-adjointPrimKinEnergy)/Emin;
233  G4double f2=(Emax-adjointPrimKinEnergy)/Emax/f1;
234  //G4cout<<"f1 and f2 "<<f1<<'\t'<<f2<<G4endl;
235  projectileKinEnergy=adjointPrimKinEnergy/(1.-f1*std::pow(f2,G4UniformRand()));
236  gammaEnergy=projectileKinEnergy-adjointPrimKinEnergy;
237  diffCSUsed=lastCZ*adjointPrimKinEnergy/projectileKinEnergy/gammaEnergy;
238 
239  }
240 
241 
242 
243 
244  //Weight correction
245  //-----------------------
246  //First w_corr is set to the ratio between adjoint total CS and fwd total CS
248 
249  //Then another correction is needed due to the fact that a biaised differential CS has been used rather than the one consistent with the direct model
250  //Here we consider the true diffCS as the one obtained by the numericla differentiation over Tcut of the direct CS, corrected by the Migdal term.
251  //Basically any other differential CS diffCS could be used here (example Penelope).
252 
253  G4double diffCS = DiffCrossSectionPerVolumePrimToSecond(currentMaterial, projectileKinEnergy, gammaEnergy);
254  w_corr*=diffCS/diffCSUsed;
255 
256  G4double new_weight = aTrack.GetWeight()*w_corr;
257  fParticleChange->SetParentWeightByProcess(false);
258  fParticleChange->SetSecondaryWeightByProcess(false);
259  fParticleChange->ProposeParentWeight(new_weight);
260 
261  //Kinematic
262  //---------
264  G4double projectileTotalEnergy = projectileM0+projectileKinEnergy;
265  G4double projectileP2 = projectileTotalEnergy*projectileTotalEnergy - projectileM0*projectileM0;
266  G4double projectileP = std::sqrt(projectileP2);
267 
268 
269  //Angle of the gamma direction with the projectile taken from G4eBremsstrahlungModel
270  //------------------------------------------------
271  G4double u;
272  const G4double a1 = 0.625 , a2 = 3.*a1 , d = 27. ;
273 
274  if (9./(9.+d) > G4UniformRand()) u = - std::log(G4UniformRand()*G4UniformRand())/a1;
275  else u = - std::log(G4UniformRand()*G4UniformRand())/a2;
276 
277  G4double theta = u*electron_mass_c2/projectileTotalEnergy;
278 
279  G4double sint = std::sin(theta);
280  G4double cost = std::cos(theta);
281 
282  G4double phi = twopi * G4UniformRand() ;
283 
284  G4ThreeVector projectileMomentum;
285  projectileMomentum=G4ThreeVector(std::cos(phi)*sint,std::sin(phi)*sint,cost)*projectileP; //gamma frame
286  if (IsScatProjToProjCase) {//the adjoint primary is the scattered e-
287  G4ThreeVector gammaMomentum = (projectileTotalEnergy-adjointPrimTotalEnergy)*G4ThreeVector(0.,0.,1.);
288  G4ThreeVector dirProd=projectileMomentum-gammaMomentum;
289  G4double cost1 = std::cos(dirProd.angle(projectileMomentum));
290  G4double sint1 = std::sqrt(1.-cost1*cost1);
291  projectileMomentum=G4ThreeVector(std::cos(phi)*sint1,std::sin(phi)*sint1,cost1)*projectileP;
292 
293  }
294 
295  projectileMomentum.rotateUz(theAdjointPrimary->GetMomentumDirection());
296 
297 
298 
299  if (!IsScatProjToProjCase ){ //kill the primary and add a secondary
300  fParticleChange->ProposeTrackStatus(fStopAndKill);
301  fParticleChange->AddSecondary(new G4DynamicParticle(theAdjEquivOfDirectPrimPartDef,projectileMomentum));
302  }
303  else {
304  fParticleChange->ProposeEnergy(projectileKinEnergy);
305  fParticleChange->ProposeMomentumDirection(projectileMomentum.unit());
306 
307  }
308 }
virtual G4double GetSecondAdjEnergyMaxForProdToProjCase(G4double PrimAdjEnergy)
double angle(const Hep3Vector &) const
G4double GetKineticEnergy() const
CLHEP::Hep3Vector G4ThreeVector
G4double GetTotalEnergy() const
G4double GetPostStepWeightCorrection()
const G4DynamicParticle * GetDynamicParticle() const
void ProposeParentWeight(G4double finalWeight)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
G4Material * currentMaterial
G4ParticleDefinition * theAdjEquivOfDirectPrimPartDef
virtual G4double GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy)
void SetSecondaryWeightByProcess(G4bool)
void SetParentWeightByProcess(G4bool)
virtual G4double DiffCrossSectionPerVolumePrimToSecond(const G4Material *aMaterial, G4double kinEnergyProj, G4double kinEnergyProd)
#define G4UniformRand()
Definition: Randomize.hh:87
virtual G4double GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy)
const G4ThreeVector & GetMomentumDirection() const
Hep3Vector & rotateUz(const Hep3Vector &)
Definition: ThreeVector.cc:72
float electron_mass_c2
Definition: hepunit.py:274
void DefineCurrentMaterial(const G4MaterialCutsCouple *couple)
G4double GetPDGMass() const
virtual G4double GetSecondAdjEnergyMinForScatProjToProjCase(G4double PrimAdjEnergy, G4double Tcut=0)
Hep3Vector unit() const
void ProposeEnergy(G4double finalEnergy)
void AddSecondary(G4Track *aSecondary)
G4double GetWeight() const
G4double currentTcutForDirectSecond
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
double G4double
Definition: G4Types.hh:76
void ProposeTrackStatus(G4TrackStatus status)
static G4AdjointCSManager * GetAdjointCSManager()
void G4AdjointBremsstrahlungModel::SampleSecondaries ( const G4Track aTrack,
G4bool  IsScatProjToProjCase,
G4ParticleChange fParticleChange 
)
virtual

Implements G4VEmAdjointModel.

Definition at line 123 of file G4AdjointBremsstrahlungModel.cc.

References G4ParticleChange::AddSecondary(), CLHEP::Hep3Vector::angle(), G4VEmAdjointModel::CorrectPostStepWeight(), G4VEmAdjointModel::DefineCurrentMaterial(), python.hepunit::electron_mass_c2, fStopAndKill, G4UniformRand, G4Track::GetDynamicParticle(), G4DynamicParticle::GetKineticEnergy(), G4Track::GetMaterialCutsCouple(), G4DynamicParticle::GetMomentumDirection(), G4ParticleDefinition::GetPDGMass(), G4DynamicParticle::GetTotalEnergy(), G4Track::GetWeight(), G4VEmAdjointModel::HighEnergyLimit, G4ParticleChange::ProposeEnergy(), G4ParticleChange::ProposeMomentumDirection(), G4VParticleChange::ProposeTrackStatus(), RapidSampleSecondaries(), CLHEP::Hep3Vector::rotateUz(), G4VEmAdjointModel::SampleAdjSecEnergyFromCSMatrix(), G4VEmAdjointModel::theAdjEquivOfDirectPrimPartDef, python.hepunit::twopi, CLHEP::Hep3Vector::unit(), and G4VEmAdjointModel::UseMatrix.

126 {
127  if (!UseMatrix) return RapidSampleSecondaries(aTrack,IsScatProjToProjCase,fParticleChange);
128 
129  const G4DynamicParticle* theAdjointPrimary =aTrack.GetDynamicParticle();
131 
132 
133  G4double adjointPrimKinEnergy = theAdjointPrimary->GetKineticEnergy();
134  G4double adjointPrimTotalEnergy = theAdjointPrimary->GetTotalEnergy();
135 
136  if (adjointPrimKinEnergy>HighEnergyLimit*0.999){
137  return;
138  }
139 
140  G4double projectileKinEnergy = SampleAdjSecEnergyFromCSMatrix(adjointPrimKinEnergy,
141  IsScatProjToProjCase);
142  //Weight correction
143  //-----------------------
144  CorrectPostStepWeight(fParticleChange,
145  aTrack.GetWeight(),
146  adjointPrimKinEnergy,
147  projectileKinEnergy,
148  IsScatProjToProjCase);
149 
150 
151  //Kinematic
152  //---------
154  G4double projectileTotalEnergy = projectileM0+projectileKinEnergy;
155  G4double projectileP2 = projectileTotalEnergy*projectileTotalEnergy - projectileM0*projectileM0;
156  G4double projectileP = std::sqrt(projectileP2);
157 
158 
159  //Angle of the gamma direction with the projectile taken from G4eBremsstrahlungModel
160  //------------------------------------------------
161  G4double u;
162  const G4double a1 = 0.625 , a2 = 3.*a1 , d = 27. ;
163 
164  if (9./(9.+d) > G4UniformRand()) u = - std::log(G4UniformRand()*G4UniformRand())/a1;
165  else u = - std::log(G4UniformRand()*G4UniformRand())/a2;
166 
167  G4double theta = u*electron_mass_c2/projectileTotalEnergy;
168 
169  G4double sint = std::sin(theta);
170  G4double cost = std::cos(theta);
171 
172  G4double phi = twopi * G4UniformRand() ;
173 
174  G4ThreeVector projectileMomentum;
175  projectileMomentum=G4ThreeVector(std::cos(phi)*sint,std::sin(phi)*sint,cost)*projectileP; //gamma frame
176  if (IsScatProjToProjCase) {//the adjoint primary is the scattered e-
177  G4ThreeVector gammaMomentum = (projectileTotalEnergy-adjointPrimTotalEnergy)*G4ThreeVector(0.,0.,1.);
178  G4ThreeVector dirProd=projectileMomentum-gammaMomentum;
179  G4double cost1 = std::cos(dirProd.angle(projectileMomentum));
180  G4double sint1 = std::sqrt(1.-cost1*cost1);
181  projectileMomentum=G4ThreeVector(std::cos(phi)*sint1,std::sin(phi)*sint1,cost1)*projectileP;
182 
183  }
184 
185  projectileMomentum.rotateUz(theAdjointPrimary->GetMomentumDirection());
186 
187 
188 
189  if (!IsScatProjToProjCase ){ //kill the primary and add a secondary
190  fParticleChange->ProposeTrackStatus(fStopAndKill);
191  fParticleChange->AddSecondary(new G4DynamicParticle(theAdjEquivOfDirectPrimPartDef,projectileMomentum));
192  }
193  else {
194  fParticleChange->ProposeEnergy(projectileKinEnergy);
195  fParticleChange->ProposeMomentumDirection(projectileMomentum.unit());
196 
197  }
198 }
double angle(const Hep3Vector &) const
G4double GetKineticEnergy() const
CLHEP::Hep3Vector G4ThreeVector
G4double GetTotalEnergy() const
const G4DynamicParticle * GetDynamicParticle() const
G4double SampleAdjSecEnergyFromCSMatrix(size_t MatrixIndex, G4double prim_energy, G4bool IsScatProjToProjCase)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
G4ParticleDefinition * theAdjEquivOfDirectPrimPartDef
#define G4UniformRand()
Definition: Randomize.hh:87
const G4ThreeVector & GetMomentumDirection() const
Hep3Vector & rotateUz(const Hep3Vector &)
Definition: ThreeVector.cc:72
void RapidSampleSecondaries(const G4Track &aTrack, G4bool IsScatProjToProjCase, G4ParticleChange *fParticleChange)
float electron_mass_c2
Definition: hepunit.py:274
void DefineCurrentMaterial(const G4MaterialCutsCouple *couple)
G4double GetPDGMass() const
Hep3Vector unit() const
void ProposeEnergy(G4double finalEnergy)
void AddSecondary(G4Track *aSecondary)
G4double GetWeight() const
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
double G4double
Definition: G4Types.hh:76
void ProposeTrackStatus(G4TrackStatus status)
virtual void CorrectPostStepWeight(G4ParticleChange *fParticleChange, G4double old_weight, G4double adjointPrimKinEnergy, G4double projectileKinEnergy, G4bool IsScatProjToProjCase)

The documentation for this class was generated from the following files: