MonteCarloSimJI

From MariachiWiki

Jason Immerman wrote a script (here) that uses the Monte Carlo method to simulate a shower front triggering four difference corners of an array. Using a random number generator to generate a random phi angle based on a uniform distribution and a theta angle based on a Gaussian distribution with a mean of theta=0 and sigma=pi/12 (in spherical coordinates) a normal vector corresponding to the plane of a shower front was produced. Using simple geometry the detectors could be placed on at any point in space such that the time each detector is triggered can be deduced. Next, using the same linear least squares method used in the shower front program (go to its page) the angles and trigger times were recalculated. This allowed for a verification of that method if the detectors all lie in a single z (vertical) plane as well as a measure of how the data is skewed if the detectors lie in different z planes.

To use the script, one must first compile the source file it in ROOT and then run the driver sending it the number of cycles it should run as the only parameter:

root[] .L waveDir_montCarlo.C+
root[] genWave(10000)

Possible outputs include the number of imaginary unit vectors, plots of the differences between actual relative trigger times and calculated relative trigger times as well as plots of the differences between actual and calculated theta (both in degrees), phi and cos(theta). As a default all outputs are set to be displayed. To turn them off one must comment out the print line "cout << ..." or "plotName->Draw()" in the source code. The comment symbol is "//".


Note: as this script remains unfinished, you must reset the limits of the different histograms so that the output data appears within the limits, otherwise you will render an empty or incomplete plot. To do this enter the source code and change the upper and lower bounds in the histogram declaration:

histExample = new TH1D("histExample","histExample",#BINS,Lower Limit,Upper Limit);

Histograms include pred1 (line 57) ,pred2 (line 61) ,pred2 (line 65) (actual vs calculated times) thetaP (line 71) , phiP (line 83) and cosTheta (line 77).

You will ultimately need to play with these limits until all of the data is included for a sufficiently small enough viewing scale. One way to check whether all of the data is included is to right click on the legend and choose OptStat and change the number to 1111111. This will allow you to see overflow and underflow (ie how many values were above or below the range).