SCALERS  PRIOR  TO  OCT 2003

R. Michaels,  Jefferson Lab,  e-mail:  rom@jlab.org,  updated Oct 29, 2003


The scalers have been pretty stable in physical layout for years. In the long shutdown of Fall 2003 I decided to add a bunch of scalers and to rearrange the helicity gated scalers so that the only redundancy was between two spectrometers; this liberated some channels. Here is the record of the arrangements prior to these changes.

Scalers count raw hits on phototubes, as well as  important quantities like charge and triggers which are used to normalize the experiment.  The scalers are read online using the "xscaler" code, and the meaning of the channels is evident from the scaler configuration file which that code uses.  The scaler config file is normally located in the directory from which you must run "xscaler", namely ~adaq/$EXPERIMENT/right/scaler ~adaq/$EXPERIMENT/left/scaler where $EXPERIMENT is an environment variable like e94104.   I typically save these config files in the Mass Storage System, see the stubfiles /mss/halla/$EXPERIMENT/raw/*scaler*

We attempt to keep the channel mapping the same to avoid driving anyone crazy, but some changes are inevitable.   For the time after Fall 2003, e.g. hypernuclear experiment e94107, see dstruct.html.   For years prior to 2002, see dstruct_year2001.html   and   dstruct_pre2001.html

The number of scaler channels in a bank is determined by the lowest 6 bits of the header. Some scaler have 16, others 32 channels. The helicity gated scalers are FIFO scalers run in G0 helicity mode, see also www.jlab.org/~rom/g0helicity.html.   Since there are two redundant scalers, there are two redundant copies of the helicity gated data.

Arrangement of  the Right   Spectrometer   Updated Jan, 2003
     Bank of 16 or 32 Channels         Header                      Usage                              
    1st  Bank    0xceb00020  1-6=S1-Left, 7,8=blank, 9-13 and 15 =S2-Left, 14,16=blank, 17-22=S1-Right, 23,24=blank, 25-29 and 31 =S2-Right, 30,32=blank.
    2nd  Bank    0xceb20010  Left.AND.Right PMTs: 1-6=S1, 7,8=blank, 9-13 and 15 =S2, 14,16=blank.
    3rd  Bank    0xceb30010   1-10=Gas Cerenkov PMTs, 11=GasC-sum
    4th  Bank    0xceb50010    EDTM Scaler
    5th  Bank    0xceb60010    Spare channels
    6th  Bank    0xceb70020  Plus Helicity gated normalization data. Channels 1-32 follow the same map as channels 1-32 of the ceb8 scaler.
    7th  Bank    0xceb80020  Normalization Data not gated by helicity   channel 1=T1, 2=T2, 3 Upstream(x10)BCM, 4=MLU-Strobe, 5=Hel+ pulses, 6=Hel- pulses, 7=Upstream(x3)BCM, 8=1024Hz-clock, 9=Unser, 10=Downstream(x3)BCM, 11=Downstream(x10)BCM, 12=blank, 13=TS-accept(IF R-arm TS), 14=Upstream(x1)BCM, 15=EDT-Pulser, 16=Downstream(x1)BCM. 18 = helicity transitions, 19 = QRT, 20 = MPS, 21 = LNE, 22=T3 from L-arm, 23=T4 from L-arm.
    8th  Bank    0xceb90020  Minus Helicity gated normalization data. Channels 1-32 follow the same map as channels 1-32 of the ceb8 scaler.
    9th  Bank    0xceba0010  1st channel = 100 kHz clock. Other channels unused at present.
    10th  Bank    0xcebb0020  This is the 2nd FIFO scaler for helicity plus gated data.
    11th  Bank    0xcebc0020  This is the 2nd FIFO scaler for helicity minus gated data.



Arrangement of  the Left   Spectrometer   Updated Sept 19, 2002
     Bank of 16 or 32 Channels         Header                      Usage                              
    1st  Bank    0xabc00010  1-6=S1-Left, 7,8=blank, 9-14=S2-Left, 15,16=blank.
    2nd  Bank    0xabc10010  1-6=S1-Right, 7,8=blank, 9-14=S2-Right, 15,16=blank.
    3rd  Bank    0xabc20010  Left.AND.Right PMTs. 1-6=S1, 7,8=blank, 9-14=S2, 15,16=blank.
    4th  Bank    0xabc30020  Plus Helicity gated normalization data. Channels 1-32 follow the same map as channels 1-32 of the abc4 scaler.
    5th  Bank    0xabc40020   Normalization Data not gated by helicity.     Channel 1=T1, 2=T2, 3=T3, 4=T4, 5=T5, 6=Hel+ Pulses, 7=Upstream(x3)BCM, 8=1024Hz-clock, 9=Upstream(x10)BCM, 10=Hel- Pulses, 11=Downstream(x3)BCM, 12=Downstream(x10)BCM, 13=Accepted-Triggers(If Trig Super on L-arm), 14=Upstream(x1)BCM, 15=Unser, 16=Downstream(x1)BCM), 17=Q10-gated-by-busy, 18=clock-gated-by-busy, 20=retiming pulse (``or'' of Right PMTs), 24=1024 clock (again), 25 = MLU output 1, 26 = helicity, 27 = QRT, 28 = MPS, 29 = LNE
    6th  Bank    0xabc50020  Minus Helicity gated normalization data. Channels 1-32 follow the same map as channels 1-32 of the abc4 scaler.
    7th  Bank    0xabc60010   1-10  Gas Cerenkov Detector PMTs, 11=GasC-sum, 12=A1-Cerenk-sum, 13=A2-Cerenk-sum, 14-16 blank.
    8th  Bank    0xabc70010   EDT Scaler after May 14, 2001. (under development)
    9th  Bank    0xabc80010   1st channel = 100 kHz clock. Other channels not used yet.
    10th  Bank    0xabc90020    This is the 2nd FIFO scaler for helicity plus gated data.
    11th  Bank    0xabca0020    This is the 2nd FIFO scaler for helicity minus gated data.


The scalers are cleared at the beginning of a run, and read out finally at the end of the run. The timing of the gates, which enables the scalers to count, is such that the end-of-run scaler readout is done after gates are turned off, and then after this final readout the gates are re-enabled, so that scalers can count in between runs. The end-of-run scaler data are written automatically to a file on ~a-onl/scaler/scaler_history.dat. Routines exist for reading this file and pulling out the particular scaler channel.

Scaler data are also inserted into the data stream as an event type 140 typically every 4 seconds, but not synchronized to any other event. The capability to read scalers at 30 Hz with zero deadtime is also supported, and these data appear as ROC10 and ROC11, see section below. New in May 2003, an event type 100 is written at end of run which has same format as ROC10/11 which is the final scaler reading from ROC10/11. Also new are the "TS2 scalers" which are scalers on the new trigger supervisor, see ROC10/11 section below.



A somewhat new feature (Aug 2002) is that we read the trigger supervisor crates every event. These appear as ROC10 and ROC11 in the datastream. ROC10 is on the right spectrometer and ROC11 is on the Left. A detailed description of the contents of these data are in www.jlab.org/~rom/scaler_roc10.html. The ROC10/11 scheme allows us to run with the helicity delayed in G0 helicity mode. See also www.jlab.org/~rom/g0helicity.html. New in May 2003, an event type 100 is written at end of run which has same format as ROC10/11 which is the final scaler reading from ROC10/11.

TS2 SCALERS :     The new trigger supervisor TS2 has scalers on board. This "TS2 scaler" data was available after March 31, 2003. The data starts with header 0xfed00015 in the ROC10 ring buffer readout (see scaler_roc10.html link above). Firstly, the 0x15 in lower bits encodes how many data follows. These data are the 21 scaler data from TS2 registers. Here is the format:

scaler 1 = trigger 1 input, i.e. after prescaling
2 = trigger 2
3 = trigger 3
same 4,5,6... 12
13 = "OR" of triggers
14 = Level 1 accept (can use this as alternative to external scaler L1A)
15 = scheduled sync's
16 = programmed events (normally zero unless I program special events)
17 = latched triggers
18 = program 2 events
After these 18 scalers are 3 more data that come from TS2 registers:
19th = Event count
20th = Live 1 count (see below)
21st = Live 2 count
---------------
Live 1 count = free running 200 kHz clock gated by DAQ live signal (.NOT. busy)
Live 2 count = same clock, no gate.
Live Time = (Live 1 count) / (Live 2 count) <= 1.0
(However, this live1/live2 ratio only works if psfactor=1.  
If psfactor!=1 it is wrong because it incorrectly assumes random trigger.)

The TS2 scalers are latched at start of ring buffer readout 
to avoid time slewing.  The latch is freed after a read, but 
the latching doesn't affect the actual counting.