BNMR: Histograms and Scalers
Links
Introduction
The data from the bnmr or bnqr experiments largely consists of histogrammed scaler data. The scaler data are read from the Multichannel Scaler(s) SIS3801 (bnmr) or SIS3820 (bnqr). The scaler data is histogrammed and saved differently depending on whether the run is Type 1 or Type 2.
Defining the Scalers for the experiment =
The number of MCS scaler channels that are (or may be) connected to input signals are defined for the bnmr and bnqr experiments in the file febnmr.h. These are known as 'Real Scalers. Since bnmr experiment has two Scaler Modules (Scalers A and B) and bnqr has one scaler module (Scaler B), the number of real scaler channels is different for the two experiments. The number of Real Scalers also includes the MCS Channel 1 test clock signal, which is usually enabled on Scaler B, and has no input connected.
In addition to Real scalers, there are also a number of Calculated Scalers defined, for example sums and asymmetry front and back counters, neutral beam counters and polarimeter.
Frontend Scaler structures
DWORD *pfifo_A, *pfifo_B; /* FIFO local buffers */ /* Individual scaler channel */ typedef struct { double sum_cycle; /* cycle scaler sum - stores the sum of nbins of scaler data for the PPG cycle */ DWORD nbins; /* number of scaler bins defined */ DWORD *ps; /* pointer to nbins of scaler data */ } MSCALER;
Fundamental structures for reading the scaler data are defined as above. The FIFO local buffers pfifo_A and pfifo_B point to areas of memory which is malloc-ed when the frontend starts (in function bnmr init() called by frontend_init()). The scaler channel structure is shown above.
For each Real Scaler, memory for the nbins of scaler data with pointer ps is malloc-ed at begin-of-run and freed at end-of-run, since the number of bins requested by the user may change between runs. No memory is malloc-ed for the cumulative scalers, since only the sum is stored.
Scaler readout
The Scaler Modules contain a buffer (FIFO) for the data. This FIFO is larger in the SIS3820 module than the SIS3801, so the SIS3820 can buffer more data. During the PPG cycle, the scaler time bins collect data in turn as the PPG steps through the time bins (via PPG MCS Next output signal connected to Scaler LNE input). This data is stored in the Scaler FIFO. During the PPG cycle, the scaler data is read out periodically, ensuring that the FIFO does not become full.
The FIFO data is read out (by the FIFO_acq equipment readout routine fifo_acq(...) ) FIFO local buffers pfifoA and pfifoB. The selected format of the scaler data is "24-bit", where the channel and user-bits are encoded in the top 8 bits of the 32-bit data word, and the data is in bits 0-23. See Manual for details.
The scaler data are then unpacked and saved in the scaler structure by function scaler_increment(..) called by fifo_acq().
The data in pfifoA and pfifoB is then stored in the scaler structure by
/* Individual scaler channel */ typedef struct { double sum_cycle; /* cycle histogram sum */ DWORD nbins; DWORD *ps; /* cumulative histogram *// } MSCALER;
At the beginning of run, the structure is initialized
The number of MCS scaler channels that are or may be connected to input signals (which also includes the MCS Channel 1 test clock signal)
The number of histograms and scaler channels needed are different for Type 1 and Type 2 runs. The values are assigned in febnmr.h.
/* Histogram struct for Event builder */ typedef struct {
double sum; /* not used yet */ double bin_max; /* not used yet */ DWORD nbins; DWORD *ph; /* cumulative histogram over run */
} MHISTO; MHISTO histo[N_HISTO_MAX]; MSCALER scaler[N_SCALER_MAX]; /* max (real + any calculated) */
Cycle Scalers
In the frontend, data read from the VME scaler(s) (SIS3801 or SIS3820) after each PPG cycle (known as Cycle Scaler Data). The data consists of arrays containing the counts in each time bin for each active input channel. The cycle scaler data are read into histograms.
Also the data from each scaler channel are summed, and assymmetries and ratios are calculated. The Cycle Scaler data sums and calculated data are output as MIDAS bank HSCL, and sent to the ODB under /Equipment/Cycle_Scalers.
For bnmr, the Front and Back Cycle data sums (Scaler A) are added together and used to check against the threshold. For bnqr sums of the Neutral Beam counters are used for thresholds.
Frontend Histograms
The number of frontend histograms into which the scaler data are saved is greater than the number of active scaler channels. For example, some scaler data are saved in separate histograms according to the helicity. In the case of Type 1 runs, the histograms are sent out every cycle, whereas for Type 2 the histograms are accumulated in the frontend memory, and sent out every few minutes. A data logger running on the host computer saves the data onto disk. The data is handled differently for Type 1 and Type 2 runs. For Type 1 runs, the data are saved in a MIDAS file by the MIDAS logger [1], and converted to MUD format by the custom logger mdarc. For Type 2 runs, mdarc saved the data directly in a MUD file, and no MIDAS file is produced.
The histograms and data logging will therefore be described separately for Type 1 and Type 2 runs.
Scaler Channels : Hardware Connections
Currently,
- experiment bnmr has two SIS3801 scalers known as Scaler A and Scaler B
- experiment bnqr has one SIS3820 scaler, Scaler B
- NOTE
- The sis3820 scaler is needed for bnqr alpha mode as it has a larger buffer and greater resolution.
BNMR
Scaler | Module | Channel | Contents |
---|---|---|---|
A | SIS3801 | 1 | Front scalers (16 segments summed in hardware) |
2 | Front scalers (16 segments summed in hardware) | ||
Total number of real scaler inputs : 2 |
Scaler | Module | Channel | Contents |
---|---|---|---|
B | SIS3801 | 1 | Scaler Internal Clock (not connected) |
2 | Fluorescence Monitor (not used) | ||
3,4 | Polarimeter counters (2) | ||
5,6,7,8 | Neutral Beam Forwards counters (4) | ||
9,10,11,12 | Neutral Beam Backwards counters (4) | ||
Total number of real scaler inputs : 12 |
BNQR
Scaler | Module | Channel | Contents |
---|---|---|---|
B | SIS3820 * | 1 | Scaler Internal Clock (not connected) |
17 | Fluorescence Monitor (not used) | ||
18,19 | Polarimeter counters (2) | ||
20 | Neutral Beam Forwards counter (summed in hardware) | ||
21 | Neutral Beam Backwards counter (summed in hardware) | ||
22,23,24,25 | Alpha Counters | ||
Total number of real scaler inputs : 10 |
- NOTE
- * SIS3820 module has ECL inputs 1-16, NIM 17-32. Therefore BNQR's input channel start at 17 (NIM).
Midas histograms built in the frontend
Histograms are built in the frontend (VMIC) using the data from the Scalers - see Cycle Scalers.
The scaler inputs are listed in scaler connections.
Type 1 Histograms
Type 1 histograms only includes data from last cycle.
Scaler A BNMR only
Table 4: Scaler A histograms (bnmr only)
Scaler A |
|
|
|
sum Back scalers |
|
|
|
sum Front scalers |
|
|
|
userbits |
|
|
|
Total number of BNMR Scaler A histograms: 3 |
Scaler B BNMR only
The Type 2 histograms built from data from Scaler B are shown in Table 5.
Table 5 : Scaler B histograms (bnmr)
Scaler B |
|
|
|
sum scaler B (scaler clock) |
|
|
|
sum scaler B (fluorescence mon) |
|
|
|
sum scaler B (pol monitor 1) |
|
|
|
sum scaler B 3 (pol monitor 2) |
|
|
|
sum scaler B (Backwards neutral beam monitors) |
|
|
|
sum scaler B (Forwards neutral beam monitors) |
|
|
|
Total number of BNMR Scaler B histograms: 6 |
Total number of histograms from both scalers: 9 bnmr
Scaler B BNQR only
The Type 2 histograms built for bnqr from data from Scaler B are shown in Table 6. For Alpha Mode (1h) only, four extra histograms are built containing the data from the Alpha counters.
Table 6 : Scaler B histograms (bnqr)
Scaler B |
|
|
|
sum scaler B (scaler clock) |
|
|
|
sum scaler B (fluorescence mon) |
|
|
|
sum scaler B (pol monitor 1) |
|
|
|
sum scaler B 3 (pol monitor 2) |
|
|
|
sum scaler B (Backwards neutral beam monitors) |
|
|
|
sum scaler B (Forwards neutral beam monitors) |
|
|
|
userbits |
|
|
|
Total number of BNQR histograms: 7 | |||
Alpha mode (1h) only | |||
Alpha1 |
|
|
|
Alpha2 |
|
|
|
Alpha3 |
|
|
|
Alpha4 |
|
|
|
userbits |
|
|
|
Total number of BNQR histograms (Alpha mode): 11 |
- NOTE
- ** Userbit bank is always the final bank
Type 2 Histograms
For Type 2 (TD style), Midas histograms are built in the PPC frontend.
Histograms accumulate through the run and are sent periodically to be saved by the data logger mdarc.
Scaler A BNMR only
The histograms built with data from Scaler A are shown in Table 7. Note that the fifth histogram (userbits) is built in the frontend for BNMR Mode 2s only.
Table 7: Scaler A histograms (bnmr only)
Contents |
Helicity |
Bank Name |
Histogram Name |
Back Scalers + | 1 | HIBP | B+ |
Front Scalers + | 1 | HIFP | F+ |
Back Scalers - | 0 | HIBN | B- |
Front Scalers - | 0 | HIFN | F- |
Userbits | n/a | USER |
Scaler B BNMR and BNQR
The following histograms using data from Scaler B are sent out for bnmr and all bnqr modes except for Sample/Reference and Alpha Modes. See Sample/Reference histograms and BNQR Alpha Mode (2h)#Alpha Histograms for details.
10 Histograms from Scaler B:
Total histograms : 10 for BNQR,
14 for BNMR
Table 8: Scaler B histograms (bnmr and bnqr)
Contents |
Helicity |
|
Bank Name |
Histogram Name |
Reference Ticks | n/a | B | HMF1 | Const |
Fluorescence monitor | n/a | B | HMF2 | FluM2 |
Polarimeter Left + | 1 | B | HMLP | L+ |
Polarimeter Right + | 1 | B | HMRP | R+ |
Polarimeter Left - | 0 | b | HMLN | L- |
Polarimater Right - | 0 | B | HMRN | R- |
Neutral Beam Backwards + | 1 | B | HMBP | NBMB+ |
Neutral Beam Forwards + | 1 | B | HMFP | NBMF+ |
Neutral Beam Backwards - | 0 | B | HMBN | NBMB- |
Neutral Beam Forwards - | 0 | B | HMFN | NBMF- |
Scaler B BNQR Sample/Reference Mode
Some of the modes on BNQR can be run in sample/reference mode. An external signal is alternately turned on/off and the scaler data is sent to a different set of histograms depending on the state of the sample/reference signal. This mode is not supported for bnmr.
Table 9a: Scaler B histograms bnqr sample/reference
Contents |
Helicity |
|
Bank Name |
Histogram Name |
Reference Ticks | n/a | n/a | HMF1 | Const |
Fluorescence monitor | n/a | n/a | HMF2 | FluM2 |
Polarimeter Left + | 1 | R | HMLP | L+ |
Polarimeter Right + | 1 | R | HMRP | R+ |
Polarimeter Left - | 0 | R | HMLN | L- |
Polarimater Right - | 0 | R | HMRN | R- |
Neutral Beam Backwards + | 1 | R | HMBP | NBMB+ |
Neutral Beam Forwards + | 1 | R | HMFP | NBMF+ |
Neutral Beam Backwards - | 0 | R | HMBN | NBMB- |
Neutral Beam Forwards - | 0 | R | HMFN | NBMF- |
Polarimeter Left + | 1 | S | HMLP | |
Polarimeter Right + | 1 | S | HMRP | |
Polarimeter Left - | 0 | S | HMLN | |
Polarimater Right - | 0 | S | HMRN | |
Neutral Beam Backwards + | 1 | S | HMBP | |
Neutral Beam Forwards + | 1 | S | HMFP | |
Neutral Beam Backwards - | 0 | S | HSBN | |
Neutral Beam Forwards - | 0 | S | HSFN |
Scaler B BNQR Alpha Mode (2h)
Alpha Mode (mode 2h) involves very long histograms with a very short bin width. To save space, histograms for the Reference Clock and Fluorescence Monitor are not saved. Furthermore, if the total number of bins requested for all histograms exceeds the maximum event size allowed by MIDAS, the histogram bin size for all histograms will be reduced to 16 bits from 32 (the default). The histograms will be sent out from the frontend in 4 chunks, and reassembled by the data logger (mdarc) before being saved. The histograms sent from the frontend in Alpha Mode are shown in Table 10. Alpha mode is not supported for bnmr.
Table 10: Scaler B histograms bnqr Alpha Mode
Contents |
Helicity |
Bank Name |
Histogram Name |
Polarimeter Left + | 1 | HMLP | L+ |
Polarimeter Right + | 1 | HMRP | R+ |
Polarimeter Left - | 0 | HMLN | L- |
Polarimater Right - | 0 | HMRN | R- |
Neutral Beam Backwards + | 1 | HMBP | NBMB+ |
Neutral Beam Forwards + | 1 | HMFP | NBMF+ |
Neutral Beam Backwards - | 0 | HMBN | NBMB- |
Neutral Beam Forwards - | 0 | HMFN | NBMF- |
Alpha1+ | 1 | HA0P | |
Alpha2+ | 1 | HA1P | |
Alpha3+ | 1 | HA2P | |
Alpha4+ | 1 | HA3P | |
Alpha1- | 0 | HA0N | |
Alpha2- | 0 | HA1N | |
Alpha3- | 0 | HA2N | |
Alpha4- | 0 | HA3N |