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
00030
00031 #ifndef G4NeutronHPContAngularPar_h
00032 #define G4NeutronHPContAngularPar_h 1
00033
00034 #include "G4ios.hh"
00035 #include <fstream>
00036 #include "globals.hh"
00037 #include "G4NeutronHPList.hh"
00038 #include "G4ReactionProduct.hh"
00039 #include "G4NeutronHPInterpolator.hh"
00040 #include "G4InterpolationManager.hh"
00041
00042 class G4NeutronHPContAngularPar
00043 {
00044 public:
00045
00046 G4NeutronHPContAngularPar()
00047 {
00048 theAngular = 0;
00049 currentMeanEnergy = -2;
00050 fresh = true;
00051 }
00052 ~G4NeutronHPContAngularPar()
00053 {
00054 if(theAngular!=0) delete [] theAngular;
00055 }
00056
00057 void Init(std::ifstream & aDataFile);
00058
00059 G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass,
00060 G4int angularRep, G4int interpol);
00061
00062 G4double GetEnergy() { return theEnergy; }
00063
00064 void SetPrimary(G4ReactionProduct * aPrimary)
00065 {
00066 thePrimary = aPrimary;
00067 }
00068
00069 void SetTarget(G4ReactionProduct * aTarget)
00070 {
00071 theTarget = aTarget;
00072 }
00073
00074 void SetTargetCode(G4double aTargetCode) { theTargetCode = aTargetCode; }
00075
00076 void SetInterpolation(G4int theInterpolation)
00077 {
00078 theManager.Init(theInterpolation, nEnergies);
00079 }
00080
00081 void Merge(G4double anEnergy, G4InterpolationScheme & aScheme,
00082 G4NeutronHPContAngularPar & store1,
00083 G4NeutronHPContAngularPar & store2)
00084 {
00085 nDiscreteEnergies = store1.nDiscreteEnergies;
00086 nAngularParameters = store1.nAngularParameters;
00087 nEnergies = store1.nEnergies;
00088 theManager = store1.theManager;
00089 theEnergy = anEnergy;
00090 if(theAngular != 0) delete [] theAngular;
00091 theAngular = new G4NeutronHPList[nEnergies];
00092 G4int i, ii;
00093 G4double value;
00094 for(i=0; i<nEnergies; i++)
00095 {
00096 theAngular[i].SetLabel(store1.theAngular[i].GetLabel());
00097 for(ii=0; ii<nAngularParameters; ii++)
00098 {
00099
00100
00101
00102 value = theInt.Interpolate(aScheme, anEnergy,
00103 store1.theEnergy, store2.theEnergy,
00104 store1.theAngular[i].GetValue(ii),
00105 store2.theAngular[i].GetValue(ii));
00106 theAngular[i].SetValue(ii, value);
00107 }
00108 }
00109 };
00110
00111 G4double MeanEnergyOfThisInteraction()
00112 {
00113 G4double result;
00114 if(currentMeanEnergy<-1)
00115 {
00116 return 0;
00117
00118 }
00119 else
00120 {
00121 result = currentMeanEnergy;
00122 }
00123 currentMeanEnergy = -2;
00124 return result;
00125 }
00126
00127 private:
00128
00129
00130 G4double theEnergy;
00131
00132
00133 G4int nEnergies;
00134
00135 G4int nDiscreteEnergies;
00136
00137 G4int nAngularParameters;
00138
00139 G4InterpolationManager theManager;
00140
00141 G4NeutronHPList * theAngular;
00142
00143 private:
00144
00145 G4NeutronHPInterpolator theInt;
00146
00147 G4double theTargetCode;
00148 G4ReactionProduct * theTarget;
00149 G4ReactionProduct * thePrimary;
00150
00151 G4double currentMeanEnergy;
00152
00153
00154 public:
00155 void ClearHistories(){ fresh = true; };
00156 private:
00157 G4bool fresh;
00158 G4double remaining_energy;
00159 };
00160 #endif