Feature #350

BankData class and support in decoder

Added by Robert Michaels over 2 years ago. Updated 6 months ago.

Status:FeedbackStart date:04/26/2018
Priority:NormalDue date:05/11/2018
Assignee:Robert Michaels% Done:

100%

Category:-Estimated time:40.00 hours
Target version:1.7Spent time:25.20 hours
Responsible:R. Michaels

Description

A "modern" way to put data into the datastream is to put separate pieces into banks, see attached picture (e.g. roc20 has 7, 8, 250, and 1495). It would be convenient to be able to pull data by (crate, bank). To support this, I am providing a new class BankData which produces global variables by reading in a database file that defines the variable name and the crate and bank. The variables can be an array, and one can skip a certain number of words in the bank. Examples of lines in the DB file are below. In order to support this class, some modifications are needed to CodaDecoder and THaEvData to store the pointers to the event buffer, and the length of bank's data, for each bank in each crate.

Examples of DB lines and their interpretation.
  1. variable crate bank Nskip Nelement
    rfadc 20 250
    skip5 20 250 5
    xarray 20 250 8 10
    norf 20 7 2 4

rfadc: one global variable named "rfadc" from crate 20 bank 250. It's the first word of that bank.
skip5: similar to rfadc, but skip the first 5 words.
xarray: an array of length 10 of data in crate 20 bank 250, skip the first 8 words.
norf: array of length 4, skipping 2, from crate 20 bank 7.

banks.png (20.6 KB) Robert Michaels, 04/26/2018 09:34 AM

db_BD.dat Magnifier (404 Bytes) Robert Michaels, 05/08/2018 12:17 PM

History

#1 Updated by Robert Michaels over 2 years ago

To get decoding for the bank data, you need a line like this in your analysis script.

gHaPhysics->Add( new BankData("BD","bank data for a roc" ));

you need a file like $DB_DIR/db_BD.dat as explained in the redmine link. Notice th "BD" in the database file goes with the "BD"
in the first argument of BankData.

The syntax of db_BD.dat is already explained in the body of this page.

#2 Updated by Robert Michaels over 2 years ago

See attached, an example of a db_BD.dat file

#3 Updated by Robert Michaels over 2 years ago

  • % Done changed from 20 to 100

I think this is done. Unless it need tweaking.

#4 Updated by Robert Michaels 6 months ago

  • Status changed from New to Feedback

Documentation.

I emphasize/repeat that this class is just a simple way to pull out a few
variables (maybe even 1) or an array and put it into the output Tree
and to make them global variables. It probably is not so great as an
example for a complex bank.

Let me clarify where the bank data goes in the output Tree.
As I explained you do this in the setup script:
gHaPhysics->Add( new BankData("BD","bank data for a roc" ));
The BD is defined in the $DB_DIR, as usual. It was already explained here.

Now, the output.
In the output.def file you need
block BD.*

And in the output tree "T" you see the following based on this example

root [1] T->Print() **********************************************************************
*Tree :T : Hall A Analyzer Output DST *
*Entries : 4000 : Total = 665307 bytes File Size = 126057 *
  • : : Tree compression factor = 5.29 * **********************************************************************
    Br 0 :BD.norf0 : BD.norf0/D *
    *Entries : 4000 : Total Size= 33142 bytes File Size = 1217 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 26.83 *
    ............................................................................*
    Br 1 :BD.norf1 : BD.norf1/D *
    *Entries : 4000 : Total Size= 33142 bytes File Size = 5718 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 5.71 *
    ............................................................................*
    Br 2 :BD.norf2 : BD.norf2/D *
    *Entries : 4000 : Total Size= 33142 bytes File Size = 5877 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 5.56 *
    ............................................................................*
    Br 3 :BD.norf3 : BD.norf3/D *
    *Entries : 4000 : Total Size= 33142 bytes File Size = 18916 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 1.73 *
    ............................................................................*
    Br 4 :BD.rfadc : BD.rfadc/D *
    *Entries : 4000 : Total Size= 33142 bytes File Size = 5722 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 5.71 *
    ............................................................................*
    Br 5 :BD.skip5 : BD.skip5/D *
    *Entries : 4000 : Total Size= 33142 bytes File Size = 8855 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 3.69 *
    ............................................................................*
    Br 6 :BD.xarray0 : BD.xarray0/D *
    *Entries : 4000 : Total Size= 33168 bytes File Size = 8980 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 3.64 *
    ............................................................................*
    Br 7 :BD.xarray1 : BD.xarray1/D *
    *Entries : 4000 : Total Size= 33168 bytes File Size = 1195 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 27.34 *
    ............................................................................*
    Br 8 :BD.xarray2 : BD.xarray2/D *
    *Entries : 4000 : Total Size= 33168 bytes File Size = 7478 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 4.37 *
    ............................................................................*
    Br 9 :BD.xarray3 : BD.xarray3/D *
    *Entries : 4000 : Total Size= 33168 bytes File Size = 8720 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 3.75 *
    ............................................................................*
    Br 10 :BD.xarray4 : BD.xarray4/D *
    *Entries : 4000 : Total Size= 33168 bytes File Size = 1195 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 27.34 *
    ............................................................................*
    Br 11 :BD.xarray5 : BD.xarray5/D *
    *Entries : 4000 : Total Size= 33168 bytes File Size = 7427 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 4.40 *
    ............................................................................*
    Br 12 :BD.xarray6 : BD.xarray6/D *
    *Entries : 4000 : Total Size= 33168 bytes File Size = 8981 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 3.64 *
    ............................................................................*
    Br 13 :BD.xarray7 : BD.xarray7/D *
    *Entries : 4000 : Total Size= 33168 bytes File Size = 1195 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 27.34 *
    ............................................................................*
    Br 14 :BD.xarray8 : BD.xarray8/D *
    *Entries : 4000 : Total Size= 33168 bytes File Size = 7429 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 4.40 *
    ............................................................................*
    Br 15 :BD.xarray9 : BD.xarray9/D *
    *Entries : 4000 : Total Size= 33168 bytes File Size = 8861 *
    *Baskets : 9 : Basket Size= 4000 bytes Compression= 3.69 *
    ............................................................................*

Also available in: Atom PDF