Warning, file /geant4/examples/advanced/composite_calorimeter/include/CCalDataSet.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 #ifndef CCalDataSet_h
0027 #define CCalDataSet_h
0028
0029 #include "G4ParticleHPInterpolator.hh"
0030 #include <vector>
0031
0032
0033
0034 class CCalDataSet
0035 {
0036 public:
0037
0038 void insert(G4double anEnergy, G4double aXsection)
0039 {
0040 pair<G4double, G4double> aPoint(anEnergy, aXsection);
0041 theData.push_back(aPoint);
0042 }
0043
0044 double getCrossSection(G4double anEnergy)
0045 {
0046 G4double result;
0047 if(anEnergy < theData[0].first)
0048 {
0049 result = 0;
0050 }
0051 else
0052 {
0053 G4double x1,x2;
0054 G4double y1,y2;
0055 if(anEnergy > theData[theData.size()-1].second)
0056 {
0057
0058 G4int n=theData.size();
0059 x1 = theData[n-1].first;
0060 y1 = theData[n-1].second;
0061 x2 = theData[n-2].first;
0062 y2 = theData[n-2].second;
0063 }
0064 else
0065 {
0066
0067 unsigned int i;
0068 for(i=0; i<theData.size(); ++i)
0069 {
0070 if(theData[i].first>anEnergy) break;
0071 }
0072 x1 = theData[i-1].first;
0073 y1 = theData[i-1].second;
0074 x2 = theData[i].first;
0075 y2 = theData[i].second;
0076 }
0077
0078 result = theInterpolator.Interpolate(LOGLIN, anEnergy, x1,x2,y1,y2);
0079 }
0080 return result*barn;
0081 }
0082
0083 private:
0084
0085 G4ParticleHPInterpolator theInterpolator;
0086
0087 private:
0088
0089 vector<pair<G4double, G4double> > theData;
0090 };
0091 #endif