19#ifndef BDSBUNCHHALOFLATSIGMA_H
20#define BDSBUNCHHALOFLATSIGMA_H
22#include "BDSBunchType.hh"
23#include "BDSException.hh"
25#include "G4Transform3D.hh"
89std::vector<G4double> CumulativeDistances(T pairs)
92 {
throw BDSException(
"At least two points needed to calculated adjacent distances.");}
93 std::vector<G4double> distances;
95 auto it = std::begin(pairs);
96 auto next = std::next(it);
97 for (; next != std::end(pairs); ++it, ++next)
99 G4double x0 = it->position;
100 G4double xp0 = it->momentum;
102 G4double x1 = next->position;
103 G4double xp1 = next->momentum;
105 G4double xd = std::pow((x0 - x1), 2);
106 G4double xpd = std::pow((xp0 - xp1), 2);
108 G4double distance = std::sqrt(xd + xpd);
110 distances.push_back(distance);
112 std::vector<G4double> result;
113 std::partial_sum(std::begin(distances), std::end(distances), std::back_inserter(result));
129 CLHEP::RandFlat* flatRandomGeneratorIn);
133 inline double EllipsePerimeter()
const {
return pathLengths.back();};
136 G4double PathLengthToAngle(G4double pathLength)
const;
140 CLHEP::RandFlat* flatRandomGenerator;
141 std::vector<G4double> angles;
142 std::vector<G4double> pathLengths;
161 G4Transform3D beamlineTransformIn = G4Transform3D::Identity,
178 G4double haloNSigmaXInner;
179 G4double haloNSigmaXOuter;
180 G4double haloNSigmaYInner;
181 G4double haloNSigmaYOuter;
183 CLHEP::RandFlat* flatGen;
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.