event_decoding

A simple program for decoding COSY-11 raw data

event_decoding flag [options] raw_data_input decoded_data_output [DSC_setup_file]


raw_data_input
A file (give filename), standard input ('stdin'), a client socket ('socket:hostname:port'), or a server socket ('socket'). In case of using a server socket, the port number will be assigned automatically and printed to stderr.
decoded_data_output
A file (give filename), standard input ('stdin'), a server socket ('socket'), or a a client socket ('socket:hostname:port'). In case of using a server socket, the port number will be assigned automatically and printed to stderr.
DSC_setup_file
The official detector setup table, named det_lookup_oda.dat normally. Needed if flag -d or --dscis used.

FLAGS
-i
--isc
output of decoded data in ISC (Instrumentationsystem-Slot-Channel) format, also called HOEF (Hardware Oriented Event Format).
-d
--dsc
output of decoded data in DSC (Detector-Subdetector-Channel) format, also called DOOF (Detector Oriented Output Format).
-I
--info
prints informations on previous and actual versions of this program.
-h
--help
prints syntax infomation.

OPTIONS
-w
--watzi
output of decoded data in DSC including some more useless data as supplied by the official event distributor (to be specified together with -d or --dsc).
-p
--pedestal_subtraction
subtract pedestals from LeCroy 1881 ADC values. If option -P or --pedestal_file is not specified, pedestal values will be read from the user header in the raw data stream, for control and as an example for a user supplied pedestal file, these values will be written into a file named event_decoding.pedestals.
-Pfilename
--pedestal_file=filename
read pedestals from a user supplied file instead from raw data.
-v
--verbose
verbose mode, prints some more or less useless information to stderr.
-D
--dump_all
dumps nearly everything to stdout, useful for debugging purposes only.
-u
--dump_user_records
dumps the contents of the user records (if existing) to stdout.
-cnumber
--choose_event=number
chooses the event with event_id 'number' for decoding. Be shure to set -n or --number_of_events high enough (if used) to reach this event.
-snumber
--skip_events=number
skips events including event_id 'number'.
-nnumber
--number_of_events=number
restricts the number of decoded events to 'number'. User headers are not counted.
-rnumber
--require_events=number
sets the number of decoded events to 'number'.
-N
--no_block_checking
switches checking of buffer numbers in FASTBUS header words off. This is relevant for 1875 and 1881 modules, because these deliver header words. By default, buffer numbers are checked. A warning will occur, if the buffer numbers in the first event differ for the different modules. If they do, it is not an indication for a faulty event, it only indicates that in the past there was an error in buffer counting. Moreover, it is checked if the increment of the buffer of each individual module is 1. If it is not, then an error in buffer counting occured between the last and the current event or in the current event, so this event is skipped. Checking if the data following the header word contain the right buffer number is always done and can not be switched off.
-byymm[.v]
--beamtime=yymm[.v]
selects the beam time in order to deal with different hardware setups, e.g. '9804.1' for April 1998 setup version 1 (= 2nd version, counts from '0').
-Cstring
--dsc_comment=string
sets the comment string (8 bytes) in the event header of the -dw or of the --dsc --watzi format.

DESCRIPTION

A simple decoding program to be used for COSY-11 written raw data. It reads from file, standard input, and socket and supplies the decoded output data to file, standard output, and socket in various formats: The ISC format is mainly to be used with the OHI_LIGHT histogramming package as simple data display, the DSC format is for use as input for offline data analysis. Hardware setup is done with #define statements in event_configuration.c, here, changes in configuration can be performed in a simple way, there is no intention to read shared memory areas generated by the official experiment control program. The assignment between ISC (which is nothing more than decoded hardware data) and DSC format is defined in the official detector lookup table, which is existing anyway. Pedestal subtraction is done for LeCroy 1881 ADCs, pedestal information is either read from the user headers of the raw data stream, or from a user supplied file, which has to be in the format <slot channel pedestal> per line.


OUTPUT DATA FORMATS

raw

 event_length           position: 0001         16  (= 5+2 + 4+2 + 3)
 event_id                            2
 trigger_id                          3
 number_of_IS                        4          2
   IS_id                             5
   IS_length                         6          5
     raw_data                        7
     raw_data                        8
     raw_data                        9
     raw_data                       10
     raw_data                       11
   IS_id                             5
   IS_length                         6          4
     raw_data                        7
     raw_data                        8
     raw_data                        9
     raw_data                       10
		

ISC

 buffer_length          position: 0001  value: sum(event_length) +
 number_of_events                    2          number_of_events*3 + 1
   event_id                          3
   trigger_id                        4
   event_length                      5         35  (= 19+2 + 11+2 + 1)
   number_of_IS                      6          2
     IS_id                           7 
     IS_length                       8         19  (= 10+2 + 4+2 + 1)
     number_of_slots                 9          2
       slot_id                      10
       slot_length                  11         10  (= 5 pairs)
         channel                    12
         value                      13
         channel                    14
         value                      15
         :                           .
         :                           .
       slot_id                      22  (= 11+1+10)
       slot_length                  23          4
         :                           .
         :                           .
     IS_id                          28  (= 23+1+4)
     IS_length                      29         11  (= 8+2 + 1)
     number_of_slots                30          1
       slot_id                      31
       slot_length                  32          8
         :                           .
         :                           .
   event_id                         41  (=32+1+8)
   trigger_id        
   event_length      
   number_of_IS      
     :           
     :           
		

DSC

 buffer_length          position: 0001  value: sum(event_length) +
 number_of_events                    2          number_of_events*3 + 1
   event_id                          3
   trigger_id                        4
   event_length                      5         35  (= 19+2 + 11+2 + 1)
   number_of_detectors               6          2
     detector_id                     7 
     detector_length                 8         19  (= 10+2 + 4+2 + 1)
     number_of_subdetectors          9          2
       subdetector_id               10
       subdetector_length           11         10  (= 5 pairs)
         channel                    12
         value                      13
         channel                    14
         value                      15
         :                           .
         :                           .
       subdetector_id               22  (= 11+1+10)
       subdetector_length           23          4
         :                           .
         :                           .
     detector_id                    28  (= 23+1+4)
     detector_length                29         11  (= 8+2 + 1)
     number_of_subdetectors         30          1
       subdetector_id               31
       subdetector_length           32          8
         :                           .
         :                           .
   event_id                         41  (=32+1+8)
   trigger_id        
   event_length      
   number_of_detectors     
     :           
     :           
		

event distributor DSC

 buffer_length          position: 0001  value: sum(event_length) + 2
 number_of_events                    2
   event_length                      3         40  (= 22+1 + 13+1 + 3)
   event_id                          4
   trigger_id                        5
   number_of_detectors               6          2
     detector_length                 7         22  (= 12+1 + 6+1 + 2)
     detector_id                     8 
     number_of_subdetectors          9          2
       subdetector_length           10         12  (= 10+2)
       subdetector_id/_type         11
       num_channels                 12          5  (= 10/2 !!!!)
         channel                    13
         value                      14
         channel                    15
         value                      16
         :                           .
         :                           .
       subdetector_length           23          6  (= 4+2)
       subdetector_id               24
       num_channels                 25          2  (= 4/2 !!!!)
         :                           .
         :                           .
     detector_length                30         13  (= 10+1 + 2)
     detector_id                    31
     number_of_subdetectors         32          1
       subdetector_length           33         10  (= 8+2)
       subdetector_id               34
       num_channels                 35          4  (= 8/2 !!!!)
         :                           .
         :                           .
   event_length                     44  (=35+1+8)
   event_id
   trigger_id        
   number_of_detectors     
     :           
     :           
		

event distributor DSC with comment string

 buffer_length          position: 0001  value: sum(event_length) + 2
 number_of_events                    2
   event_length                      3         42  (= 22+1 + 13+1 + 5)
   event_id                          4
   trigger_id                        5
   comment string part 1             6             <--
   comment string part 2             7             <--
   number_of_detectors               8          2
     detector_length                 9         22  (= 12+1 + 6+1 + 2)
     detector_id                    10 
     number_of_subdetectors         11          2
     :           
     :           
		

FILES

event_decoding.c
Main program which includes all following files
event_flags.h
Header to set the flags: SAFETY_CHECK, CONSISTENCY_CHECK, PFUSCH, and BUFFER_SIZE
event_includes.h
Header to include C specific headers
event_configuration.c
Hardware configuration and structure for ISC-DSC assignment, routines for detector setup
ISC_structure.c
ISC structure for filling one event in and relevant routines
DSC_structure.c
DSC structure for filling one event in and relevant routines
ISC_DSC_table.c
Routines for reading the detector setup file and for filling the ISC-DSC assigment structure
decoding.c
Routines which decode the raw FASTBUS and CAMAC data into ISC format
header_decoding.c
Routines to extract LeCroy 1881 ADC pedestals out of the user header or a user supplied file
pedestal_packing.c
Routines to write a pedestal file
read_events.c
Routines to read raw data in
socket.c
Routines needed if data a read from or written to socket
command_line_options.c
Routines to check command line options and to set the relevant internal flags
check_expiration_date.c
Routines to check the age of the executable and to prevent execution if it is too old
getevent.h
ev_file.c
Routines supplied by Peter Wuestner for reading raw data records in
shhopt.h
shhopt.c
Routines which make options handling easier

RELATED INFORMATION

Commands: ohi(L), ohi_light(L),


COMMENTS AND COMPLAINTS

send them to t.sefzick@fz-juelich.de or contact me:

  Thomas Sefzick                  TEL: +49 2461 61-4337
  IKP                             FAX: +49 2461 61-3930
  Forschungszentrum Juelich
  D-52428 Juelich
  Germany
			
If this software turnes out to be to be useful and you keep on using it, tell me. I will be glad about it.


written by Thomas Sefzick mail to:  t.sefzick@fz-juelich.de