19#include "BDSBunchSlowExt.hh"
21#include "BDSException.hh"
22#include "BDSParticleCoordsFull.hh"
23#include "BDSUtilities.hh"
24#include "BDSWarning.hh"
26#include "parser/beam.h"
28#include "Randomize.hh"
29#include "CLHEP/Units/PhysicalConstants.h"
33BDSBunchSlowExt::BDSBunchSlowExt():
45BDSBunchSlowExt::~BDSBunchSlowExt()
51 G4Transform3D beamlineTransformIn,
52 const G4double beamlineSIn)
55 dTStart = beam.
dTStart * CLHEP::s;
56 dTStop = beam.
dTStop * CLHEP::s;
57 dPStart = beam.
dPStart * CLHEP::GeV;
58 dPStop = beam.
dPStop * CLHEP::GeV;
60 dT = dTStop - dTStart;
63 G4double pA =
P0 + dPStart;
64 G4double pB =
P0 + dPStop;
66 pdCopy.SetEnergies(0, 0, pA);
67 G4double EStart = pdCopy.TotalEnergy();
68 pdCopy.SetEnergies(0, 0, pB);
69 G4double EStop = pdCopy.TotalEnergy();
70 dEStart = EStart -
E0;
77 {BDS::Warning(__METHOD_NAME__,
"no difference in time and momentum - no action for this distribution");}
84 {
throw BDSException(__METHOD_NAME__,
"dTStop must be greater or equal to dTStart");}
92 G4double dtLocal, dELocal;
94 G4double t =
T0 + dtLocal;
95 G4double E =
E0 + dELocal;
102 G4double fraction = G4RandFlat::shoot();
103 dtLocal = dTStart + dT*fraction;
104 dELocal = dEStart + dE*fraction;
virtual void CheckParameters()
virtual void SetOptions(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0)
virtual BDSParticleCoordsFull GetNextParticleLocal()
void GetDeltas(G4double &dt, G4double &dE) const
The base class for bunch distribution generators.
G4double Yp0
Centre of distributions.
G4double T0
Centre of distributions.
G4double S0
Centre of distributions.
G4double P0
central momentum
G4double Z0
Centre of distributions.
virtual BDSParticleCoordsFull GetNextParticleLocal()
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)
BDSParticleDefinition * particleDefinition
Particle definition for bunch - this class owns it.
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 dPStop
for slow-extraction beam
double dTStart
for slow-extraction beam
double dPStart
for slow-extraction beam
double dTStop
for slow-extraction beam
G4bool IsFinite(G4double value, G4double tolerance=std::numeric_limits< double >::epsilon())