File indexing completed on 2025-01-18 09:17:10
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
0030
0031
0032
0033
0034
0035
0036 #include "XrayFluoNormalization.hh"
0037 #include "XrayFluoDataSet.hh"
0038 #include "G4SystemOfUnits.hh"
0039 #include "G4VDataSetAlgorithm.hh"
0040 #include "G4LogLogInterpolation.hh"
0041
0042 XrayFluoNormalization::XrayFluoNormalization()
0043
0044 { }
0045
0046 XrayFluoNormalization::~XrayFluoNormalization()
0047
0048 { }
0049
0050 const XrayFluoDataSet* XrayFluoNormalization::Normalize(G4double minIntExtreme, G4double maxIntExtreme, G4int nBins, G4String fileName)
0051 {
0052
0053 G4VDataSetAlgorithm* interpolation = new G4LogLogInterpolation();
0054
0055 XrayFluoDataSet* dataSet =
0056 new XrayFluoDataSet(1,fileName,interpolation,keV,1);
0057
0058 G4double integral = Integrate(minIntExtreme, maxIntExtreme, nBins, dataSet);
0059
0060 G4VDataSetAlgorithm* interpolation2 = new G4LogLogInterpolation();
0061
0062 XrayFluoDataSet* finalDataSet = new XrayFluoDataSet(1,fileName,interpolation2,keV,1/(integral/keV));
0063 return finalDataSet;
0064 }
0065
0066
0067
0068 G4double XrayFluoNormalization::Integrate(G4double minIntExtreme, G4double maxIntExtreme, G4int nBins, XrayFluoDataSet* dataSet)
0069 {
0070 G4double partialHeight = 0;
0071 G4int id = 0;
0072 G4double lenghtOfBins = (maxIntExtreme - minIntExtreme)/nBins;
0073
0074 for (G4int i = 0; i<nBins; i++)
0075 {
0076 G4double midPoint = minIntExtreme + i*lenghtOfBins+lenghtOfBins/2;
0077
0078 G4double heightOfRectangle = dataSet->FindValue(midPoint,id);
0079
0080 partialHeight += heightOfRectangle;
0081
0082 }
0083
0084 G4double integral = lenghtOfBins * partialHeight;
0085
0086 delete dataSet;
0087 dataSet = 0;
0088 return integral;
0089 }
0090
0091
0092
0093