19#include "BDSBunchRing.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"
33BDSBunchRing::BDSBunchRing():
39BDSBunchRing::~BDSBunchRing()
45 G4Transform3D beamlineTransformIn,
46 const G4double beamlineSIn)
49 rMin = beam.
Rmin * CLHEP::m;
50 rMax = beam.
Rmax * CLHEP::m;
57 {
throw BDSException(__METHOD_NAME__,
"rMin: " + std::to_string(rMin) +
" < 0");}
59 {
throw BDSException(__METHOD_NAME__,
"rMax: " + std::to_string(rMin) +
" < 0");}
61 {
throw BDSException(__METHOD_NAME__,
"rMax: " + std::to_string(rMax) +
" < rMin: " + std::to_string(rMin));}
66 G4double r = std::sqrt(G4RandFlat::shoot(std::pow(rMin,2), std::pow(rMax,2)));
67 G4double phi = 2 * CLHEP::pi * G4RandFlat::shoot();
68 G4double x =
X0 + r * std::sin(phi);
69 G4double y =
Y0 + r * std::cos(phi);
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 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)
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 Rmax
for the ring beam distribution
double Rmin
for the ring beam distribution