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.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 
 53 class G4NuDEXLevelDensity;
 54 class G4NuDEXInternalConversion;
 55 class 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 
 65 struct Level{
 66   G4double Energy;
 67   G4int spinx2;
 68   G4bool parity; //true/false --> positive,negative
 69   unsigned int seed;
 70   G4int KnownLevelID;
 71   G4int NLevels;
 72   G4double Width;
 73 };
 74 
 75 
 76 
 77 //multipolarity of a transition is ...,-2,-1,0,1,2,... --> ...,M2,M1,Unk,E1,E2,...
 78 
 79 struct KnownLevel{
 80   G4int id;
 81   G4double Energy;
 82   G4int spinx2;
 83   G4bool parity; //true/false --> positive,negative
 84   G4double T12; //half life - seconds
 85   G4int Ndecays;
 86   G4double* decayFraction;
 87   std::string* decayMode;
 88   G4int NGammas;
 89   G4int *FinalLevelID,*multipolarity;
 90   G4double *Eg,*cumulPtot,*Pg,*Pe,*Icc;
 91 };
 92 
 93 
 94 
 95 G4int ComparisonLevels(const void* va, const void* vb);
 96 void CopyLevel(Level* a,Level* b);
 97 void CopyLevel(KnownLevel* a,Level* b);
 98 
 99 
100 class G4NuDEXStatisticalNucleus{
101 
102 public:
103   G4NuDEXStatisticalNucleus(G4int Z,G4int A);
104   ~G4NuDEXStatisticalNucleus();
105 
106 public:
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
117   G4double GetLevelEnergy(G4int i_level);
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   
155 private:
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 
181 private:
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 
194 private:
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;
243   G4NuDEXInternalConversion* theICC;
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 
264