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 G4ParticleHPLegendreTable_h
0030 #define G4ParticleHPLegendreTable_h 1
0031
0032 #include "G4InterpolationManager.hh"
0033 #include "G4ios.hh"
0034 #include "globals.hh"
0035
0036 #include <CLHEP/Units/SystemOfUnits.h>
0037
0038 #include <fstream>
0039
0040 class G4ParticleHPLegendreTable
0041 {
0042 public:
0043 G4ParticleHPLegendreTable()
0044 {
0045 nCoeff = 0;
0046 theCoeff = nullptr;
0047 theRep = 0;
0048 theEnergy = 0.0;
0049 theTemp = 0.0;
0050 }
0051 ~G4ParticleHPLegendreTable() { delete[] theCoeff; }
0052
0053 void operator=(const G4ParticleHPLegendreTable& aSet)
0054 {
0055 if (&aSet != this) {
0056 theRep = aSet.theRep;
0057 theEnergy = aSet.theEnergy;
0058 theTemp = aSet.theTemp;
0059 theManager = aSet.theManager;
0060 nCoeff = aSet.nCoeff;
0061 delete[] theCoeff;
0062 theCoeff = new G4double[nCoeff];
0063 for (G4int i = 0; i < nCoeff; i++) {
0064 theCoeff[i] = aSet.theCoeff[i];
0065 }
0066 }
0067 }
0068
0069 inline void Init(std::istream& aDataFile)
0070 {
0071 G4double eNeu, coeff;
0072 G4int nPoly;
0073 aDataFile >> eNeu >> nPoly;
0074 eNeu *= CLHEP::eV;
0075 Init(eNeu, nPoly);
0076 for (G4int l = 0; l < nPoly; l++) {
0077 aDataFile >> coeff;
0078 SetCoeff(l + 1, coeff);
0079 }
0080 }
0081
0082 inline void Init(G4double e, G4int n)
0083 {
0084 nCoeff = n + 1;
0085 theCoeff = new G4double[nCoeff];
0086 for (G4int i = 0; i < nCoeff; i++)
0087 theCoeff[i] = 0;
0088 theCoeff[0] = 1.;
0089 theEnergy = e;
0090
0091 }
0092 inline void SetEnergy(G4double energy) { theEnergy = energy; }
0093 inline void SetTemperature(G4double temp) { theTemp = temp; }
0094 inline void SetCoeff(G4int l, G4double coeff) { theCoeff[l] = coeff; }
0095 inline void SetRepresentation(G4int aRep) { theRep = aRep; }
0096
0097 inline G4double GetCoeff(G4int l) { return theCoeff[l]; }
0098 inline G4double GetEnergy() { return theEnergy; }
0099 inline G4double GetTemperature() { return theTemp; }
0100 inline G4int GetNumberOfPoly() { return nCoeff; }
0101 inline G4int GetRepresentation() { return theRep; }
0102 inline const G4InterpolationManager& GetManager() { return theManager; }
0103
0104 private:
0105 G4int theRep;
0106 G4double theEnergy;
0107 G4double theTemp;
0108 G4int nCoeff;
0109 G4InterpolationManager theManager;
0110 G4double* theCoeff;
0111 };
0112
0113 #endif