Replay Simulation

Example of reading data files from previous simulation

This example demonstrates the possibility of reading data files from previous simulation runs and replaying the messages to the framework, dispatching them to modules with altered parameters. In this case, the output of the fast simulation example is reprocessed with a new charge threshold in the digitization step.

Since this example requires input data from another simulation, it has to be executed using the following command:

allpix -c replay_simulation.conf -o ROOTObjectReader.file_name=<input_file>

where <input_file> should be replaced with the absolute path of the data file generated by the fast simulation example. Alternatively, this parameter can be set directly in the configuration file of the example.

The main advantage of replaying a simulation is, that late stages of the simulation chain can be repeatedly executed without having to regenerate the full event. In the present case, only the PixelCharge objects, i.e. the charge collected at each amplifier input of the pixel are read from the input file as indicated by the include keyword. These objects are then dispatched for every event, and the subsequent modules listening to this object type receive them just as if they have been generated from scratch.

The DefaultDigitizer module then performs the digitization of the charges, but this time with a different threshold than in the original “fast simulation” example. Finally, the ROOTObjectWriter stores the newly digitized PixelHit objects to a new data file.

A quick speed comparison of running the initial fast simulation and re-running the digitization step of the simulation using the replay technique reveals event generation frequencies of about 70 Hz versus 970 Hz, respectively, i.e. a speed-up factor larger than 10 on a single core of a standard Intel CPU.