19#include "BDSBunchCircle.hh"
21#include "BDSException.hh"
23#include "parser/beam.h"
25#include "Randomize.hh"
26#include "CLHEP/Units/PhysicalConstants.h"
27#include "CLHEP/Units/SystemOfUnits.h"
31BDSBunchCircle::BDSBunchCircle():
39BDSBunchCircle::~BDSBunchCircle()
45 G4Transform3D beamlineTransformIn,
46 const G4double beamlineSIn)
61 {
throw BDSException(__METHOD_NAME__,
"envelopeRp <= 0");}
70 G4double dt = envelopeT * (1.-2.*G4RandFlat::shoot());
71 G4double dz = dt * CLHEP::c_light;
75 G4double phiR = G4RandFlat::shoot() * CLHEP::twopi;
76 G4double phiRp = G4RandFlat::shoot() * CLHEP::twopi;
77 G4double r = std::sqrt(G4RandFlat::shoot()) * envelopeR;
78 G4double rp = std::sqrt(G4RandFlat::shoot()) * envelopeRp;
80 G4double x =
X0 + std::cos(phiR) * r;
81 G4double y =
Y0 + std::sin(phiR) * r;
82 G4double xp =
Xp0 + std::cos(phiRp) * rp;
83 G4double yp =
Yp0 + std::sin(phiRp) * rp;
85 G4double E =
E0 + envelopeE * (1-2*G4RandFlat::shoot());
virtual void CheckParameters()
virtual void SetOptions(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, G4double beamlineS=0)
virtual BDSParticleCoordsFull GetNextParticleLocal()
The base class for bunch distribution generators.
G4double Yp0
Centre of distributions.
G4double T0
Centre of distributions.
G4double S0
Centre of distributions.
G4double Z0
Centre of distributions.
G4double X0
Centre of distributions.
G4double Zp0
Centre of distributions.
G4double Xp0
Centre of distributions.
G4double E0
Centre of distributions.
G4double Y0
Centre of distributions.
virtual void SetOptions(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0)
static G4double CalculateZp(G4double xp, G4double yp, G4double Zp0)
Calculate zp safely based on other components.
virtual void CheckParameters()
General exception with possible name of object and message.
A set of particle coordinates including energy and weight.
Wrapper for particle definition.
Improve type-safety of native enum data type in C++.
double envelopeRp
for the circle/square/box beam distribution
double envelopeE
for the circle/square/box beam distribution
double envelopeR
for the circle/square/box beam distribution
double envelopeT
for the circle/square/box beam distribution