Does ‘accumulableManager->Merge()’ merge the data from different events as well?
I thought the function merged the data returned by multiple threads so it wouldn’t do anything in a non-multithread mode. However, if this is true, the rms calculation in B1RunAction.cc of exampleB1 cannot be explained.
We do not print the average value of edepPerEvent, but the sum of edepPerEvent over the run, eg. the total energy deposited in the run.
I believe that the rms formula of this sum is correct in exampleB1
Thank you for the reply. I believe my question was a bit confusing. Let me split it into two.
Am I understanding correctly that ‘accumulableManager->Merge()’ wouldn’t do anything in a non-multithread mode, as it merges the data returned by multiple threads?
With regard to the quantity calculated for ‘rms’ in exampleB1,
G4double edep=fEdep.GetValue() calculates the sum of Ei, where Ei is the edepPerEvent, while G4double edep2=fEdep2.GetValue() calculates the sum of Ei^2.
The rms calculation is done in the following:
G4double rms = edep2 - edep*edep/nofEvents;
if (rms > 0.) rms = std::sqrt(rms); else rms = 0.;
The ‘root mean square’ would be sqrt (sum of Ei^2 / nofEvents). The ‘root mean square of the deviations from the mean’, which I believe the code was trying to calculate, would be sqrt (sum of Ei^2 / nofEvents - (sum of Ei / nofEvents)^2), or sqrt (sum of Ei^2 - (sum of Ei)^2 / nofEvents) / nofEvents.
1- yes of course : in sequential mode, Merge( ) is nothing.
2- let me repeat what I said. Given a random variable X,
S = X1+X2+…+Xn is a random variable.
M = S/n is another random variable.
The formula in exampleB1 is for S, not for M.
I am speaking of the rms too ! The formula is what the mathematics give for the variance of the variable S. I encourage you to redo the calculation yourself.
But I am not a super expert in statistic, and I am not sure of how to interpret the formula.