9 #include <boost/numeric/ublas/matrix.hpp>
10 #include <boost/numeric/ublas/io.hpp>
14 #include "constants.h"
17 # define SampleFreq 80.5e6
19 # define SampleLambda (C0/SampleFreq*MtoMM)
38 IonZ = IonQ = IonEs = IonW
41 = std::numeric_limits<double>::quiet_NaN();
48 gamma = (IonEs != 0e0)? IonW/IonEs : 1e0;
49 beta = sqrt(1e0-1e0/(gamma*gamma));
50 bg = (beta != 0e0)? beta*gamma : 1e0;
51 SampleIonK = 2e0*M_PI/(beta*SampleLambda);
55 std::ostream& operator<<(std::ostream&,
const Particle&);
80 PS_X, PS_PX, PS_Y, PS_PY, PS_S, PS_PS,
87 typedef boost::numeric::ublas::vector<double,
88 boost::numeric::ublas::bounded_array<double, maxsize>
91 typedef boost::numeric::ublas::matrix<double,
92 boost::numeric::ublas::row_major,
93 boost::numeric::ublas::bounded_array<double, maxsize*maxsize>
98 virtual void show(std::ostream& strm,
int level)
const;
103 std::vector<Particle> real;
104 std::vector<vector_t> moment0;
105 std::vector<matrix_t> moment1;
107 vector_t moment0_env, moment0_rms;
108 matrix_t moment1_env;
118 for(
size_t i=0; i<real.size(); i++) real[i].recalc();
123 inline size_t size()
const {
return real.size(); }
135 typedef state_t::matrix_t value_t;
140 void get_misalign(
const state_t& ST,
const Particle& real, value_t& M, value_t& IM)
const;
155 virtual void show(std::ostream& strm,
int level)
const;
158 std::vector<Particle> last_real_in, last_real_out;
161 std::vector<value_t> misalign, misalign_inv;
164 double dx, dy, pitch, yaw, roll;
174 state_t::matrix_t scratch;
177 #endif // FLAME_MOMENT_H
double gamma
Gamma for ion. (dependent)
virtual bool check_cache(const state_t &S) const
virtual bool getArray(unsigned idx, ArrayInfo &Info)
Introspect named parameter of the derived class.
Base class for all simulated elements.
double IonW
Total energy. (dependent)
double IonEk
Kinetic energy.
virtual void show(std::ostream &strm, int level) const
The abstract base class for all simulation state objects.
virtual void advance(StateBase &s)
Propogate the given State through this Element.
double phis
Absolute synchrotron phase [rad].
Associative configuration container.
virtual void recompute_matrix(state_t &ST)
recalculate 'transfer' taking into consideration the provided input state
Used with StateBase::getArray() to describe a single parameter.
virtual void assign(const ElementVoid *other)=0
virtual void assign(const StateBase &other)
double dx
constituents of misalign
bool skipcache
If set, check_cache() will always return false.
size_t size() const
of charge states
std::vector< value_t > transfer
final transfer matricies
double beta
Beta for ion. (dependent)
double bg
Beta*gamma. (dependent)
virtual void show(std::ostream &strm, int level) const
virtual MomentState * clone() const
double SampleIonK
Sample rate; different RF Cavity due to RF frequenies. (dependent)
void resize_cache(const state_t &ST)
An Element which propagates the statistical moments of a bunch.