Project

General

Profile

Useful Midas commands for debugging

This section is intended to guide the user on how to use the available MIDAS executable/binary to perform simple data checking on a MIDAS file.

mdump

The mdump utility displays the contents of events from the online data stream, offline MIDAS file or from log files.
The command line for offline version is

mdump -x

Once you have executed this command without any input file, you will the help message like the following:

mdump for replay  -x file name    : file to inspect
                  -m mode         : Display mode either Bank or raw
                  -b bank name    : search for bank name (case sensitive)
                  -i evt_id (any) : event id from the FE
                  -[single]       : Request single bank only (to be used with -b)
                  -y              : Serial number consistency check
                  -j              : Display # of banks and bank name list only for all the event
                  -k mask (any)   : trigger_mask from FE setting
>>> -i and -k are valid for YBOS ONLY if EVID bank is present in the event
                  -w what         : [h]eader, [r]ecord, [l]ength
                                    [e]vent, [j]bank_list (same as -j)
>>> Header & Record are not supported for MIDAS as no physical record structure exists
                  -f format (auto): data representation ([x]/[d]/[a]scii) def:bank header content
                  -r #            : skip event(MIDAS) to #

After you go to the folder

gm2analyses/day3/talk2MidasTools

source the file setup.sh to get access to all the MIDAS executables (Only while you are on gm2gpvm).

Now inspect the file using command

mdump -x run04287_00.mid | less

and you will get a bunch of lines like

------------------------ Event# 1 --------------------------------
Evid:0001- Mask:0000- Serial:0- Time:0x58acc26d- Dsize:77000/0x12cc8
#banks:12 - Bank list:-TRIGGPS0CA00CR00CZ00CP26CQ26CT26CA26CB26CZ26CC26-

Bank:TRIG Length: 32(I*1)/8(I*4)/8(Type) Type:Unsigned Integer*4
   1-> 0x000002d2 0x00000000 0x58acc13c 0x684598bc 0x58acc1b8 0x0004a461 0x00000000 0x00000000 

Bank:GPS0 Length: 20(I*1)/5(I*4)/5(Type) Type:Unsigned Integer*4
   1-> 0x00000cc8 0x58acc1f1 0x6848b82b 0x58acc1f1 0x6852696e 

Bank:CA00 Length: 48(I*1)/12(I*4)/12(Type) Type:Unsigned Integer*4
   1-> 0x01000051 0x08009086 0xb0083010 0x903f0000 0x2c00000d 0x27500500 0x2c00000d 0x28500800 
   9-> 0x2c00000d 0x1e400b00 0xe2950577 0x69180000 

Bank:CR00 Length: 1056(I*1)/264(I*4)/528(Type) Type:Signed Integer*2
   1->     5   256     0 11264   256 16128 27288 10064 
   9->     0     0   768   257     0     0     0  4884 
  17->     0     0     0     0     0     0     0     0 
  25-> 12291     0     0     0     0  3840     0     0 
  33->     0     0     0 -15360     0     0     0     0 

Parameters like Evid, Mask and Serial are the unique identifies of an event in the MIDAS structure and is the EventHeader of a MIDAS event. A complete description can be found under
https://midas.triumf.ca/MidasWiki/index.php/Event_Structure
and is reproduced below:

  • EventID - the EventID identifies the event by number. Usually 1 is used for triggered events, 2 for scaler events, 3 for HV events etc.
  • TriggerMask - the trigger mask can be used to describe the sub-type of an event. A trigger event can have different trigger sources like "physics event", "calibration event", "clock event". These trigger sources are usually read in by the front-end in a pattern unit. Consumers can request events with a specific triggering mask.
  • Serial number - The serial number starts at 1 and is incremented by the front-end for each event.
  • Time Stamp - the time stamp is written by the front-end before an event is read out. It uses the time() function which returns the time in seconds since 1.1.1970 00:00:00 UTC.
  • Event Data Size - The event data size contains the size of the event in bytes excluding the header.

The above example is from run 4287, event number 1, event id 1, mask 0 and serial number 0. After the EventHeader, a list of MIDAS banks in that event follows.

#banks:12 - Bank list:-TRIGGPS0CA00CR00CZ00CP26CQ26CT26CA26CB26CZ26CC26-

There is a rule regarding MIDAS bank name where it has to be 4 characters. So starting from left to right we have

  • TRIG
  • GPS0
  • CA00
  • CR00

and so on. Then after the bank link, we have the raw content of all the banks in hex format. For instance the CA00 bank

Bank:CA00 Length: 48(I*1)/12(I*4)/12(Type) Type:Unsigned Integer*4
   1-> 0x01000051 0x08009086 0xb0083010 0x903f0000 0x2c00000d 0x27500500 0x2c00000d 0x28500800 
   9-> 0x2c00000d 0x1e400b00 0xe2950577 0x69180000 

Since each digit is 16 bit, each 0xNNNNNNNN is a 16-byte integer. This is the information we get from the AMC13's CDF header from the uTCA crate with CCC-FC7 installed.

It may take a while to get used to reading numbers in hex but it has been a useful tool for me to debug this kind of information whenever the offline framework could not interpret the content of a bank.