If we use the same notation as in this post, I assume that the standard deviation of a variable weighted by these subroutines is calculated by substituting x_{i,j} with w_{i,j} \cdot x_{i,j}, where w_{i,j} is the weight added by COMSCW or FLUSCW to x in the j^{th} history of the i^{th} batch, in the formula given in said post, so that:

the substitution you propose is only valid in the case when the weighing factor is a constant value (at least during a history).

However, most of the time the weighting factor is applied to a fraction of the cases when it is called during a history, for example filtering out particle types. Furthermore, the weighing factors can depend on particle type or the energy of the particle, like the fluence to dose equivalent conversion factors.

Thank you very much for your reply. I understand, then how does FLUKA calculate the standard deviation when COMSCW or FLUSCW are used?

Would it be the following?

If we consider now a weight that varies for each step w_{i,j,k} where is the weight added by COMSCW or FLUSCW to x in the k^{th} simulation step of the j^{th} history in the i^{th} batch, then the formula above would be now:

where x_{i,j,k} is the contribution to x in the k^{th} step of the j^{th} history in the i^{th} batch and m_j is the number of simulation steps in history j.

FLUKA only returns the average (x_i) value in for a batch (cycle), with or without the COMSCW and FLUSCW routines.

So the calculation of the standard deviation doesn’t change. The only difference is that with COMSCW / FLUSCW x_i is the value of a different quantity.

(One note: During one history (primary event) the results are cumulated only.)

Thank you for your reply once again! I see, I have edited the previous post accordingly.

Just to confirm, without any subroutine, FLUKA returns the average x_i for a batch. When FLUSCW/COMSCW is used, the calculated average is [w(\textrm{sim}) \cdot x]_i where w(\textrm{sim}) \cdot x is x, modified by the weight w (\textrm{sim}) which can be a function that varies in many ways along the simulation.

this is mostly correct, the only caveat is that the weigh is not applied to x directly, but during each “scoring event” (which would sum up to x if no weight is applied), and w can be different in each of them.