OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
DistributionMoments Class Reference

#include <DistributionMoments.h>

Collaboration diagram for DistributionMoments:
Collaboration graph
[legend]

Public Member Functions

 DistributionMoments ()
 
void compute (const std::vector< OpalParticle >::const_iterator &, const std::vector< OpalParticle >::const_iterator &)
 
void compute (PartBunchBase< double, 3 > const &)
 
void computeMeanKineticEnergy (PartBunchBase< double, 3 > const &)
 
void computeDebyeLength (PartBunchBase< double, 3 > const &, double)
 
void computePlasmaParameter (double)
 
Vector_t getMeanPosition () const
 
Vector_t getStandardDeviationPosition () const
 
Vector_t getMeanMomentum () const
 
Vector_t getStandardDeviationMomentum () const
 
Vector_t getNormalizedEmittance () const
 
Vector_t getGeometricEmittance () const
 
Vector_t getStandardDeviationRP () const
 
Vector_t getHalo () const
 
Vector_t getMaxR () const
 
Vector_t get68Percentile () const
 
Vector_t get95Percentile () const
 
Vector_t get99Percentile () const
 
Vector_t get99_99Percentile () const
 
Vector_t getNormalizedEmittance68Percentile () const
 
Vector_t getNormalizedEmittance95Percentile () const
 
Vector_t getNormalizedEmittance99Percentile () const
 
Vector_t getNormalizedEmittance99_99Percentile () const
 
double getMeanTime () const
 
double getStdTime () const
 
double getMeanGamma () const
 
double getMeanKineticEnergy () const
 
double getTemperature () const
 
double getDebyeLength () const
 
double getPlasmaParameter () const
 
double getStdKineticEnergy () const
 
double getDx () const
 
double getDDx () const
 
double getDy () const
 
double getDDy () const
 
FMatrix< double, 6, 6 > getMoments6x6 () const
 
double getTotalCharge () const
 
double getTotalMass () const
 
double getTotalNumParticles () const
 

Private Types

using iterator_t = std::vector< Vektor< double, 2 > >::const_iterator
 

Private Member Functions

bool isParticleExcluded (const OpalParticle &) const
 
template<class InputIt >
void computeMeans (const InputIt &, const InputIt &)
 
template<class InputIt >
void computeStatistics (const InputIt &, const InputIt &)
 
template<class InputIt >
void computePercentiles (const InputIt &, const InputIt &)
 
std::pair< double, iterator_tdeterminePercentilesDetail (const iterator_t &begin, const iterator_t &end, const std::vector< int > &globalAccumulatedHistogram, const std::vector< int > &localAccumulatedHistogram, unsigned int dimension, int numRequiredParticles) const
 
double computeNormalizedEmittance (const iterator_t &begin, const iterator_t &end) const
 
void fillMembers (std::vector< double > const &)
 
void reset ()
 
void resetPlasmaParameters ()
 

Private Attributes

Vector_t meanR_m
 
Vector_t meanP_m
 
Vector_t stdR_m
 
Vector_t stdP_m
 
Vector_t stdRP_m
 
Vector_t normalizedEps_m
 
Vector_t geometricEps_m
 
Vector_t halo_m
 
Vector_t maxR_m
 
Vector_t minR_m
 
Vector_t sixtyEightPercentile_m
 
Vector_t normalizedEps68Percentile_m
 
Vector_t ninetyFivePercentile_m
 
Vector_t normalizedEps95Percentile_m
 
Vector_t ninetyNinePercentile_m
 
Vector_t normalizedEps99Percentile_m
 
Vector_t ninetyNine_NinetyNinePercentile_m
 
Vector_t normalizedEps99_99Percentile_m
 
double meanTime_m
 
double stdTime_m
 
double meanKineticEnergy_m
 
double temperature_m
 
double debyeLength_m
 
double plasmaParameter_m
 
double stdKineticEnergy_m
 
double meanGamma_m
 
double centroid_m [6]
 
FMatrix< double, 6, 6 > moments_m
 
double totalCharge_m
 
double totalMass_m
 
unsigned int totalNumParticles_m
 

Static Private Attributes

static const double percentileOneSigmaNormalDist_m = std::erf(1 / sqrt(2))
 
static const double percentileTwoSigmasNormalDist_m = std::erf(2 / sqrt(2))
 
static const double percentileThreeSigmasNormalDist_m = std::erf(3 / sqrt(2))
 
static const double percentileFourSigmasNormalDist_m = std::erf(4 / sqrt(2))
 

Detailed Description

Definition at line 33 of file DistributionMoments.h.

Member Typedef Documentation

◆ iterator_t

using DistributionMoments::iterator_t = std::vector<Vektor<double, 2> >::const_iterator
private

Definition at line 88 of file DistributionMoments.h.

Constructor & Destructor Documentation

◆ DistributionMoments()

DistributionMoments::DistributionMoments ( )

Definition at line 40 of file DistributionMoments.cpp.

References reset(), and resetPlasmaParameters().

Here is the call graph for this function:

Member Function Documentation

◆ compute() [1/2]

void DistributionMoments::compute ( const std::vector< OpalParticle >::const_iterator &  first,
const std::vector< OpalParticle >::const_iterator &  last 
)

Definition at line 51 of file DistributionMoments.cpp.

References computeStatistics().

Referenced by LossDataSink::saveH5().

Here is the call graph for this function:

◆ compute() [2/2]

void DistributionMoments::compute ( PartBunchBase< double, 3 > const &  bunch)

Definition at line 46 of file DistributionMoments.cpp.

References PartBunchBase< T, Dim >::begin(), computeStatistics(), and PartBunchBase< T, Dim >::end().

Here is the call graph for this function:

◆ computeDebyeLength()

void DistributionMoments::computeDebyeLength ( PartBunchBase< double, 3 > const &  bunch_r,
double  density 
)

◆ computeMeanKineticEnergy()

void DistributionMoments::computeMeanKineticEnergy ( PartBunchBase< double, 3 > const &  bunch)

Definition at line 422 of file DistributionMoments.cpp.

References allreduce(), Util::getKineticEnergy(), PartBunchBase< T, Dim >::getLocalNum(), and meanKineticEnergy_m.

Here is the call graph for this function:

◆ computeMeans()

template<class InputIt >
void DistributionMoments::computeMeans ( const InputIt &  first,
const InputIt &  last 
)
private

◆ computeNormalizedEmittance()

double DistributionMoments::computeNormalizedEmittance ( const iterator_t begin,
const iterator_t end 
) const
private

Definition at line 340 of file DistributionMoments.cpp.

References allreduce(), begin(), end(), max(), pow(), and sqrt().

Referenced by computePercentiles().

Here is the call graph for this function:

◆ computePercentiles()

template<class InputIt >
void DistributionMoments::computePercentiles ( const InputIt &  first,
const InputIt &  last 
)
private

◆ computePlasmaParameter()

void DistributionMoments::computePlasmaParameter ( double  density)

Definition at line 476 of file DistributionMoments.cpp.

References debyeLength_m, Physics::pi, plasmaParameter_m, and pow().

Referenced by computeDebyeLength().

Here is the call graph for this function:

◆ computeStatistics()

template<class InputIt >
void DistributionMoments::computeStatistics ( const InputIt &  first,
const InputIt &  last 
)
private

◆ determinePercentilesDetail()

std::pair< double, DistributionMoments::iterator_t > DistributionMoments::determinePercentilesDetail ( const iterator_t begin,
const iterator_t end,
const std::vector< int > &  globalAccumulatedHistogram,
const std::vector< int > &  localAccumulatedHistogram,
unsigned int  dimension,
int  numRequiredParticles 
) const
private

Computes the percentile and the range of all local particles that are contained therein. In a first step the container globalAccumulatedHistogram is looped through until accumulated histogram value exceeds the required number of particles. The percentile then is between the boundaries of the last histogram bin before the loop stopped. Then all particle coordinates that are between the boundaries of this bin are communicated acros all nodes and sorted. The exact percentile is then determined by counting the n smallest coordinates such that the total number of partiles results is equal to 'numRequiredParticles'. In accordance with matlab (?) the percentile is the midpoint between the last particle within the percentile and tje first particle outside. Finally each node determines which of its particles are contained in the percentile.

To determine the histogram, the coordinates should not be used directly. Instead, the absolute value of the difference between a coordinate and the mean, |x - <x>|, should be used so that the percentile values are similar to the standard deviation.

Parameters
beginbegin of a container containing the one dimensional phase space of all local particles.
endend of the container.
globalAccumulatedHistogramcontainer with partial sum of histogram values of position coordinates summed up across all nodes. The first value should be 0.
localAccumulatedHistogramcontainer with partial sum of histogram values of position coordinates of all local particles. The first value should be 0.
dimensiondimension of the one dimensional phase space.
numRequiredParticlesnumber of particles that are contained in the requested percentile. Is determined by the total number of particles and the percentile.
Returns
: pair of percentile and iterator pointing to the element after the range contained in the percentile.

Definition at line 292 of file DistributionMoments.cpp.

References abs(), allreduce(), begin(), end(), IpplInfo::getNodes(), meanR_m, and IpplInfo::myNode().

Referenced by computePercentiles().

Here is the call graph for this function:

◆ fillMembers()

void DistributionMoments::fillMembers ( std::vector< double > const &  localMoments)
private

◆ get68Percentile()

Vector_t DistributionMoments::get68Percentile ( ) const
inline

Definition at line 285 of file DistributionMoments.h.

References sixtyEightPercentile_m.

Referenced by LossDataSink::saveH5().

◆ get95Percentile()

Vector_t DistributionMoments::get95Percentile ( ) const
inline

Definition at line 297 of file DistributionMoments.h.

References ninetyFivePercentile_m.

Referenced by LossDataSink::saveH5().

◆ get99_99Percentile()

Vector_t DistributionMoments::get99_99Percentile ( ) const
inline

Definition at line 321 of file DistributionMoments.h.

References ninetyNine_NinetyNinePercentile_m.

Referenced by LossDataSink::saveH5().

◆ get99Percentile()

Vector_t DistributionMoments::get99Percentile ( ) const
inline

Definition at line 309 of file DistributionMoments.h.

References ninetyNinePercentile_m.

Referenced by LossDataSink::saveH5().

◆ getDDx()

double DistributionMoments::getDDx ( ) const
inline

Definition at line 243 of file DistributionMoments.h.

References moments_m.

◆ getDDy()

double DistributionMoments::getDDy ( ) const
inline

Definition at line 255 of file DistributionMoments.h.

References moments_m.

◆ getDebyeLength()

double DistributionMoments::getDebyeLength ( ) const
inline

Definition at line 220 of file DistributionMoments.h.

References debyeLength_m.

◆ getDx()

double DistributionMoments::getDx ( ) const
inline

Definition at line 237 of file DistributionMoments.h.

References moments_m.

◆ getDy()

double DistributionMoments::getDy ( ) const
inline

Definition at line 249 of file DistributionMoments.h.

References moments_m.

◆ getGeometricEmittance()

Vector_t DistributionMoments::getGeometricEmittance ( ) const
inline

Definition at line 170 of file DistributionMoments.h.

References geometricEps_m.

Referenced by LossDataSink::saveH5().

◆ getHalo()

Vector_t DistributionMoments::getHalo ( ) const
inline

Definition at line 182 of file DistributionMoments.h.

References halo_m.

◆ getMaxR()

Vector_t DistributionMoments::getMaxR ( ) const
inline

Definition at line 333 of file DistributionMoments.h.

References abs(), max(), maxR_m, and minR_m.

Referenced by LossDataSink::saveH5().

Here is the call graph for this function:

◆ getMeanGamma()

double DistributionMoments::getMeanGamma ( ) const
inline

Definition at line 200 of file DistributionMoments.h.

References meanGamma_m.

◆ getMeanKineticEnergy()

double DistributionMoments::getMeanKineticEnergy ( ) const
inline

Definition at line 206 of file DistributionMoments.h.

References meanKineticEnergy_m.

Referenced by LossDataSink::saveH5().

◆ getMeanMomentum()

Vector_t DistributionMoments::getMeanMomentum ( ) const
inline

Definition at line 152 of file DistributionMoments.h.

References meanP_m.

Referenced by LossDataSink::saveH5().

◆ getMeanPosition()

Vector_t DistributionMoments::getMeanPosition ( ) const
inline

Definition at line 140 of file DistributionMoments.h.

References meanR_m.

Referenced by LossDataSink::saveH5().

◆ getMeanTime()

double DistributionMoments::getMeanTime ( ) const
inline

Definition at line 188 of file DistributionMoments.h.

References meanTime_m.

Referenced by LossDataSink::saveH5().

◆ getMoments6x6()

FMatrix< double, 6, 6 > DistributionMoments::getMoments6x6 ( ) const
inline

Definition at line 261 of file DistributionMoments.h.

References moments_m.

◆ getNormalizedEmittance()

Vector_t DistributionMoments::getNormalizedEmittance ( ) const
inline

Definition at line 164 of file DistributionMoments.h.

References normalizedEps_m.

Referenced by LossDataSink::saveH5().

◆ getNormalizedEmittance68Percentile()

Vector_t DistributionMoments::getNormalizedEmittance68Percentile ( ) const
inline

Definition at line 291 of file DistributionMoments.h.

References normalizedEps68Percentile_m.

Referenced by LossDataSink::saveH5().

◆ getNormalizedEmittance95Percentile()

Vector_t DistributionMoments::getNormalizedEmittance95Percentile ( ) const
inline

Definition at line 303 of file DistributionMoments.h.

References normalizedEps95Percentile_m.

Referenced by LossDataSink::saveH5().

◆ getNormalizedEmittance99_99Percentile()

Vector_t DistributionMoments::getNormalizedEmittance99_99Percentile ( ) const
inline

Definition at line 327 of file DistributionMoments.h.

References normalizedEps99_99Percentile_m.

Referenced by LossDataSink::saveH5().

◆ getNormalizedEmittance99Percentile()

Vector_t DistributionMoments::getNormalizedEmittance99Percentile ( ) const
inline

Definition at line 315 of file DistributionMoments.h.

References normalizedEps99Percentile_m.

Referenced by LossDataSink::saveH5().

◆ getPlasmaParameter()

double DistributionMoments::getPlasmaParameter ( ) const
inline

Definition at line 225 of file DistributionMoments.h.

References plasmaParameter_m.

◆ getStandardDeviationMomentum()

Vector_t DistributionMoments::getStandardDeviationMomentum ( ) const
inline

Definition at line 158 of file DistributionMoments.h.

References stdP_m.

Referenced by LossDataSink::saveH5().

◆ getStandardDeviationPosition()

Vector_t DistributionMoments::getStandardDeviationPosition ( ) const
inline

Definition at line 146 of file DistributionMoments.h.

References stdR_m.

Referenced by LossDataSink::saveH5().

◆ getStandardDeviationRP()

Vector_t DistributionMoments::getStandardDeviationRP ( ) const
inline

Definition at line 176 of file DistributionMoments.h.

References stdRP_m.

◆ getStdKineticEnergy()

double DistributionMoments::getStdKineticEnergy ( ) const
inline

Definition at line 231 of file DistributionMoments.h.

References stdKineticEnergy_m.

Referenced by LossDataSink::saveH5().

◆ getStdTime()

double DistributionMoments::getStdTime ( ) const
inline

Definition at line 194 of file DistributionMoments.h.

References stdTime_m.

Referenced by LossDataSink::saveH5().

◆ getTemperature()

double DistributionMoments::getTemperature ( ) const
inline

Definition at line 213 of file DistributionMoments.h.

References Physics::c, Units::eV2kg, Physics::kB, and temperature_m.

◆ getTotalCharge()

double DistributionMoments::getTotalCharge ( ) const
inline

Definition at line 267 of file DistributionMoments.h.

References totalCharge_m.

Referenced by LossDataSink::saveH5().

◆ getTotalMass()

double DistributionMoments::getTotalMass ( ) const
inline

Definition at line 273 of file DistributionMoments.h.

References totalMass_m.

Referenced by LossDataSink::saveH5().

◆ getTotalNumParticles()

double DistributionMoments::getTotalNumParticles ( ) const
inline

Definition at line 279 of file DistributionMoments.h.

References totalNumParticles_m.

◆ isParticleExcluded()

bool DistributionMoments::isParticleExcluded ( const OpalParticle particle) const
private

Definition at line 521 of file DistributionMoments.cpp.

References Options::amr, OpalParticle::getId(), OpalData::getInstance(), and OpalData::isInOPALCyclMode().

Referenced by computeMeans(), and computeStatistics().

Here is the call graph for this function:

◆ reset()

void DistributionMoments::reset ( )
private

◆ resetPlasmaParameters()

void DistributionMoments::resetPlasmaParameters ( )
private

Definition at line 514 of file DistributionMoments.cpp.

References debyeLength_m, plasmaParameter_m, and temperature_m.

Referenced by computeDebyeLength(), and DistributionMoments().

Member Data Documentation

◆ centroid_m

double DistributionMoments::centroid_m[6]
private

Definition at line 126 of file DistributionMoments.h.

Referenced by computeMeans(), computeStatistics(), fillMembers(), and reset().

◆ debyeLength_m

double DistributionMoments::debyeLength_m
private

◆ geometricEps_m

Vector_t DistributionMoments::geometricEps_m
private

Definition at line 105 of file DistributionMoments.h.

Referenced by fillMembers(), getGeometricEmittance(), and reset().

◆ halo_m

Vector_t DistributionMoments::halo_m
private

Definition at line 106 of file DistributionMoments.h.

Referenced by fillMembers(), getHalo(), and reset().

◆ maxR_m

Vector_t DistributionMoments::maxR_m
private

Definition at line 107 of file DistributionMoments.h.

Referenced by computeMeans(), computePercentiles(), and getMaxR().

◆ meanGamma_m

double DistributionMoments::meanGamma_m
private

Definition at line 125 of file DistributionMoments.h.

Referenced by computeMeans(), fillMembers(), and getMeanGamma().

◆ meanKineticEnergy_m

double DistributionMoments::meanKineticEnergy_m
private

◆ meanP_m

Vector_t DistributionMoments::meanP_m
private

Definition at line 100 of file DistributionMoments.h.

Referenced by computeMeans(), fillMembers(), getMeanMomentum(), and reset().

◆ meanR_m

Vector_t DistributionMoments::meanR_m
private

◆ meanTime_m

double DistributionMoments::meanTime_m
private

Definition at line 118 of file DistributionMoments.h.

Referenced by computeMeans(), computeStatistics(), and getMeanTime().

◆ minR_m

Vector_t DistributionMoments::minR_m
private

Definition at line 108 of file DistributionMoments.h.

Referenced by computeMeans(), computePercentiles(), and getMaxR().

◆ moments_m

FMatrix<double, 6, 6> DistributionMoments::moments_m
private

Definition at line 127 of file DistributionMoments.h.

Referenced by fillMembers(), getDDx(), getDDy(), getDx(), getDy(), getMoments6x6(), and reset().

◆ ninetyFivePercentile_m

Vector_t DistributionMoments::ninetyFivePercentile_m
private

Definition at line 111 of file DistributionMoments.h.

Referenced by computePercentiles(), get95Percentile(), and reset().

◆ ninetyNine_NinetyNinePercentile_m

Vector_t DistributionMoments::ninetyNine_NinetyNinePercentile_m
private

Definition at line 115 of file DistributionMoments.h.

Referenced by computePercentiles(), get99_99Percentile(), and reset().

◆ ninetyNinePercentile_m

Vector_t DistributionMoments::ninetyNinePercentile_m
private

Definition at line 113 of file DistributionMoments.h.

Referenced by computePercentiles(), get99Percentile(), and reset().

◆ normalizedEps68Percentile_m

Vector_t DistributionMoments::normalizedEps68Percentile_m
private

◆ normalizedEps95Percentile_m

Vector_t DistributionMoments::normalizedEps95Percentile_m
private

◆ normalizedEps99_99Percentile_m

Vector_t DistributionMoments::normalizedEps99_99Percentile_m
private

◆ normalizedEps99Percentile_m

Vector_t DistributionMoments::normalizedEps99Percentile_m
private

◆ normalizedEps_m

Vector_t DistributionMoments::normalizedEps_m
private

Definition at line 104 of file DistributionMoments.h.

Referenced by fillMembers(), getNormalizedEmittance(), and reset().

◆ percentileFourSigmasNormalDist_m

const double DistributionMoments::percentileFourSigmasNormalDist_m = std::erf(4 / sqrt(2))
staticprivate

Definition at line 136 of file DistributionMoments.h.

Referenced by computePercentiles().

◆ percentileOneSigmaNormalDist_m

const double DistributionMoments::percentileOneSigmaNormalDist_m = std::erf(1 / sqrt(2))
staticprivate

Definition at line 133 of file DistributionMoments.h.

Referenced by computePercentiles().

◆ percentileThreeSigmasNormalDist_m

const double DistributionMoments::percentileThreeSigmasNormalDist_m = std::erf(3 / sqrt(2))
staticprivate

Definition at line 135 of file DistributionMoments.h.

Referenced by computePercentiles().

◆ percentileTwoSigmasNormalDist_m

const double DistributionMoments::percentileTwoSigmasNormalDist_m = std::erf(2 / sqrt(2))
staticprivate

Definition at line 134 of file DistributionMoments.h.

Referenced by computePercentiles().

◆ plasmaParameter_m

double DistributionMoments::plasmaParameter_m
private

◆ sixtyEightPercentile_m

Vector_t DistributionMoments::sixtyEightPercentile_m
private

Definition at line 109 of file DistributionMoments.h.

Referenced by computePercentiles(), get68Percentile(), and reset().

◆ stdKineticEnergy_m

double DistributionMoments::stdKineticEnergy_m
private

Definition at line 124 of file DistributionMoments.h.

Referenced by fillMembers(), getStdKineticEnergy(), and reset().

◆ stdP_m

Vector_t DistributionMoments::stdP_m
private

Definition at line 102 of file DistributionMoments.h.

Referenced by fillMembers(), getStandardDeviationMomentum(), and reset().

◆ stdR_m

Vector_t DistributionMoments::stdR_m
private

Definition at line 101 of file DistributionMoments.h.

Referenced by fillMembers(), getStandardDeviationPosition(), and reset().

◆ stdRP_m

Vector_t DistributionMoments::stdRP_m
private

Definition at line 103 of file DistributionMoments.h.

Referenced by fillMembers(), getStandardDeviationRP(), and reset().

◆ stdTime_m

double DistributionMoments::stdTime_m
private

Definition at line 119 of file DistributionMoments.h.

Referenced by fillMembers(), and getStdTime().

◆ temperature_m

double DistributionMoments::temperature_m
private

◆ totalCharge_m

double DistributionMoments::totalCharge_m
private

Definition at line 129 of file DistributionMoments.h.

Referenced by fillMembers(), getTotalCharge(), and reset().

◆ totalMass_m

double DistributionMoments::totalMass_m
private

Definition at line 130 of file DistributionMoments.h.

Referenced by fillMembers(), getTotalMass(), and reset().

◆ totalNumParticles_m

unsigned int DistributionMoments::totalNumParticles_m
private

The documentation for this class was generated from the following files: