18. Simulation

The (detector) simulation package simulates how MC events appear in the detector (e.g. which tracks they leave). MC with detector simulation can then be processed in the same way as raw data, allowing for an accurate comparison that takes detector effects into account as well.

The core of the simulation library is Geant4, which is an external library. A simulation library module, FullSim, was created as a wrapper for the basf2 - Geant4 interface. The default input parameters for FullSim are stored in two places,

18.1. Geant4 version in the externals library

The Geant4 version information is stored in the variable G4Version in the Geant4 source code global/management/include/G4Version.hh.

The history of Geant4 version information in the basf2 external library is as follows:

externals version

Geant4 version

v01-09-00 and later


v01-01-01 to v01-08-00


v00-04-00 to v01-00-00


v00-02-02 to v00-03-04


v00-02-00 to v00-02-01


v00-00-05 to v00-01-05


v00-00-01 to v00-00-04


To check the externals version of your current basf2 setup, use:


18.2. Physics list for Geant4

PhysicsList collects information on all the particles, physics processes and production thresholds to be used in the detector simulation. This class is passed to the Geant4 run manager as the “physics configuration” of the application. basf2 has two options for the input physics list for Geant4.

18.2.1. The default physics list

Until November 29, 2013, the default physics list parameter for FullSim was set as QGSP_VERT. After this day, the parameter was changed to FTFP_BERT, the popular physics list for high energy physics.

18.2.2. Belle2PhysicsList

The second one is Belle2PhysicsList, optimized for the Belle II needs by the Geant4 experts. The details on the Belle2PhysicsList are explained below.


The Belle2PhysicsList option became the default option with basf2 release 05-00-00.

18.3. Secondary particles

18.4. FullSim

18.5. Functions in simulation.py

simulation.add_PXDDataReduction(path, components, pxd_unfiltered_digits='pxd_unfiltered_digits', doCleanup=True, overrideDB=False, usePXDDataReduction=True)[source]

This function adds the standard simulation modules to a path.

  • pxd_unfiltered_digits – the name of the StoreArray containing the input PXDDigits

  • overrideDB – override settings from the DB with the value set in ‘usePXDDataReduction’

  • usePXDDataReduction – if ‘overrideDB==True’, override settings from the DB

  • doCleanup – if ‘doCleanup=True’ temporary datastore objects are emptied

simulation.add_roiFinder(path, reco_tracks)[source]

Add the ROI finding to the path creating ROIs out of reco tracks by extrapolating them to the PXD volume. :param path: Where to add the module to. :param reco_tracks: Which tracks to use in the extrapolation step.

simulation.add_simulation(path, components=None, bkgfiles=None, bkgOverlay=True, forceSetPXDDataReduction=False, usePXDDataReduction=True, cleanupPXDDataReduction=True, generate_2nd_cdc_hits=False, simulateT0jitter=True, isCosmics=False, FilterEvents=False, usePXDGatedMode=False, skipExperimentCheckForBG=False)[source]

This function adds the standard simulation modules to a path.

  • forceSetPXDDataReduction – override settings from the DB with the value set in ‘usePXDDataReduction’

  • usePXDDataReduction – if ‘forceSetPXDDataReduction==True’, override settings from the DB

  • cleanupPXDDataReduction – if True the datastore objects used by PXDDataReduction are emptied

  • simulateT0jitter – if True simulate L1 trigger jitter

  • isCosmics – if True the filling pattern is removed from L1 jitter simulation

  • FilterEvents – if True only the events that pass the L1 trigger will survive simulation, the other are discarded. Make sure you do need to filter events before you set the value to True.

  • skipExperimentCheckForBG – If True, skip the check on the experiment number consistency between the basf2 process and the beam background files. Note that this check should be skipped only by experts.


Check if the minimum number of modules required for simulation are in the path and in the correct order