BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Data Fields | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes
SamplerAnalysis Class Reference

Analysis routines for an individual sampler. More...

#include <SamplerAnalysis.hh>

Collaboration diagram for SamplerAnalysis:
Collaboration graph

Public Member Functions

 SamplerAnalysis (BDSOutputROOTEventSampler< float > *samplerIn, bool debugIn=false)
 
 SamplerAnalysis (BDSOutputROOTEventSampler< double > *samplerIn, bool debugIn=false)
 
void CommonCtor ()
 Initialisation of arrays for optical function calculations.
 
void Initialise ()
 Initialise variables.
 
void Process (bool firstTime=false)
 Loop over all entries in the sampler and accumulate power sums over variuos moments.
 
std::vector< double > Terminate (std::vector< double > emittance, bool useEmittanceFromFirstSampler=true)
 Calculate optical functions based on combinations of moments already accumulated.
 
std::vector< std::vector< double > > GetOpticalFunctions ()
 Accessor for optical functions.
 

Static Public Member Functions

static void UpdateMass (SamplerAnalysis *s)
 Set primary particle mass for optical functions from sampler data.
 
static void UpdateMass (const std::string &particleName)
 Set primary particle mass for optical functions from particle name.
 

Data Fields

BDSOutputROOTEventSampler< float > * s
 
BDSOutputROOTEventSampler< double > * s
 
BDSOutputROOTEventSampler< double > * p
 

Protected Types

typedef std::vector< std::vector< double > > twoDArray
 
typedef std::vector< std::vector< std::vector< double > > > threeDArray
 
typedef std::vector< std::vector< std::vector< std::vector< double > > > > fourDArray
 

Protected Member Functions

double powSumToCentralMoment (fourDArray &powSum, long long int npartIn, int i, int j, int m, int n)
 
double centMomToCovariance (fourDArray &centMoms, long long int npartIn, int k, int i, int j)
 
double centMomToDerivative (fourDArray &centMoms, int k, int t, int i)
 
void printBeamCorrelationMatrix (fourDArray &centMoms)
 

Protected Attributes

long long int npart
 
double S
 
std::vector< double > coordinates
 
std::vector< double > offsets
 
fourDArray powSums
 
fourDArray cenMoms
 
fourDArray powSumsFirst
 
fourDArray cenMomsFirst
 
threeDArray covMats
 
threeDArray derivMats
 
twoDArray optical
 emt, alf, bta, gma, eta, etapr, mean, sigma
 
twoDArray varOptical
 variances of optical functions
 

Static Protected Attributes

static double particleMass = 0
 

Private Attributes

bool debug
 

Detailed Description

Analysis routines for an individual sampler.

Author
Stewart Boogert, Andrey Abramov

Definition at line 30 of file SamplerAnalysis.hh.

Member Typedef Documentation

◆ fourDArray

typedef std::vector<std::vector<std::vector<std::vector<double> > > > SamplerAnalysis::fourDArray
protected

Definition at line 88 of file SamplerAnalysis.hh.

◆ threeDArray

typedef std::vector<std::vector<std::vector<double> > > SamplerAnalysis::threeDArray
protected

Definition at line 87 of file SamplerAnalysis.hh.

◆ twoDArray

typedef std::vector<std::vector<double> > SamplerAnalysis::twoDArray
protected

Definition at line 86 of file SamplerAnalysis.hh.

Constructor & Destructor Documentation

◆ SamplerAnalysis() [1/2]

SamplerAnalysis::SamplerAnalysis ( )

Definition at line 27 of file SamplerAnalysis.cc.

◆ SamplerAnalysis() [2/2]

SamplerAnalysis::SamplerAnalysis ( BDSOutputROOTEventSampler< float > *  samplerIn,
bool  debugIn = false 
)

Definition at line 37 of file SamplerAnalysis.cc.

◆ ~SamplerAnalysis()

SamplerAnalysis::~SamplerAnalysis ( )
virtual

Definition at line 160 of file SamplerAnalysis.cc.

Member Function Documentation

◆ centMomToCovariance()

double SamplerAnalysis::centMomToCovariance ( fourDArray &  centMoms,
long long int  npartIn,
int  k,
int  i,
int  j 
)
protected

Returns a matrix element of the parameter covariance matrix which is a 3x3 symmetric matrix in each plane (coupling is ignored). Arguments: int k: plane specifier (k=0: horizontal, k=1: vertical, k=2: longitudinal) int i,j: indices of matrix elements (i,j=0: <uu>, i,j=1: <u'u'>, i,j=2: <uu'>) e.g. covMat[0][1][2] = cov[<x'x'>,<xx'>], covMat[1][0][0] = cov[<yy>,<yy>]

Definition at line 517 of file SamplerAnalysis.cc.

Referenced by Terminate().

Here is the caller graph for this function:

◆ centMomToDerivative()

double SamplerAnalysis::centMomToDerivative ( fourDArray &  centMoms,
int  k,
int  t,
int  i 
)
protected

Returns the derivative of an optical function w.r.t. central moments. Arguments: int t: function specifier, corresponds to index of the function in the optical function vector. int k: plane specifier (k=0: horizontal, k=1: vertical, k=2: longitudinal) int i: central moment to diffrentiate w.r.t, i=0: <uu>, i=1: <u'u'>, i=2: <uu'> e.g. derivMat[t=2][k=0][i=0]: d(beta)/d<xx> , derivMat[t=0][k=1][i=1]: d(emittance)/d<yy'>

Definition at line 595 of file SamplerAnalysis.cc.

Referenced by Terminate().

Here is the caller graph for this function:

◆ CommonCtor()

void SamplerAnalysis::CommonCtor ( )

Initialisation of arrays for optical function calculations.

Definition at line 91 of file SamplerAnalysis.cc.

References optical, and varOptical.

◆ GetOpticalFunctions()

std::vector< std::vector< double > > SamplerAnalysis::GetOpticalFunctions ( )
inline

Accessor for optical functions.

Definition at line 58 of file SamplerAnalysis.hh.

References optical.

◆ Initialise()

void SamplerAnalysis::Initialise ( )

Initialise variables.

Definition at line 163 of file SamplerAnalysis.cc.

◆ powSumToCentralMoment()

double SamplerAnalysis::powSumToCentralMoment ( fourDArray &  powSum,
long long int  npartIn,
int  i,
int  j,
int  m,
int  n 
)
protected

Returns a central moment calculated from the corresponding coordinate power sums. Arguments: powSums: array contatining the coordinate power sums a, b: integer identifier for the coordinate (0->x, 1->xp, 2->y, 3->yp, 4->E, 5->t) m, n: order of the moment wrt to the coordinate note: total order of the mixed moment is given by k = m + n

Definition at line 389 of file SamplerAnalysis.cc.

Referenced by Terminate().

Here is the caller graph for this function:

◆ printBeamCorrelationMatrix()

void SamplerAnalysis::printBeamCorrelationMatrix ( fourDArray &  centMoms)
protected

Definition at line 751 of file SamplerAnalysis.cc.

◆ Process()

void SamplerAnalysis::Process ( bool  firstTime = false)

Loop over all entries in the sampler and accumulate power sums over variuos moments.

Definition at line 168 of file SamplerAnalysis.cc.

◆ Terminate()

std::vector< double > SamplerAnalysis::Terminate ( std::vector< double >  emittance,
bool  useEmittanceFromFirstSampler = true 
)

Calculate optical functions based on combinations of moments already accumulated.

Definition at line 215 of file SamplerAnalysis.cc.

References centMomToCovariance(), centMomToDerivative(), optical, powSumToCentralMoment(), and varOptical.

Here is the call graph for this function:

◆ UpdateMass() [1/2]

void SamplerAnalysis::UpdateMass ( const std::string &  particleName)
static

Set primary particle mass for optical functions from particle name.

Definition at line 72 of file SamplerAnalysis.cc.

◆ UpdateMass() [2/2]

void SamplerAnalysis::UpdateMass ( SamplerAnalysis s)
static

Set primary particle mass for optical functions from sampler data.

Definition at line 51 of file SamplerAnalysis.cc.

Referenced by EventAnalysis::EventAnalysis().

Here is the caller graph for this function:

Field Documentation

◆ cenMoms

fourDArray SamplerAnalysis::cenMoms
protected

Definition at line 91 of file SamplerAnalysis.hh.

◆ cenMomsFirst

fourDArray SamplerAnalysis::cenMomsFirst
protected

Definition at line 94 of file SamplerAnalysis.hh.

◆ coordinates

std::vector<double> SamplerAnalysis::coordinates
protected

Definition at line 81 of file SamplerAnalysis.hh.

◆ covMats

threeDArray SamplerAnalysis::covMats
protected

Definition at line 96 of file SamplerAnalysis.hh.

◆ debug

bool SamplerAnalysis::debug
private

Definition at line 143 of file SamplerAnalysis.hh.

◆ derivMats

threeDArray SamplerAnalysis::derivMats
protected

Definition at line 97 of file SamplerAnalysis.hh.

◆ npart

long long int SamplerAnalysis::npart
protected

Definition at line 77 of file SamplerAnalysis.hh.

◆ offsets

std::vector<double> SamplerAnalysis::offsets
protected

Definition at line 84 of file SamplerAnalysis.hh.

◆ optical

twoDArray SamplerAnalysis::optical
protected

emt, alf, bta, gma, eta, etapr, mean, sigma

Definition at line 98 of file SamplerAnalysis.hh.

Referenced by CommonCtor(), GetOpticalFunctions(), and Terminate().

◆ p

BDSOutputROOTEventSampler<double>* SamplerAnalysis::p

Definition at line 70 of file SamplerAnalysis.hh.

◆ particleMass

double SamplerAnalysis::particleMass = 0
staticprotected

Definition at line 74 of file SamplerAnalysis.hh.

◆ powSums

fourDArray SamplerAnalysis::powSums
protected

Definition at line 90 of file SamplerAnalysis.hh.

◆ powSumsFirst

fourDArray SamplerAnalysis::powSumsFirst
protected

Definition at line 93 of file SamplerAnalysis.hh.

◆ s [1/2]

BDSOutputROOTEventSampler<float>* SamplerAnalysis::s

Definition at line 67 of file SamplerAnalysis.hh.

◆ s [2/2]

BDSOutputROOTEventSampler<double>* SamplerAnalysis::s

Definition at line 69 of file SamplerAnalysis.hh.

◆ S

double SamplerAnalysis::S
protected

Definition at line 78 of file SamplerAnalysis.hh.

◆ varOptical

twoDArray SamplerAnalysis::varOptical
protected

variances of optical functions

Definition at line 99 of file SamplerAnalysis.hh.

Referenced by CommonCtor(), and Terminate().


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