PrimEx Note 049
Event Configuration of PrimEx Data
Liyang Jiang
Aug, 2007
0
Event Configuration of PrimEx data
Liyang Jiang
UNCW/CIAE
While running the prim_ana program, the PrimEx experimental data are stored in several groups.
These groups are called banks. Each bank is consisted of two parts: bank header and bank body.
nrow
Bank Header Structure (bankHeader_t)
Every bank has a same bank header structure.
The general information about the bank, such
as size, name and flags of the bank are stored in
this part. (Fig 1)
maxrows
HEADER
name[16]
BANK
There are five values in the bank header:
number of rows (nrow), maximum number of
rows (maxrows), size of data structure for a
single row (size), name of the bank (name[16]),
bank flags (flags).
size
flags
BODY
Fig 1. Bank structure and bankHeader structure
Table 1: Data in Bank Header
Variables
TYPE
Description
nrow
int
Number of records in this event
maxrows
int
Number of rows for which memory is allocated in the bank
size
int
Size of data structure for a single row
name[16]
char
Name of bank
flags
unsigned int
Bit-wise flags
The banks are divided in two Classes: Event-bank and Nonevent-bank. The event-banks store the data
acquired event by event; and the nonevent-banks store the data which can’t be acquired event by event,
such as BPM, Beam position, Beam current, Temperature, Humidity etc.
Event-banks
The configuration of event-banks is shown in Fig 2. The data of each event are stored in different
banks according the nature of the signals. For example, the data from Tagger T-counter are stored in
TAGT bank, from HYCAL are sent to HYCAL bank, and so on..
1
EVENT
BANK1
VALUE1
BANK2
BANK3
BANK4
BANK5
……
VALUE3
etc.
VALUE4
VALUE6
VALUE2
VALUE7
VALUE9
VALUE5
VALUE8
Fig 2: Event Data Banks
Depending on the types of data stored in the body of banks, the event banks are divided into four
types:
1 Primitive banks;
2 Raw data banks;
3 Pre-analyzed banks;
4 Reconstructed banks;
1. Primitive banks:
The primitive banks store
the electronics identity of
signals collected in one
event.
HARDWARE,
TRIGGER,
TRIGGER_PHASE and
EVENTID banks are
primitive banks.
Primitive Banks
Translate from electronics channel (crate, slot, channel) to
detector id
Raw Data Banks
Convert ADC or TDC digitized values to physical unit values
(ns, GeV)
Pre-analyzed Banks
Combine the data from different detectors and reconstruct
quantities of the event
Reconstructed Banks
Fig 3: Different type of Event-banks
The TRIGGER and TRIGGER_PHASE banks save the latch word which indicates which trigger
created the event. In TRIGGER_PHASE bank also saves the run number and the phase of the event.
The data in EVENTID bank are created by the data acquisition system. It stores the run number, event
number, and the system time when the event was created.
2
Table 2: Variables and corresponding Data in Primitive banks
TRIGGER bank
Latch
Trigger latch word
live1
Live time gated scaler driven by 195kHz clock
live2
Ungated scaler driven by same 195kHz clock
Time
Time of the event according to ROC’s clock
TRIGGER_PHASE bank
trigger
A structure stores all data in TRIGGER bank
runnumber
The run number
Phase
The phase in the run (3 = data collect phase)
EVENTID
Time
Unix time of the event
relative_time
Real time passed since beginning this file (sec)
run_start_time
Start time of the run from online
roc_start_time
last_time
last_live2
event_number
event_class
event_status
run_number
The run number
HARDWARE bank stores all the data from the detectors. The data in HARDWARE bank are stored
as rocid, slot, channel and val. The values rocid, slot and channel are the ids of crate, slot and channel,
from which the signal was collected. One set of these ids corresponds to one detector and the val
stores the output value of this detector.
2. Raw Data Structure and Banks:
Translation is a procedure to map out and rewrite data from HARDWARE bank into several raw data
banks which are corresponding to individual detectors.
The data in Raw Data Banks are translated from the HARDWARE bank. Each Raw Data Bank stores
the data from a certain detector.
The structure of raw data banks is composed of bank header structure and raw data structure. (Fig 3)
3
Raw Data bank
bank
nrow
maxrows
size
name[16]
flags
*hit
1
id
val
2
id
val
…
…
…
nrow
id
val
Fig 3: Raw data bank structure
In different banks, the id and val store the raw data from different detectors. The raw data banks are
listed in Table 3.
Table 3: The List of Raw Data Banks
RAW DATA BANKS’ NAMES
id
val
TAGT
id of T counter
TDC of T counter
TAGTL
id of T counter
TDC of T counter left PMT
TAGTR
id of T counter
TDC of T counter right PMT
TAGE
id of E counter
TDC of E counter
PST
TDC of Pair Spectrometer paddle
PSA
ADC of Pair Spectrometer paddle
TACA
ADC of Total Absorption Counter
HYCAL
Crystal ID code
ADC of crystal
HTRIGT
TDC of HYCAL trigger group
HTRIGA
ADC of HYCAL trigger group
VETOA
ADC of Veto Counter
VETOT
TDC of Veto Counter
TRIGT
TDC of trigger bits
For example, the HYCAL bank stores the raw data from Hycal. The id is the id number of Lead glass
4
or PWO crystals. And the val is the adc out put of this crystals.
3. Pre-analyzed banks:
The raw data banks store the digital output of ADC and TDC. To make the values more convenient to
use, it is necessary to subtract pedestals and convert these raw numbers into physical values, such as
energies, times and etc. The banks store converted values are called pre-analyzed banks. The
pre-analyzed banks and corresponding raw data banks are listed in Table 4.
Table 4: List of Pre-analyzed Banks
Pre-Analyzed Bank
TAGT
TAGEHIT*
TAGE
PSHIT
PST & PSA
HYCALHIT
HYCAL
VETOHIT
VETOA &VETOT
TRIGTHIT
TRIGT
TAGTHIT
*the
Raw Bank
*
id in the banks is T/E channel id, instead of T/E counter id in corresponding Raw Banks.
4. Reconstructed banks: TAGM, TRIGPHOTON, HYCALCLUSTER etc.
Some physical variables are reconstructed with the raw data, such as the time difference, the cluster
energy and position. The banks which store these kinds of data are reconstructed banks. The most
important Reconstructed banks are TAGM, TRIGPHOTON and HYCALCLUSTER.
The data in TAGM bank are reconstructed from TAGTHIT, TAGT_LR_HIT & TAGEHIT banks.
When the time and energy of a hit in TAGTHIT bank matches to those of a hit in TAGEHIT bank,
these hits are considered as a real tag hit. And the e of TAGEHIT and t of TAGTHIT are stored in
TAGM bank as the e and t of the real tag hit.
Table 5: Values stored in TAGM bank
Variable
Comment
Value
Energy
Energy of the photon (GeV)
E in TAGEHIT bank
T
T-counter time (ns)
t in TAGTHIT bank
e_t
E-counter time (ns)
t in TAGEHIT bank
Tid
T channel id
id in TAGTHIT bank
Eid
E channel id
id in TAGEHIT bank
Ehit
Index of hit in TAGEHIT bank
nrow in TAGTHIT bank
Thit
Index of hit in TAGTHIT bank
nrow in TAGEHIT bank
Status
TRIGPHOTON:
5
TRIGPHOTON bank is reconstructed from TAGM bank and TRIGTHIT bank.
Table 6: Values stored in TRIGPHOTON bank
Variable
Comment
Value
Energy
Energy of the photon (GeV)
energy in TAGM with t~100ns
T
T-counter time (ns)
t in TAGM ~ 100ns
Tid
T channel id
tid in TAGM of selected event
Eid
E channel id
eid in TAGM of selected event
Id
Trigger bit
id in TRIGTHIT
Tdiff
T-counter – trigger time diff.
t in TAGM – t in TRIGTHIT
HYCALCLUSTER bank is reconstructed from HYCALHIT bank. It stores the data of the clusters in
Hycal.
Table 7: Some Values stored in HYCALCLUSTER bank
Variable
Comment
Value
E
Cluster’s energy (GeV)
Sum of cluster cells’ energies
Time
Cluster’s time (ns)
X
x position
reconstructed with wi=Ei
Y
y position
reconstructed with wi=Ei
Z
Distance target to hycal
X1
x position
reconstructed with wi=a+lnEi
Y1
y position
reconstructed with wi=a+lnEi
-Calibration constants
The calibration constants used in creating pre-analyzed and reconstructed banks are stored in PrimEx
database. The list of currently available constants can be found at the webpage
http://clasweb.jlab.org/cgi-bin/primex/caldb/cq.pl.
To switch the calibration constants, you may modify the code of the detector. The code getting the
calibration constants for each detector is the “*_brun.cc” file in the “src/libraries/*/”. For example:
“gain5_iter” and “pi0_gain” are two options of PWO crystals gains and Lead Glass gains of 5X5
cluster reconstruction. To switch the “gain5_iter” to “pi0_gain” calibration constants of hycal, modify
the lines in “src/libraries/hycal/hycal_brun.cc” file as below.
you have to change in place
get_from_db("crystal", "gain5_iter", CRYSTAL_BLOCKS, &HYCAL_GAINS[1000], RunNumber);
6
get_from_db("glass", "gain5_iter", GLASS_BLOCKS, &HYCAL_GAINS[0], RunNumber);
to
get_from_db("crystal", "pi0_gain", CRYSTAL_BLOCKS, &HYCAL_GAINS[1000], RunNumber);
get_from_db("glass", "pi0_gain", GLASS_BLOCKS, &HYCAL_GAINS[0],
RunNumber);
-Photon flux
The photon flux is not a data stored in the banks, it is saved in “Fluxnnnn.txt” file which is created
while running prim_ana program with “–Cconfig.xml” argument. The following is an example of
config.xml file, which can be used to generate flux of E channel:
<?xml version="1.0" ?>
<pconfig>
<beam_trip>1</beam_trip>
<flux_output>1</flux_output>
<Eflux_output>1</Eflux_output>
<livetime_sigma>5.0</livetime_sigma>
<DCOMPTON_GAINS>1</DCOMPTON_GAINS>
</pconfig>
To generate flux of T channel, delete the “Eflux_output” line.
Typical size of banks
The size of banks are different between Compton run and pi0 run. The plots of Fig 4 to Fig 7
demonstrate the average size of each bank in levels.
7
Size of HARDWARE Bank
2500
2210.4
Size (4 bytes per unit)
2000
1500
1206.9
1000
500
0
Pi0
Compton
HARDWARE BANK
Fig 4: The average size of HARDWARE Bank of pi0 run and Compton run
Average Size of Raw data Banks
363
400
350
205.4
Pi0 Run 5003
Compton Run 4943
66.6
45.14
76.66
GT
TR
I
OT
VE
T
OA
48
48
31.68
31.68
VE
T
7.014
6.83
RI
GA
HT
RI
GT
AL
A
1.9932
1.9932
HY
C
0.002245903
0.0003728
TA
C
T
64
64
30.62
PS
A
PS
T
E
TA
G
TR
TL
TA
G
TA
G
T
0
TA
C
71.52
55.56
14.574
50
14.59
36.94
56.58
100
104.9
88.06
150
114.6
157.54
200
HT
250
TA
G
Size (4 bytes per unit)
300
Banks
Fig 5: The average size of Raw Data Banks of pi0 run and Compton run
8
Average Size of Pre-analyzed Banks
700
681.5
800
459.8
500
Pi0 Run 5003
Compton Run 4943
400
100.86
62.78
35.01
81.24
16.716
16.734
81.3
66.3
100
104.6
200
118.3
218.91
300
22.605
Size (4 bytes per unit)
600
0
TAGEHIT
TAGTHIT
TAGT_LR_HIT
TAGTLHIT
TAGTRHIT
PSHIT
HYCALHIT
Banks
Fig 6: The average size of Pre-analyzed Banks of pi0 run and Compton run
Average Size of Reconstructed Banks
800
700
685.52
Size (4 bytes per unit)
600
500
Pi0 Run 5003
Compton Run 4943
400
300
200
100
97.68
31.47
25.728
0
TAGM
TRIGPHOTON
2.9919
0.00012429
PSR
48.89737.8
HYCALCLUSTER
63.21
40.5
HYCALASSOC
Banks
Fig 7: The average size of Pre-analyzed Banks of pi0 run and Compton run
9
Primitive
Data
Raw
Data
TAGTR
TAGTL
H
A
R
D
W
A
R
E
TAGT
TAGE
Pre-Analyzed
TAGTRHIT
TAGT_LR
TAGT_LR_HIT
TAGTLHIT
TAGTHIT
TAGEHIT
PST
PSA
PSHIT
TACT
TACA
TACHIT
HYCAL
HYCALHIT
HTRIGT
HTRIGA
VETOA
VETOT
VETOHIT
TRIGT
TRIGTHIT
Fig 8: The relationship of Hardware bank and its daughter banks
10
Reconstructed
TAGM
TRIGPHOTON
PSR
HYCALCLUSTER
HYCALASSOC
© Copyright 2026 Paperzz