20#include "BDSBunchBox.hh"
21#include "BDSBunchCircle.hh"
22#include "BDSBunchComposite.hh"
23#include "BDSBunchCompositeSDE.hh"
24#include "BDSBunchEShell.hh"
25#include "BDSBunchEventGenerator.hh"
26#include "BDSBunchFactory.hh"
27#include "BDSBunchHalo.hh"
28#include "BDSBunchHaloFlatSigma.hh"
29#include "BDSBunchPtc.hh"
30#include "BDSBunchRing.hh"
31#include "BDSBunchSphere.hh"
32#include "BDSBunchSigmaMatrix.hh"
33#include "BDSBunchSixTrack.hh"
34#include "BDSBunchSquare.hh"
35#include "BDSBunchTwiss.hh"
36#include "BDSBunchType.hh"
37#include "BDSBunchUserFile.hh"
39#include "BDSException.hh"
40#include "BDSUtilities.hh"
42#include "parser/beam.h"
47#include "src-external/gzstream/gzstream.h"
52 const G4Transform3D& beamlineTransform,
54 G4bool generatePrimariesOnlyIn)
56 G4String distrName = G4String(beam.
distrType);
63 if (generatePrimariesOnlyIn)
64 {
throw BDSException(__METHOD_NAME__,
"eventgeneratorfile will not work with generator primaries only.");}
70 return CreateBunch(beamParticle, distrType, beam, beamlineTransform, beamlineS, generatePrimariesOnlyIn);
76 const G4Transform3D& beamlineTransform,
78 G4bool generatePrimariesOnlyIn)
84 case BDSBunchType::reference:
86 case BDSBunchType::gaussmatrix:
87 case BDSBunchType::gauss:
89 case BDSBunchType::gausstwiss:
91 case BDSBunchType::circle:
93 case BDSBunchType::square:
95 case BDSBunchType::ring:
97 case BDSBunchType::eshell:
99 case BDSBunchType::halo:
101 case BDSBunchType::composite:
103 case BDSBunchType::compositesde:
105 case BDSBunchType::userfile:
107 G4String distrFile = G4String(beam.
distrFile);
108 if(distrFile.rfind(
"gz") != std::string::npos)
111 if (distrFile.find(
"tar") != std::string::npos)
112 {
throw BDSException(__METHOD_NAME__,
"Cannot load tar file -> only gzip compressed");}
116 G4String message = beam.
distrFile +
" is a compressed file but BDSIM is compiled without GZIP.";
124 case BDSBunchType::ptc:
126 case BDSBunchType::sixtrack:
128 case BDSBunchType::sphere:
130 case BDSBunchType::eventgeneratorfile:
131 case BDSBunchType::bdsimsampler:
133 case BDSBunchType::box:
135 case BDSBunchType::halosigma:
141 bdsBunch->
SetOptions(beamParticle, beam, distrType, beamlineTransform, beamlineS);
A bunch distribution that produces an uncorrelated uniform random distribution within a 6D box.
An uncorrelated uniform random distribution within a circle in each dimension.
A distribution that allows mixing of three different distributions in each primary dimension.
A distribution that allows mixing of three different distributions in each primary dimension.
An uncorrelated uniform random distribution within an elliptical shell.
A wrapper of BDSBunch to include a filter for the events loaded by an event generator.
static BDSBunch * CreateBunch(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const G4Transform3D &beamlineTransform=G4Transform3D::Identity, G4double beamlineS=0, G4bool generatePrimariesOnlyIn=false)
factory method
Bunch halo distribution where the PDF is uniformly distribution in sigma.
A halo distribution based on both twiss parameters and sigmas.
A bunch distribution that reads a PTC inrays file.
A bunch distribution that produces an uncorrelated random uniform distribution along a circle in phas...
A 6D Gaussian distribution based on a covariance matrix.
A bunch distribution that reads a SixTrack hits file.
A bunch distribution that produces an uncorrelated uniform random direction distribution over a spher...
A bunch distribution that produces an uncorrelated uniform random distribution within a square in pha...
A bunch distribution according to the twiss parameterisation.
A bunch distribution that reads a user specified column file.
The base class for bunch distribution generators.
virtual void SetGeneratePrimariesOnly(G4bool generatePrimariesOnlyIn)
virtual void Initialise()
Any initialisation - to be used after SetOptions, then CheckParameters.
virtual void SetOptions(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0)
virtual void CheckParameters()
General exception with possible name of object and message.
Wrapper for particle definition.
Improve type-safety of native enum data type in C++.
type underlying() const
return underlying value (can be used in switch statement)
std::string distrFile
beam parameters
std::string distrType
beam parameters
std::pair< G4String, G4String > SplitOnColon(const G4String &formatAndPath)
G4bool StrContains(const G4String &str, const G4String &test)
Utility function to simplify lots of syntax changes for pedantic g4 changes.
BDSBunchType DetermineBunchType(G4String distrType)
Function that gives corresponding enum value for string (case-insensitive).