BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
A wrapper of BDSBunch to include a filter for the events loaded by an event generator. More...
#include <BDSBunchEventGenerator.hh>
Public Member Functions | |
virtual void | SetOptions (const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, G4double beamlineS=0) |
Pull out the relevant options and then pass through to BDSBunch::SetOptions(). | |
virtual void | CheckParameters () |
G4bool | AcceptParticle (const BDSParticleCoordsFull &coords, G4double rpOriginal, G4double kineticEnergy, G4int pdgID) |
G4RotationMatrix | ReferenceBeamMomentumOffset () const |
Get a rotation matrix according to Xp0 and Yp0. | |
BDSBunchEventGenerator & | operator= (const BDSBunchEventGenerator &)=delete |
Assignment and copy constructor not implemented nor used. | |
BDSBunchEventGenerator (BDSBunchEventGenerator &)=delete | |
Assignment and copy constructor not implemented nor used. | |
![]() | |
BDSBunchFileBased (const G4String &distributionName) | |
virtual void | BeginOfRunAction (G4int numberOfEvents, G4bool batchMode) |
void | SetNEventsInFile (unsigned long long int nEventsInFileIn) |
void | SetNOriginalEvents (unsigned long long int nOriginalEventsIn) |
void | IncrementNEventsInFileSkipped () |
void | IncrementNEventsInFileSkipped (unsigned long long int plus) |
virtual void | SetOptions (const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0) |
Pull out the relevant options and then pass through to BDSBunch::SetOptions(). | |
BDSBunchFileBased & | operator= (const BDSBunchFileBased &)=delete |
Assignment and copy constructor not implemented nor used. | |
BDSBunchFileBased (BDSBunchFileBased &)=delete | |
Assignment and copy constructor not implemented nor used. | |
unsigned long long int | NOriginalEvents () const |
Accessor. | |
unsigned long long int | NEventsInFile () const |
Accessor. | |
unsigned long long int | NEventsInFileSkipped () const |
Accessor. | |
G4int | DistrFileLoopNTimes () const |
Accessor. | |
![]() | |
BDSBunch (const G4String &nameIn) | |
virtual void | SetOptions (const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0) |
virtual void | CheckParameters () |
virtual void | Initialise () |
Any initialisation - to be used after SetOptions, then CheckParameters. | |
BDSParticleCoordsFullGlobal | GetNextParticle () |
virtual G4bool | ExpectChangingParticleType () const |
A hint of whether we expect to require and extended particle set (ie pions, kaons, muons). | |
virtual BDSParticleCoordsFullGlobal | GetNextParticleValid (G4int maxTries=100) |
virtual void | BeginOfRunAction (G4int numberOfEvents, G4bool batchMode) |
virtual const BDSParticleDefinition * | ParticleDefinition () const |
Access the beam particle definition. | |
virtual void | SetGeneratePrimariesOnly (G4bool generatePrimariesOnlyIn) |
virtual BDSParticleCoordsFull | GetNextParticleLocal () |
G4bool | UseCurvilinearTransform () const |
Access whether there's a finite S offset and therefore we're using a CL transform. | |
virtual void | RecreateAdvanceToEvent (G4int eventOffset) |
G4bool | BeamParticleIsAnIon () const |
Access whether the beam particle is an ion or not. | |
virtual void | UpdateIonDefinition () |
G4bool | ParticleDefinitionHasBeenUpdated () const |
G4String | Name () const |
Distribution name. | |
G4int | CurrentBunchIndex () const |
Get the current bunch index for writing to output. | |
void | CalculateBunchIndex (G4int eventIndex) |
Calculate which bunch index we should be at given an event index. | |
Protected Member Functions | |
void | ParseAcceptedParticleIDs () |
![]() | |
BDSParticleCoordsFullGlobal | ApplyTransform (const BDSParticleCoordsFull &localIn) const |
void | ApplyTilt (BDSParticleCoordsFull &localIn) const |
Apply a rotation about unitZ for the local coordinates according to member variable tilt. | |
void | ApplyBunchTiming (BDSParticleCoordsFullGlobal &localIn) const |
Add on the offset in T for the current bunch number (i*bunchPeriod). | |
BDSParticleCoordsFullGlobal | ApplyCurvilinearTransform (const BDSParticleCoordsFull &localIn) const |
Calculate the global coordinates from curvilinear coordinates of a beam line. | |
Protected Attributes | |
std::set< G4int > | acceptedParticles |
Vector (sorted) of permitted particles. | |
G4int | eventGeneratorNEventsSkip |
Cache of limit. | |
G4double | eventGeneratorMinX |
Cache of limit. | |
G4double | eventGeneratorMaxX |
Cache of limit. | |
G4double | eventGeneratorMinY |
Cache of limit. | |
G4double | eventGeneratorMaxY |
Cache of limit. | |
G4double | eventGeneratorMinZ |
Cache of limit. | |
G4double | eventGeneratorMaxZ |
Cache of limit. | |
G4double | eventGeneratorMinXp |
Cache of limit. | |
G4double | eventGeneratorMaxXp |
Cache of limit. | |
G4double | eventGeneratorMinYp |
Cache of limit. | |
G4double | eventGeneratorMaxYp |
Cache of limit. | |
G4double | eventGeneratorMinZp |
Cache of limit. | |
G4double | eventGeneratorMaxZp |
Cache of limit. | |
G4double | eventGeneratorMinRp |
Cache of limit. | |
G4double | eventGeneratorMaxRp |
Cache of limit. | |
G4double | eventGeneratorMinT |
Cache of limit. | |
G4double | eventGeneratorMaxT |
Cache of limit. | |
G4double | eventGeneratorMinEK |
Cache of limit. | |
G4double | eventGeneratorMaxEK |
Cache of limit. | |
G4double | Rp0 |
Cache of limit. | |
![]() | |
unsigned long long int | nOriginalEvents |
nOriginalEvents from upstream file if skimmed - need to pass through. | |
unsigned long long int | nEventsInFile |
The number of entries in the file loaded. | |
unsigned long long int | nEventsInFileSkipped |
Number that are skipped as we go through the file due to filters. | |
G4bool | distrFileLoop |
G4int | distrFileLoopNTimes |
![]() | |
G4String | name |
Name of distribution. | |
G4bool | useCurvilinear |
Whether to ignore z and use s and transform for curvilinear coordinates. | |
BDSParticleDefinition * | particleDefinition |
Particle definition for bunch - this class owns it. | |
G4bool | particleDefinitionHasBeenUpdated |
G4bool | finiteTilt |
G4bool | generatePrimariesOnly |
G4double | X0 |
Centre of distributions. | |
G4double | Y0 |
Centre of distributions. | |
G4double | Z0 |
Centre of distributions. | |
G4double | S0 |
Centre of distributions. | |
G4double | T0 |
Centre of distributions. | |
G4double | Xp0 |
Centre of distributions. | |
G4double | Yp0 |
Centre of distributions. | |
G4double | Zp0 |
Centre of distributions. | |
G4double | E0 |
Centre of distributions. | |
G4double | P0 |
central momentum | |
G4double | tilt |
Centre of distributions. | |
G4double | sigmaT |
Centre of distributions. | |
G4double | sigmaP |
Centre of distributions. | |
G4double | sigmaE |
Centre of distributions. | |
G4double | sigmaEk |
Centre of distributions. | |
bool | useBunchTiming |
Bunch offset in time parameters. | |
G4int | currentBunchIndex |
Bunch offset in time parameters. | |
G4int | eventsPerBunch |
Bunch offset in time parameters. | |
G4double | bunchPeriod |
Bunch offset in time parameters. | |
G4bool | finiteSigmaE |
Flags to ignore random number generator in case of no finite E or T. | |
G4bool | finiteSigmaT |
Flags to ignore random number generator in case of no finite E or T. | |
Private Attributes | |
G4bool | firstTime |
Flag to prepare acceptedParticles on first call. | |
G4bool | testOnParticleType |
Flag whether to bother applying search. | |
G4String | acceptedParticlesString |
Cache of string for parsing on first query. | |
Friends | |
class | BDSPrimaryGeneratorFileHEPMC |
class | BDSPrimaryGeneratorFileSampler |
Additional Inherited Members | |
![]() | |
static G4double | CalculateZp (G4double xp, G4double yp, G4double Zp0) |
Calculate zp safely based on other components. | |
static void | SetEmittances (const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, G4double &emittGeometricX, G4double &emittGeometricY, G4double &emittNormalisedX, G4double &emittNormalisedY) |
A wrapper of BDSBunch to include a filter for the events loaded by an event generator.
Definition at line 36 of file BDSBunchEventGenerator.hh.
BDSBunchEventGenerator::BDSBunchEventGenerator | ( | ) |
Definition at line 41 of file BDSBunchEventGenerator.cc.
|
virtual |
Definition at line 68 of file BDSBunchEventGenerator.cc.
G4bool BDSBunchEventGenerator::AcceptParticle | ( | const BDSParticleCoordsFull & | coords, |
G4double | rpOriginal, | ||
G4double | kineticEnergy, | ||
G4int | pdgID | ||
) |
Return whether a particle is within the phase space cuts for an event generator file particle.
Definition at line 167 of file BDSBunchEventGenerator.cc.
References acceptedParticles, eventGeneratorMaxEK, eventGeneratorMaxRp, eventGeneratorMaxT, eventGeneratorMaxX, eventGeneratorMaxXp, eventGeneratorMaxY, eventGeneratorMaxYp, eventGeneratorMaxZ, eventGeneratorMaxZp, eventGeneratorMinEK, eventGeneratorMinRp, eventGeneratorMinT, eventGeneratorMinX, eventGeneratorMinXp, eventGeneratorMinY, eventGeneratorMinYp, eventGeneratorMinZ, eventGeneratorMinZp, firstTime, ParseAcceptedParticleIDs(), BDSBunch::T0, testOnParticleType, BDSBunch::X0, BDSBunch::Xp0, BDSBunch::Y0, and BDSBunch::Yp0.
Referenced by BDSPrimaryGeneratorFileHEPMC::HepMC2G4(), and BDSPrimaryGeneratorFileSampler::ReadSingleEvent().
|
virtual |
Check the parameters for the given bunch distribution and exit if they're problematic or unphysical.
Reimplemented from BDSBunch.
Definition at line 102 of file BDSBunchEventGenerator.cc.
References BDSBunch::CheckParameters(), eventGeneratorMaxEK, eventGeneratorMaxT, eventGeneratorMaxX, eventGeneratorMaxXp, eventGeneratorMaxY, eventGeneratorMaxYp, eventGeneratorMaxZ, eventGeneratorMaxZp, eventGeneratorMinEK, eventGeneratorMinT, eventGeneratorMinX, eventGeneratorMinXp, eventGeneratorMinY, eventGeneratorMinYp, eventGeneratorMinZ, eventGeneratorMinZp, and eventGeneratorNEventsSkip.
|
protected |
Split on white space and try and find names and IDs in the G4ParticleTable. Because it uses G4ParticleTable this should only be called once the particle table is initialised.
Definition at line 125 of file BDSBunchEventGenerator.cc.
References acceptedParticles, acceptedParticlesString, BDS::PrintDefinedParticles(), and testOnParticleType.
Referenced by AcceptParticle().
G4RotationMatrix BDSBunchEventGenerator::ReferenceBeamMomentumOffset | ( | ) | const |
Get a rotation matrix according to Xp0 and Yp0.
Definition at line 192 of file BDSBunchEventGenerator.cc.
References BDS::IsFinite(), BDSBunch::Xp0, and BDSBunch::Yp0.
Referenced by BDSPrimaryGeneratorFileHEPMC::BDSPrimaryGeneratorFileHEPMC(), and BDSPrimaryGeneratorFileSampler::BDSPrimaryGeneratorFileSampler().
|
virtual |
Pull out the relevant options and then pass through to BDSBunch::SetOptions().
Reimplemented from BDSBunchFileBased.
Definition at line 71 of file BDSBunchEventGenerator.cc.
References acceptedParticlesString, eventGeneratorMaxEK, GMAD::BeamBase::eventGeneratorMaxEK, eventGeneratorMaxRp, GMAD::BeamBase::eventGeneratorMaxRp, eventGeneratorMaxT, GMAD::BeamBase::eventGeneratorMaxT, eventGeneratorMaxX, GMAD::BeamBase::eventGeneratorMaxX, eventGeneratorMaxXp, GMAD::BeamBase::eventGeneratorMaxXp, eventGeneratorMaxY, GMAD::BeamBase::eventGeneratorMaxY, eventGeneratorMaxYp, GMAD::BeamBase::eventGeneratorMaxYp, eventGeneratorMaxZ, GMAD::BeamBase::eventGeneratorMaxZ, eventGeneratorMaxZp, GMAD::BeamBase::eventGeneratorMaxZp, eventGeneratorMinEK, GMAD::BeamBase::eventGeneratorMinEK, eventGeneratorMinRp, GMAD::BeamBase::eventGeneratorMinRp, eventGeneratorMinT, GMAD::BeamBase::eventGeneratorMinT, eventGeneratorMinX, GMAD::BeamBase::eventGeneratorMinX, eventGeneratorMinXp, GMAD::BeamBase::eventGeneratorMinXp, eventGeneratorMinY, GMAD::BeamBase::eventGeneratorMinY, eventGeneratorMinYp, GMAD::BeamBase::eventGeneratorMinYp, eventGeneratorMinZ, GMAD::BeamBase::eventGeneratorMinZ, eventGeneratorMinZp, GMAD::BeamBase::eventGeneratorMinZp, eventGeneratorNEventsSkip, GMAD::BeamBase::eventGeneratorNEventsSkip, GMAD::BeamBase::eventGeneratorParticles, Rp0, BDSBunchFileBased::SetOptions(), BDSBunch::Xp0, and BDSBunch::Yp0.
|
friend |
Definition at line 47 of file BDSBunchEventGenerator.hh.
|
friend |
Definition at line 48 of file BDSBunchEventGenerator.hh.
|
protected |
Vector (sorted) of permitted particles.
Definition at line 97 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), and ParseAcceptedParticleIDs().
|
private |
Cache of string for parsing on first query.
Definition at line 102 of file BDSBunchEventGenerator.hh.
Referenced by ParseAcceptedParticleIDs(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 92 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 88 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 90 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 76 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 82 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 78 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 84 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 80 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 86 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 91 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 87 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 89 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 75 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 81 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 77 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 83 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 79 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 85 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), CheckParameters(), and SetOptions().
|
protected |
Cache of limit.
Definition at line 74 of file BDSBunchEventGenerator.hh.
Referenced by BDSPrimaryGeneratorFileHEPMC::BDSPrimaryGeneratorFileHEPMC(), BDSPrimaryGeneratorFileSampler::BDSPrimaryGeneratorFileSampler(), CheckParameters(), and SetOptions().
|
private |
Flag to prepare acceptedParticles on first call.
Definition at line 100 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle().
|
protected |
Cache of limit.
Definition at line 93 of file BDSBunchEventGenerator.hh.
Referenced by SetOptions().
|
private |
Flag whether to bother applying search.
Definition at line 101 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), and ParseAcceptedParticleIDs().