Clone wiki

rome3 / Midas


ROME example for accessing online/offline MIDAS data

In the ROME package, there is an example to use ROME for analyzing/monitoring MIDAS data. You can start your development based on the example. As the first step, please make a local copy of the entire directory.

$ export MIDASSYS=/directory/where/you/have/midas
$ export ROMESYS=/directory/where/you/have/rome
$ export MIDASSYS=/directory/where/you/have/midas
$ cd $ROMESYS/
$ make
$ cp -r examples/midas myproject
$ cd myproject
$ ../bin/romebuilder.exe -i midas.xml -o . -midas
$ ./midanalyzer.exe -i romeConfig.xml -r 1 -pi . -m offline
( then press "update" button)

This example is written to be used with an example in the MIDAS package ($MIDASSYS/examples/experiment). The usage is written in $ROMESYS/examples/midas/README.txt in the ROME package.

The example can be used both for the online and offline mode; the mode can be switched with -m online and -m offline command-line option or a parameter in the configuration XML file (romeConfig.xml).

By default, the example program shows the histogram of ADC values. If you don't need the graphics, you can switch the mode with a command line option -p 0 (analysis mode), -p 2 (monitor mode) or with editing the configuration XML file.

The actual code to read data in the MIDAS banks and for filling histograms are written in the files under src/tasks. For example, in the following code,

      for (Int_t i = 0; i < gAnalyzer->GetMidasDAQ()->GetADC0BankEntries(); i++) {
         gAnalyzer->GetData()->SetADCAt(i, gAnalyzer->GetMidasDAQ()->GetADC0BankAt(i));

You get the array size of ADC0 bank with GetADC0BankEntries() function, and get actual data with GetADC0BankAt(i) function. Those functions are automatically generated according to the definition written in midas.xml in the example. The unpacking of the MIDAS data in automatically programed by ROME, and you don't need to write code to access online MIDAS system or decode MIDAS files. The actual code for drawing histograms are under src/tabs. Users don't need to modify files under include/generated or src/generated.

The midas banks are defined in the definition XML file (midas.xml). For modifying the example for reading data from MIDAS files of your projects, please edit the midas.xml and run the romebuider again. The generated project will be modified (i.e. files under src/generated and include/generated will be overwritten) and new functions to access your data banks will be added. You can use the new functions in tasks and tabs.

A set of HTML to describe all the generated classes created in htmldoc/ClassIndex.html directory with the following command in the example folder.

$ ./midanalyzer.exe -docu

You can add new tasks and tabs as you need for your analysis and monitoring, or enhance the visual with using ROOT GUI classes.

For a description of all available tags of the definition file please see the XML framework definition schema documentation section of the users guide.

For a description of all available tags of the configuration file please see the XML configuration schema documentation section of the users guide.

Standalone example for accessing offline MIDAS data

If you are going to use a standalone program, which is not a ROME project, for analyzing offlien MIDAS data, you can borrow some classes from a ROME project to access your data. You can choose either to use

  1. A generated MIDASDAQ class
  2. ROMEMidasFile class

Using a generated MIDASDAQ class

With the first method, you use a generated class which already contains the bank structure of your experiment. The generation is done by ROMEBuilder as usual way of ROME projects. You can make a dynamic link library in the generated ROME project with a command,

$ make so

The dynamic link library will be made under the obj directory.

Please see examples/midas/standalone as an example.

Using ROMEMidasFile class

With the second method, you can have a lower level handle for MIDAS files. By using the class, you can read the raw bank structure stored in the midas files. You need to prgram the decoding of the banks.

Please see examples/midas/standalone2 as an example.

(Matthias Schneebeli), Ryu Sawada