## LookUp Tables

Chris Marker

2nd year Phd Particle Physics
Royal Holloway, University of London
Egham, Surrey, TW20 0EX
Phone: + 44 (0)1784 443479
Fax:+ 44 (0)1784 472794
E-mail: c.marker@rhbnc.ac.uk
Room: Wilson

American Location
Building : Main lab , Babar Computing / Users area
Mail Stop : 59
Phone: (650) 926 5329
Fax : (650) 926 3767

For instructions on how to run the check see Instructions

In this page there are details of how the project progreesed with links to talks given to the EMC meetings.

INTRODUCTION

The aim of the exercise was to produce a simple program that would run over all of the lookup tables and check if they were incorrect for some reason. This program would need to run quickly over each table so that the entire batch of look up tables could be checked as speedily as possible.

PROBLEMS ALREADY SEEN IN LOOKUP TABLES

These two graphs show problematic lookup tables already identified by Dan Bowerman

Incorrect lookup table.

Incorrect lookup table 2.

See ~bowerman/lutanalysis.html for a full list of bad lookup tables initially discovered.

A good lookup table should look like this

Good lookuptable.

IMPLEMENTATION

To determine if a lookup up table is good or not I choose to look at the gradient of the graph as the problems that had already been seen could all be identified in this way. I wrote a perl program to compute the gradient between each DAC point and if it was considerably different to the normal gradient the program would return the crate slot channel DAC value where the problem occurred. Initially all the problematic channels were written out to one file. However it was decided to split the problems up into different categories to make for easier reading.

1. Problems That Need To Be Looked At Quickly.

Any lookup table that has a plateau in it e.g. 7 5 1

Incorrect lookup table.

Any lookup table with a high negative gradient ( < -20 ) at some point e.g. 3 5 2 Incorrect lookup table 3.

2. Problems That Are Not So Urgent

A

Any lookup up table with a low negative gradient ( -20 < < 0 ) at some point e.g. 8 7 14. This seams to occur mostly at the beginning of the times 4 range ( but sometimes also at the beginning of the times 1 range) Incorrect lookup table 4.

B

Any lookup table with a lower gradient than normal e.g . 8 3 15 Incorrect lookup table 5.

C

Any lookup table with a higher gradient than normal e.g 9 10 36 Incorrect lookup table 6.

RESULTS

The files produced are in ~marker/lookup/ NOT ANY LONGER
afile for problem 1.
bfile for problem 2 A ,
cfile for problem 2 B ,
dfile for problem 2 C.

The crate slot channel DAC value and normal gradient (calculated in script ) are written out for each incorrect lookup table. Note that the DAC values run from 0-2048 i.e opposite to normal numbering scheme.

Running over the times 1 and 4 ranges has only been done at the moment, this process takes ~2.5 hours.

Looking at the list of incorrect crates slots and channels and comparing a list done by Ming I find some of the same ones but by no means all that he does.

See talk given to EMC software meeting Talk 2 May.

UPDATE 7/5/01

The electronics calibration for each class of minor problem has been checked and nothing unusual seen. A reason for the small bump (Incorrect lookup table 4.
)which often occurs in the LUTs at the begiining of the range was given by Martin in the meeting. He suggested it was because at the beginning of the range the fitting of the waveform often switches between a parabolic and linear fit and this could cause the bump.

The program has been modified to :

Run over all the ranges.

Not run over the uninstrumented channels in the endcap.

Check if the starting value of the lookup table is lower than normal ( upon a suggestion from Helmut ).

UPDATE 14/5/01

Currently I find 31 problems to be looked at plus 12 problems Dan has already seen.
Program (almost) ready to be used. To use it

1. Copy ~marker/lookup/lutgood.pl to directory your running in.

2. Copy ~marker/lookup/restestp to directory your running in.

3. Change the code line

system " /u/ec/marker/lookup/restestp \$constdir \$crate \$slot \$channel ";

to reflect which directory you are running in.

4. perl lutgood.pl

5. Wait about 4 hours ( can cut this down to two if you change code slightly to run over only ranges 1 and 4 , working on implementation which will allow choice of range to run over ).

6. 4 files are produced a majourerrorfile with those channels that should be looked at. Also bfile , cfile , and dfile which correspond to the minor problems 2a ,2b and 2c respectively. Note these files can require a lot of space

Talk 15th May .

UPDATE 5/6/01

Implementation added to look at the global gradient for each range and check that it is OK

Increased the flexibility of the program.

Talk 6th June .

UPDATE 8/8/01

Martin produced a new program to give numbers for the LUTs which runs considerably faster than before , hence the time to run my LUT check program has reduced.
The process of identifying incorrect LUTs was tested in action for the first time. Talk 8 Aug.

INSTRUCTIONS FOR PROCEDURE TO CHECK LUTs

In /afs/slac.stanford.edu/g/babar/detector/emc Ivo has created a subdirectory call lutcheck. In this I will put the two things you need to check lookup tables.

1. Martins program to produce the numbers for the lookups table. This is called restestpmart.

2. My perl script to check if a look up table is good or not.

To use the program is simple .

Type lutgood.pl -c# -s# .

The -c argument lets you choose a crate (0-9) to look at. If there is no choice made all channels will be looped over.

The -s argument lets you choose a slot ( 0-10 ) to look at. If there is no choice made all slots will be looped over.

The file containing the incorrect LUTs will be written out to majorerrorfile.

The full run through all crates slots and channels, if you print to a log file (>! lut.log ), takes ~ 1.5 hours. Doing one crate takes ~ 10 minute and one crate and a slot 1 minute. These times mean that after a calibration you can run on just a crate or crate and slot very quickly if you think there is a problem in that area. If you have more time you can run over the whole detector.

To create histograms of the LUTs (to physically see problems) use the restuple program in this directory with the arguments

/nfs/bbr-srv02/dataflow/constants/emc/ crate slot

Convert the output hbook file to root.

In root do TFile d("name of root file")