Generators
This page is a draft, please help complete it!
Introduction
Generators are art modules which produce the first particle in a simulation job. Some may be configured by fcl only, but some can be configured by specifying a SimpleConfig file.
Protons
This generator creates a proton approaching the proton target. You can set the width of the beam, and offset it for systematic studies.
Since each generated event is a proton on target, normalization can be done by simple counting events, equal to the number of protons on target.
Examples of configurations are under the JobConfig
directory of Offline
.
It is difficult to generate a billionth of the full luminosity.
Cosmics
This generator creates a cosmic ray approaching the detector.
If the generator is the "Daya Bay" generator, then only one particle, a muon, is generated per event. The CRY generator allows multiple correlated particles per event, of several species, simulating an atmospheric shower.
Example configurations are under the JobConfig
directory of Offline.
The cosmic ray phase space is specified by a horizontal or vertical plane with limited extent. There also may be angle and momentum restrictions.
The Daya Bay generator will print an integral at the start of the job:
Total cosmic rate = 93510.8 Hz
This tells you how much time you have simulated: Ngen/rate=time
.
It is not too hard to generate a comics sample corresponding to the full run of mu2e.
Stopped Particles
This generator starts with a list of stopped particle positions, usually in a ntuple made in a earlier job. Each event starts with reading in a stopped particle position. The stopped particle is decayed. Usually the decay mode and daughters are specified. The decay model can be specified. A common choice would be to generate DIO decays of stopped muons. Another common request is to produce a given spectrum of soft photons, or other particles, as would be expected from stopped muon capture. For some studies stopped pions may be used on input.
Here is a an example stanza to configure for DIO decays.
physics: { producers: { generate: { module_type: "StoppedParticleReactionGun" muonStops: { averageNumRecordsToUse: 500000 branchName: "stops" inputFiles: ["mergedMuonStops/nts.mu2e.cd3-beam-nts3-tgtstops.v533_v543_v563b.001002_00000000.root"] treeName: "stoppedMuonDumper/stops" } physics: { elow: 1 pdgId: 11 ''Italic text'' spectrumResolution: 1e-1 spectrumShape: "Czarnecki" spectrumVariable: "totalEnergy" } } } }
Normalization would have to be based on the jobs that produced the stopped particle list.
Particle guns
Particle guns can produce any particle with any position and momentum. A typical use would be to study the resolution or efficiency of a specific piece of a detector. The gun is contained in the EventGenerator
art module and are configured with SimpleConfig. Examples are in the Mu2eG4/test
directory of Offline.
GenEventCounter
This is a simple module which counts events and writes the total to the SubRun record, GenEventCount
product.
These records are retained as the events are processed further, and can be read and totaled by the GenEventCountReader
art module..
Multi-threaded Generators
Multithreaded capabilities became available in all art modules with the release of art3. For details about art multithreading, see the 'Multithreaded processing' section in the art wiki.
As of the writing of this (May 7th, 2020), Mu2e has a single multithreaded generator EventGenerator/src/PrimaryProtonGun_module.cc
, a ReplicatedProducer Module. This module runs just as a standard EDProducer does when the number of threads and schedules are set to 1. When run in MT mode, one module instance is created per schedule. Replicated modules are appropriate when
- the module does not need to see every event
- the module does not need to create SubRun or Run data products (current limitation of art which will be fixed in a newer version)
- the external libraries used by the module are thread-safe
- only module data members are not intrinsically thread-safe.
PrimaryProtonGun_module.cc
can be run in conjunction with the multi-threaded G4 module, Mu2eG4/src/Mu2eG4MT_module.cc
for fully MT generator and simulation processes. As an example, see the file Validation/fcl/potSimMT.fcl
which will run these two processes in multi-threaded mode, followed by a filter run in single-threaded mode. For more information on running multi-threaded G4, see 'Simulation Multi-threaded Mode'.