Software Development for the BM@N Experiment at NICA: Challenges and Status

. A new generation of experiments on relativistic nuclear physics is planned to be started in the nearest years at the Nuclotron-based Ion Collider facility (NICA) under construction at the Joint Institute for Nuclear Research in Dubna. The ﬁxed target ex-periment BM@N (Baryonic Matter at Nuclotron) is considered as a ﬁrst stage towards the implementation of the physics program available at NICA. For a successful accomplishment of the BM@N physics program, a well-developed and tested software package for simulation, digitization, reconstruction and analysis of collision events and other supporting tasks is of utmost importance. The data ﬂow scheme of the experiment is shown. O ﬄ ine and online software systems, such as the main BmnRoot framework, databases of the experiment, data monitoring and others providing information support for the experiment are presented. The implementation of the software systems is a necessary stage for the successful operation of the BM@N experiment.


Introduction
According to the programme of the Joint Institute for Nuclear Research, a flagship project for the next years is the construction of an accelerator-accumulator complex and experimental facilities for the study of hot and dense baryonic matter at the energy range of maximum baryon density and study of nucleon spin structure and polarization phenomena. The implementation of the project called NICA [1] was started in 2008. The accelerator part of the NICA project involves the construction of a unique complex on the base of the modernized accelerator Nuclotron that allows performing a wide experimental programme. The NICA accelerator complex being under construction in Dubna will provide different beam species up to gold ions for a fixed-target and collider experiments.
The beams from the existing Nuclotron are extracted to the experimental hall, where one of the main elements of the NICA first stage, BM@N is located. BM@N [2] is a fixed target experiment with Nuclotron extracted beams for the study of collisions of particles and ions at energies up to 6 GeV per nucleon. The main goals of the BM@N experiment are studies of hypermatter and strangeness production, in-medium effects, hadron femtoscopy and short-range correlations. Since 2015, technical runs of the BM@N experiment have been already conducted with deuteron, carbon, argon and krypton beams collided with various targets at beam kinetic energies from 2.3 to 5.12 GeV per nucleon. The e-mail: gertsen@jinr.ru on behalf of the BM@N collaboration BM@N experiment has recorded hundreds of million events of experimental data to be reconstructed and subsequently analyzed.

Architecture of event data processing in the BM@N experiment
The BM@N data processing flow from the Data Acquisition System [3] is illustrated in the Figure 1. The data stream from the detector readout systems, which include the detector readout electronics (DRE) and local data collectors (LDC), up to the data storage of the BM@N experiment is organized as a sequential data-driven pipeline. The Trigger System performs online event selection relevant to physics topics being studied. Upon reception of a sequence of trigger signals requesting the data collection, selected elements of the detectors generate raw data fragments that are transferred via optical lines and collected into events by the Event Builder. Then the events are sent to the Transient Data Storage -a low-latency and high-throughput soft real-time distributed cluster storage system based on solid-state memory devices, where the events are used in online operator systems, such as checking raw data quality, online histogramming and event monitor. From the temporary storage, the data are migrated to the Permanent Data Storage built with the use of cost-effective components with no specific requirements on latency. Here the raw data are converted to the ROOT [4] format (hierarchical ROOT trees), and event reconstruction and physics analysis are performed at NICA distributed systems.
The software and computing parts of the experiment are responsible for the activities including design, evaluation and calibration of detectors; storing, accessing, reconstruction and analysis of the physics data; and development and maintenance of a distributed computing infrastructure for physicists engaged in these tasks. The software of the BM@N experiment can be classified into online and offline systems, which are briefly described in the next sections.

Online monitoring systems and electronic logbook for the BM@N experiment
The acquisition, storage, processing and analysis of experimental data are an integral part of all modern high-energy physics experiments. These tasks are of particular importance in the experiments of the NICA project due to the high interaction rate and particle multiplicity of heavy ion collision events. The development of software systems to automate the considered processes for acquiring, storing, processing and analyzing the data obtained from the BM@N detectors is a very urgent topic. This section briefly presents the development of online software systems for the BM@N experiment. During experiment runs, it is very important to have an online system for monitoring the quality of obtained data. For visual control of the ongoing BM@N experiment, the Online Histogramming system [5] was developed. The system implements decoding of the incoming raw data, preprocessing and visualization of the calculated histograms on the web-page. The histograms are transferred via the CERN jsROOT (JavaScript ROOT) library to the HTTP server viewed by any web-browser in the control room. The lighttpd web-server is used. Users can monitor any detector subsystem, select specific detector plane or station, time or strip profile histograms in 1/2/3D view.
In addition, the Online Event Display [6] was developed for visual presentation and control of selective events during the experiment run. New raw events from the DAQ system are converted to digits, and then the digits are sent via the specialized Event Monitoring Service to a machine with the Online Event Display for fast clustering and tracking. The Event Monitor gets the current detector geometry from the Unified Database presented in the next section and continuously visualizes the BM@N geometry with obtained hits and tracks on the screen. The operators can work with the Online Event Display interactively by zooming, rotating, shifting it and changing some cuts and filters.
Starting this year, a RFBR grant has been assigned for the development of the following set of information systems designed for online and offline processing of experiment data: online electronic logbook, geometry information system, condition database, configuration database and event indexing system. The first one, online Electronic Logbook was developed as a collaborative tool based on the PostgreSQL database to allow shift crew storing and sharing information on different types of events and problems occurred in BM@N runs, operating modes and states of various subsystems and detectors, which is further used in the data processing and physics analysis of particle collision events. The developed interfaces provide a unified access to required data in the Electronic Logbook for various online and offline systems, and convenient viewing, transparent managing and searching data for users. Offline software systems of the BM@N experiment including those implemented within the framework of the RFBR grant are given in the next section.

Offline software systems of the BM@N experiment
The main software framework of the BM@N experiment is BmnRoot [7] serving for raw data conversion, realistic simulation and processing of interaction events. The development of the framework was started in 2014 based on the ROOT and FairRoot [8] environments to avoid many software issues and not submerge into low-level details. To study physics feasibilities of the experiment, BmnRoot supports a wide list of Monte-Carlo event generators with the proper physics effects. Particle propagation through the detectors in simulation is performed using Geant 3 or Geant 4. The main processing tasks of the digitizer, simulation, reconstruction and physics analysis macros, such as detector response functions, tracking, particle identification and others were implemented as a chain of FairRun Manager Tasks. BmnRoot is available in the GitLab repository providing GIT Continuous Integration tests to verify software correctness.
The BmnRoot framework also includes a tool for event navigation, inspection and visualization. The BM@N event display [9] was developed to provide users with a control and graphical representation of detector geometries, Monte-Carlo tracks and their points, as well as reconstructed tracks, hits and calorimeter towers. It offers full interactivity and delivers an easy way to navigate through the events and to make cuts on energy and particle codes, to choose objects to be presented on the screen, configure object parameters, set desired colors, transparency and many other visualization settings.
Today the use of databases is a prerequisite for qualitative management and unified access to the data of experiments. The BM@N Unified Database [10] was developed on PostgreSQL as comprehensive data storage for offline data processing. It stores information on the BM@N experiment sessions and runs, recorded experimental data, as well as detectors, arbitrary parameters of different types (configuration, calibration, parameter, algorithm) and simulation files obtained by various event generators. The BmnRoot environment uses the developed C++ database interface to get information for detector simulation, raw data processing, event reconstruction and physics analysis tasks. The web-interface of the BM@N database simplifies reading and changing the data of the experiment over the Web. The web-service provides convenient viewing and changing the data in tables, and visualizing detector geometries and summary information on the BM@N experiment.
The information system based on the Geometry Database was implemented to store and process information on the composition and structure of the BM@N detectors used in the sessions of the experiment and provides it for the further reconstruction and physics analysis of simulated and experimental data. In addition, the system is aimed at supplying information on the geometry of the setup for online monitoring and offline visualization of BM@N collision events. The information system includes the database and developed Graphical User and Application Programming Interfaces as a convenient web-service and a set of ROOT macros of the BmnRoot framework, respectively.

Conclusions
The BmnRoot framework of the BM@N experiment provides to users the necessary tools to describe geometries and simulate any kind of detectors for studying their properties, to reconstruct events and make proposed physics analysis both for experimental and simulated data. A lot of offline and online software systems have been developed, such as BM@N databases, event displays, online histogramming, e-Logbook, software test system and many others. RFBR support enables to improve significantly the information systems for online and offline data processing. The future work will focus on directions concerned with distributed and high-performance computing, data visualization, development of databases and user interfaces, web-services and online systems, event simulation and reconstruction. Detailed information on the BM@N experiment, presented systems and their usage can be found on the BM@N web-site: bmn.jinr.ru.