Standard simulation

The structure of a default simulation macro r3broot/macros/r3b/r3bsim.C
The same basic macro r3ball.C should be used for all setup-specific copies of r3bsim.C, with change of file names, detector list, geometry versions, etc.

Load the basic simulation macro r3ball.C:

TString macro_r3ball = getenv("VMCWORKDIR");
macro_r3ball += "/macros/r3b/r3ball.C";
gROOT->LoadMacro(macro_r3ball.Data());


Name of the output and parameter files:

TString OutFile = "r3bsim.root";
TString ParFile = "r3bpar.root";


Transport engine ("TGeant3" or "TGeant4"):

TString fMC = "TGeant3";


Event generator type ("ascii", "box" or "r3b"):

TString fGene = "box";


In case of TGeant4 this flag indicates whether user-defined cuts and processes should be used:

Bool_t fUserPList = kTRUE;


Target choice:

TString target1 = "LeadTarget";
TString target2 = "Para";
TString target3 = "Para45";
TString target4 = "LiH";


List of detectors with name and geometry version. Corresponding files have to be located in **r3broot/geometry** folder. Versioning scheme: "v" + XX (year) + XX... (user-defined version)

TMap detGeo;
detGeo.Add(new TObjString("TARGET"), new TObjString("target_"+target4+".geo.root"));
detGeo.Add(new TObjString("ALADIN"), new TObjString("aladin_v13a.geo.root"));
detGeo.Add(new TObjString("CRYSTALBALL"), new TObjString("cal_v13a.geo.root"));
detGeo.Add(new TObjString("TOF"), new TObjString("tof_v13a.geo.root"));
detGeo.Add(new TObjString("MTOF"), new TObjString("mtof_v13a.geo.root"));
detGeo.Add(new TObjString("DCH"), new TObjString("dch_v13a.geo.root"));
detGeo.Add(new TObjString("TRACKER"), new TObjString("tra_v13vac.geo.root"));
detGeo.Add(new TObjString("GFI"), new TObjString("gfi_v13a.geo.root"));
detGeo.Add(new TObjString("LAND"), new TObjString("land_v12a_10m.geo.root"));


Number of events to simulate:

Int_t nEvents = 1;


Flag which indicates wether particle trajectories should be stored. Decreases computation time and results in heavy output:

Bool_t fEventDisplay = kTRUE;


Magnetic field flag. Field map will be selected automatically according to magnet type in detectors list:

Bool_t fR3BMagnet = kTRUE;


Call basic simulation macro. In this case 1500. - current strength of ALADIN magnet

r3ball(nEvents, detGeo, target4,
fEventDisplay, fMC, fGene, fUserPList,
fR3BMagnet, 1500.,
OutFile, ParFile);


To run a simulation:
  1. cd R3BROOT_BUILD_DIR
  2. . ./config.sh
  3. cd R3BROOT_SOURCE_DIR/macros/r3b
  4. root -l r3bsim.C
  5. [..] .q

This will produce output file r3bsim.root with results of simulation in TTree format and parameter file r3bpar.root with parameter containers and detector geometry.

Output file can be directly opened and viewed with ROOT. TTree object with name "cbmsim" contains branches of type TClonesArray with MC tracks and MC points for each detector present in the simulation.