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) |
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. More... | |
BDSBunchEventGenerator & | operator= (const BDSBunchEventGenerator &)=delete |
Assignment and copy constructor not implemented nor used. | |
BDSBunchEventGenerator (BDSBunchEventGenerator &)=delete | |
Assignment and copy constructor not implemented nor used. | |
![]() | |
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. More... | |
BDSParticleCoordsFullGlobal | GetNextParticle () |
virtual G4bool | ExpectChangingParticleType () const |
A hint of whether we expect to require and extended particle set (ie pions, kaons, muons). More... | |
virtual BDSParticleCoordsFullGlobal | GetNextParticleValid (G4int maxTries=100) |
virtual void | BeginOfRunAction (G4int numberOfEvents) |
virtual const BDSParticleDefinition * | ParticleDefinition () const |
Access the beam particle definition. More... | |
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. More... | |
virtual void | RecreateAdvanceToEvent (G4int) |
G4bool | BeamParticleIsAnIon () const |
Access whether the beam particle is an ion or not. More... | |
virtual void | UpdateIonDefinition () |
G4bool | ParticleDefinitionHasBeenUpdated () const |
G4String | Name () const |
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. More... | |
BDSParticleCoordsFullGlobal | ApplyCurvilinearTransform (const BDSParticleCoordsFull &localIn) const |
Calculate the global coordinates from curvilinear coordinates of a beam line. More... | |
Protected Attributes | |
std::vector< G4int > | acceptedParticles |
Vector (sorted) of permitted particles. More... | |
G4double | eventGeneratorMinX |
Cache of limit. More... | |
G4double | eventGeneratorMaxX |
Cache of limit. More... | |
G4double | eventGeneratorMinY |
Cache of limit. More... | |
G4double | eventGeneratorMaxY |
Cache of limit. More... | |
G4double | eventGeneratorMinZ |
Cache of limit. More... | |
G4double | eventGeneratorMaxZ |
Cache of limit. More... | |
G4double | eventGeneratorMinXp |
Cache of limit. More... | |
G4double | eventGeneratorMaxXp |
Cache of limit. More... | |
G4double | eventGeneratorMinYp |
Cache of limit. More... | |
G4double | eventGeneratorMaxYp |
Cache of limit. More... | |
G4double | eventGeneratorMinZp |
Cache of limit. More... | |
G4double | eventGeneratorMaxZp |
Cache of limit. More... | |
G4double | eventGeneratorMinRp |
Cache of limit. More... | |
G4double | eventGeneratorMaxRp |
Cache of limit. More... | |
G4double | eventGeneratorMinT |
Cache of limit. More... | |
G4double | eventGeneratorMaxT |
Cache of limit. More... | |
G4double | eventGeneratorMinEK |
Cache of limit. More... | |
G4double | eventGeneratorMaxEK |
Cache of limit. More... | |
G4double | Rp0 |
Cache of limit. More... | |
![]() | |
G4String | name |
Name of distribution. More... | |
G4bool | useCurvilinear |
Whether to ignore z and use s and transform for curvilinear coordinates. More... | |
BDSParticleDefinition * | particleDefinition |
Particle definition for bunch - this class owns it. More... | |
G4bool | particleDefinitionHasBeenUpdated |
G4bool | finiteTilt |
G4bool | generatePrimariesOnly |
G4double | X0 |
Centre of distributions. More... | |
G4double | Y0 |
Centre of distributions. More... | |
G4double | Z0 |
Centre of distributions. More... | |
G4double | S0 |
Centre of distributions. More... | |
G4double | T0 |
Centre of distributions. More... | |
G4double | Xp0 |
Centre of distributions. More... | |
G4double | Yp0 |
Centre of distributions. More... | |
G4double | Zp0 |
Centre of distributions. More... | |
G4double | E0 |
Centre of distributions. More... | |
G4double | P0 |
central momentum More... | |
G4double | tilt |
Centre of distributions. More... | |
G4double | sigmaT |
Centre of distributions. More... | |
G4double | sigmaP |
Centre of distributions. More... | |
G4double | sigmaE |
Centre of distributions. More... | |
G4double | sigmaEk |
Centre of distributions. More... | |
G4bool | finiteSigmaE |
Flags to ignore random number generator in case of no finite E or T. More... | |
G4bool | finiteSigmaT |
Flags to ignore random number generator in case of no finite E or T. More... | |
Private Attributes | |
G4bool | firstTime |
Flag to prepare acceptedParticles on first call. More... | |
G4bool | testOnParticleType |
Flag whether to bother applying search. More... | |
G4String | acceptedParticlesString |
Cache of string for parsing on first query. More... | |
Additional Inherited Members | |
![]() | |
static G4double | CalculateZp (G4double xp, G4double yp, G4double Zp0) |
Calculate zp safely based on other components. More... | |
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 42 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 168 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 BDSHepMC3Reader::HepMC2G4(), and BDSROOTSamplerReader::ReadSingleEvent().
|
virtual |
Check the parameters for the given bunch distribution and exit if they're problematic or unphysical.
Reimplemented from BDSBunch.
Definition at line 104 of file BDSBunchEventGenerator.cc.
References BDSBunch::CheckParameters(), eventGeneratorMaxEK, eventGeneratorMaxT, eventGeneratorMaxX, eventGeneratorMaxXp, eventGeneratorMaxY, eventGeneratorMaxYp, eventGeneratorMaxZ, eventGeneratorMaxZp, eventGeneratorMinEK, eventGeneratorMinT, eventGeneratorMinX, eventGeneratorMinXp, eventGeneratorMinY, eventGeneratorMinYp, eventGeneratorMinZ, and eventGeneratorMinZp.
|
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 193 of file BDSBunchEventGenerator.cc.
References BDS::IsFinite(), BDSBunch::Xp0, and BDSBunch::Yp0.
Referenced by BDSHepMC3Reader::BDSHepMC3Reader(), and BDSROOTSamplerReader::BDSROOTSamplerReader().
|
virtual |
Extract and set the relevant options from the beam definition. The distribution type is explicitly required as this function may be used inside a nested bunch distribution. This argument is for the most part ignored, but there's no way to have a default for it. Also, some classes can cover multiple input distributions so need to know which one they're meant to be.
Reimplemented from BDSBunch.
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, GMAD::BeamBase::eventGeneratorParticles, GMAD::BeamBase::matchDistrFileLength, Rp0, BDSBunch::SetOptions(), BDSBunch::Xp0, and BDSBunch::Yp0.
|
protected |
Vector (sorted) of permitted particles.
Definition at line 91 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), and ParseAcceptedParticleIDs().
|
private |
Cache of string for parsing on first query.
Definition at line 96 of file BDSBunchEventGenerator.hh.
Referenced by ParseAcceptedParticleIDs(), 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 82 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), 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 70 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 72 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 74 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 85 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(), 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 69 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 71 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 73 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().
|
private |
Flag to prepare acceptedParticles on first call.
Definition at line 94 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle().
|
protected |
Cache of limit.
Definition at line 87 of file BDSBunchEventGenerator.hh.
Referenced by SetOptions().
|
private |
Flag whether to bother applying search.
Definition at line 95 of file BDSBunchEventGenerator.hh.
Referenced by AcceptParticle(), and ParseAcceptedParticleIDs().