The Unified Database for BM@N experiment data handling

. The article describes the developed Unified Database designed as a comprehensive relational data storage for the BM@N experiment at the Joint Institute for Nuclear Research in Dubna. The BM@N experiment, which is one of the main elements of the first stage of the NICA project, is a fixed target experiment at extracted Nuclotron beams of the Laboratory of High Energy Physics (LHEP JINR). The structure and purposes of the BM@N setup are briefly presented. The article considers the scheme of the Unified Database, its attributes and implemented features in detail. The use of the developed BM@N database provides correct multi-user access to actual information of the experiment for data processing. It stores information on the experiment runs, detectors and their geometries, different configuration, calibration and algorithm parameters used in offline data processing. An important part of any database – user interfaces are presented.

A new generation of heavy-ion physics experiments is expected to emerge at NICA.The BM@N experiment is a fixed target experiment at extracted Nuclotron beams to study collisions of particles and ions with fixed targets at the energies up to 6 GeV per nucleon.It is proposed to study elementary reactions and cold nuclear matter, properties of dense baryonic matter in heavy ion collisions.This information could be obtained from the measurement of particle yields and ratios, transverse momentum spectra, rapidity and angular distributions, as well as fluctuations of event properties and correlations between particles.Production of (multi)-strange hyperons and search for hyper-nuclei will be studied also.
The detector should measure particles produced in collisions with high efficiency and estimate the parameters with high precision for the full study of hot matter that is why the BM@N is constructed as a set of different types of subdetectors.It combines high precision track measurements with time-of-flight information for particle identification and uses total energy measurements for the analysis of the collision centrality.The target is located inside the large-acceptance dipole magnet with the magnetic field up to 1.2 T. The BM@N setup divides detectors into inner tracker, such as Silicon detectors and GEMs, and outer tracker, such as Drift Chambers and Time-of-Flight detectors, to measure particles with both low and high momentum.The conceptual structure of the detector is shown in figure 1.

Purposes of the BM@N database development
Since 2015, four technical runs of the BM@N experiment have been performed with deuteron and carbon beams collided with various targets, such as carbon, copper and lead, at the energies 3.5 -5 GeV per nucleon.About 1000 raw data files have been obtained and converted to the ROOT format [2].Multiple parameter data of the BM@N experiment used in offline data processing have been stored in files of different formats, such as binary data, text, CSV and XML.
The first runs of the BM@N experiment showed the following main problems concerned with the BM@N file storing approach previously used: • The usage of multiple files and different formats, duplication of information in different files lead to data isolation, redundancy and inconsistency.
• Sequential, non-indexed file access and search are not efficient.
• No mechanism exists for relating data between these files.• It is difficult to access and manipulate the data.• Uncontrolled concurrent access by multiple users also often leads to inconsistencies.
Today the use of databases is a prerequisite for qualitative management and unified access to data of modern high-energy physics experiments.The Unified Database designed as a central data storage of the BM@N experiment for offline data analysis offers solutions to the above problems and provides unified access and data management for collaboration members, correct multi-user data processing, ensuring the actuality of the information being accessed, data consistency and integrity, excluding the multiple duplication and use of outdated data.Furthermore, automatic daily backup of the stored data is provided to ensure that data of the experiment will not be lost due to software or hardware failures.

The Unified Database of the BM@N experiment for offline data processing
The entity-relationship diagram of the Unified Database implemented on PostgreSQL Database Management System is shown in figure 2. The following parts of the database can be highlighted: storing simulation data, detector geometries, information on experiment runs and experimental data files, detectors and parameters with their values.Hardware parameters of the BM@N Slow Control System "Tango" do not correspond to any table of the Unified Database, but a special C++ interface was implemented.During the design, the structure of the Unified Database was simplified as much as possible.
The parameters being stored in the Unified Database can be classified into 4 groups.Configuration data is concerned with the detector running mode, as well as some programmable parameters for front-end electronics.Calibration data describes the calibration and alignment of the subdetectors.Usually these quantities are evaluated by running offline algorithms.Parameter data presents the state of the detector subsystems.Algorithm data is used to control the way the offline algorithms operate.It includes, for example, cuts for selection and noise channels excluded from the data processing.
To support the BM@N experiment, the BmnRoot [3] software is developed for event simulation, reconstruction of experimental or simulated data and following physical analysis of particle collisions with a fixed target.The developed database integrates with the BmnRoot framework to use the database in offline raw data processing, reconstruction and physical analysis tasks.Also, it can be noted that BmnRoot converts BM@N .geoand .rootsubdetector geometry files to a single ROOT geometry file used to visualize BM@N events on the screen and stored in the developed database.
To process the experiment data via the BmnRoot environment, a C++ database interface was implemented as a set of C++ class wrappers for all database tables (figure 2) with many specific functions.It allows for the access to the data of the Unified Database without any SQL statements.The developed classes correspond to the database tables and manage information on the experiment runs, detector geometries, detectors, their parameters and parameters' values, and generated simulation files.Among functions for creating and changing the objects and their attributes, Search function should be noted which was developed to select runs and detector parameters for analysis.
Some additional classes of the C++ database interface were developed.UniDbConnection serves to open and close database connections, UniDbGenerateClassesto generate automatically skeletons of the class wrappers for all tables of the database, UniDbParser -to parse existing data of the experiment from HTML, Excel and text files and to write them to the Unified Database.Also, the interface includes ROOT macros to execute tasks presented by the above classes, numerous examples to work with the BM@N database and documentation.UniDbTangoData interface is used to get hardware data from the Tango control system.Figure 3 presents an example of using the interface to get BM@N magnet field values for selected runs.The overview scheme of the Unified Database used in offline processing is shown in figure 4. The BmnRoot environment uses the C++ database interface to get data for detector simulation, raw data processing, event reconstruction and physics analysis tasks.Also, the BmnRoot has an access to the Tango hardware data by the developed interface.The Web interface of the BM@N database is under development now to simplify reading and changing the experiment data for users over the Web.

Conclusions
The BM@N database has been developed based on PostgreSQL and deployed in the cloud of the Laboratory of Information Technologies, JINR.The Unified Database includes existing data of conducted BM@N runs from multiple files (binary, text, CSV, HTML and XML).The developed database is a comprehensive data storage of the BM@N experiment, which provides unified user access to actual information of the experiment: experiment runs, detectors and their geometries, configuration, calibration and algorithm parameters.The C++ database interface has been implemented as a part of the BmnRoot environment to use it for offline raw data processing, reconstruction and physical analysis tasks.The C++ Tango interface has been developed to get hardware data from the BM@N Slow Control System.The Web interface is under development now to simplify reading and changing the experiment data for users.The detailed information on the Unified Database and user interfaces is presented in the «Databases» section on our technical Web-site mpd.jinr.ru.A future version of the Unified Database can be used for the MPD/NICA experiment.

Fig. 4 .
Fig. 4. The overview scheme of the BM@N database usage.