Skip to content
Dennis Klein edited this page Feb 9, 2017 · 5 revisions

Getting Started

2. Data Simulation

The particle transport through the detector model is managed by the FairRunSim class. Traditionally, this stage is referred to as “Monte Carlo simulation” or “particle transport”.

The transport engine is operated via the Virtual Monte Carlo (TVirtualMC) of ROOT. Currently Geant3 and Geant4 are supported. They have to be set:

FairRunSim *fRun = new FairRunSim();
fRun->SetName(“TGeant3”); // or “TGeant4”

The detector description is provided to FairRunSim via experiment-specific classes deriving from FairModule (for passive elements like cave, magnets, pipes, etc.) or from FairDetector (for active detectors). Magnetic field used in the simulations may be set through classes deriving from FairField:

fRun->SetMaterials(MediaFile.Data());
FairModule *Cave= new MyCave("CAVE");
Cave->SetGeometryFileName("mycave.geo");
fRun->AddModule(Cave); 
FairModule *Magnet= new MyMagnet("MAGNET");
Magnet->SetGeometryFileName("MyMagnet.root");
fRun->AddModule(Magnet);
FairDetector *Detector = new MyDetector(“DET”);
Detector->SetGeometryFileName(“MyDetector.root”);
fRun->AddModule(Detector);

Magnetic field used in the simulations may be set through classes deriving from FairField:

FairField *fField= new MyField("AUTO");
fRun->SetField(fField);

For each simulation run a set of parameters is stored for later reconstruction:

FairRuntimeDb *rtdb=fRun->GetRuntimeDb();
FairParRootFileIo* output=new FairParRootFileIo(kTRUE);
output->open(ParOutputFile.Data());
rtdb->setOutput(output);

These parameters are typically saved in a separate file at the end of the simulation macro:

rtdb->saveOutput();

The radiation length analysis may be performed after enabling registration of the radiation losses in all of the geometry:

fRun->SetRadLenRegister(kTRUE);

For the visualisation purposes (event display), it is possible to store the information about particle trajectories:

fRun->SetStoreTraj(kTRUE);

The input to the class is provided by the particle generator. There are several particle generators implemented in FairRoot, however it is possible to develop additional generators - they need to derive from FairGenerator and contain the ReadEvent() function that pushes generated tracks onto the stack. One may add several particle generators to FairRunSim. Several generators are part of FairRoot:

  • FairParticleGenerator generates a single particle type with given momentum components, vertex and multiplicity per event.
  • FairBoxGenerator generates particles within given range over pt, phi, eta, y or theta a fixed multiplicity per event.
  • FairIonGenerator for the generation of ions with pre-defined FairIon
  • FairAsciiGenerator reads an Ascii input file. The file must contain for each event a header line of the format NTRACKS IEV VX VY VZ, where NTRACKS is the number of tracks in the event, IEV the event number, and VX, VY, VZ the event vertex coordinates in cm. The header line is followed by NTRACKS lines of the format G3PID, PX, PY, PZ, where G3PID is the GEANT3 particle code, and PX, PY, PZ the cartesian momentum coordinates in GeV.
  • FairUrqmdGenerator reads the output file 14 (ftn14) from UrQMD. The UrQMD calculation has to be performed in the CM system of the collision; Lorentz transformation into the lab is performed by this class.
  • FairPlutoGenerator reads the PLUTO output file (ROOT format) and inserts the tracks into the FairStack via the FairPrimaryGenerator.
  • FairPlutoReactionGenerator inserts an inline PReaction and thus connects Pluto with the FairPrimaryGenerator.
  • FairShieldGenerator is similar to the FairAsciiGenerator. It uses the ASCII output of the SHIELD code as input for simulation. The format of the event header is: event nr., number of particles, beam momentum, impact parameter; followed by a line for each particle of the format: PID; A; Z; px; py; pz. The PID must be given as for GEANT3. For ions, it is 1000. The total momentum is required, not momentum per nucleon.

↪ Next step: [3. Data analysis](Data analysis)