56 "The \"BEAM\" statement defines data for the particles "
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. "
141 "Set either \"GAMMA\", \"ENERGY\" or \"PC\".");
146 "The beam particle hasn't been set. "
147 "Set either \"PARTICLE\" or \"MASS\" and \"CHARGE\".");
151 throw OpalException(
"Beam::execute()",
"\"NPART\" must be set.");
171 "Wrong number of particles in beam!. \"NPART\" must be positive");
232 "\"GAMMA\" should be greater than 1.");
240 "\"ENERGY\" should be greater than \"MASS\".");
248 "\"PC\" should be greater than 0.");
259 os <<
"* ************* B E A M ************************************************************ " <<
std::endl;
263 <<
"* CHARGE " << (charge > 0 ?
'+' :
'-') <<
"e * " <<
std::abs(charge) <<
" \n"
268 os <<
"* ********************************************************************************** " <<
std::endl;
PETE_TBTree< FnCopysign, PETE_Scalar< Vektor< T1, Dim > >, typename T2::PETE_Expr_t > copysign(const Vektor< T1, Dim > &l, const PETE_Expr< T2 > &r)
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
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_p
The proton rest mass in GeV.
constexpr double q_e
The elementary charge in As.
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.
double getP() const
The constant reference momentum per particle.
void setP(double p)
Set reference momentum.
void setE(double E)
Set reference energy.
double getM() const
The constant mass per particle.
static double getParticleMass(const ParticleType &type)
static double getParticleCharge(const ParticleType &type)
static ParticleType getParticleType(const std::string &str)
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.
The base class for all OPAL exceptions.