art-framework-suite / art

The implementation of the art physics event processing framework
Other
2 stars 7 forks source link

Allow source modules to use random number engines from the RandomNumberGenerator service. #99

Open knoepfel opened 2 years ago

knoepfel commented 2 years ago

This issue has been migrated from https://cdcvs.fnal.gov/redmine/issues/23582 (FNAL account required) Originally created by @kutschke on 2019-11-12 18:42:11


In the original design discussions for RandomNumberGenerator service we decided to restrict it's use to producer and analyzer modules; in particular source models could not use it.

Mu2e now has a use case to allow it. We run the CORSIKA cosmic ray air shower MC. It produces showers with a footprint many times larger than the Mu2e world. It is moderately expensive to run since it uses FLUKA to interact cosmic rays with the atmosphere and allow the shower to develop. We run CORSIKA in a stand alone job and write a CORSIKA binary format output file. Our source model reads the output file.

  1. On art event 1, read in one CORSIKA event from the input file.
  2. Choose a random part of the CORSIKA event footprint and map that onto the Mu2e world; run G4 and the rest of our workflow.
  3. On the next art event, do not read in a CORSIKA event. Choose another random part of the footprint and map it onto the Mu2e world; run G4 etc
  4. Repeat 3) until we have sampled the CORSIKA event enough; then read in a new CORSIKA event and continue.

We would like to read in one event. Randomly choose a piece of the shower footprint that is the size of the Mu2e world

knoepfel commented 2 years ago

Comment by @knoepfel on 2019-11-13 14:21:25


This feature request will require some discussion among the art developers. There are some issues related to capturing and restoring the state of the RandomNumberGenerator that may be difficult to address if createEngine is callable from sources/detail templates. For now, the best approach is to create your own CLHEP random number engine inside of the source, independent of art's RandomNumberGenerator service.

This feature will not be included in art version:3.04.00.