BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Friends
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)
 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.
 
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 BDSBunchFileBased
 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().
 
BDSBunchFileBasedoperator= (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.
 
- 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.
 
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 BDSParticleDefinitionParticleDefinition () 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 ()
 
- 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.
 
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.
 
- Protected Attributes inherited from BDSBunchFileBased
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
 
- Protected Attributes inherited from BDSBunch
G4String name
 Name of distribution.
 
G4bool useCurvilinear
 Whether to ignore z and use s and transform for curvilinear coordinates.
 
BDSParticleDefinitionparticleDefinition
 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 Public Member Functions inherited from BDSBunch
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)
 

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 41 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

◆ 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 192 of file BDSBunchEventGenerator.cc.

References BDS::IsFinite(), BDSBunch::Xp0, and BDSBunch::Yp0.

Referenced by BDSPrimaryGeneratorFileHEPMC::BDSPrimaryGeneratorFileHEPMC(), and BDSPrimaryGeneratorFileSampler::BDSPrimaryGeneratorFileSampler().

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

Friends And Related Function Documentation

◆ BDSPrimaryGeneratorFileHEPMC

friend class BDSPrimaryGeneratorFileHEPMC
friend

Definition at line 47 of file BDSBunchEventGenerator.hh.

◆ BDSPrimaryGeneratorFileSampler

friend class BDSPrimaryGeneratorFileSampler
friend

Definition at line 48 of file BDSBunchEventGenerator.hh.

Field Documentation

◆ acceptedParticles

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

Vector (sorted) of permitted particles.

Definition at line 97 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 102 of file BDSBunchEventGenerator.hh.

Referenced by ParseAcceptedParticleIDs(), and SetOptions().

◆ eventGeneratorMaxEK

G4double BDSBunchEventGenerator::eventGeneratorMaxEK
protected

Cache of limit.

Definition at line 92 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMaxRp

G4double BDSBunchEventGenerator::eventGeneratorMaxRp
protected

Cache of limit.

Definition at line 88 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), and SetOptions().

◆ eventGeneratorMaxT

G4double BDSBunchEventGenerator::eventGeneratorMaxT
protected

Cache of limit.

Definition at line 90 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMaxX

G4double BDSBunchEventGenerator::eventGeneratorMaxX
protected

Cache of limit.

Definition at line 76 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMaxXp

G4double BDSBunchEventGenerator::eventGeneratorMaxXp
protected

Cache of limit.

Definition at line 82 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMaxY

G4double BDSBunchEventGenerator::eventGeneratorMaxY
protected

Cache of limit.

Definition at line 78 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMaxYp

G4double BDSBunchEventGenerator::eventGeneratorMaxYp
protected

Cache of limit.

Definition at line 84 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMaxZ

G4double BDSBunchEventGenerator::eventGeneratorMaxZ
protected

Cache of limit.

Definition at line 80 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMaxZp

G4double BDSBunchEventGenerator::eventGeneratorMaxZp
protected

Cache of limit.

Definition at line 86 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMinEK

G4double BDSBunchEventGenerator::eventGeneratorMinEK
protected

Cache of limit.

Definition at line 91 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMinRp

G4double BDSBunchEventGenerator::eventGeneratorMinRp
protected

Cache of limit.

Definition at line 87 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), and SetOptions().

◆ eventGeneratorMinT

G4double BDSBunchEventGenerator::eventGeneratorMinT
protected

Cache of limit.

Definition at line 89 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMinX

G4double BDSBunchEventGenerator::eventGeneratorMinX
protected

Cache of limit.

Definition at line 75 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMinXp

G4double BDSBunchEventGenerator::eventGeneratorMinXp
protected

Cache of limit.

Definition at line 81 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMinY

G4double BDSBunchEventGenerator::eventGeneratorMinY
protected

Cache of limit.

Definition at line 77 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMinYp

G4double BDSBunchEventGenerator::eventGeneratorMinYp
protected

Cache of limit.

Definition at line 83 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMinZ

G4double BDSBunchEventGenerator::eventGeneratorMinZ
protected

Cache of limit.

Definition at line 79 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorMinZp

G4double BDSBunchEventGenerator::eventGeneratorMinZp
protected

Cache of limit.

Definition at line 85 of file BDSBunchEventGenerator.hh.

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

◆ eventGeneratorNEventsSkip

G4int BDSBunchEventGenerator::eventGeneratorNEventsSkip
protected

◆ firstTime

G4bool BDSBunchEventGenerator::firstTime
private

Flag to prepare acceptedParticles on first call.

Definition at line 100 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle().

◆ Rp0

G4double BDSBunchEventGenerator::Rp0
protected

Cache of limit.

Definition at line 93 of file BDSBunchEventGenerator.hh.

Referenced by SetOptions().

◆ testOnParticleType

G4bool BDSBunchEventGenerator::testOnParticleType
private

Flag whether to bother applying search.

Definition at line 101 of file BDSBunchEventGenerator.hh.

Referenced by AcceptParticle(), and ParseAcceptedParticleIDs().


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