BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
BDSBunchEventGenerator Class Reference

A wrapper of BDSBunch to include a filter for the events loaded by an event generator. More...

#include <BDSBunchEventGenerator.hh>

Inheritance diagram for BDSBunchEventGenerator:
Inheritance graph
Collaboration diagram for BDSBunchEventGenerator:
Collaboration graph

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...
 
BDSBunchEventGeneratoroperator= (const BDSBunchEventGenerator &)=delete
 Assignment and copy constructor not implemented nor used.
 
 BDSBunchEventGenerator (BDSBunchEventGenerator &)=delete
 Assignment and copy constructor not implemented nor used.
 
- Public Member Functions inherited from BDSBunch
 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 BDSParticleDefinitionParticleDefinition () 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 ()
 
- Protected Member Functions inherited from BDSBunch
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...
 
- Protected Attributes inherited from BDSBunch
G4String name
 Name of distribution. More...
 
G4bool useCurvilinear
 Whether to ignore z and use s and transform for curvilinear coordinates. More...
 
BDSParticleDefinitionparticleDefinition
 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 Public Member Functions inherited from BDSBunch
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)
 

Detailed Description

A wrapper of BDSBunch to include a filter for the events loaded by an event generator.

Author
Laurie Nevay

Definition at line 36 of file BDSBunchEventGenerator.hh.

Constructor & Destructor Documentation

◆ BDSBunchEventGenerator()

BDSBunchEventGenerator::BDSBunchEventGenerator ( )

Definition at line 42 of file BDSBunchEventGenerator.cc.

◆ ~BDSBunchEventGenerator()

BDSBunchEventGenerator::~BDSBunchEventGenerator ( )
virtual

Definition at line 68 of file BDSBunchEventGenerator.cc.

Member Function Documentation

◆ AcceptParticle()

G4bool BDSBunchEventGenerator::AcceptParticle ( const BDSParticleCoordsFull coords,
G4double  rpOriginal,
G4double  kineticEnergy,
G4int  pdgID 
)

◆ CheckParameters()

void BDSBunchEventGenerator::CheckParameters ( )
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.

Here is the call graph for this function:

◆ ParseAcceptedParticleIDs()

void BDSBunchEventGenerator::ParseAcceptedParticleIDs ( )
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReferenceBeamMomentumOffset()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetOptions()

void BDSBunchEventGenerator::SetOptions ( const BDSParticleDefinition beamParticle,
const GMAD::Beam beam,
const BDSBunchType distrType,
G4Transform3D  beamlineTransformIn = G4Transform3D::Identity,
G4double  beamlineS = 0 
)
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.

Here is the call graph for this function:

Field Documentation

◆ acceptedParticles

std::vector<G4int> BDSBunchEventGenerator::acceptedParticles
protected

Vector (sorted) of permitted particles.

Definition at line 91 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), and ParseAcceptedParticleIDs().

◆ acceptedParticlesString

G4String BDSBunchEventGenerator::acceptedParticlesString
private

Cache of string for parsing on first query.

Definition at line 96 of file BDSBunchEventGenerator.hh.

Referenced by ParseAcceptedParticleIDs(), and SetOptions().

◆ eventGeneratorMaxEK

G4double BDSBunchEventGenerator::eventGeneratorMaxEK
protected

Cache of limit.

Definition at line 86 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMaxRp

G4double BDSBunchEventGenerator::eventGeneratorMaxRp
protected

Cache of limit.

Definition at line 82 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), and SetOptions().

◆ eventGeneratorMaxT

G4double BDSBunchEventGenerator::eventGeneratorMaxT
protected

Cache of limit.

Definition at line 84 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMaxX

G4double BDSBunchEventGenerator::eventGeneratorMaxX
protected

Cache of limit.

Definition at line 70 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMaxXp

G4double BDSBunchEventGenerator::eventGeneratorMaxXp
protected

Cache of limit.

Definition at line 76 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMaxY

G4double BDSBunchEventGenerator::eventGeneratorMaxY
protected

Cache of limit.

Definition at line 72 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMaxYp

G4double BDSBunchEventGenerator::eventGeneratorMaxYp
protected

Cache of limit.

Definition at line 78 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMaxZ

G4double BDSBunchEventGenerator::eventGeneratorMaxZ
protected

Cache of limit.

Definition at line 74 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMaxZp

G4double BDSBunchEventGenerator::eventGeneratorMaxZp
protected

Cache of limit.

Definition at line 80 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMinEK

G4double BDSBunchEventGenerator::eventGeneratorMinEK
protected

Cache of limit.

Definition at line 85 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMinRp

G4double BDSBunchEventGenerator::eventGeneratorMinRp
protected

Cache of limit.

Definition at line 81 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), and SetOptions().

◆ eventGeneratorMinT

G4double BDSBunchEventGenerator::eventGeneratorMinT
protected

Cache of limit.

Definition at line 83 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMinX

G4double BDSBunchEventGenerator::eventGeneratorMinX
protected

Cache of limit.

Definition at line 69 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMinXp

G4double BDSBunchEventGenerator::eventGeneratorMinXp
protected

Cache of limit.

Definition at line 75 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMinY

G4double BDSBunchEventGenerator::eventGeneratorMinY
protected

Cache of limit.

Definition at line 71 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMinYp

G4double BDSBunchEventGenerator::eventGeneratorMinYp
protected

Cache of limit.

Definition at line 77 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMinZ

G4double BDSBunchEventGenerator::eventGeneratorMinZ
protected

Cache of limit.

Definition at line 73 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ eventGeneratorMinZp

G4double BDSBunchEventGenerator::eventGeneratorMinZp
protected

Cache of limit.

Definition at line 79 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), CheckParameters(), and SetOptions().

◆ firstTime

G4bool BDSBunchEventGenerator::firstTime
private

Flag to prepare acceptedParticles on first call.

Definition at line 94 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle().

◆ Rp0

G4double BDSBunchEventGenerator::Rp0
protected

Cache of limit.

Definition at line 87 of file BDSBunchEventGenerator.hh.

Referenced by SetOptions().

◆ testOnParticleType

G4bool BDSBunchEventGenerator::testOnParticleType
private

Flag whether to bother applying search.

Definition at line 95 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), and ParseAcceptedParticleIDs().


The documentation for this class was generated from the following files: