This document is intended to aid HiRes personnel in finding and building code to create the HiRes 2 Steerable Laser System (HR2SLS) monte carlo program. Instructions on how to run the monte carlo to generate DSTs and PAW ntuples for analysis are also provided. If any of this information is erroneous or not clear, contact the author of this document.


Location of HR2SLS monte carlo source files

Source code for building the HR2SLS laser monte carlo can be found on the University of Utah's machine franny.cosmic.utah.edu under the directory /hires_soft/mc97/uvm.

Also, my directory ~whanlon/hr2sls on hrlx01.cosmic.utah.edu is where my working copies of HR2SLS monte carlo files are contained.


How to extract and build the source files to make executables

On one of Utah's Alpha machines (e.g. franny.cosmic.utah.edu) create a directory in which you wish to have the source code reside, cd to that directory and enter:

uvma fetch '/hires_soft/mc97/uvm/*'

to extract the latest update of the source code. To build the binary executables, log into a newer, faster machine like hrlx01.cosmic.utah.edu (where you will run the monte carlo) and run the build script by entering

bld_mc97_sls

Note: If you do not have /hires_soft/build2k in your path the build script will not work. You can add this directory to your path or you can add the following lines to the beginning of bld_mc97_sls:

#!/bin/tcsh
set path = ( $path /hires_soft/build2k )

Upon successful completion of the build script you should see at message similar to:

Link completed: Fri Sep 22 15:57:13 MDT 2000

To make the program that converts the HR2SLS monte carlo output to DST format, you must log into one of the Alpha's at the University of Utah (e.g. franny.cosmic.utah.edu) and cd to the directory where you extracted the HR2SLS monte carlo source code and execute the script

bld_mc97todst_sls

Note: I have not gotten the conversion program to work on the linux PC's only on the Alpha's.


How to run the monte carlo to generate DST files

After extracting and building the HR2SLS monte carlo, the executable mc97_sls should have been created. This is the monte carlo program. It accepts a limited number of command line options and outputs its results in the form of an ascii file called mc.dat.

The command line options and defaults are:

Command-line driven Laser Montecarlo:

The output from this program is printed in an ascii file
called "mc.dat".  This text file can be converted to a DST
file by running "mc97todst_sls" on your ascii output file.


Usage: mc97_sls [options/switches] -file {lidar_loop.file}

Options:
Name            Description                             Default Value
        *** LASER OPTIONS ***
 -alamb         set laser wavelength in nm              355.000000 
                (lambda is between 300 to 420 nm)
 -e             number of shots                         1 
 -energy        mean laser energy in mJ                 5.700000 
 -lsrpx         laser position (x-coordinate)(meters)   -10504.000000 
 -lsrpy         laser position (y-coordinate)           -7074.000000 
 -lsrpz         laser position (z-coordinate)           -53.000000 

        *** ATMOSPHERIC OPTIONS ***
 -ex            extinction length (m)                   12000.000000 
 -hlmax         maximum laser altitude (m)              100000.000000 
 -aermodel      selects the aerosol model               1 
                (1=Toy Model
 -mex           wavelength dependent extinction         0 
                (0=Elbert/Etterman 0=call uextin)
 -mph           phase function                          0 
                (0=Longtin  1=Elbert  2=Greenstein  3=other)
 -mpr           vertical profile                        0 
                (0=Dai 1=other)
 -mx            mixinglayer (m)                         0.000000 
 -hsc           scale height (m)                        1200.000000 

        *** OTHER OPTIONS ***
 -setNr         set number of form YYMMDDPP             98052201
 -iseed         random number seed                      11381138 

        *** SWITCHES ***
 -bigh17        selects 17 mirror config
 -molec         use molecular atmosphere                standard
 -noise         toggle night sky noise                  ON
 -hr2sls        option to emulate HR2SLS more closely   ON
 -file          read positions from a file

A lidar loop file must also be provided to change the laser's pointing direction and elevation angle. Lines that do not begin with a '*' are considered comments by mc97_sls. The following is an example of the required format:

Edited for use as a montecarlo input file on 13 March 2000
Reid Mumford.  
an astrix is before each point
the first number is ut bit map (0 fire each hour)
the second is azimuth
the third is zenith
the fourth is shots
the fifth is hertz
the sixth is filter
the seventh is the voltage across flash lamp of BigSky laser if present 
     this should be between 1 and 20
the eighth is the Q switch frequency
    this is the number of flashes by the bulb before lasing occurs. 
    This can  be between 1 and 99 although it is recommended that you do 
    1-20
then comment if desired
if wait is zero following loops will wait for top of hour to begin

for example to fire a shot at ut 3 and ut 10, ut bit map is 408

^LOOPS 12  ^WAIT 0

utmap azi     zen  shots  hz  filter  V   BF  comment
*0    4       15   2      4   24      20  1

Basically for the monte carlo the only fields that I believe are relevant are:

Now you should be able to run the monte carlo by providing the command line switches that you like to define the laser energy and atmospheric conditions and by providing a lidar loop file to define the laser's geometry.

After running the monte carlo a file called mc.dat will be created. To convert this file to DST format (a necessary step before conversion to NTUPLE format), log into an Alpha (e.g. franny.cosmic.utah.edu), cd to the directory where mc.dat resides and enter the command:

mc97todst_sls mc.dat <DST output file name>

Where <DST output file name> is the DST file you wish to create from the ascii output.

There is also available documentation written by one of the authors of the monte carlo.

How to convert the DST files to PAW NTUPLES.

To convert the DST files to NTUPLES use ~whanlon/hr2sls/hr2slslsrprof.run (you can copy this to the same directory where you created mc97_sls). If the name of the DST file you created is for example mc.dst, the command to convert to NTUPLES would then be:

hr2slslsrprof.run 2 mc.dst mc.dst

A .rz file named hrtemp.rz is created. This is the NTUPLE file. The NTUPLE number is 1000.

Now you can use paw to look at the monte carlo output. The following is a semi-complete list of NTUPLE variables (originally from Richard Gray):

This is a list of the variables in the rz files containing the 
binned laser data which were made by hr2slslsrprof program.
The data is binned in 4deg sections of mirror.

cell	This is a number from 1 to 88 describing which bin the 
	photons were measured in. 1 through 4 are mirror 7. It then goes 
	around the detector.

mradian	This is the azimuthal angle in radians of the mirror's cells or
	bins.

qdcA	This is the sum of the qdcA's of the tubes in the bin

prxf	This is the "calibrated" signal, or number of photons in bin

d1	This is the distance in kilometers from the laser to the point
	where the light scattered.

d2 	Is the distance from the detector to the point along the direction
	of the bin which is of closest approach to the point along the 	
	laser where the light most likely scattered from. In other
	words the distance the light in that bin traveled from where it
	scattered to the detector.

sradian This is the scattering angle the bin made to the laser in radians.

energy	This was the energy of the laser. (I can't remember if it's in
	joules or milijoules)

azi	This is the azimuthal angle the laser made in hires1 coordinates
	when it was fired. Measured in radians.

zen	This is the elevation angle of the laser in radians.

xint	This is the point along the laser direction where the light
yint	scattered.
zint

r	The distance of closest approach between laser direction and
	bin direction.

mirnum	This is the number of the mirror the bin came from

xcell	Unit vector of bin
ycell 
zcell

evnt	Event number.

filter	The laser's filter that was used.

prxf2 	I believe this is the photon's of the montecarlo molecular
	prediction. I'll have to check to make sure.

av1	This is the average photon counts divided by incident energy
	in a bin out of 10 shots.

nmir 	This is the number of mirrors in an event

emon	This was what was read at the monitor probe on the laser system
	for the energy.

hr 	Is the hour that an event occured.

avenergy	This is the average energy of laser shots used in av1

xt	This is the point along bin direction closest to laser direction
yt
zt

min	This is the minute an event occured

xp	This is the unit vector of the plane, will only have value if data
yp 	has gone through a plane fit.
zp

ldotp	dot product of laser direction with plane normal

norm	This is the average of montecarlo molecular prediction divided
	by incident energy.

enorm	Is the energy of the montecarlo shots

whanlon@physics.rutgers.edu

Last update: Sun Sep 24 06:13:46 EDT 2000