Closed AndrewEdmonds11 closed 10 years ago
Draw a random number from the histogram then add another random number flatly distributed between -binwidth/2 and +binwidth/2? The histograms themselves should be fine enough for this to work.
Also, I think you're right about the 0m thing but we should check that the distance isn't meters-away-from-production-target with Peter.
Draw a random number from the histogram then add another random number flatly distributed between -binwidth/2 and +binwidth/2?
I think this is what TH1F::GetRandom()
essentially does. My worry is that when I use this with x-position and fill a histogram that has 10 times as many bins, I get this:
and we can see the binning of the original histogram. I guess I could try to linearly interpolate between bins. Or are bin widths of 0.1cm good enough anyway and I don't need to worry?
The other option is to use the mean and RMS of the histograms (which also match the values given in the TURTLE output)
How about using the fitted gaussians for the x, x' and y distributions since it looks like a reasonable model for those values and then for the y-direction use a flat distribution over the range of angles in the histogram?
How about using the fitted gaussians for the x, x' and y distributions since it looks like a reasonable model for those values and then for the y-direction use a flat distribution over the range of angles in the histogram?
Yes, I think that's what I'm going to do. So now it's just a case of transforming the coordinates correctly.
Everything working and merged in
This has now changed slightly - see my presentation in elog:204
I've had a look into this from the output file that John gave me yesterday.
In the file, there is only a bunch of text histograms like so:
where the first two columns are the bin limits and the third column is the number of entries in that bin.
There are histograms for x, x', y and y' for several distances "from target". I've assumed that we want the one at 0m and that is the end of the beam pipe.
I have converted these to ROOT histograms but am not sure how suitable they are since the bins are too wide.
We can't really draw random values from the histograms because we will just end up with an unrealistic distribution and I have tried fits to a Gaussian (shown below), which don't alway look that nice...
(for this one, I know that there are 0 entries in the underflow and overflow bins in the tutrtle data so we might get a better fit)
(I guess that a Gaussian isn't suitable here)
Any ideas?