BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
Generates primary particle vertices using BDSBunch. More...
#include <BDSPrimaryGeneratorAction.hh>
Public Member Functions | |
BDSPrimaryGeneratorAction (BDSBunch *bunchIn, const GMAD::Beam &beam, G4bool batchMode) | |
Bunch must have a valid particle definition (ie not nullptr). | |
virtual void | GeneratePrimaries (G4Event *) |
Main interface for Geant4. Prepare primary(ies) for the event. | |
void | SetWorldExtent (const BDSExtent worldExtentIn) |
Set the world extent that particle coordinates will be checked against. | |
void | RegisterPTCOneTurnMap (BDSPTCOneTurnMap *otmIn) |
Private Member Functions | |
void | GeneratePrimariesFromFile (G4Event *anEvent) |
For a file-based event generator there are a few checks we have to do - put in a function to keep tidy. | |
Private Attributes | |
G4ParticleGun * | particleGun |
Geant4 particle gun that creates single particles. | |
BDSBunch * | bunch |
BDSIM particle generator. | |
G4bool | writeASCIISeedState |
Cache of whether to write seed state as ASCII per event. | |
BDSOutputLoader * | recreateFile |
Optional output handler for restoring seed state. | |
G4bool | recreate |
Whether to load seed state at start of event from rootevent file. | |
G4int | eventOffset |
The offset in the file to read events from when setting the seed. | |
G4bool | useASCIISeedState |
Whether to use the ascii seed state each time. | |
G4bool | ionPrimary |
The primary particle will be an ion. | |
G4bool | distrFileMatchLength |
Match external file length for event generator. | |
BDSExtent | worldExtent |
World extent that particle coordinates are checked against to ensure they're inside it. | |
G4bool | ionCached |
BDSPTCOneTurnMap * | oneTurnMap |
Cached OTM for setting first turn primary coords. | |
BDSPrimaryGeneratorFile * | generatorFromFile |
Generates primary particle vertices using BDSBunch.
Definition at line 45 of file BDSPrimaryGeneratorAction.hh.
BDSPrimaryGeneratorAction::BDSPrimaryGeneratorAction | ( | BDSBunch * | bunchIn, |
const GMAD::Beam & | beam, | ||
G4bool | batchMode | ||
) |
Bunch must have a valid particle definition (ie not nullptr).
Definition at line 52 of file BDSPrimaryGeneratorAction.cc.
References BDSBunch::BeamParticleIsAnIon(), bunch, BDSPrimaryGeneratorFile::ConstructGenerator(), eventOffset, BDSGlobalConstants::Instance(), ionPrimary, particleGun, recreate, BDSBunch::RecreateAdvanceToEvent(), recreateFile, useASCIISeedState, and writeASCIISeedState.
|
virtual |
Definition at line 88 of file BDSPrimaryGeneratorAction.cc.
|
virtual |
Main interface for Geant4. Prepare primary(ies) for the event.
Definition at line 95 of file BDSPrimaryGeneratorAction.cc.
References bunch, BDSBunch::CalculateBunchIndex(), BDSParticleDefinition::Charge(), BDSBunch::CurrentBunchIndex(), BDSExtent::Encompasses(), eventOffset, GeneratePrimariesFromFile(), BDSBunch::GetNextParticleValid(), BDSGlobalConstants::Instance(), ionCached, ionPrimary, BDSParticleDefinition::Mass(), oneTurnMap, BDSBunch::ParticleDefinition(), BDSParticleDefinition::ParticleDefinition(), particleGun, recreate, recreateFile, BDSOutputLoader::SeedState(), BDSEventInfo::SetBunchIndex(), BDSPTCOneTurnMap::SetInitialPrimaryCoordinates(), BDSEventInfo::SetSeedStateAtStart(), BDSBunch::UpdateIonDefinition(), useASCIISeedState, BDSBunch::UseCurvilinearTransform(), BDSException::what(), worldExtent, and writeASCIISeedState.
|
private |
For a file-based event generator there are a few checks we have to do - put in a function to keep tidy.
Definition at line 218 of file BDSPrimaryGeneratorAction.cc.
References distrFileMatchLength, BDSPrimaryGeneratorFile::DistributionIsFinished(), BDSPrimaryGeneratorFile::GeneratePrimaryVertexSafe(), BDSGlobalConstants::Instance(), and BDSPrimaryGeneratorFile::NEventsReadThatPassedFilters().
Referenced by GeneratePrimaries().
|
inline |
Register a PTC map instance used in the teleporter which this class will set initial (first turn) primary coordinates for.
Definition at line 61 of file BDSPrimaryGeneratorAction.hh.
References oneTurnMap.
Referenced by BDSFieldFactory::CreateTeleporter().
|
inline |
Set the world extent that particle coordinates will be checked against.
Definition at line 58 of file BDSPrimaryGeneratorAction.hh.
References worldExtent.
|
private |
BDSIM particle generator.
Definition at line 68 of file BDSPrimaryGeneratorAction.hh.
Referenced by BDSPrimaryGeneratorAction(), and GeneratePrimaries().
|
private |
Match external file length for event generator.
Definition at line 75 of file BDSPrimaryGeneratorAction.hh.
Referenced by GeneratePrimariesFromFile().
|
private |
The offset in the file to read events from when setting the seed.
Definition at line 72 of file BDSPrimaryGeneratorAction.hh.
Referenced by BDSPrimaryGeneratorAction(), and GeneratePrimaries().
|
private |
Definition at line 87 of file BDSPrimaryGeneratorAction.hh.
|
private |
Can only get a G4ParticleDefinition for an ion when primary generator is called so cache the first time. This is the flag of that cache.
Definition at line 82 of file BDSPrimaryGeneratorAction.hh.
Referenced by GeneratePrimaries().
|
private |
The primary particle will be an ion.
Definition at line 74 of file BDSPrimaryGeneratorAction.hh.
Referenced by BDSPrimaryGeneratorAction(), and GeneratePrimaries().
|
private |
Cached OTM for setting first turn primary coords.
Definition at line 85 of file BDSPrimaryGeneratorAction.hh.
Referenced by GeneratePrimaries(), and RegisterPTCOneTurnMap().
|
private |
Geant4 particle gun that creates single particles.
Definition at line 67 of file BDSPrimaryGeneratorAction.hh.
Referenced by BDSPrimaryGeneratorAction(), and GeneratePrimaries().
|
private |
Whether to load seed state at start of event from rootevent file.
Definition at line 71 of file BDSPrimaryGeneratorAction.hh.
Referenced by BDSPrimaryGeneratorAction(), and GeneratePrimaries().
|
private |
Optional output handler for restoring seed state.
Definition at line 70 of file BDSPrimaryGeneratorAction.hh.
Referenced by BDSPrimaryGeneratorAction(), and GeneratePrimaries().
|
private |
Whether to use the ascii seed state each time.
Definition at line 73 of file BDSPrimaryGeneratorAction.hh.
Referenced by BDSPrimaryGeneratorAction(), and GeneratePrimaries().
|
private |
World extent that particle coordinates are checked against to ensure they're inside it.
Definition at line 78 of file BDSPrimaryGeneratorAction.hh.
Referenced by GeneratePrimaries(), and SetWorldExtent().
|
private |
Cache of whether to write seed state as ASCII per event.
Definition at line 69 of file BDSPrimaryGeneratorAction.hh.
Referenced by BDSPrimaryGeneratorAction(), and GeneratePrimaries().