MPD simulation includes interactions and particles of interest, geometry of the system, materials used, generation of test events of particles, interactions of particles with matter and electromagnetic fields, response to detectors, records of energies and tracks, analysis of the full simulation at different detail and visualization of the detector system and collision events. As the events are processed via the simulation, the information is disintegrated and reduced to that generated by particles when crossing a detector.

Simulation in high energy physics experiments uses transport packages to move the particles through experimental setup from initial state or origin files produced by event generators, such as UrQMD or QGSM described above. Geant (short from “geometry and tracking”) transport package is developed at CERN and most commonly used today. Geant3 was implemented in Fortran programming language whereas Geant4 is developed in C++.

Transport includes detailed description of detector geometries and propagates all particle tracks through detector materials and media. The detector geometries are described by Geant3/Geant4 native geometrical models. During tracking of all particles through detectors, Geant forms the detector responses (hits) which are used in reconstruction task. In order to evaluate the software and detector performance, simulated events are processed through the whole cycle and finally the reconstructed information about particles is compared with the information taken directly from the Monte Carlo generation.

To simulate MPD events of particle collisions with a fixed target, run_sim_Mpd macro is used. Function parameters of the macro:

TString inFile–path of the input file with generator data if required;
TString outFile–path of the result file with MC data, default value: evetest.root;
Int_t nStartEvent–number (start with zero) of the first event to process, default: 0; Int_t nEvents–number of events to transport (0–all events in the input file), default: 3;

Bool_tflag_store_FairRadLenPoint–whether enables radiation length manager to estimate radiation length data, default: kFALSE;

Bool_t isFieldMap – kFALSE corresponds to the constant field, kTRUE corresponds to the field map stored in the file (it is used by default).

The main macro lines are described below. On the first steps (after creating a timer for execution profiling), all libraries required for simulation are loaded:

gROOT->LoadMacro(“$VMCWORKDIR/macro/run/Mpdloadlibs.C”); Mpdloadlibs();

The macro Mpdloadlibs.C loads basic libraries of the ROOT package and specific libraries of the MpdRoot environment. Then the simulation macro creates FairRunSim (run simulation) class and chooses a transport package for it. By default, Geant3 is chosen: fRun->SetName(“TGeant3”);

This function also automatically runs ROOT macros from gconfig directory to set configuration of selected transport package.On the next step, the MPD geometry is loaded by geometry .C macro: ROOT- >LoadMacro(“$VMCWORKDIR/macro/run/geometry.C”); geometry(fRun);

It parses media definition and creates passive volumes, such as cave, magnet, target, and subdetectors: RECOIL, GEM, TOF-400, DCH1, DCH2, TOF-700, andZDC. Then run_sim_Mpd.C macro defines event generator, which will be used to simulate MPD events.

FairPrimaryGenerator* primGen = new FairPrimaryGenerator();fRun->SetGenerator(primGen);

One can choose and tune one of the following event generators:UrQMD, Particle Generator, Ion Generator, Box Generator, HSD/PHSD or LAQGSM/QGSM Generator. To select event generator, Add Generator function of FairPrimaryGenerator class is used.

Files of different event generators are located on the NICA cluster (nc2,nc3,nc8, machines) in the directory /nica/data4mpd. If you do not have access to the cluster, you can use, for example,a simple particle BOX generator to propagate selected particles to the desired directions. BOX generator is used without any input files for the simulation macro. To choose BOX generator for MPD simulation, change the line “#defineURQMD” to “#define BOX”inrun_sim_Mpd.C.

On the next step,the output file name is specified:

The magnetic field set by map (ASCII or ROOT) file or constant field is chosen in the next lines ofthe macro. In the MPD experiment the transition from a constant magnetic field to real field map, interpolation of the field between map nodes and extrapolation of the field map to out-of-magnet region were made.

The following line enables or disables radiation length manager:
fRun->SetRadLenRegister (flag_store_FairRadLenPoint);

The manager determines the particle fluency through a certain boundary (surface) and deducesa map. Knowing the volume and density of the object of interest and the specific energy loss, dose scan be estimated. Therefore, FairRadLenManager class estimates radiation length data and can answer the questions: “What energy dose will be accumulated during a certain time of operation?” and “How to create physical volumes with correct material assignment?”.

The next function initializes MPD simulation, i.e. Virtual Monte Carlo classes and tasks (if they are used in simulation): fRun->Init(). To run event simulation, the following line is executed: fRun->Run(nEvents).The figure 1 presents the main modules of the MpdRoot framework and their relationship during the simulation.

Figure1.The scheme of the MpdRoot modules in the simulation

Input/Output manager (shown on the figure as I/O manager) called the Runtime Parameter Manager is the manager class for all parameter containers and based on ROOT TFolder and TTreeclasses. The Runtime Manager includes container factory, list of parameter containers and list of runs. The parameters are stored in the containers, which are created in the Init() function of the tasks via the container factory or produced from ASCII or ROOT files in the macro.

Subdetector geometries can be defined using different input formats: ASCIIor ROOT files (Root Geometry format presented in the form of TGeoVolumes tree) or defined directly in the source code.The ASCII input format for detector geometry consists of volumes defined by the following sequence:

The simulation result is evetest.root (default name) file with Monte Carlo data such as simulated track points and particle tracks in the MPD detector. It also includes MPD detector geometry stored in the FairBaseParSet container and presented by ROOT geometry manager (TGeoManagerclass)–its global pointer gGeoManager. To get geometry from this file, you can execute in a stand-alone ROOT macro the following lines:



TFile* f = new TFile(“evetest.root”);

f->Get (“FairBaseParSet”); // and then use gGeoManager

ROOT files are created via the object streaming mechanism (information about ROOT Streamers you can find in the ROOT documentation and are presented by a tree of objects saved as byte array.