Scaler   Data   Class   Package   for   Hall A

Robert Michaels,, Jefferson Lab Hall A, Mar 22, 2005

This file:

Update, March 30, 2016   For Podd version 1.6, THaScaler is no longer part of the distribution. Instead, you'll need to use an Event Type Handler.   There are already some useful examples of these which replace the function of THaScaler, which was considered a bit too complicated and not suitable for Hall C. The rest of this is old documenation ...


In Hall A we have crates of scaler data, see also dstruct.html (write-up about data structure).   The present class package is intended to analyze those data and works either as a standlone code suite, or within the context of the new Root/C++ analyzer .


To use scalers inside the Root/C++ analyzer do the following:


You may want to use the THaNormAna class to get the normalization of the runs, i.e. to summarize the number of triggers, deadtime correction, integrated charge. It also provides a method to do BCM calibration. Untar and see README.


The code can be run as a standalone package. This buys you a few features not available with the analyzer, like reading from VME, analyzing end-run history file, or analyzing the ring-buffer from scaler ROC10/11 data..   Download   and   untar and see README, and/or look at the THaScaler programming notes.     Of course these codes also come with the Root/C++ analyzer in directories /hana_decode and /hana_scaler. Finally, the codes are probably installed in the experiment's directory (e.g. as I write this there exists a directory   ~adaq/e01015/scaler).

The following examples illustrate usage. Note, all these examples are available when you download the scaler code. See README.

  The file is in $DB_DIR for running with the analyzer,
  or in $(pwd) if running the standalone scaler codes.

  It contains a time-dependent text-based mapping of scaler channels
  which permits getting data from THaScaler by names like "bcm_u3".

  For usage prior to Feb 1, 2005, the syntax was limited to the following,
  while the new code still respects these conventions:
  1. comments start with #

  2. DATE field: starts the map for a particular date 
     format of date 
         "DATE day month year" 
         DATE 1 9 2002
   Note, after Feb,'05 "date" may be lower case and is ignored if after a #

   scaler-map-info (see below) is taken from the time between the time 
   of "date" and the time of the next "date".  Apart from that rule, the
   ordering of line in is irrelevant. 

  3. scaler-map-info:
  The format of scaler-map-info is as following line:
  short-name  helicity  crate-num  slot-num  start-chan  num-chan  long-name
     short-name = string corresponding to data member in THaScaler
     helicity :  0 = none, -1 = negative, +1 = positive
     crate :  Crate numbers follow a convention (7=Right, 8=Left, 
              10,11 = synchronous readouts, etc)
     slot:  Comes from 17th-20th bits of VME header, is related to 
            physical slot in VME (usually in order left to right).
            For synch readout, we have slots 1,2,3 defined in THaCrateMap.
     start-chan, num-chan starting and number of channels in raw data
     long-name: Long descriptive string used for plots.
  Note about channel indices:  0 = 1st one (C-style)

  New features after Feb 1, 2005:

  Note, these new features might confuse old versions of THaScalerDB.
  However, if you put the new features after a "# " (i.e. a comment)
  they will be ignored by the old version, but still get used by the new
  version (after Feb '05).  This makes the new compatible
  with both the old and new code.  If you are using newer THaScalerDB, 
  however, the "# " (pound followed by space) is optional.

  4. Directives

  Directives are of the general form

    directive-name  Crate index1:data1 index2:data2 index3:data3 ...

  and can be obtained by client code for the particular crate by
  the THaScalerDB::GetDirective() routine.
  The following directives control "xscaler" layout.  If absent,
  however, xscaler by default displays one scaler slot per page 
  and labels the channels 1-32.  

    xscaler-layout   -- controls the page layout
    xscaler-tabs     -- tab names of the page
    xscaler-pagename -- names of the pages
    xscaler-pageslot -- relation of page# to slot#
    xscaler-server   -- server IP addresss
    xscaler-clock    -- channel of clock to normalize rates
  The following directives permit to tie one crate's data to
  another.  This was necessary since, for example, crate 11
  (event stream EvLeft) is tied to crate 8 (event type 140 data)
  historically.  It allows for much shorter (factor of ~6) file.  The "indices" 0,-1,1 are the helicities and
  the "data" are the crate it is tied to.

    crate-tied  EvLeft 0:8 -1:8  1:8

  The helicities -1 and +1 can be tied to another slot (e.g. helicity 0)
  The indices are helicities, and the data are offsets to the slot for 
  helicity 0

    slot-offset Left -1:1 1:-1


Robert Michaels   --   e-mail: