mesytec_data 1.1.1
Toolkit for parsing Mesytec VME module data
Loading...
Searching...
No Matches
mesytec_data v1.2

mesytec data parsing library & GANIL acquisition interface

Website and class reference documentation: https://mesytec-ganil.pages.in2p3.fr/mesytec_data/

This package provides the shared library

libmesytec_data.so

for analysing Mesytec data.

It can also provide the executable application

mesytec_receiver_mfm_transmitter

which encapsulates data received from the Mesytec acquisition application mvme into GANIL MFM metaframe format data (with frame type 0x4ADF) which are published on a ZeroMQ port: see below for more details.

The shared library

libzmq_narval_receiver.so

defines a Narval actor which can receive data from a ZeroMQ port and inject it into the Narval dataflow (this can be used with any type of data, not only Mesytec. The actor simply copies the incoming buffer to its output buffer).

It can also provide the

libmesytec_data_root_interface.so

library if ROOT is found on the system, which can be used to automatically convert Mesytec data to the TTree format.

Prerequisites

CMake version 3.12 or later. C++ compiler with at least C++11 compatibility.

To build <tt>mesytec_receiver_mfm_transmitter</tt>:

Configure the build with CMake option -DENABLE_RECEIVER_TRANSMITTER=ON

ZeroMQ [optional]

Required to build mesytec_receiver_mfm_transmitter and libzmq_narval_receiver.so.

If installed from Ubuntu/Debian packages, make sure to install the dev package.

If you have more than one version on your system in different places, you can specify the path to use when configuring the build by setting either ZeroMQ_DIR or ZeroMQ_ROOT CMake variable with the path to use (see below).

Build and install

$ cmake -S [source_dir] -B [build_dir]
[-DCMAKE_INSTALL_PREFIX=[install_dir]]
[-DCMAKE_BUILD_TYPE=[Release|RelWithDebInfo|Debug]]
[-DENABLE_RECEIVER_TRANSMITTER=ON]
$ cmake --build [build_dir] --target install --parallel [ncpu]

replacing [source_dir], [install_dir] and [ncpu] with appropriate values

The CMAKE_BUILD_TYPE determines the amount of optimisation of code: for production versions, use Release or RelWithDebInfo for the fastest execution.

To build mesytec_receiver_mfm_transmitter add option -DENABLE_RECEIVER_TRANSMITTER=ON.

If required, add -DZeroMQ_DIR=[path] or -DZeroMQ_ROOT=[path] to use a specific installation of ZeroMQ.

Define VME configuration

Parsing data requires a file containing the definitions of modules in the VME crate, and optionally a file with a correspondence between each bus/channel and detector.

Example crate_map.dat

MDPP_0,0x20,16,SCP
MDDP_1,0x1,32,MDPP_QDC
MMR_1,0x10,8,VMMR
Free_Trigs,0x0a,32,MVLC_SCALAR

Each line has the format: name, crate-address, number_channels, firmware

crate-address is the HW address of the module: remember that Mesytec data only uses the top two nibbles of these addresses, therefore make sure all modules have addresses such as 0xXY, not 0x0XY or 0x00XY.

number_channels is the number of channels (16 or 32) for MDPP modules, number of buses for VMMR (each bus is assumed to have 128 subaddresses).

firmware can be: (note that only MDPP modules can have different firmwares; for other modules the 'firmware' is used to define the type of the module - KLUDGE!)

  • for MDPP: SCP, QDC, CSI, MDPP_QDC, MDPP_SCP, MDPP_CSI
  • for MTDC: MTDC
  • for VMMR: VMMR
  • for MVLC: MVLC_SCALAR

Example detector_correspondence.dat

0x10,2,1,PISTA_DE_2_1
0x10,0,64,PISTA_DE_0_64
0x20,0,PISTA_E_0
0x20,4,PISTA_E_4
0x20,5,PISTA_E_5

Each line has the format: crate-address, channel_number, name (MDPP modules) or crate-address, bus_number, channel_number, name (VMMR modules)

Data analysis

Buffers of data can be parsed with class mesytec::buffer_reader. See example_analysis.cpp.

GANIL Acquisition Interface

Using timestamps from CENTRUM/BEAST/GTS modules

In order to correlate data with other DAQ systems at GANIL, we add timestamps to each Mesytec data frame which can be retrieved from one of 2 modules placed in the same VME crate:

  • TGV module (with either CENTRUM or BEAST timestamp provider);
  • AGAVA module (with GTS timestamp provider)

The appropriate module should be added to the crate_map.dat file:

TGV,0xFF,16,TGV
AGAVA,0x17,32,AGAVA

Only the 'firmware' (TGV or AGAVA) and the crate address are important here. Note that the crate address need not be the physical address of the module, rather it must correspond to the one used in the mvme interface when data from the module is read out.

MFM encapsulation

Run the mesytec_receiver_mfm_transmitter executable with suitable arguments in order to encapsulate data received by ZMQ from the mesytec mvme software into MFMMesytecFrame frames, which are in turn bufferized and transmitted on a ZMQ PUB socket. A timeout mechanism allows to flush any incomplete buffer if the DAQ stops transmitting data. Usage:

$ mesytec_receiver_mfm_transmitter --help
Optional arguments:
-c [ --config_dir ] arg (=.) directory in which to look for config
files
--config_file arg (=transceiver.cfg) file with default argument values (in
config_dir)
-h [ --mvme_host ] arg (=localhost) url of host where mvme-zmq is runnning
-m [ --crate_map ] arg (=crate_map.dat)
name of file containing crate map
-y [ --mvlc_config ] arg (=mvlc_crateconfig.yaml)
yaml file with exported MVLC config
-s [ --data_source ] arg (=0) data source id [0-255] for MFM frame
headers
-p [ --mvme_port ] arg (=5575) port number of mvme-zmq host
-z [ --zmq_port ] arg (=9097) port on which to publish MFM data
-b [ --buffer_size ] arg (=64) buffer size to use (in kilobytes)
-t [ --timeout ] arg (=1000) timeout for buffer flush (in
milliseconds)
--debug [option] enable debug output
--trace [option] enable trace output

The MVLC VME configuration can be exported from the mvme GUI menus:

File > mesytec-mvlc library import/export > Export VME config to mesytec-mvlc CrateConfig

It is possible to use a configuration file (default name: transceiver.cfg) to give values to options:

mvme_host=192.168.1.210
mvlc_config=vme_setup.yaml
timeout=500

If a transceiver.cfg file, MVME export file & crate map are present in the same directory, the transceiver can be launched by just giving the path to the directory:

$ mesytec_receiver_mfm_transmitter -c /path/to/config

Narval receiver

libzmq_narval_receiver.so is a Narval actor which can receive the MFM frames produced by mesytec_receiver_mfm_transmitter in order to inject them into a Narval dataflow. Give the specification of the ZMQ port (tcp://hostname:port) in the algo_path option of the actor.

Use by other projects (CMake)

For other projects to use us we provide two targets in the mesytec_data:: namespace:

  • mesytec_data::mesytec_data: compile and link with libmesytec_data.so;
  • mesytec_data::mesytec_data_root_interface: compile and link with the ROOT/TTree interface

You can build and link your own projects which use either libmesytec_data.so or libmesytec_data_root_interface.so by adding to your CMakeLists.txt the following:

find_package(mesytec_data [optional:minimum version] [REQUIRED|QUIET])
# executable using libmesytec_data.so
add_executable(MyApp my_code.cpp)
target_link_libraries(MyApp PRIVATE mesytec_data::mesytec_data)
# shared lib using libmesytec_data_root_interface.so
add_library(MyLib SHARED my_class1.cpp my_class2.cpp)
target_link_libraries(MyLib PUBLIC mesytec_data::mesytec_data_root_interface)