Dear Sir, I tried to simulate optical photons and I tried to define scintillator properties. I found that GEANT4 makes incorrect interpolation when I try to define more than 2 data points on energy grid.... The origin of the problem is in "G4PhysicsOrderedFreeVector.cc" file. In "G4PhysicsOrderedFreeVector.cc" there is the function to get an energy value: G4double G4PhysicsOrderedFreeVector::GetEnergy(G4double aValue) { G4double e; if (aValue <= GetMinValue()) { e = edgeMin; } else if (aValue >= GetMaxValue()) { e = edgeMax; } else { size_t closestBin = FindValueBinLocation(aValue); e = LinearInterpolationOfEnergy(aValue, closestBin); } return e; } But instead of: inline G4double G4PhysicsOrderedFreeVector::GetMaxLowEdgeEnergy() { return binVector.back(); } inline G4double G4PhysicsOrderedFreeVector::GetMinLowEdgeEnergy() { return binVector.front(); } "GetMinValue()" and "GetMaxValue()" are used !!!! Additionaly, "e = LinearInterpolationOfEnergy(aValue, closestBin)" looks very strange because inside of "LinearInterpolationOfEnergy" you make interpolation of the function values (dataVector[]) instead of energy grid (binVector[]). Please check it!
I am sorry, I was wrong. The code has no any comments it was rather hard to understood a logic.