36#include <gsl/gsl_linalg.h>
37#include <gsl/gsl_randist.h>
38#include <gsl/gsl_rng.h>
39#include <gsl/gsl_sf_erf.h>
41#include <boost/filesystem.hpp>
42#include <boost/numeric/odeint/stepper/runge_kutta4.hpp>
43#include <boost/regex.hpp>
83 "The DISTRIBUTION statement defines data for the 6D particle distribution."),
121 "on flat top portion of emitted GAUSS "
122 "distribtuion (in percent of flat top "
127 "flat top portion of emitted GAUSS "
128 "distribution", 0.0);
132 "an injected beam.",
false);
158 if (myNode < remainder)
182 throw OpalException(
"Distribution::find()",
"Distribution \"" + name +
"\" not found.");
190 <<
"* ************* D I S T R I B U T I O N ********************************************"
194 os <<
"* In restart. Distribution read in from .h5 file." <<
endl;
207 throw OpalException(
"Distribution Param",
"Unknown \"TYPE\" of \"DISTRIBUTION\"");
210 os <<
"* Distribution is injected." <<
endl;
213 os <<
"* **********************************************************************************"
268 for (
unsigned int i = 0; i < 6; ++ i) {
269 for (
unsigned int j = 0; j < 6; ++ j) {
281 for (
unsigned int i = 0; i < 3; ++ i){
290 if (cr.size() == 15) {
291 *
gmsg <<
"* Use r to specify correlations" <<
endl;
293 for (
unsigned int i = 0; i < 5; ++ i) {
294 for (
unsigned int j = i + 1; j < 6; ++ j, ++ k) {
302 "Inconsistent set of correlations specified, check manual");
319 for (
unsigned int i = 0; i < 6; ++ i) {
320 for (
unsigned int j = 0; j < 6; ++ j) {
358 double timeRatio = std::sqrt(2.0 * std::log(10.0)) - std::sqrt(2.0 * std::log(10.0 / 9.0));
376 os <<
"* Distribution type: GAUSS" <<
endl;
381 os <<
"* SIGMAPX = " <<
sigmaP_m[0] <<
" [Beta Gamma]" <<
endl;
382 os <<
"* SIGMAPY = " <<
sigmaP_m[1] <<
" [Beta Gamma]" <<
endl;
383 os <<
"* SIGMAPZ = " <<
sigmaP_m[2] <<
" [Beta Gamma]" <<
endl;
387 os <<
"* Distribution type: MULTIVARIATEGAUSS" <<
endl;
392 os <<
"* SIGMAPX = " <<
sigmaP_m[0] <<
" [Beta Gamma]" <<
endl;
393 os <<
"* SIGMAPY = " <<
sigmaP_m[1] <<
" [Beta Gamma]" <<
endl;
394 os <<
"* SIGMAPZ = " <<
sigmaP_m[2] <<
" [Beta Gamma]" <<
endl;
396 os <<
"* input cov matrix = ";
397 for (
unsigned int i = 0; i < 6; ++ i) {
398 for (
unsigned int j = 0; j < 6; ++ j) {
406 os <<
"* Distribution type: FLATTOP" <<
endl;
418 os <<
"* Longitudinal cutoff = " <<
cutoffR_m[2]
419 <<
" [units of Sigma Time]" <<
endl;
451 throw OpalException(
"Distribution Param",
"Unknown \"TYPE\" of \"DISTRIBUTION\"");
456 static const std::map<std::string, DistributionType> typeStringToDistType_s = {
467 "Distribution::setDistType",
468 "The attribute \"TYPE\" isn't set for the \"DISTRIBUTION\"!");
typename Kokkos::Random_XorShift64_Pool<> GeneratorPool
typename ippl::detail::ViewType< ippl::Vector< double, Dim >, 1 >::view_type view_type
Inform & endl(Inform &inf)
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
double getReal(const Attribute &attr)
Return real value.
Attribute makePredefinedString(const std::string &name, const std::string &help, const std::initializer_list< std::string > &predefinedStrings)
Make predefined string attribute.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
bool getBool(const Attribute &attr)
Return logical value.
Attribute makeRealArray(const std::string &name, const std::string &help)
Create real array attribute.
std::vector< double > getRealArray(const Attribute &attr)
Get array value.
std::string getString(const Attribute &attr)
Get string value.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
std::unique_ptr< mpi::Communicator > Comm
The base class for all OPAL definitions.
The base class for all OPAL objects.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
virtual void update()
Update this object.
std::vector< Attribute > itsAttr
The object attributes.
Object * find(const std::string &name)
Find entry.
static OpalData * getInstance()
static Distribution * find(const std::string &name)
ippl::Vector< double, 3 > sigmaR_m
void printDistFlatTop(Inform &os) const
ippl::Vector< double, 3 > sigmaP_m
double tPulseLengthFWHM_m
virtual void execute()
Execute the command.
double getTEmission() const
Distribution is an emitted, and is currently emitting, rather than an injected, beam.
virtual bool canReplaceBy(Object *object)
Distribution can only be replaced by another distribution.
ippl::Vector< double, 3 > cutoffR_m
DistributionType distrTypeT_m
void setDistParametersMultiVariateGauss()
virtual Distribution * clone(const std::string &name)
Return a clone.
void printDistMultiVariateGauss(Inform &os) const
ippl::Vector< double, 3 > cutoffP_m
size_t getNumOfLocalParticlesToCreate(size_t n)
Calculate the local number of particles evenly and adjust node 0 such that n is matched exactly.
void setTEmission(double tEmission)
void setDistParametersFlatTop()
void setAvrgPz(double avrgpz)
void printDistGauss(Inform &os) const
Inform & printInfo(Inform &os) const
Matrix_t correlationMatrix_m
void setDistParametersGauss()
The base class for all OPAL exceptions.