MIDAS Event Construction: Difference between revisions

From MidasWiki
Jump to navigation Jump to search
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==MIDAS event construction==
{{Pagelinks}}


The  [[MIDAS Event Structure]] is a variable length event format. It uses [[MIDAS Event Structure #MIDAS Data Bank |banks]] as
== Introduction ==
subsets of an event.
The  [[MIDAS Event Structure]] is a variable length event format. It uses [[MIDAS Event Structure #MIDAS Data Bank |banks]] as subsets of an event.
 
Usually a bank contains an array of values that logically belong together. For example, an experiment can generate an ADC bank, a TDC bank and a
bank with trigger information. The length of a bank can vary from one event to another due to zero suppression from the hardware. Besides the variable data length
support of the bank structure, another main advantage is the possibility for the analyzer to add more (calculated) banks during the analysis process to the event
in process. After the first analysis stage, the event can contain in addition to the the raw ADC bank, a bank with calibrated ADC values called CADC for example.
In this CADC bank the raw ADC values could be offset or gain-corrected.


Usually a bank contains an array of values that logically belong together. For example, an experiment can generate an ADC bank, a TDC bank and a bank with trigger information. The length of a bank can vary from one event to another due to zero suppression from the hardware. Besides the variable data length support of the bank structure, another main advantage is the possibility for the analyzer to add more (calculated) banks during the analysis process to the event in process. After the first analysis stage, the event can contain in addition to the the raw ADC bank, a bank with calibrated ADC values called CADC for example. In this CADC bank the raw ADC values could be offset or gain-corrected.


==Creation of MIDAS banks==
==Creation of MIDAS banks==
 
[[MIDAS Event Structure #MIDAS Data Bank |MIDAS banks]] may be created in the [[Frontend user code|Frontend User Code]] with calls to the MIDAS library.
[[MIDAS Event Structure #MIDAS Data Bank |MIDAS banks]] may be created in the   [[Frontend user code|frontend user code]] [[Frontend user code|Event Readout routine|Event readout routine]] with calls to the MIDAS library.


The following routines are available in the MIDAS package :
The following routines are available in the MIDAS package :


* ''bk_init()''  Initializes a bank structure in an event.
* '''bk_init()'''  Initializes a bank structure in an event with a 16-bit word event size field
* ''bk_init32()''  Initializes a bank structure in an event. '''bk_init32()''' can be used to reduce the size of very large banks, where the data will fit into a 32-bit word
* '''bk_init32()'''  Similar to '''bk_init()''' with a 32-bit word event size field
* ''bk_create()'' Creates a bank with a given name (exactly four characters)
* '''bk_init32a()'''  Similar to '''bk_init32()''' with a 64-bit bank alignment
* ''bk_close()'' Closes a bank previously opened with bk_create().
* '''bk_create()''' Creates a bank with a given name (exactly four characters)
* ''bk_locate()'' Locates a bank within an event by its name.
* '''bk_close()''' Closes a bank previously opened with bk_create()
* ''bk_iterate()'' Returns bank and data pointers to each bank in the event.
* '''bk_copy()''' Copy bank given by name into pointed event
* ''bk_list()'' Constructs a string with all the banks' names in the event.
* '''bk_locate()''' Locates a bank within an event by its name
* ''bk_size()'' Returns the size in bytes of all banks including the bank headers in an event.
* '''bk_iterate()''' Returns bank and data pointers to each bank in the event
* '''bk_list()''' Constructs a string with all the banks' names in the event
* '''bk_size()''' Returns the size in bytes of all banks including the bank headers in an event


The first four routines are for creation of banks (e.g. in a frontend), while the last four are used to process the banks (e.g. in an analyzer).
The first four routines are for creation of banks (e.g. in a frontend), while the last four are used to process the banks (e.g. in an analyzer).


An example of MIDAS bank construction in a frontend can be found in a [[Frontend user code#General readout function|frontend readout routine]]. Many more examples are available in
 
the [[Frontend user code#Introduction|frontend templates provided]].
An example of MIDAS bank construction in a frontend can be found in a [[Frontend user code#General readout function|frontend readout routine]]. Many more examples are available in the [[Frontend user code#Introduction|frontend templates provided]].
 
[[Category:Event]]

Latest revision as of 11:46, 6 April 2020


Introduction

The MIDAS Event Structure is a variable length event format. It uses banks as subsets of an event.

Usually a bank contains an array of values that logically belong together. For example, an experiment can generate an ADC bank, a TDC bank and a bank with trigger information. The length of a bank can vary from one event to another due to zero suppression from the hardware. Besides the variable data length support of the bank structure, another main advantage is the possibility for the analyzer to add more (calculated) banks during the analysis process to the event in process. After the first analysis stage, the event can contain in addition to the the raw ADC bank, a bank with calibrated ADC values called CADC for example. In this CADC bank the raw ADC values could be offset or gain-corrected.

Creation of MIDAS banks

MIDAS banks may be created in the Frontend User Code with calls to the MIDAS library.

The following routines are available in the MIDAS package :

  • bk_init() Initializes a bank structure in an event with a 16-bit word event size field
  • bk_init32() Similar to bk_init() with a 32-bit word event size field
  • bk_init32a() Similar to bk_init32() with a 64-bit bank alignment
  • bk_create() Creates a bank with a given name (exactly four characters)
  • bk_close() Closes a bank previously opened with bk_create()
  • bk_copy() Copy bank given by name into pointed event
  • bk_locate() Locates a bank within an event by its name
  • bk_iterate() Returns bank and data pointers to each bank in the event
  • bk_list() Constructs a string with all the banks' names in the event
  • bk_size() Returns the size in bytes of all banks including the bank headers in an event

The first four routines are for creation of banks (e.g. in a frontend), while the last four are used to process the banks (e.g. in an analyzer).


An example of MIDAS bank construction in a frontend can be found in a frontend readout routine. Many more examples are available in the frontend templates provided.