Integral of the two functions for a double gaus fit

ROOT Forum → Search → “gausn(3)”

A simple, standalone dedicated simulation (a “toy MC”) can be found here: