Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4SandiaTable Class Reference

#include <G4SandiaTable.hh>

Public Member Functions

 G4SandiaTable ()
 
 G4SandiaTable (const G4Material *)
 
 G4SandiaTable (G4int matIndex)
 
 ~G4SandiaTable ()
 
 G4SandiaTable (G4SandiaTable &)=delete
 
G4SandiaTableoperator= (const G4SandiaTable &right)=delete
 
void GetSandiaCofPerAtom (G4int Z, G4double energy, std::vector< G4double > &coeff) const
 
void GetSandiaCofWater (G4double energy, std::vector< G4double > &coeff) const
 
G4double GetWaterEnergyLimit () const
 
G4double GetWaterCofForMaterial (G4int, G4int) const
 
G4int GetMatNbOfIntervals () const
 
G4double GetSandiaCofForMaterial (G4int, G4int) const
 
G4double GetSandiaMatTable (G4int, G4int) const
 
const G4doubleGetSandiaCofForMaterial (G4double energy) const
 
G4double GetSandiaMatTablePAI (G4int, G4int) const
 
const G4doubleGetSandiaCofForMaterialPAI (G4double energy) const
 
void SetVerbose (G4int ver)
 
void Initialize (const G4Material *)
 
G4int SandiaIntervals (G4int Z[], G4int el)
 
G4int SandiaMixing (G4int Z[], const G4double *fractionW, G4int el, G4int mi)
 
G4double GetPhotoAbsorpCof (G4int i, G4int j) const
 
G4int GetMaxInterval () const
 
G4bool GetLowerI1 ()
 
void SetLowerI1 (G4bool flag)
 
G4bool operator== (const G4SandiaTable &) const =delete
 
G4bool operator!= (const G4SandiaTable &) const =delete
 

Static Public Member Functions

static G4double GetZtoA (G4int Z)
 

Detailed Description

Definition at line 58 of file G4SandiaTable.hh.

Constructor & Destructor Documentation

◆ G4SandiaTable() [1/4]

G4SandiaTable::G4SandiaTable ( )

Definition at line 625 of file G4SandiaTable.cc.

626{
627 fMaterial = nullptr;
628 fMatNbOfIntervals = 0;
629 fMatSandiaMatrix = nullptr;
630 fMatSandiaMatrixPAI = nullptr;
631 fPhotoAbsorptionCof = nullptr;
632
633 fMaxInterval = 0;
634 fVerbose = 0;
635 fLowerI1 = false;
636
637 fSandiaCofPerAtom.resize(4, 0.0);
638}

◆ G4SandiaTable() [2/4]

G4SandiaTable::G4SandiaTable ( const G4Material * material)

Definition at line 57 of file G4SandiaTable.cc.

57 : fMaterial(material)
58{
59 fMatSandiaMatrix = nullptr;
60 fMatSandiaMatrixPAI = nullptr;
61 fPhotoAbsorptionCof = nullptr;
62
63 fMatNbOfIntervals = 0;
64
65 fMaxInterval = 0;
66 fVerbose = 0;
67
68 // build the CumulInterval array
69 if (0 == fCumulInterval[0]) {
70 fCumulInterval[0] = 1;
71
72 for (G4int Z = 1; Z < 101; ++Z) {
73 fCumulInterval[Z] = fCumulInterval[Z - 1] + fNbOfIntervals[Z];
74 }
75 }
76
77 fMaxInterval = 0;
78 fSandiaCofPerAtom.resize(4, 0.0);
79 fLowerI1 = false;
80 // compute macroscopic Sandia coefs for a material
81 ComputeMatSandiaMatrix(); // mma
82}
int G4int
Definition G4Types.hh:85

◆ G4SandiaTable() [3/4]

G4SandiaTable::G4SandiaTable ( G4int matIndex)

Definition at line 597 of file G4SandiaTable.cc.

598{
599 fMaterial = nullptr;
600 fMatNbOfIntervals = 0;
601 fMatSandiaMatrix = nullptr;
602 fMatSandiaMatrixPAI = nullptr;
603 fPhotoAbsorptionCof = nullptr;
604
605 fMaxInterval = 0;
606 fVerbose = 0;
607 fLowerI1 = false;
608
609 fSandiaCofPerAtom.resize(4, 0.0);
610
611 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
612 auto numberOfMat = (G4int)G4Material::GetNumberOfMaterials();
613
614 if (matIndex >= 0 && matIndex < numberOfMat) {
615 fMaterial = (*theMaterialTable)[matIndex];
616 }
617 else {
619 "G4SandiaTable::G4SandiaTable(G4int matIndex)", "mat401", FatalException, "wrong matIndex");
620 }
621}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::vector< G4Material * > G4MaterialTable
static std::size_t GetNumberOfMaterials()
static G4MaterialTable * GetMaterialTable()

◆ ~G4SandiaTable()

G4SandiaTable::~G4SandiaTable ( )

Definition at line 86 of file G4SandiaTable.cc.

87{
88 if (fMatSandiaMatrix != nullptr) {
89 fMatSandiaMatrix->clearAndDestroy();
90 delete fMatSandiaMatrix;
91 }
92 if (fMatSandiaMatrixPAI != nullptr) {
93 fMatSandiaMatrixPAI->clearAndDestroy();
94 delete fMatSandiaMatrixPAI;
95 }
96
97 delete[] fPhotoAbsorptionCof;
98}

◆ G4SandiaTable() [4/4]

G4SandiaTable::G4SandiaTable ( G4SandiaTable & )
delete

Member Function Documentation

◆ GetLowerI1()

G4bool G4SandiaTable::GetLowerI1 ( )
inline

Definition at line 106 of file G4SandiaTable.hh.

106{ return fLowerI1; };

Referenced by G4PAIxSection::Initialize().

◆ GetMatNbOfIntervals()

G4int G4SandiaTable::GetMatNbOfIntervals ( ) const

Definition at line 871 of file G4SandiaTable.cc.

871{ return fMatNbOfIntervals; }

◆ GetMaxInterval()

G4int G4SandiaTable::GetMaxInterval ( ) const

◆ GetPhotoAbsorpCof()

G4double G4SandiaTable::GetPhotoAbsorpCof ( G4int i,
G4int j ) const

Definition at line 673 of file G4SandiaTable.cc.

674{
675 return fPhotoAbsorptionCof[i][j] * funitc[j];
676}

Referenced by G4PAIxSection::G4PAIxSection().

◆ GetSandiaCofForMaterial() [1/2]

const G4double * G4SandiaTable::GetSandiaCofForMaterial ( G4double energy) const

Definition at line 917 of file G4SandiaTable.cc.

918{
919 G4int interval = 0;
920 if (energy > (*(*fMatSandiaMatrix)[0])[0]) {
921 interval = fMatNbOfIntervals - 1;
922 // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
923 while ((interval > 0) && (energy < (*(*fMatSandiaMatrix)[interval])[0])) {
924 --interval;
925 }
926 }
927 return &((*(*fMatSandiaMatrix)[interval])[1]);
928}

◆ GetSandiaCofForMaterial() [2/2]

G4double G4SandiaTable::GetSandiaCofForMaterial ( G4int interval,
G4int j ) const

Definition at line 900 of file G4SandiaTable.cc.

901{
902#ifdef G4VERBOSE
903 if (interval < 0 || interval >= fMatNbOfIntervals) {
904 PrintErrorV("GetSandiaCofForMaterial");
905 interval = (interval < 0) ? 0 : fMatNbOfIntervals - 1;
906 }
907 if (j < 0 || j > 4) {
908 PrintErrorV("GetSandiaCofForMaterial");
909 j = (j < 0) ? 0 : 4;
910 }
911#endif
912 return ((*(*fMatSandiaMatrix)[interval])[j]);
913}

Referenced by G4PEEffectFluoModel::CrossSectionPerVolume(), G4VXTRenergyLoss::GetGasLinearPhotoAbs(), G4StrawTubeXTRadiator::GetMediumLinearPhotoAbs(), and G4VXTRenergyLoss::GetPlateLinearPhotoAbs().

◆ GetSandiaCofForMaterialPAI()

const G4double * G4SandiaTable::GetSandiaCofForMaterialPAI ( G4double energy) const

◆ GetSandiaCofPerAtom()

void G4SandiaTable::GetSandiaCofPerAtom ( G4int Z,
G4double energy,
std::vector< G4double > & coeff ) const

Definition at line 102 of file G4SandiaTable.cc.

104{
105#ifdef G4VERBOSE
106 if (Z < 1 || Z > 100) {
107 Z = PrintErrorZ(Z, "GetSandiaCofPerAtom");
108 }
109 if (4 > coeff.size()) {
110 PrintErrorV("GetSandiaCofPerAtom(): input vector is resized");
111 coeff.resize(4);
112 }
113#endif
114 G4double Emin = fSandiaTable[fCumulInterval[Z - 1]][0] * CLHEP::keV;
115 // G4double Iopot = fIonizationPotentials[Z]*eV;
116 // if (Emin < Iopot) Emin = Iopot;
117
118 G4int row = 0;
119 if (energy <= Emin) {
120 energy = Emin;
121 }
122 else {
123 G4int interval = fNbOfIntervals[Z] - 1;
124 row = fCumulInterval[Z - 1] + interval;
125 // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
126 while ((interval > 0) && (energy < fSandiaTable[row][0] * CLHEP::keV)) {
127 --interval;
128 row = fCumulInterval[Z - 1] + interval;
129 }
130 }
131
132 G4double AoverAvo = Z * amu / fZtoAratio[Z];
133
134 coeff[0] = AoverAvo * funitc[1] * fSandiaTable[row][1];
135 coeff[1] = AoverAvo * funitc[2] * fSandiaTable[row][2];
136 coeff[2] = AoverAvo * funitc[3] * fSandiaTable[row][3];
137 coeff[3] = AoverAvo * funitc[4] * fSandiaTable[row][4];
138}
double G4double
Definition G4Types.hh:83
G4double energy(const ThreeVector &p, const G4double m)

Referenced by G4PEEffectFluoModel::ComputeCrossSectionPerAtom().

◆ GetSandiaCofWater()

void G4SandiaTable::GetSandiaCofWater ( G4double energy,
std::vector< G4double > & coeff ) const

Definition at line 142 of file G4SandiaTable.cc.

143{
144#ifdef G4VERBOSE
145 if (4 > coeff.size()) {
146 PrintErrorV("GetSandiaCofWater: input vector is resized");
147 coeff.resize(4);
148 }
149#endif
150 G4int i = 0;
151 if (energy > fH2OlowerI1[0][0] * CLHEP::keV) {
152 i = fH2OlowerInt - 1;
153 for (; i > 0; --i) {
154 if (energy >= fH2OlowerI1[i][0] * CLHEP::keV) {
155 break;
156 }
157 }
158 }
159 coeff[0] = funitc[1] * fH2OlowerI1[i][1];
160 coeff[1] = funitc[2] * fH2OlowerI1[i][2];
161 coeff[2] = funitc[3] * fH2OlowerI1[i][3];
162 coeff[3] = funitc[4] * fH2OlowerI1[i][4];
163}

Referenced by G4LivermorePhotoElectricModel::CrossSectionPerVolume().

◆ GetSandiaMatTable()

G4double G4SandiaTable::GetSandiaMatTable ( G4int interval,
G4int j ) const

Definition at line 932 of file G4SandiaTable.cc.

933{
934#ifdef G4VERBOSE
935 if (interval < 0 || interval >= fMatNbOfIntervals) {
936 PrintErrorV("GetSandiaCofForMaterial");
937 interval = (interval < 0) ? 0 : fMatNbOfIntervals - 1;
938 }
939 if (j < 0 || j > 4) {
940 PrintErrorV("GetSandiaCofForMaterial");
941 j = (j < 0) ? 0 : 4;
942 }
943#endif
944 return ((*(*fMatSandiaMatrix)[interval])[j]) * funitc[j];
945}

Referenced by G4InitXscPAI::G4InitXscPAI(), and G4PAIxSection::G4PAIxSection().

◆ GetSandiaMatTablePAI()

G4double G4SandiaTable::GetSandiaMatTablePAI ( G4int interval,
G4int j ) const

Definition at line 949 of file G4SandiaTable.cc.

950{
951#ifdef G4VERBOSE
952 if (interval < 0 || interval >= fMaxInterval) {
953 PrintErrorV("GetSandiaCofForMaterialPAI");
954 interval = (interval < 0) ? 0 : fMaxInterval - 1;
955 }
956 if (j < 0 || j > 4) {
957 PrintErrorV("GetSandiaCofForMaterialPAI");
958 j = (j < 0) ? 0 : 4;
959 }
960#endif
961 return ((*(*fMatSandiaMatrixPAI)[interval])[j]);
962}

Referenced by G4PAIModelData::Initialise(), G4PAIPhotData::Initialise(), G4PAIxSection::Initialize(), and G4PAIySection::Initialize().

◆ GetWaterCofForMaterial()

G4double G4SandiaTable::GetWaterCofForMaterial ( G4int i,
G4int j ) const

Definition at line 174 of file G4SandiaTable.cc.

175{
176 return fH2OlowerI1[i][j] * funitc[j];
177}

◆ GetWaterEnergyLimit()

G4double G4SandiaTable::GetWaterEnergyLimit ( ) const

Definition at line 167 of file G4SandiaTable.cc.

168{
169 return fH2OlowerI1[fH2OlowerInt - 1][0] * CLHEP::keV;
170}

◆ GetZtoA()

G4double G4SandiaTable::GetZtoA ( G4int Z)
static

Definition at line 181 of file G4SandiaTable.cc.

182{
183#ifdef G4VERBOSE
184 if (Z < 1 || Z > 100) {
185 Z = PrintErrorZ(Z, "GetSandiaCofPerAtom");
186 }
187#endif
188 return fZtoAratio[Z];
189}

Referenced by G4ParticleHPNames::GetName().

◆ Initialize()

void G4SandiaTable::Initialize ( const G4Material * mat)

Definition at line 642 of file G4SandiaTable.cc.

643{
644 fMaterial = mat;
645 ComputeMatSandiaMatrixPAI();
646}

Referenced by G4PAIModelData::Initialise(), and G4PAIPhotData::Initialise().

◆ operator!=()

G4bool G4SandiaTable::operator!= ( const G4SandiaTable & ) const
delete

◆ operator=()

G4SandiaTable & G4SandiaTable::operator= ( const G4SandiaTable & right)
delete

◆ operator==()

G4bool G4SandiaTable::operator== ( const G4SandiaTable & ) const
delete

◆ SandiaIntervals()

G4int G4SandiaTable::SandiaIntervals ( G4int Z[],
G4int el )

Definition at line 699 of file G4SandiaTable.cc.

700{
701 G4int c, i, flag = 0, n1 = 1;
702 G4int j, c1, k1, k2;
703 G4double I1;
704 fMaxInterval = 0;
705
706 for (i = 0; i < el; ++i) {
707 fMaxInterval += fNbOfIntervals[Z[i]];
708 }
709
710 fMaxInterval += 2;
711
712 if (fVerbose > 0) {
713 G4cout << "begin sanInt, fMaxInterval = " << fMaxInterval << G4endl;
714 }
715
716 fPhotoAbsorptionCof = new G4double*[fMaxInterval];
717
718 for (i = 0; i < fMaxInterval; ++i) {
719 fPhotoAbsorptionCof[i] = new G4double[5];
720 }
721 // for(c = 0; c < fIntervalLimit; ++c) // just in case
722
723 for (c = 0; c < fMaxInterval; ++c) {
724 fPhotoAbsorptionCof[c][0] = 0.;
725 }
726
727 c = 1;
728
729 for (i = 0; i < el; ++i) {
730 I1 = fIonizationPotentials[Z[i]] * keV; // First ionization
731 n1 = 1; // potential in keV
732
733 for (j = 1; j < Z[i]; ++j) {
734 n1 += fNbOfIntervals[j];
735 }
736
737 G4int n2 = n1 + fNbOfIntervals[Z[i]];
738
739 for (k1 = n1; k1 < n2; k1++) {
740 if (I1 > fSandiaTable[k1][0]) {
741 continue; // no ionization for energies smaller than I1 (first
742 } // ionisation potential)
743 break;
744 }
745 flag = 0;
746
747 for (c1 = 1; c1 < c; c1++) {
748 if (fPhotoAbsorptionCof[c1][0] == I1) // this value already has existed
749 {
750 flag = 1;
751 break;
752 }
753 }
754 if (flag == 0) {
755 fPhotoAbsorptionCof[c][0] = I1;
756 ++c;
757 }
758 for (k2 = k1; k2 < n2; k2++) {
759 flag = 0;
760
761 for (c1 = 1; c1 < c; c1++) {
762 if (fPhotoAbsorptionCof[c1][0] == fSandiaTable[k2][0]) {
763 flag = 1;
764 break;
765 }
766 }
767 if (flag == 0) {
768 fPhotoAbsorptionCof[c][0] = fSandiaTable[k2][0];
769 if (fVerbose > 0) {
770 G4cout << "sanInt, c = " << c << ", E_c = " << fPhotoAbsorptionCof[c][0] << G4endl;
771 }
772 ++c;
773 }
774 }
775 } // end for(i)
776
777 SandiaSort(fPhotoAbsorptionCof, c);
778 fMaxInterval = c;
779 if (fVerbose > 0) {
780 G4cout << "end SanInt, fMaxInterval = " << fMaxInterval << G4endl;
781 }
782 return c;
783}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout

Referenced by G4PAIxSection::G4PAIxSection().

◆ SandiaMixing()

G4int G4SandiaTable::SandiaMixing ( G4int Z[],
const G4double * fractionW,
G4int el,
G4int mi )

Definition at line 790 of file G4SandiaTable.cc.

791{
792 G4int i, j, n1, k, c = 1, jj, kk;
793 G4double I1, B1, B2, E1, E2;
794
795 for (i = 0; i < mi; ++i) {
796 for (j = 1; j < 5; ++j) {
797 fPhotoAbsorptionCof[i][j] = 0.;
798 }
799 }
800 for (i = 0; i < el; ++i) {
801 n1 = 1;
802 I1 = fIonizationPotentials[Z[i]] * keV;
803
804 for (j = 1; j < Z[i]; ++j) {
805 n1 += fNbOfIntervals[j];
806 }
807
808 G4int n2 = n1 + fNbOfIntervals[Z[i]] - 1;
809
810 for (k = n1; k < n2; ++k) {
811 B1 = fSandiaTable[k][0];
812 B2 = fSandiaTable[k + 1][0];
813
814 for (c = 1; c < mi - 1; ++c) {
815 E1 = fPhotoAbsorptionCof[c][0];
816 E2 = fPhotoAbsorptionCof[c + 1][0];
817
818 if (B1 > E1 || B2 < E2 || E1 < I1) {
819 continue;
820 }
821
822 for (j = 1; j < 5; ++j) {
823 fPhotoAbsorptionCof[c][j] += fSandiaTable[k][j] * fractionW[i];
824 if (fVerbose > 0) {
825 G4cout << "c=" << c << "; j=" << j << "; fST=" << fSandiaTable[k][j]
826 << "; frW=" << fractionW[i] << G4endl;
827 }
828 }
829 }
830 }
831 for (j = 1; j < 5; ++j) // Last interval
832 {
833 fPhotoAbsorptionCof[mi - 1][j] += fSandiaTable[k][j] * fractionW[i];
834 if (fVerbose > 0) {
835 G4cout << "mi-1=" << mi - 1 << "; j=" << j << "; fST=" << fSandiaTable[k][j]
836 << "; frW=" << fractionW[i] << G4endl;
837 }
838 }
839 } // for(i)
840 c = 0; // Deleting of first intervals where all coefficients = 0
841
842 do {
843 ++c;
844
845 if (fPhotoAbsorptionCof[c][1] != 0.0 || fPhotoAbsorptionCof[c][2] != 0.0 ||
846 fPhotoAbsorptionCof[c][3] != 0.0 || fPhotoAbsorptionCof[c][4] != 0.0)
847 {
848 continue;
849 }
850
851 for (jj = 2; jj < mi; ++jj) {
852 for (kk = 0; kk < 5; ++kk) {
853 fPhotoAbsorptionCof[jj - 1][kk] = fPhotoAbsorptionCof[jj][kk];
854 }
855 }
856 mi--;
857 c--;
858 }
859 // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
860 while (c < mi - 1);
861
862 if (fVerbose > 0) {
863 G4cout << "end SanMix, mi = " << mi << G4endl;
864 }
865
866 return mi;
867}

Referenced by G4PAIxSection::G4PAIxSection().

◆ SetLowerI1()

void G4SandiaTable::SetLowerI1 ( G4bool flag)
inline

Definition at line 107 of file G4SandiaTable.hh.

107{ fLowerI1 = flag; };

◆ SetVerbose()

void G4SandiaTable::SetVerbose ( G4int ver)
inline

Definition at line 88 of file G4SandiaTable.hh.

88{ fVerbose = ver; };

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