19#include "BDSBunchSixTrack.hh"
21#include "BDSException.hh"
22#include "BDSParticleCoordsFull.hh"
24#include "parser/beam.h"
26#include "CLHEP/Units/SystemOfUnits.h"
31BDSBunchSixTrack::BDSBunchSixTrack():
34 useCurvilinear =
true;
39BDSBunchSixTrack::~BDSBunchSixTrack()
41 for (
auto i : sixtrackData)
48 G4Transform3D beamlineTransformIn,
49 const G4double beamlineSIn)
58 G4double s = sixtrackData[
iPart][2] * CLHEP::m;
59 G4double x = sixtrackData[
iPart][3] * CLHEP::mm;
60 G4double xp = sixtrackData[
iPart][4] * CLHEP::mrad;
61 G4double y = sixtrackData[
iPart][5] * CLHEP::mm;
62 G4double yp = sixtrackData[
iPart][6] * CLHEP::mrad;
63 G4double E =
E0 * (1 + sixtrackData[
iPart][7]);
72 G4cout << __METHOD_NAME__ <<
"End of file reached. Returning to beginning of file." << G4endl;
77void BDSBunchSixTrack::LoadSixTrackFile()
83 std::ifstream infile(fileName.c_str());
86 {
throw BDSException(__METHOD_NAME__,
"\"" + fileName +
"\" file doesn't exist - exiting as no input");}
88 {G4cout << __METHOD_NAME__ <<
"Reading as SixTrack input " << fileName <<
"\"" << G4endl;}
91 double sixtrackParticleID = 0.0;
103 while (infile >> sixtrackParticleID >> turn >> s >> x >> xp >> y >> yp >> en >> type >> turns)
105 double* values =
new double[10];
108 values[0] = sixtrackParticleID;
119 sixtrackData.push_back(values);
122 nPart = sixtrackData.size();
virtual void SetOptions(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0)
virtual BDSParticleCoordsFull GetNextParticleLocal()
The base class for bunch distribution generators.
G4double T0
Centre of distributions.
G4double Zp0
Centre of distributions.
G4double E0
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.
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++.
std::string distrFile
beam parameters