Running Timing Scan Code

This page will describe how to run the code for doing the endcap timing at the beginning of each run.  You can see results for run 9 here and run 10 here.

The code was originally written by Jason Webb and is rather easy to figure out.  It is in the cvs repository as StRoot/StEEmcPool/StEEmcTimingMaker.  Be sure to read the HOWTO there first (thank you, Jason, for code with directions!). 

The only problem with this code and setup is that it requires MuDsts as input, and making the MuDsts quickly requires an official request and time that we often don't like to take.  Beginning in run 10, instead of using the MuDsts, we started using Matt's DAQ reader to produce histograms from DAQ files.  Then I did the analysis from the histograms that are the output of Matt's code.  This required basically adding one extra function to the timing maker to take the 2-d histograms from Matt's code and put them in the format that Jason's code expected.   For run 10, Stephen T made the 2-d histograms from Matt's code and then I just used Jason's code to do the final analysis.  I will include here instructions for running the DAQ reader if you need to run them, however.

 I have checked all this code into my personal cvs area under offline/users/aliceb/StRoot/StEEmcPool/StEEmcTimingMaker.  So, first, cvs co this directory:

cvs co offline/users/aliceb/StRoot/StEEmcPool/StEEmcTimingMaker

The code related to the DAQ histograms is found in StRoot/StEEmcPool/StEEmcTimingMaker/DAQ.  You maybe find it better to move that entire directory somewhere more convenient. 

Running the DAQ Reader to produce 2-d histograms

Once you have the code checked out your DAQ directory somewhere you like, move into that directory.  Compile the emchist code with:

compile.sh  emchist.cpp

You should get an emchist executable when you are done.  I included in the DAQ directory a perl script, runDaqHistos.pl, that I used to run emchist over all the data from run 9 when I was developing this code.  Right now this script will not work because the I did not keep the daq files, but it should be a useful example.  The script looks in the directory set by $path for files that contain a run number in the lists of runs @runs.  It will run emchist over each.  I believe the output of emchist goes into your current working directory and not the directory where the daq files are found, but I do not remember 100%. 

I assume you might want to actually run this code from start to finish so you can see how things work.  In order to do this you will need to pull some daq files from HPSS.  I included in the DAQ directory another perl script, hpsgetdaq.pl, that will make a properly formatted list of files for you to submit to the file catalog.  Let's say you wanted to get files from run 10364013 and put the daq files at /star/institutions/anl/aliceb/daqFiles (of course, don't put them here, but them in your own area somewhere).  You would do:

hpsgetdaq.pl 10364013 /star/institutions/anl/aliceb/daqFiles

After running this you should get a file called 10364013_request.lis.  It should contain on each line the full path of file on hpss followed by the desired output directory like this:

/home/starsink/raw/daq/2009/364/10364013/st_physics_10364013_raw_1010001.daq /star/institutions/anl/aliceb/daqFiles
/home/starsink/raw/daq/2009/364/10364013/st_physics_10364013_raw_1020001.daq /star/institutions/anl/aliceb/daqFiles
/home/starsink/raw/daq/2009/364/10364013/st_physics_10364013_raw_1030001.daq /star/institutions/anl/aliceb/daqFiles
/home/starsink/raw/daq/2009/364/10364013/st_physics_10364013_raw_1040001.daq /star/institutions/anl/aliceb/daqFiles

Now we follow the directions for using the data carousel and submit our request with

hpss_user.pl -f 10364013_request.lis

Once your request has completed (the time for this varies a lot, but should be within ~1 day), you can run change the path and/or runs in runDaqHistos.pl and run it

runDaqHistos.pl

Running the Timing Maker to Make Timing Curves

The timing maker code is StEEmcTimingMaker.cxx and StEEmcTimingMaker.h.  It is run with runEEmcDAQTiming.C in the macros directory. 

First things first, you need to compile the code.  I usually use starnew.  From your parent directory (one above StRoot) do:

starnew

cons

Next, make a directory for all your output files called timing_files

mkdir timing_files

I also usually like to make a symbolic link to the macros directory to make it more accessible

ln -s  StRoot/StEEmcPool/StEEmcTimingMaker/macros .

You will run macros/runEEmcDaqTiming.C.  Before running it,however, you need to make file lists, one per run, with names <run>.list that contains a list of the histograms output from the daq reader step above.  Note: plotEEmcDaqTiming.C expects these lists to be the same directory as plotEEmcDaqTiming.C.  I again have a perl script for running over all the runs with the proper inputs to plotEEmcDaqTiming.C.  This is makeDaqTimingFiles.pl.  After you make all your file lists, change the file as directed and then run with

macros/makeDaqTimingFiles.pl

When this completes, if all goes well you will have, for each run, an output file in timing_files that contains both histograms and a small tree which stores slopes and counts for the run.  The plots are make from the tree, the histograms are there for your reference. The code for making the plots macros/plotEEmcTiming.C.  You would run this with

root4star -b -q macros/plotEEmcTiming.C

The code contains two methods for getting timing curves: (1)using Scott's method for slopes, and (2) using sums.  You will see that curves for both are made. 

That's all, good luck, and remember to always look out for bugs!