File indexing completed on 2025-01-18 09:58:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifndef G4ParticleHPLegendreStore_h
0030 #define G4ParticleHPLegendreStore_h 1
0031
0032 #include "G4InterpolationManager.hh"
0033 #include "G4ParticleHPLegendreTable.hh"
0034 #include "G4ios.hh"
0035
0036 #include <vector>
0037 #include <fstream>
0038
0039 class G4ParticleHPLegendreStore
0040 {
0041 public:
0042 G4ParticleHPLegendreStore(G4int n)
0043 {
0044 theCoeff.resize(n);
0045 nEnergy = n;
0046 }
0047
0048 ~G4ParticleHPLegendreStore() {}
0049
0050 inline void Init(G4int i, G4double e, G4int n) { theCoeff[i].Init(e, n); }
0051 inline void SetNPoints(G4int n) { nEnergy = n; }
0052 inline void SetEnergy(G4int i, G4double energy) { theCoeff[i].SetEnergy(energy); }
0053 inline void SetTemperature(G4int i, G4double temp) { theCoeff[i].SetTemperature(temp); }
0054 inline void SetCoeff(G4int i, G4int l, G4double coeff) { theCoeff[i].SetCoeff(l, coeff); }
0055 inline void SetCoeff(G4int i, G4ParticleHPLegendreTable* theTable)
0056 {
0057 if (i > nEnergy)
0058 throw G4HadronicException(__FILE__, __LINE__, "LegendreTableIndex out of range");
0059 theCoeff[i] = *theTable;
0060
0061
0062 }
0063
0064 inline G4double GetCoeff(G4int i, G4int l) { return theCoeff[i].GetCoeff(l); }
0065 inline G4double GetEnergy(G4int i) { return theCoeff[i].GetEnergy(); }
0066 inline G4double GetTemperature(G4int i) { return theCoeff[i].GetTemperature(); }
0067 inline G4int GetNumberOfPoly(G4int i) { return theCoeff[i].GetNumberOfPoly(); }
0068
0069 G4double SampleDiscreteTwoBody(G4double anEnergy);
0070 G4double SampleElastic(G4double anEnergy);
0071 G4double Sample(G4double energy);
0072 G4double SampleMax(G4double energy);
0073 G4double Integrate(G4int k, G4double costh);
0074
0075 void InitInterpolation(std::istream& aDataFile) { theManager.Init(aDataFile); }
0076
0077 void SetManager(G4InterpolationManager& aManager) { theManager = aManager; }
0078
0079 private:
0080 G4int nEnergy;
0081 std::vector<G4ParticleHPLegendreTable> theCoeff;
0082 G4InterpolationManager theManager;
0083 };
0084 #endif