19#include "BDSBunchEShell.hh"
21#include "BDSException.hh"
22#include "BDSParticleCoordsFull.hh"
24#include "parser/beam.h"
26#include "Randomize.hh"
27#include "CLHEP/Units/PhysicalConstants.h"
28#include "CLHEP/Units/SystemOfUnits.h"
32BDSBunchEShell::BDSBunchEShell():
44BDSBunchEShell::~BDSBunchEShell()
50 G4Transform3D beamlineTransformIn,
51 const G4double beamlineSIn)
54 shellX = beam.
shellX * CLHEP::m;
55 shellY = beam.
shellY * CLHEP::m;
56 shellXp = beam.
shellXp * CLHEP::rad;
57 shellYp = beam.
shellYp * CLHEP::rad;
78 {
throw BDSException(__METHOD_NAME__,
"shellXWidth < 0");}
80 {
throw BDSException(__METHOD_NAME__,
"shellYWidth < 0");}
82 {
throw BDSException(__METHOD_NAME__,
"shellXpWidth < 0");}
84 {
throw BDSException(__METHOD_NAME__,
"shellYpWidth < 0");}
89 G4double phi = 2 * CLHEP::pi * G4RandFlat::shoot();
90 G4double xamp = 0.5 - G4RandFlat::shoot();
91 G4double yamp = 0.5 - G4RandFlat::shoot();
92 G4double xpamp = 0.5 - G4RandFlat::shoot();
93 G4double ypamp = 0.5 - G4RandFlat::shoot();
95 G4double x =
X0 + (std::sin(phi) * shellX) + xamp * shellXWidth;
96 G4double xp =
Xp0 + (std::cos(phi) * shellXp) + xpamp * shellXpWidth;
97 phi = 2 * CLHEP::pi * G4RandFlat::shoot();
98 G4double y =
Y0 + (std::sin(phi) * shellY) + yamp * shellYWidth;
99 G4double yp =
Yp0 + (std::cos(phi) * shellYp) + ypamp * shellYpWidth;
101 G4double E =
E0 * (1 +
sigmaE/2. * (1. -2. * G4RandFlat::shoot()));
virtual BDSParticleCoordsFull GetNextParticleLocal()
virtual void SetOptions(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0)
virtual void CheckParameters()
The base class for bunch distribution generators.
G4double sigmaE
Centre of distributions.
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 shellXp
for the elliptic shell distribution
double shellXpWidth
for the elliptic shell distribution
double shellYp
for the elliptic shell distribution
double shellX
for the elliptic shell distribution
double shellY
for the elliptic shell distribution
double shellYpWidth
for the elliptic shell distribution
double shellXWidth
for the elliptic shell distribution
double shellYWidth
for the elliptic shell distribution