00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef G4NeutronHPLegendreStore_h
00030 #define G4NeutronHPLegendreStore_h 1
00031
00032 #include "G4NeutronHPLegendreTable.hh"
00033 #include "G4InterpolationManager.hh"
00034 #include "G4ios.hh"
00035 #include <fstream>
00036
00037 class G4NeutronHPLegendreStore
00038 {
00039 public:
00040
00041 G4NeutronHPLegendreStore(G4int n)
00042 {
00043 theCoeff = new G4NeutronHPLegendreTable[n];
00044 nEnergy = n;
00045 }
00046
00047 ~G4NeutronHPLegendreStore()
00048 {
00049 delete [] theCoeff;
00050 }
00051
00052 inline void Init(G4int i, G4double e, G4int n)
00053 {
00054 theCoeff[i].Init(e, n);
00055 }
00056 inline void SetNPoints(G4int n) { nEnergy = n; }
00057 inline void SetEnergy(G4int i, G4double energy) { theCoeff[i].SetEnergy(energy); }
00058 inline void SetTemperature(G4int i, G4double temp) { theCoeff[i].SetTemperature(temp); }
00059 inline void SetCoeff(G4int i, G4int l, G4double coeff) {theCoeff[i].SetCoeff(l, coeff); }
00060 inline void SetCoeff(G4int i, G4NeutronHPLegendreTable * theTable)
00061 {
00062 if(i>nEnergy) throw G4HadronicException(__FILE__, __LINE__, "LegendreTableIndex out of range");
00063 theCoeff[i] = *theTable;
00064
00065
00066 }
00067
00068 inline G4double GetCoeff(G4int i, G4int l) {return theCoeff[i].GetCoeff(l);}
00069 inline G4double GetEnergy(G4int i){return theCoeff[i].GetEnergy();}
00070 inline G4double GetTemperature(G4int i){return theCoeff[i].GetTemperature();}
00071 inline G4int GetNumberOfPoly(G4int i) {return theCoeff[i].GetNumberOfPoly();}
00072
00073 G4double SampleDiscreteTwoBody (G4double anEnergy);
00074 G4double SampleElastic (G4double anEnergy);
00075 G4double Sample (G4double energy);
00076 G4double SampleMax (G4double energy);
00077 G4double Integrate(G4int k, G4double costh);
00078
00079 void InitInterpolation(std::ifstream & aDataFile)
00080 {
00081 theManager.Init(aDataFile);
00082 }
00083
00084 void SetManager(G4InterpolationManager & aManager)
00085 {
00086 theManager = aManager;
00087 }
00088
00089 private:
00090
00091 G4int nEnergy;
00092 G4NeutronHPLegendreTable * theCoeff;
00093 G4InterpolationManager theManager;
00094 };
00095 #endif