OPAL (Object Oriented Parallel Accelerator Library)  2024.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

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 ( )

Definition at line 40 of file DistributionMoments.cpp.

References reset(), and resetPlasmaParameters().

Here is the call graph for this function:

Member Function Documentation

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 PartBunchBase< T, Dim >::calcBeamParameters(), and LossDataSink::saveH5().

Here is the call graph for this function:

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:

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

Definition at line 422 of file DistributionMoments.cpp.

References allreduce(), Util::getKineticEnergy(), and meanKineticEnergy_m.

Referenced by PartBunchBase< T, Dim >::calcEMean().

Here is the call graph for this function:

template<class InputIt >
void DistributionMoments::computeMeans ( const InputIt &  first,
const InputIt &  last 
)
private
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, it, max(), pow(), and sqrt().

Referenced by computePercentiles().

Here is the call graph for this function:

template<class InputIt >
void DistributionMoments::computePercentiles ( const InputIt &  first,
const InputIt &  last 
)
private
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:

template<class InputIt >
void DistributionMoments::computeStatistics ( const InputIt &  first,
const InputIt &  last 
)
private
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
begin,:begin of a container containing the one dimensional phase space of all local particles.
end,:end of the container.
globalAccumulatedHistogram,:container with partial sum of histogram values of position coordinates summed up across all nodes. The first value should be 0.
localAccumulatedHistogram,:container with partial sum of histogram values of position coordinates of all local particles. The first value should be 0.
dimension,:dimension of the one dimensional phase space.
numRequiredParticles,:number 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(), end, IpplInfo::getNodes(), it, meanR_m, and IpplInfo::myNode().

Referenced by computePercentiles().

Here is the call graph for this function:

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

Definition at line 285 of file DistributionMoments.h.

References sixtyEightPercentile_m.

Referenced by PartBunchBase< T, Dim >::get_68Percentile().

Vector_t DistributionMoments::get95Percentile ( ) const
inline

Definition at line 297 of file DistributionMoments.h.

References ninetyFivePercentile_m.

Referenced by PartBunchBase< T, Dim >::get_95Percentile().

Vector_t DistributionMoments::get99_99Percentile ( ) const
inline
Vector_t DistributionMoments::get99Percentile ( ) const
inline

Definition at line 309 of file DistributionMoments.h.

References ninetyNinePercentile_m.

Referenced by PartBunchBase< T, Dim >::get_99Percentile().

double DistributionMoments::getDDx ( ) const
inline

Definition at line 243 of file DistributionMoments.h.

References moments_m.

Referenced by PartBunchBase< T, Dim >::get_DDx().

double DistributionMoments::getDDy ( ) const
inline

Definition at line 255 of file DistributionMoments.h.

References moments_m.

Referenced by PartBunchBase< T, Dim >::get_DDy().

double DistributionMoments::getDebyeLength ( ) const
inline

Definition at line 220 of file DistributionMoments.h.

References debyeLength_m.

Referenced by PartBunchBase< T, Dim >::get_debyeLength().

double DistributionMoments::getDx ( ) const
inline

Definition at line 237 of file DistributionMoments.h.

References moments_m.

Referenced by PartBunchBase< T, Dim >::get_Dx().

double DistributionMoments::getDy ( ) const
inline

Definition at line 249 of file DistributionMoments.h.

References moments_m.

Referenced by PartBunchBase< T, Dim >::get_Dy().

Vector_t DistributionMoments::getGeometricEmittance ( ) const
inline

Definition at line 170 of file DistributionMoments.h.

References geometricEps_m.

Referenced by PartBunchBase< T, Dim >::get_emit().

Vector_t DistributionMoments::getHalo ( ) const
inline

Definition at line 182 of file DistributionMoments.h.

References halo_m.

Referenced by PartBunchBase< T, Dim >::get_halo().

Vector_t DistributionMoments::getMaxR ( ) const
inline

Definition at line 333 of file DistributionMoments.h.

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

Here is the call graph for this function:

double DistributionMoments::getMeanGamma ( ) const
inline

Definition at line 200 of file DistributionMoments.h.

References meanGamma_m.

Referenced by PartBunchBase< T, Dim >::get_gamma().

double DistributionMoments::getMeanKineticEnergy ( ) const
inline
Vector_t DistributionMoments::getMeanMomentum ( ) const
inline

Definition at line 152 of file DistributionMoments.h.

References meanP_m.

Referenced by PartBunchBase< T, Dim >::get_pmean().

Vector_t DistributionMoments::getMeanPosition ( ) const
inline
double DistributionMoments::getMeanTime ( ) const
inline

Definition at line 188 of file DistributionMoments.h.

References meanTime_m.

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

Definition at line 261 of file DistributionMoments.h.

References moments_m.

Referenced by PartBunchBase< T, Dim >::getSigmaMatrix().

Vector_t DistributionMoments::getNormalizedEmittance ( ) const
inline

Definition at line 164 of file DistributionMoments.h.

References normalizedEps_m.

Referenced by PartBunchBase< T, Dim >::get_norm_emit().

Vector_t DistributionMoments::getNormalizedEmittance68Percentile ( ) const
inline
Vector_t DistributionMoments::getNormalizedEmittance95Percentile ( ) const
inline
Vector_t DistributionMoments::getNormalizedEmittance99_99Percentile ( ) const
inline
Vector_t DistributionMoments::getNormalizedEmittance99Percentile ( ) const
inline
double DistributionMoments::getPlasmaParameter ( ) const
inline

Definition at line 225 of file DistributionMoments.h.

References plasmaParameter_m.

Referenced by PartBunchBase< T, Dim >::get_plasmaParameter().

Vector_t DistributionMoments::getStandardDeviationMomentum ( ) const
inline

Definition at line 158 of file DistributionMoments.h.

References stdP_m.

Referenced by PartBunchBase< T, Dim >::get_prms().

Vector_t DistributionMoments::getStandardDeviationPosition ( ) const
inline
Vector_t DistributionMoments::getStandardDeviationRP ( ) const
inline

Definition at line 176 of file DistributionMoments.h.

References stdRP_m.

Referenced by PartBunchBase< T, Dim >::get_rprms().

double DistributionMoments::getStdKineticEnergy ( ) const
inline

Definition at line 231 of file DistributionMoments.h.

References stdKineticEnergy_m.

Referenced by PartBunchBase< T, Dim >::getdE().

double DistributionMoments::getStdTime ( ) const
inline

Definition at line 194 of file DistributionMoments.h.

References stdTime_m.

double DistributionMoments::getTemperature ( ) const
inline
double DistributionMoments::getTotalCharge ( ) const
inline

Definition at line 267 of file DistributionMoments.h.

References totalCharge_m.

double DistributionMoments::getTotalMass ( ) const
inline

Definition at line 273 of file DistributionMoments.h.

References totalMass_m.

double DistributionMoments::getTotalNumParticles ( ) const
inline

Definition at line 279 of file DistributionMoments.h.

References totalNumParticles_m.

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:

void DistributionMoments::reset ( )
private
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

double DistributionMoments::centroid_m[6]
private

Definition at line 126 of file DistributionMoments.h.

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

double DistributionMoments::debyeLength_m
private
Vector_t DistributionMoments::geometricEps_m
private

Definition at line 105 of file DistributionMoments.h.

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

Vector_t DistributionMoments::halo_m
private

Definition at line 106 of file DistributionMoments.h.

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

Vector_t DistributionMoments::maxR_m
private

Definition at line 107 of file DistributionMoments.h.

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

double DistributionMoments::meanGamma_m
private

Definition at line 125 of file DistributionMoments.h.

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

double DistributionMoments::meanKineticEnergy_m
private
Vector_t DistributionMoments::meanP_m
private

Definition at line 100 of file DistributionMoments.h.

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

Vector_t DistributionMoments::meanR_m
private
double DistributionMoments::meanTime_m
private

Definition at line 118 of file DistributionMoments.h.

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

Vector_t DistributionMoments::minR_m
private

Definition at line 108 of file DistributionMoments.h.

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

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().

Vector_t DistributionMoments::ninetyFivePercentile_m
private

Definition at line 111 of file DistributionMoments.h.

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

Vector_t DistributionMoments::ninetyNine_NinetyNinePercentile_m
private

Definition at line 115 of file DistributionMoments.h.

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

Vector_t DistributionMoments::ninetyNinePercentile_m
private

Definition at line 113 of file DistributionMoments.h.

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

Vector_t DistributionMoments::normalizedEps68Percentile_m
private
Vector_t DistributionMoments::normalizedEps95Percentile_m
private
Vector_t DistributionMoments::normalizedEps99_99Percentile_m
private
Vector_t DistributionMoments::normalizedEps99Percentile_m
private
Vector_t DistributionMoments::normalizedEps_m
private

Definition at line 104 of file DistributionMoments.h.

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

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

Definition at line 136 of file DistributionMoments.h.

Referenced by computePercentiles().

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

Definition at line 133 of file DistributionMoments.h.

Referenced by computePercentiles().

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

Definition at line 135 of file DistributionMoments.h.

Referenced by computePercentiles().

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

Definition at line 134 of file DistributionMoments.h.

Referenced by computePercentiles().

double DistributionMoments::plasmaParameter_m
private
Vector_t DistributionMoments::sixtyEightPercentile_m
private

Definition at line 109 of file DistributionMoments.h.

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

double DistributionMoments::stdKineticEnergy_m
private

Definition at line 124 of file DistributionMoments.h.

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

Vector_t DistributionMoments::stdP_m
private

Definition at line 102 of file DistributionMoments.h.

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

Vector_t DistributionMoments::stdR_m
private

Definition at line 101 of file DistributionMoments.h.

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

Vector_t DistributionMoments::stdRP_m
private

Definition at line 103 of file DistributionMoments.h.

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

double DistributionMoments::stdTime_m
private

Definition at line 119 of file DistributionMoments.h.

Referenced by fillMembers(), and getStdTime().

double DistributionMoments::temperature_m
private
double DistributionMoments::totalCharge_m
private

Definition at line 129 of file DistributionMoments.h.

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

double DistributionMoments::totalMass_m
private

Definition at line 130 of file DistributionMoments.h.

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

unsigned int DistributionMoments::totalNumParticles_m
private

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