The method by which I handle the detections and the upper limits is based on analyzing Gaussians. A detection is an observation of an absorption system that has been measured to better than 3sigma, whereas an upper limit is where the observation does not detect any absorption feature, and simply quotes the 3sigma upper limit below which there may be an MgII abs feature.

A match to an observation is made, and then the simulations try to generate 900 simulated versions of the pair of the matched sight line. It is easiest to use an example in explanation. Assume there is some observed MgII of EW=0.5\pm0.1 Ang. The simulations will generate 900 EWsim values that can range from 0 to >5 Ang.

Using the detection of 0.5 \pm 0.1 we define a Gaussian to have \mu=0.5 and \sigma=0.1. I populate an array (size=900) with Gaussian values following:

G=exp(-(x-\mu)^2 / \sigma^2)

where x is the array of 900 EWsim. Integrating this array over min(EWsim) to max(EWsim) and then dividing by the area I have a normalized Gaussian defined by the observed detection:

area=integrate(G,x, [min(EWsim),max(EWsim)])

G=G/area

The array G is now only defined min(EWsim) < x < max(EWsim). To generate a cumulative distribution from this I add up each successive value:
for i=0,899 { errorF[x]=errorF[x-1]+G[x] }
I then force the boundaries on the errorF by: errorF=erroF/max(errorF). The resulting errorFunction is normalized and ready for continued analysis.
However: When you renormalize a truncated Gaussian to have a total area of unity underneath it, you divide by 1-c(0) where c(0) is the the area of the Gaussian from -\infty to 0.
Is this division by 1-c(0) done after normalizing as I did, meaning after I divided by the area under the curve? Or should I be only dividing by 1-c(0) and not calculate the area under the curve. And then once this issue is taken care of, I must also include another subtraction. that is c(0)/[1-c(0)]. That is, you subtract from the renormalized cumulative distribution everything that

accumulated at negative values.

I’m confused because there should be no ‘accumulated at negative values’ as my Gaussian has been only been used (and normalized) at x>0. Having played with some code, I see no difference between including these steps, and not including them.