# Statistical Error Calculation in COMSCW and FLUSCW subroutines

Dear FLUKA experts,

I hope you are all well. Following Statistical Error calculations - #2 by horvathd post, I wanted to ask how this formula changes after using the COMSCW or FLUSCW subroutines.

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:

x_i \rightarrow x'_{i} = \sum^{n_i}_{j=1} \frac{w_{i,j} \cdot x_{i,j}}{n_i}

Is this correct?

Best wishes,
Daniel

Dear Daniel,

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.

Cheers,
David

Dear @horvathd,

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:

x_i \rightarrow x'_i = \sum ^{n_i}_{j=1} \frac{1}{n_i}\sum^{m_j}_{k=1} w_{i,j,k} \cdot x_{i,j,k}

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.

Best wishes,
Daniel

Dear Daniel,

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.)

Cheers,
David

Dear @horvathd,

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.

Best wishes,
Daniel

Dear Daniel,

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.

Cheers,
David

Dear @horvathd,

Thank you for your reply. Apologies, that was what I was (unsuccessfully) trying to convey by writing w and x within the same bracket.

Best wishes,
Daniel