Geant4 11.3.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4NuDEXStatisticalNucleus.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// -------------------------------------------------------------------
28//
29// Author: E.Mendoza
30//
31// Creation date: May 2024
32//
33// Modifications:
34//
35// -------------------------------------------------------------------
36//
37// NuDEX code (https://doi.org/10.1016/j.nima.2022.167894)
38//
39
40
41#ifndef NUDEXSTATISTICALNUCLEUS_HH
42#define NUDEXSTATISTICALNUCLEUS_HH 1
43
44#include <cstdlib>
45#include <iostream>
46#include <fstream>
47#include <cmath>
48#include <vector>
49
50#include "G4NuDEXRandom.hh"
51
52
55class G4NuDEXPSF;
56
57
58//This define remains:
59//#define GENERATEEXPLICITLYALLLEVELSCHEME 1
60
61//Class to obtain the level density for each excitation energy, spin, and parity
62//All energies in MeV, all times in s
63//Some of the class methods could be functions out of the class
64
65struct Level{
68 G4bool parity; //true/false --> positive,negative
69 unsigned int seed;
73};
74
75
76
77//multipolarity of a transition is ...,-2,-1,0,1,2,... --> ...,M2,M1,Unk,E1,E2,...
78
92
93
94
95G4int ComparisonLevels(const void* va, const void* vb);
96void CopyLevel(Level* a,Level* b);
97void CopyLevel(KnownLevel* a,Level* b);
98
99
101
102public:
105
106public:
107 //Initialize everything. All the required files should be in dirname.
108 //some of the data could also be in inputfname
109 G4int Init(const char* dirname,const char* inputfname=0);
110
111 //If InitialLevel==-1 then we start from the thermal capture level
112 //If ExcitationEnergy>0 then is the excitation energy of the nucleus
113 //If ExcitationEnergy<0 then is a capture reaction of a neutron with energy -ExcitationEnergy (MeV)
114 G4int GenerateCascade(G4int InitialLevel,G4double ExcitationEnergy,std::vector<char>& pType,std::vector<double>& pEnergy,std::vector<double>& pTime);
115
116 G4int GetClosestLevel(G4double Energy,G4int spinx2,G4bool parity); //if spinx2<0, then retrieves the closest level of any spin and parity
118 void GetSnAndI0(G4double &sn,G4double &i0){sn=Sn; i0=I0;}
119 Level* GetLevel(G4int i_level);
120 void ChangeLevelSpinParityAndBR(G4int i_level,G4int newspinx2,G4bool newParity,G4int nlevels,G4double width,unsigned int seed=0); //if nlevels or width are negative they don't change. If seed (to generate the BR) is 0 it does not change.
121 void ChangeThermalCaptureLevelBR(G4double LevelEnergy,G4double absoluteIntensity);
122
123 void SetSomeInitalParameters(G4int LDtype=-1,G4int PSFFlag=-1,G4double MaxSpin=-1,G4int minlevelsperband=-1,G4double BandWidth_MeV=0,G4double maxExcEnergy=0,G4int BrOption=-1,G4int sampleGammaWidths=-1,unsigned int aseed1=0,unsigned int aseed2=0,unsigned int aseed3=0);
124 void SetInitialParameters02(G4int knownLevelsFlag=-1,G4int electronConversionFlag=-1,G4double primGamNormFactor=-1,G4double primGamEcut=-1,G4double ecrit=-1);
125 void SetBandWidth(G4double bandWidth){ if(bandWidth==0){bandWidth=-1;} BandWidth=bandWidth;} //So it is not re-written with the lib-params.
126 void SetBrOption(G4int BrOption){BROpt=BrOption;}
127 void SetRandom1Seed(unsigned int seed){theRandom1->SetSeed(seed); Rand1seedProvided=true;}
128 void SetRandom2Seed(unsigned int seed){theRandom2->SetSeed(seed); Rand2seedProvided=true;}
129 void SetRandom3Seed(unsigned int seed){theRandom3->SetSeed(seed); Rand3seedProvided=true;}
130
131 G4NuDEXRandom* GetRandom3(){return theRandom3;}
132 G4bool HasBeenInitialized(){return hasBeenInitialized;}
133
134
135 //-------------------------------------------------------
136 //Print:
137 void PrintAll(std::ostream &out);
138
139 void PrintParameters(std::ostream &out);
140 void PrintKnownLevels(std::ostream &out);
141 void PrintLevelDensity(std::ostream &out);
142 void PrintLevelScheme(std::ostream &out);
143 void PrintThermalPrimaryTransitions(std::ostream &out);
144 void PrintPSF(std::ostream &out);
145 void PrintICC(std::ostream &out);
146 void PrintTotalCumulBR(G4int i_level,std::ostream &out);
147 void PrintBR(G4int i_level,G4double MaxExcEneToPrint_MeV,std::ostream &out);
148 void PrintInput01(std::ostream &out);
149 //----------------
150 void PrintKnownLevelsInDEGENformat(std::ostream &out);
151 void PrintLevelSchemeInDEGENformat(const char* fname,G4int MaxLevelID=-1);
152 //-------------------------------------------------------
153
154
155private:
156 //-------------------------------------------------------
157 //Used by Init():
158 //Read different data from files (do it in this order). If returnval<0 --> error reading file or nucleus not present in the file:
159 G4int ReadSpecialInputFile(const char* fname);
160 G4int ReadGeneralStatNuclParameters(const char* fname);
161 G4double ReadEcrit(const char* fname);
162 G4double ReadKnownLevels(const char* fname);
163 void CreateLevelScheme();
164 G4int InsertHighEnergyKnownLevels();
165 void ComputeKnownLevelsMissingBR();
166 void MakeSomeParameterChecks01();
167 //-------------------------------------------------------
168 G4double TakeTargetNucleiI0(const char* fname,G4int& check);
169 void CreateThermalCaptureLevel(unsigned int seed=0); //If seed (to generate the BR) is 0 it does not change.
170 void GenerateThermalCaptureLevelBR(const char* dirname);
171 //-------------------------------------------------------
172
173 //-------------------------------------------------------
174 //cascade generation:
175 G4double ComputeDecayIntensities(G4int i_level,G4double* cumulativeBR=0,G4double randnumber=-1,G4double TotGR=-1,G4bool AllowE1=false);
176 G4int SampleFinalLevel(G4int i_level,G4int& multipolarity,G4double &icc_fac,G4int nTransition);
177 G4int GetMultipolarity(Level* theInitialLevel,Level* theFinalLevel);
178 //-------------------------------------------------------
179
180
181private:
182 //-------------------------------------------------------
183 //Used to create the unknown Levels:
184 G4int GenerateLevelsInBigRange(G4double Emin,G4double Emax,G4int spinx2,G4bool parity,Level* someLevels,G4int MaxNLevelsToFill); //salen sin ordenar
185 G4int GenerateLevelsInSmallRange(G4double Emin,G4double Emax,G4int spinx2,G4bool parity,Level* someLevels,G4int MaxNLevelsToFill); //salen sin ordenar
186 G4int GenerateWignerLevels(G4double Emin,G4double Emax,G4int spinx2,G4bool parity,Level* someLevels,G4int MaxNLevelsToFill); //salen ordenados
187 G4int GenerateBandLevels(G4int bandmin,G4int bandmax,G4int spinx2,G4bool parity,Level* someLevels,G4int MaxNLevelsToFill);
188 G4int GenerateAllUnknownLevels(Level* someLevels,G4int MaxNLevelsToFill); //salen ordenados
189 G4int CreateBandsFromLevels(G4int thisNLevels,Level* someLevels,G4int spinx2,G4bool parity);
190 G4int EstimateNumberOfLevelsToFill(); //to estimate the length of "theLevels" vector
191 //-------------------------------------------------------
192
193
194private:
195
196 //General info:
197 G4int A_Int,Z_Int;
198 G4double Sn,D0,I0; //I0 es el del nucleo A-1 (el que captura)
199 G4bool hasBeenInitialized;
200 std::string theLibDir;
201
202 G4NuDEXRandom* theRandom1; //To generate the unknown level scheme
203 G4NuDEXRandom* theRandom2; //To calculate the Gamma-rho values (i.e. to generate the branching ratios)
204 G4NuDEXRandom* theRandom3; //To generate the cascades
205 unsigned int seed1,seed2,seed3;
206 G4bool Rand1seedProvided,Rand2seedProvided,Rand3seedProvided;
207
208 //--------------------------------------------------------------------------
209 //Parameters which will define how the level scheme will be created:
210 G4double Ecrit; //Energy between the known and unknown levels
211 G4double MaxExcEnergy,BandWidth;
212 G4int maxspinx2,NBands,MinLevelsPerBand; //maximum spin (x2) to consider, number of bands used to "rebin" the stat. part
213 G4int LevelDensityType; //if negative or cero, use the default one.
214 G4int PSFflag; // use IAEA PSF-data (PSFflag==0), use RIPL-3 data (PSFflag==1)
215 G4double E_unk_min,E_unk_max; //min and max energy where the statistical part will be generated
216 G4double Emin_bands,Emax_bands; //limites de energia para calcular las bandas de niveles
217 //--------------------------------------------------------------------------
218
219 //--------------------------------------------------------------------------
220 //Level scheme:
221 Level* theLevels; //known+unknown levels
222 KnownLevel* theKnownLevels; // known levels
223 G4int NKnownLevels,NUnknownLevels,NLevels,KnownLevelsVectorSize;
224 Level theThermalCaptureLevel;
225 G4int NLevelsBelowThermalCaptureLevel; //excluding the last one
226 G4int KnownLevelsFlag;
227 //--------------------------------------------------------------------------
228
229 //--------------------------------------------------------------------------
230 //Branching ratios:
231 G4int BROpt,SampleGammaWidths;
232 G4double* TotalGammaRho;
233 G4double* theThermalCaptureLevelCumulBR;
234 G4double** TotalCumulBR; //all BR
235 G4double PrimaryGammasIntensityNormFactor;
236 G4double PrimaryGammasEcut; //This variable can be used to avoid generating transitions close to the "Primary Gammas" region
237 //--------------------------------------------------------------------------
238
239 //--------------------------------------------------------------------------
240 //LD,ICC, PSF:
241 G4int ElectronConversionFlag;
242 G4NuDEXLevelDensity* theLD;
244 G4NuDEXPSF* thePSF;
245 //--------------------------------------------------------------------------
246
247 //--------------------------------------------------------------------------
248 //for internal use, when generating the cascades:
249 G4int theSampledLevel,theSampledMultipolarity;
250 //--------------------------------------------------------------------------
251};
252
253//***************************************************************************************************************
254//***************************************************************************************************************
255
256
257
258
259#endif
260
261
262
263
void CopyLevel(Level *a, Level *b)
G4int ComparisonLevels(const void *va, const void *vb)
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
const G4double A[17]
void PrintLevelSchemeInDEGENformat(const char *fname, G4int MaxLevelID=-1)
void SetRandom2Seed(unsigned int seed)
void PrintLevelDensity(std::ostream &out)
void PrintLevelScheme(std::ostream &out)
void SetRandom1Seed(unsigned int seed)
G4int Init(const char *dirname, const char *inputfname=0)
G4double GetLevelEnergy(G4int i_level)
void PrintParameters(std::ostream &out)
G4int GenerateCascade(G4int InitialLevel, G4double ExcitationEnergy, std::vector< char > &pType, std::vector< double > &pEnergy, std::vector< double > &pTime)
void PrintKnownLevels(std::ostream &out)
void PrintKnownLevelsInDEGENformat(std::ostream &out)
void ChangeThermalCaptureLevelBR(G4double LevelEnergy, G4double absoluteIntensity)
void SetInitialParameters02(G4int knownLevelsFlag=-1, G4int electronConversionFlag=-1, G4double primGamNormFactor=-1, G4double primGamEcut=-1, G4double ecrit=-1)
void PrintTotalCumulBR(G4int i_level, std::ostream &out)
G4int GetClosestLevel(G4double Energy, G4int spinx2, G4bool parity)
void SetRandom3Seed(unsigned int seed)
void PrintThermalPrimaryTransitions(std::ostream &out)
void SetBandWidth(G4double bandWidth)
void GetSnAndI0(G4double &sn, G4double &i0)
void PrintBR(G4int i_level, G4double MaxExcEneToPrint_MeV, std::ostream &out)
void ChangeLevelSpinParityAndBR(G4int i_level, G4int newspinx2, G4bool newParity, G4int nlevels, G4double width, unsigned int seed=0)
void SetSomeInitalParameters(G4int LDtype=-1, G4int PSFFlag=-1, G4double MaxSpin=-1, G4int minlevelsperband=-1, G4double BandWidth_MeV=0, G4double maxExcEnergy=0, G4int BrOption=-1, G4int sampleGammaWidths=-1, unsigned int aseed1=0, unsigned int aseed2=0, unsigned int aseed3=0)
unsigned int seed