RICH scaler ntuple

WHAT THIS IS

I have written scripts to create ntuples using RICH scaler data stored in the DB. These ntuples have advantages over the available GUIs for accessing this data from the DB (available here and here) in that they allow one to easily correlate and cut on various quantities. They also bring together information beyond the RICH scalers regarding the runs which were taken.

 

LOCATION OF MY NTUPLES

During a Run year, I create my own ntuples on disk which I update every few days for my own work purposes. It is fine to use the ntuples I update, or generate your own as described below.

The ntuples I create can be found in:
/star/subsys/tpc/SCGL/genevb/SCAL/*/ntup.root
where the * is a RunYear number (e.g. RUN22/ntup.root is for Run 22, which occurred in 2022). 

 

HOW TO GENERATE

The ntuples are generated using the following two codes (these can be run by anyone else as well):
offline/users/genevb/getRichScalers.csh
offline/users/genevb/matchRichScalers.C
which first obtain the scalers from the DB, then correlate the data into an ntuple. Simply check out the shell script:
cvs co -d . offline/users/genevb/getRichScalers.csh
...and execute it (it checks out and executes the macro), and wait for it to finish, producing a file called ntup.root. If no argument is provided for the shell script, the ntuple will contain data for the current Run year. Optionally, one can use an argument such as 22 or 2022 to get the data for Run 22 (taken in 2022).

Note: there are two database sources of RICH scalers. One collects 60-second-averaged scaler rates recorded every 30 seconds, and the other collects 15-second-averaged scaler rates recorded every 15 seconds. By default, the 15-second scaler source is used. However, that source is unavailable before Run 12. To use the other source, please comment out the setenv USE15 line in the shell script.

 

WHAT'S INSIDE

Each entry in the ntuple is a DB recording of the RICH scalers, and includes things like:

zdce : ZDC East singles rate
zdcx : ZDC coincidence rate
bbcw : BBC West singles rate
inty : Yellow beam intensity
etc.

Also included is a run number which is greater than zero only if that scaler reading occurred during a DAQ run (the quantity fill is also non-zero only during runs). Additionally there are three times included, all three of which are stored as unix timestamps (seconds since the start of the year 1970):

t : time of the scaler recording
begin : time at which the run associated with this recording started (0 if not during a run)
end : time at which the run associated with this recording ended (0 if not during a run)

Yet more information in each ntuple entry includes the ShiftLeaderStatus (status = 0 = OK) of the run, and a bitmap of detectors in the run called det. The bitmap can be used to require presence of a detector, as in (((det>>X)&1)>0), where X is the detector ID number as found by the following query:

mysql -h heston.star.bnl.gov -P 3501 -C RunLog -e "select name,detectorID from detectorTypes;"

For example, (((det>>20)&1)>0) is a requirement on the presence of TPX data in the run.

 

EXAMPLES

A very simple example is to just open an ntuple and plot the ZDC coincidence rate versus time:

root -l /star/subsys/tpc/SCGL/genevb/SCAL/RUN21/ntup.root
...
sc.Draw("zdcx:t");

As a more detailed example of usage, here is how I might generate the average ZDC coincidence rate per day for Run 9 for good status data with TPX (here I subtract the unix timestamp for 4 am on Dec. 31, 2008 such that the bin from 80.0 to 81.0 represents the day on which run numbers were 10080xxx):

root -l /star/subsys/tpc/SCGL/genevb/SCAL/RUN9/ntup.root
...
sc.Draw("zdcx:(t-1230696000)/(3600*24)>>rate(136,49,185)","(status==0)&&(det>>20)&1","prof");
int bin;
for (bin=1;bin<=136;bin++) printf("%d %f+/-%f\n",bin+49,rate->GetBinContent(bin),rate->GetBinError(bin));


To that end, another possibly useful script is currently available at:
/star/subsys/tpc/SCGL/genevb/SCAL/run2scaler.C
This script can take an input file listing run numbers and generate averages of various scalers for each of those runs:

root -l -b -q '/star/subsys/tpc/SCGL/genevb/SCAL/run2scaler.C("runs.txt","zdcx:bbcx","/star/subsys/tpc/SCGL/genevb/SCAL/RUN9/ntup.root","output")'
...will generate a text file file called output that has the averaged zdcx and bccx scalers during any runs listed in the local file runs.txt.

-Gene