56 "The \"BEAM\" statement defines data for the particles "
58 reference(1.0,
Physics::
m_p *energy_scale, 1.0 * energy_scale) {
61 (
"PARTICLE",
"Name of particle to be used",
76 (
"MASS",
"Particle rest mass [GeV]");
79 (
"CHARGE",
"Particle charge in proton charges");
82 (
"ENERGY",
"Particle energy [GeV]");
85 (
"PC",
"Particle momentum [GeV/c]");
88 (
"GAMMA",
"ENERGY / MASS");
91 (
"BCURRENT",
"Beam current [A] (all bunches)");
94 (
"BFREQ",
"Beam frequency [MHz] (all bunches)");
97 (
"NPART",
"Number of particles in bunch");
116 reference(parent->reference)
126 return dynamic_cast<Beam*
>(object) != 0;
140 "The energy hasn't been set. Set either GAMMA, ENERGY or PC.");
198 static const char *names[] = {
213 static const double masses[] = {
228 static const double charges[] = {
229 -1.0, 1.0, 1.0, -1.0, 12.0, -1.0, 35.0, -1.0, 1.0, 20.0, 1.0, 2.0
234 for (
unsigned int i = 0; i < numParticleNames; ++ i) {
235 if (pName == names[i]) {
256 "\"GAMMA\" should be greater than 1.");
264 "\"ENERGY\" should be greater than \"MASS\".");
272 "\"PC\" should be greater than 0.");
294 os <<
"* ************* B E A M ************************************************************ " <<
std::endl;
299 <<
"* CHARGE " << (charge > 0 ?
'+' :
'-') <<
"e * " <<
std::abs(charge) <<
" \n"
303 os <<
"* ********************************************************************************** " <<
std::endl;
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
PartBunchBase< T, Dim >::ConstIterator begin(PartBunchBase< T, Dim > const &bunch)
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
PETE_TBTree< FnCopysign, PETE_Scalar< Vektor< T1, Dim > >, typename T2::PETE_Expr_t > copysign(const Vektor< T1, Dim > &l, const PETE_Expr< T2 > &r)
Inform & endl(Inform &inf)
Representation objects and parsers for attribute expressions.
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.
void setReal(Attribute &attr, double val)
Set real value.
std::string getString(const Attribute &attr)
Get string value.
constexpr double m_xe
The xenon rest mass in GeV.
constexpr double m_alpha
The alpha particle rest mass in GeV.
constexpr double m_u
The uranium rest mass in GeV.
constexpr double m_p
The proton rest mass in GeV.
constexpr double m_h2p
The H2+ rest mass in GeV.
constexpr double q_e
The elementary charge in As.
constexpr double m_e
The electron rest mass in GeV.
constexpr double m_hm
The H- rest mass in GeV.
constexpr double m_mu
The muon rest mass in GeV.
constexpr double m_c
The carbon rest mass in GeV.
constexpr double m_d
The deuteron rest mass in GeV.
The base class for all OPAL definitions.
The base class for all OPAL objects.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
const std::string & getOpalName() const
Return object name.
void setOpalName(const std::string &name)
Set object name.
std::vector< Attribute > itsAttr
The object attributes.
bool builtin
Built-in flag.
Object * find(const std::string &name)
Find entry.
static OpalData * getInstance()
void define(Object *newObject)
Define a new object.
void setGamma(double gamma)
Set gamma.
void setP(double p)
Set reference momentum.
void setE(double E)
Set reference energy.
double getM() const
The constant mass per particle.
std::string getParticleName() const
Return Particle's name.
double getCurrent() const
Return the beam current in A.
double getChargePerParticle() const
Charge per macro particle in C.
virtual void execute()
Check the BEAM data.
static Beam * find(const std::string &name)
Find named BEAM.
double getCharge() const
Return the charge number in elementary charge.
virtual Beam * clone(const std::string &name)
Make clone.
double getFrequency() const
Return the beam frequency in MHz.
size_t getNumberOfParticles() const
Return the number of (macro)particles.
double getMassPerParticle() const
Mass per macro particle in GeV/c^2.
double getMass() const
Return Particle's rest mass in GeV.
virtual void update()
Update the BEAM data.
void print(std::ostream &os) const
Print the object.
Beam()
Exemplar constructor.
const PartData & getReference() const
Return the embedded CLASSIC PartData.
virtual bool canReplaceBy(Object *object)
Test if replacement is allowed.
static const double energy_scale
The base class for all OPAL exceptions.