Producing ADC distributions for the EMCs from raw DAQ files


For calibrations of the EMCs (eg. pedestals, status, relative gains) it is often useful to look at raw ADC distributions from a sample of minimum bias events.  This can be done simply by analyzing the MuDsts once production has occured, but if one wants to proceed with calibrations before production occurs it often faster to use the raw DAQ files to produce these simple ADC distributions summed over many events.  The instructions below describe an adaptation of the general daq reader (provided by Tonko et. al.) used specifically to produce these distributions. 

The general daq reader for all STAR subsystems can be found in StRoot/RTS/src/RTS_EXAMPLE/rts_example.C, however for EMC purposes not all of the functionality provided there are necessary.  The macro used here, emchist.C, uses the relevant pieces of the general daq reader to retrieve raw ADC information on a crate/channel level from the daq files and store them in ROOT histograms.  These histograms are useful for many QA and other tasks including timing scans, pedstals, status tables, relative gains (from slopes), etc.
If one is interested in only events from a specific trigger to increment the raw ADC histograms, then this can be specified in the emchist.C macro by using
int trigID[2]={A,B};
where A is the "DAQ trigger ID" for events to be incremented in the histograms and B is another trigger which is only implemented as a counter.  These trigger IDs can be found in the RunLog browser, but then they need to be converted to get the numbers A and B in trigID[].  The mapping pattern is
1 2 4 8 16 32 64 128 256 512 1024 2048...
1 2 4 8 10 20 40 80  100 200 400  800...

So for example, for the emc-check runs in Run 13,

the line should be trigID[2]={1024,0};


1) Check out the macro from cvs:
% cvs co StRoot/StEEmcPool/macros/DaqReader

2) Copy the relevant macros and scripts to your working directory:

% cp StRoot/StEEmcPool/macros/DaqReader/ ./

% cp StRoot/StEEmcPool/macros/DaqReader/emchist.C  ./

% cp StRoot/StEEmcPool/macros/DaqReader/  ./

% cp StRoot/StEEmcPool/macros/DaqReader/  ./

3) Compile the macro by using the script:
% ./ emchist.C
which produces an executable emchist* which reads the daq file by executing
./emchist /star/data03/daq/2012/100/13100049w_js/st_W_13100049_raw_1340001.daq
for the daq file of interest.
To process all the daq files for a given run which are stored on some NFS disk space there is a script provided ( which loops over a given runList to do this.  Finally, you can add all the histograms for a given run using the script.