19#ifndef BDSBUNCHHALOFLATSIGMA_H
20#define BDSBUNCHHALOFLATSIGMA_H
22#include "BDSBunchType.hh"
23#include "BDSException.hh"
25#include "G4Transform3D.hh"
84std::vector<G4double> CumulativeDistances(T pairs)
87 {
throw BDSException(
"At least two points needed to calculated adjacent distances.");}
88 std::vector<G4double> distances;
90 auto it = std::begin(pairs);
91 auto next = std::next(it);
92 for (; next != std::end(pairs); ++it, ++next)
94 G4double x0 = it->position;
95 G4double xp0 = it->momentum;
97 G4double x1 = next->position;
98 G4double xp1 = next->momentum;
100 G4double xd = std::pow((x0 - x1), 2);
101 G4double xpd = std::pow((xp0 - xp1), 2);
103 G4double distance = std::sqrt(xd + xpd);
105 distances.push_back(distance);
107 std::vector<G4double> result;
108 std::partial_sum(std::begin(distances), std::end(distances), std::back_inserter(result));
127 inline double EllipsePerimeter()
const {
return pathLengths.back();};
130 G4double PathLengthToAngle(G4double pathLength)
const;
134 std::vector<G4double> angles;
135 std::vector<G4double> pathLengths;
154 G4Transform3D beamlineTransformIn = G4Transform3D::Identity,
171 G4double haloNSigmaXInner;
172 G4double haloNSigmaXOuter;
173 G4double haloNSigmaYInner;
174 G4double haloNSigmaYOuter;
Bunch halo distribution where the PDF is uniformly distribution in sigma.
G4double alphaX
Twiss parameter.
G4double sigmaY
Twiss parameter.
G4double betaY
Twiss parameter.
virtual void SetOptions(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0)
G4double sigmaX
Twiss parameter.
G4double emitX
Twiss parameter.
G4double betaX
Twiss parameter.
G4double emitY
Twiss parameter.
virtual BDSParticleCoordsFull GetNextParticleLocal()
G4double alphaY
Twiss parameter.
virtual void CheckParameters()
The base class for bunch distribution generators.
G4double beamlineS
Beamline initial S position.
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++.
Class for generating points uniformly on ellipse perimeters via interpolation. Part of implementation...
Return either G4Tubs or G4CutTubs depending on flat face.
Parser namespace for GMAD language. Combination of Geant4 and MAD.
Simple struct for storing action/angle pairs to aid readability. Implementation detail.
Simple struct for storing position/momentum pairs to aid readability. Implementation detail.
Simple struct for storing Twiss alpha/beta pairs to aid readability. Implementation detail.