BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Public Member Functions
BDSBunchTwiss Class Reference

A bunch distribution according to the twiss parameterisation. More...

#include <BDSBunchTwiss.hh>

Inheritance diagram for BDSBunchTwiss:
Inheritance graph
Collaboration diagram for BDSBunchTwiss:
Collaboration graph

Public Member Functions

virtual void SetOptions (const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0)
 
virtual void CheckParameters ()
 
- Public Member Functions inherited from BDSBunchGaussian
 BDSBunchGaussian (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 BeginOfRunAction (G4int numberOfEvents)
 
virtual BDSParticleCoordsFull GetNextParticleLocal ()
 
- 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
 

Private Attributes

G4double betaX
 Twiss parameters. More...
 
G4double betaY
 Twiss parameters. More...
 
G4double alphaX
 Twiss parameters. More...
 
G4double alphaY
 Twiss parameters. More...
 
G4double emitX
 Twiss parameters. More...
 
G4double emitY
 Twiss parameters. More...
 
G4double gammaX
 Twiss parameters. More...
 
G4double gammaY
 Twiss parameters. More...
 
G4double dispX
 Twiss parameters. More...
 
G4double dispY
 Twiss parameters. More...
 
G4double dispXP
 Twiss parameters. More...
 
G4double dispYP
 Twiss parameters. 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)
 
- Protected Member Functions inherited from BDSBunchGaussian
CLHEP::RandMultiGauss * CreateMultiGauss (CLHEP::HepRandomEngine &anEngine, const CLHEP::HepVector &mu, CLHEP::HepSymMatrix &sigma)
 
void PreGenerateEvents (G4int nGenerate)
 Pre-generate all the particle coordinates and subtract the sample mean. More...
 
virtual BDSParticleCoordsFull GetNextParticleLocalCoords ()
 Fire random number generator and get coordinates. Can be overloaded if required. More...
 
- 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 inherited from BDSBunchGaussian
CLHEP::HepVector meansGM
 
CLHEP::HepSymMatrix sigmaGM
 
CLHEP::RandMultiGauss * gaussMultiGen
 Randon number generator with sigma matrix and mean. More...
 
G4bool offsetSampleMean
 Whether to offset the sample mean. More...
 
G4int iPartIteration
 Iterator for reading out pre-calculate coordinates. More...
 
std::vector< std::vector< G4double > * > coordinates
 Convenience vector of vectors for clearing up. More...
 
std::vector< G4double > x0_v
 Holder for pre-calculated coordinates. More...
 
std::vector< G4double > xp_v
 Holder for pre-calculated coordinates. More...
 
std::vector< G4double > y0_v
 Holder for pre-calculated coordinates. More...
 
std::vector< G4double > yp_v
 Holder for pre-calculated coordinates. More...
 
std::vector< G4double > z0_v
 Holder for pre-calculated coordinates. More...
 
std::vector< G4double > zp_v
 Holder for pre-calculated coordinates. More...
 
std::vector< G4double > E_v
 Holder for pre-calculated coordinates. More...
 
std::vector< G4double > t_v
 Holder for pre-calculated coordinates. More...
 
std::vector< G4double > weight_v
 Holder for pre-calculated coordinates. 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...
 

Detailed Description

A bunch distribution according to the twiss parameterisation.

Author
Stewart Boogert

Definition at line 37 of file BDSBunchTwiss.hh.

Constructor & Destructor Documentation

◆ BDSBunchTwiss()

BDSBunchTwiss::BDSBunchTwiss ( )

Definition at line 37 of file BDSBunchTwiss.cc.

◆ ~BDSBunchTwiss()

virtual BDSBunchTwiss::~BDSBunchTwiss ( )
inlinevirtual

Definition at line 41 of file BDSBunchTwiss.hh.

Member Function Documentation

◆ CheckParameters()

void BDSBunchTwiss::CheckParameters ( )
virtual

Check the parameters for the given bunch distribution and exit if they're problematic or unphysical.

Reimplemented from BDSBunch.

Definition at line 117 of file BDSBunchTwiss.cc.

References betaX, betaY, BDSBunch::CheckParameters(), emitX, and emitY.

Referenced by SetOptions().

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

◆ SetOptions()

void BDSBunchTwiss::SetOptions ( const BDSParticleDefinition beamParticle,
const GMAD::Beam beam,
const BDSBunchType distrType,
G4Transform3D  beamlineTransformIn = G4Transform3D::Identity,
const 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 BDSBunchGaussian.

Definition at line 47 of file BDSBunchTwiss.cc.

References GMAD::BeamBase::alfx, GMAD::BeamBase::alfy, alphaX, alphaY, betaX, betaY, GMAD::BeamBase::betx, GMAD::BeamBase::bety, CheckParameters(), BDSBunchGaussian::CreateMultiGauss(), dispX, GMAD::BeamBase::dispx, dispXP, GMAD::BeamBase::dispxp, dispY, GMAD::BeamBase::dispy, dispYP, GMAD::BeamBase::dispyp, emitX, emitY, gammaX, gammaY, BDSBunchGaussian::gaussMultiGen, BDSBunch::SetEmittances(), BDSBunchGaussian::SetOptions(), BDSBunch::sigmaE, BDSBunch::sigmaP, and BDSBunch::sigmaT.

Here is the call graph for this function:

Field Documentation

◆ alphaX

G4double BDSBunchTwiss::alphaX
private

Twiss parameters.

Definition at line 53 of file BDSBunchTwiss.hh.

Referenced by SetOptions().

◆ alphaY

G4double BDSBunchTwiss::alphaY
private

Twiss parameters.

Definition at line 54 of file BDSBunchTwiss.hh.

Referenced by SetOptions().

◆ betaX

G4double BDSBunchTwiss::betaX
private

Twiss parameters.

Definition at line 51 of file BDSBunchTwiss.hh.

Referenced by CheckParameters(), and SetOptions().

◆ betaY

G4double BDSBunchTwiss::betaY
private

Twiss parameters.

Definition at line 52 of file BDSBunchTwiss.hh.

Referenced by CheckParameters(), and SetOptions().

◆ dispX

G4double BDSBunchTwiss::dispX
private

Twiss parameters.

Definition at line 59 of file BDSBunchTwiss.hh.

Referenced by SetOptions().

◆ dispXP

G4double BDSBunchTwiss::dispXP
private

Twiss parameters.

Definition at line 61 of file BDSBunchTwiss.hh.

Referenced by SetOptions().

◆ dispY

G4double BDSBunchTwiss::dispY
private

Twiss parameters.

Definition at line 60 of file BDSBunchTwiss.hh.

Referenced by SetOptions().

◆ dispYP

G4double BDSBunchTwiss::dispYP
private

Twiss parameters.

Definition at line 62 of file BDSBunchTwiss.hh.

Referenced by SetOptions().

◆ emitX

G4double BDSBunchTwiss::emitX
private

Twiss parameters.

Definition at line 55 of file BDSBunchTwiss.hh.

Referenced by CheckParameters(), and SetOptions().

◆ emitY

G4double BDSBunchTwiss::emitY
private

Twiss parameters.

Definition at line 56 of file BDSBunchTwiss.hh.

Referenced by CheckParameters(), and SetOptions().

◆ gammaX

G4double BDSBunchTwiss::gammaX
private

Twiss parameters.

Definition at line 57 of file BDSBunchTwiss.hh.

Referenced by SetOptions().

◆ gammaY

G4double BDSBunchTwiss::gammaY
private

Twiss parameters.

Definition at line 58 of file BDSBunchTwiss.hh.

Referenced by SetOptions().


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