will read the newline and append the (a, b) of the previous line to e and dNde. This will create incorrect sampling weights when using discrete energy sampling since a given energy will essentially be given twice the weight.
A simple fix is to just ignore empty lines as follows:
float a,b;
while(f >> a >> b) {
e.push_back(a);
dNde.push_back(b);
}
Producing the correct weights:
Furthermore, there was a bug from a previous commit which removed the line
If input_spectrum.txt contains a newline (most commonly seen at the very end of the file), the current code
will read the newline and append the (a, b) of the previous line to e and dNde. This will create incorrect sampling weights when using discrete energy sampling since a given energy will essentially be given twice the weight.
A simple fix is to just ignore empty lines as follows:
Producing the correct weights:
Furthermore, there was a bug from a previous commit which removed the line
vDir = G4ThreeVector(sin(theta)*cos(phi),sin(theta)*sin(phi),cos(theta));
when using a fan beam.