dmp_msu.c : simple test/dump program that
is using the MSU tape reader routines. This program could be the start of
your own sorting program. If the program is called without argumenets,
help will be printed on the calling format:
use: dmp_msu <#blocks> <#events to print> <#files>
I.e., just specify the number of blocks you want to sort, the
number of events you want to print out (format described below)
and the number of files to sort.
Some examples of more specific dumping/sorting routines based on the
basic MSU event getter routines are:
- dmp_msu_bgo.c : expanded version of
the dmp_msu program tailored to the BGO setup at ATLAS. This program
is documented more bgo_sort.c : This is a general purpose
sorting program for the BGO setup at ATLAS. The program is documented
bgo_ev.c : Support routine for the dmp_msu_bgo.c
program.
- str_decomp.c: Support routine for bgo_sort.c.
- msu.c : main sorter program source code
- spe_fun.c : Radford spectra routines
(you may not need those)
- time_stamp.c : time stamp routine
- tape_fun.c : tape operation routines
(you may not need those)
- msu.h : include file
- bgo.h : include file
- Makefile : sample makefile. Will make
two versions of the dmp_msu:
which will read data from nrst8 and nrst9, respectively. Just say
'make dmp_msu' and the routines will be generated. Note: This makefile
contains a lot of entries for utilities that are not served via this
WWW page. Just ignore those extra entries.
The sample dmp_msu.c program really only contains two active
reading elements:
-
The line:
unsigned short int ev[MAXEV], evlen;
defines the event array that the msu.c software returns
the data in - 'evlen' is the length of the event.
-
To get the NEXT event on the tape, simply
make a call as:
st = get_msu_ev(&evlen, ev);
If the "get_msu_ev" routine returns 0, then you have gotten a valid
event! You can then process the event in your sorting program and ask
for another event. However, if the routine returns anything other than
zero the event was not valid. The error code will tell what happened,
e.g., an EOF mark or header was encountered. The return code meanings
are available by the "err_print(st)" routine. For example, the code at
the end of the dmp_msu.c code:
printf("counts and errors encountered:\n");
for (i = 0; i < 20; i++)
if (err[i] > 0)
{
err_print(i);
printf(" %10i\n", err[i]);
}
will list the count statistics (code 1, good events) and errors that was encountered during the sort and accumulated by the lines:
if ((st > -1) && (st < 20))
err[st]++;
An example of the output:
counts and errors encountered:
valid events.............: 4939165
buffer reads.............: 22121
end of files (eof).......: 4
various headers..........: 7
event too long (> MAXEV).: 12
illustrates this point.
The function " print_event(&evlen, ev)" allows you to make a
simple printout of the event that was retrieved using the
"get_msu_ev(&evlen, ev)" call. In the dmp_msu.c code this is
done as:
if (np < max_prints )
if (st == 0)
{
np++;
printf("event print @ call # %i:\n", nn);
print_event(&evlen, ev);
};
(only the first 'max_prints' events are written out
). Notice that
the code checks the return code before it prints! If you don't
get a zero return code, don't try to print the event (or use it).
Here is an example of the printout of an event:
event print @ call # 7:
_ 1:{ 128}{0x0080} bits: |0000|0000|1000|0000|
_ 2:{ 0}{0x0000} bits: |0000|0000|0000|0000|
_ 3:{ 0}{0x0000} bits: |0000|0000|0000|0000|
_ 4:{ 65280}{0xff00} bits: |1111|1111|0000|0000|
_ 5:{ 1}{0x0001} bits: |0000|0000|0000|0001|
_ 6:{ 0}{0x0000} bits: |0000|0000|0000|0000|
_ 7:{ 0}{0x0000} bits: |0000|0000|0000|0000|
_ 8:{ 2048}{0x0800} bits: |0000|1000|0000|0000|
_ 9:{ 33280}{0x8200} bits: |1000|0010|0000|0000|
_ 10:{ 8272}{0x2050} bits: |0010|0000|0101|0000|
_ 11:{ 75}{0x004b} bits: |0000|0000|0100|1011|
_ 12:{ 1531}{0x05fb} bits: |0000|0101|1111|1011|
_ 13:{ 0}{0x0000} bits: |0000|0000|0000|0000|
_ 14:{ 0}{0x0000} bits: |0000|0000|0000|0000|
_ 15:{ 0}{0x0000} bits: |0000|0000|0000|0000|
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
As can be seen, the values are given both on decimal, hex and
binary.
The rules of tape
positioning are descrihed here. The MSU tapes are ansi tapes, thus,
they have several files per run.
future developments:
- An ALPHA OSF version will me made when the SUN version
is stable.
- A fortran version will be available soon (or rather, a
fortran version of dmp_msu. The The fortran program
will call the C routines).
The basic philosophy of this software package is that all a user
should ever have to do is to: "ask for an event!"
-
The user should not have to know anything about the format of the data
tape. The events should come back in the simplest format possible. The
user should not have to worry about mounting the tape nor read the data
blocks nor extract the events from the blocks - the "get_msu_ev(&evlen,
ev)" routine is there for that task! Likewise, all error checking is
done in the "get_msu_ev" so that when an error code of 0 is returned,
the user can safely use the event.
- Rather than having the data available at the bottom of a long sorting
program as a user sub routine, the get_msu_ev routine is CALLED
from the users own main program! This should make it easier to organize
the users sorting program. There is no need for such routines as
user_init or user_exit. The user is in charge and the tape reader
routine is the slave!
-
The user should only have to concentrate on making sense
of the data... (we all know that can be bad enough!)
-
The "dmp_msu.c" sample routine should provide a simple but powerful
starting point for the users own sorting program.
[email protected] (x-4026)