Simulation macro - R3BRootGroup/R3BRoot GitHub Wiki

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);