#include <G4NeutronHPPartial.hh>
Public Member Functions | |
G4NeutronHPPartial (G4int n) | |
G4NeutronHPPartial (G4int n1, G4int n2) | |
void | InitInterpolation (G4int i, std::ifstream &aDataFile) |
void | InitInterpolation (std::ifstream &aDataFile) |
void | Init (std::ifstream &aDataFile) |
void | InitData (G4int i, std::ifstream &aDataFile, G4double unit=1.) |
~G4NeutronHPPartial () | |
G4int | GetNumberOfEnergies () |
void | SetX (G4int i, G4double x) |
void | SetT (G4int i, G4double x) |
void | SetX (G4int i, G4int j, G4double x) |
void | SetY (G4int i, G4int j, G4double y) |
G4double | GetX (G4int i) |
G4double | GetT (G4int i) |
G4double | GetX (G4int i, G4int j) |
G4double | GetY (G4int i, G4int j) |
G4double | GetY (G4int i, G4double e) |
G4int | GetNEntries (G4int i) |
G4NeutronHPVector * | GetY (G4double e1) |
G4double | Sample (G4double x) |
Definition at line 41 of file G4NeutronHPPartial.hh.
G4NeutronHPPartial::G4NeutronHPPartial | ( | G4int | n | ) | [inline] |
Definition at line 45 of file G4NeutronHPPartial.hh.
00046 { 00047 X = new G4double[n]; 00048 data = new G4NeutronHPVector[n]; 00049 nData = n; 00050 T=0; 00051 }
Definition at line 53 of file G4NeutronHPPartial.hh.
00054 { 00055 T = new G4double[n2]; 00056 X = new G4double[n1]; 00057 data = new G4NeutronHPVector[n1]; 00058 nData = std::max(n1,n2); 00059 }
G4NeutronHPPartial::~G4NeutronHPPartial | ( | ) | [inline] |
Definition at line 118 of file G4NeutronHPPartial.hh.
References G4NeutronHPVector::GetVectorLength().
Referenced by Sample().
00118 {return data[i].GetVectorLength();}
G4int G4NeutronHPPartial::GetNumberOfEnergies | ( | ) | [inline] |
Definition at line 115 of file G4NeutronHPPartial.hh.
References G4NeutronHPVector::GetX().
00115 {return data[i].GetX(j);}
G4NeutronHPVector * G4NeutronHPPartial::GetY | ( | G4double | e1 | ) |
Definition at line 36 of file G4NeutronHPPartial.cc.
References G4NeutronHPVector::GetInterpolationManager(), G4InterpolationManager::GetScheme(), G4NeutronHPVector::GetVectorLength(), G4NeutronHPVector::GetX(), GetX(), G4NeutronHPVector::GetY(), GetY(), G4NeutronHPInterpolator::Interpolate(), G4NeutronHPVector::SetData(), G4NeutronHPVector::SetInterpolationManager(), and G4NeutronHPVector::SetScheme().
00037 { 00038 G4NeutronHPVector * aBuffer = new G4NeutronHPVector(); 00039 G4int i; 00040 if(nData==1) 00041 { 00042 for(i=0; i<data[0].GetVectorLength(); i++) 00043 { 00044 aBuffer->SetInterpolationManager(data[0].GetInterpolationManager()); 00045 aBuffer->SetData(i , data[0].GetX(i), data[0].GetY(i)); 00046 } 00047 return aBuffer; 00048 } 00049 for (i=0; i<nData; i++) 00050 { 00051 if(X[i]>e1) break; 00052 } 00053 if(i==nData) i--; 00054 if(0==i) i=1; 00055 G4double x1,x2,y1,y2,y; 00056 G4int i1=0, ib=0; 00057 G4double E1 = X[i-1]; 00058 G4double E2 = X[i]; 00059 for(G4int ii=0; ii<data[i].GetVectorLength(); ii++) 00060 { 00061 x1 = data[i-1].GetX(std::min(i1, data[i-1].GetVectorLength()-1)); 00062 x2 = data[i].GetX(ii); 00063 if(x1<x2&&i1<data[i-1].GetVectorLength()) 00064 { 00065 y1 = data[i-1].GetY(i1); 00066 y2 = data[i].GetY(x1); 00067 if(E2-E1!=0) 00068 { 00069 y = theInt.Interpolate(theManager.GetScheme(i), e1, E1, E2, y1, y2); 00070 } 00071 else 00072 { 00073 y = 0.5*(y1+y2); 00074 } 00075 aBuffer->SetData(ib, x1, y); 00076 aBuffer->SetScheme(ib++, data[i-1].GetScheme(i1)); 00077 i1++; 00078 if(x2-x1>0.001*x1) 00079 { 00080 ii--; 00081 } 00082 } 00083 else 00084 { 00085 y1 = data[i-1].GetY(x2); 00086 y2 = data[i].GetY(ii); 00087 if(E2-E1!=0) 00088 { 00089 y = theInt.Interpolate(theManager.GetScheme(i), e1, E1, E2, y1, y2); 00090 } 00091 else 00092 { 00093 y = 0.5*(y1+y2); 00094 } 00095 aBuffer->SetData(ib, x2, y); 00096 aBuffer->SetScheme(ib++, data[i].GetScheme(ii)); 00097 if(x1-x2<0.001*x2) i1++; 00098 } 00099 } 00100 return aBuffer; 00101 }
Definition at line 117 of file G4NeutronHPPartial.hh.
References G4NeutronHPVector::GetY().
00117 {return data[i].GetY(e);}
Definition at line 116 of file G4NeutronHPPartial.hh.
References G4NeutronHPVector::GetY().
Referenced by G4NeutronHPPhotonDist::GetPhotons(), GetY(), and Sample().
00116 {return data[i].GetY(j);}
void G4NeutronHPPartial::Init | ( | std::ifstream & | aDataFile | ) | [inline] |
Definition at line 71 of file G4NeutronHPPartial.hh.
References InitData(), and SetX().
Referenced by G4NeutronHPPhotonDist::InitEnergies().
00072 { 00073 G4int i; 00074 G4double e; 00075 for( i=0; i<nData; i++) 00076 { 00077 aDataFile >> e; 00078 e *= CLHEP::eV; 00079 SetX(i,e); 00080 InitData(i, aDataFile, CLHEP::eV); // energy and probability for gammas 00081 } 00082 }
void G4NeutronHPPartial::InitData | ( | G4int | i, | |
std::ifstream & | aDataFile, | |||
G4double | unit = 1. | |||
) | [inline] |
Definition at line 84 of file G4NeutronHPPartial.hh.
References G4NeutronHPVector::InitInterpolation(), SetX(), and SetY().
Referenced by Init(), and G4NeutronHPAngular::Init().
00085 { 00086 G4int ii; 00087 G4double eg, pg; 00088 G4int neg; 00089 aDataFile >> neg; 00090 data[i].InitInterpolation(aDataFile); 00091 for (ii=0; ii<neg; ii++) 00092 { 00093 aDataFile >> eg >> pg; 00094 eg *= unit; 00095 SetX(i,ii,eg); 00096 SetY(i,ii,pg); 00097 } 00098 }
void G4NeutronHPPartial::InitInterpolation | ( | std::ifstream & | aDataFile | ) | [inline] |
Definition at line 66 of file G4NeutronHPPartial.hh.
References G4InterpolationManager::Init().
00067 { 00068 theManager.Init(aDataFile); 00069 }
void G4NeutronHPPartial::InitInterpolation | ( | G4int | i, | |
std::ifstream & | aDataFile | |||
) | [inline] |
Definition at line 61 of file G4NeutronHPPartial.hh.
References G4NeutronHPVector::InitInterpolation().
Referenced by G4NeutronHPElasticFS::Init(), G4NeutronHPAngular::Init(), and G4NeutronHPPhotonDist::InitEnergies().
00062 { 00063 data[i].InitInterpolation(aDataFile); 00064 }
Definition at line 103 of file G4NeutronHPPartial.cc.
References G4NeutronHPVector::GetInterpolationManager(), GetNEntries(), G4InterpolationManager::GetScheme(), GetX(), GetY(), G4NeutronHPInterpolator::Interpolate(), G4NeutronHPVector::Sample(), G4NeutronHPVector::SetInterpolationManager(), G4NeutronHPVector::SetScheme(), G4NeutronHPVector::SetX(), and G4NeutronHPVector::SetY().
Referenced by G4NeutronHPElasticFS::ApplyYourself(), and G4NeutronHPAngular::SampleAndUpdate().
00104 { 00105 G4int i; 00106 for (i=0; i<nData; i++) 00107 { 00108 if(x<X[i]) break; 00109 } 00110 G4NeutronHPVector theBuff; 00111 if(i==0) 00112 { 00113 theBuff.SetInterpolationManager(data[0].GetInterpolationManager()); 00114 for(G4int ii=0;ii<GetNEntries(0);ii++) 00115 { 00116 theBuff.SetX(ii, GetX(0,ii)); 00117 theBuff.SetY(ii, GetY(0,ii)); 00118 } 00119 } 00120 //else if(i==nData-1) this line will be delete 00121 else if ( i == nData ) 00122 { 00123 for(i=0;i<GetNEntries(nData-1);i++) 00124 { 00125 theBuff.SetX(i, GetX(nData-1,i)); 00126 theBuff.SetY(i, GetY(nData-1,i)); 00127 theBuff.SetInterpolationManager(data[nData-1].GetInterpolationManager()); 00128 } 00129 } 00130 else 00131 { 00132 G4int low = i-1; 00133 G4int high = low+1; 00134 G4double x1,x2,y1,y2; 00135 G4int i1=0, i2=0, ii=0; 00136 x1 = X[low]; 00137 x2 = X[high]; 00138 while(i1<GetNEntries(low)||i2<GetNEntries(high)) 00139 { 00140 if( (GetX(low,i1)<GetX(high,i2) && i1<GetNEntries(low)) 00141 ||(i2==GetNEntries(high)) ) 00142 { 00143 theBuff.SetX(ii, GetX(low,i1)); 00144 y1 = GetY(low,i1); 00145 y2 = GetY(high, GetX(low,i1)); //prob at ident theta 00146 theBuff.SetY(ii, theInt.Interpolate(theManager.GetScheme(high), 00147 x, x1, x2, y1, y2)); //energy interpol 00148 theBuff.SetScheme(ii, data[low].GetScheme(i1)); 00149 if(std::abs(GetX(low,i1)-GetX(high,i2))<0.001) i2++; 00150 i1++; 00151 ii++; 00152 } 00153 else 00154 { 00155 theBuff.SetX(ii, GetX(high,i2)); 00156 //******************************************************************************* 00157 //Change by E.Mendoza and D.Cano (CIEMAT): 00158 //y1 = GetY(high,i2); 00159 //y2 = GetY(low, GetX(high,i2)); //prob at ident theta 00160 y2 = GetY(high,i2); 00161 y1 = GetY(low, GetX(high,i2)); //prob at ident theta 00162 //******************************************************************************* 00163 theBuff.SetY(ii, theInt.Interpolate(theManager.GetScheme(high), 00164 x, x1, x2, y1, y2)); //energy interpol 00165 theBuff.SetScheme(ii, data[high].GetScheme(i2)); 00166 if(std::abs(GetX(low,i1)-GetX(high,i2))<0.001) i1++; 00167 i2++; 00168 ii++; 00169 } 00170 } 00171 } 00172 //buff is full, now sample. 00173 return theBuff.Sample(); 00174 }
Definition at line 109 of file G4NeutronHPPartial.hh.
Referenced by G4NeutronHPElasticFS::Init(), and G4NeutronHPAngular::Init().
Definition at line 110 of file G4NeutronHPPartial.hh.
References G4NeutronHPVector::SetX().
00110 {data[i].SetX(j,x);}
Definition at line 108 of file G4NeutronHPPartial.hh.
Referenced by Init(), G4NeutronHPElasticFS::Init(), G4NeutronHPAngular::Init(), and InitData().
Definition at line 111 of file G4NeutronHPPartial.hh.
References G4NeutronHPVector::SetY().
Referenced by G4NeutronHPElasticFS::Init(), and InitData().
00111 {data[i].SetY(j,y);}