56 "The \"BEAM\" statement defines data for the particles "
60 "PARTICLE",
"Name of particle to be used",
61 {
"ELECTRON",
"POSITRON",
"MUON",
"PROTON",
"ANTIPROTON",
"DEUTERON",
"HMINUS",
"H2P",
62 "ALPHA",
"CARBON",
"XENON",
"URANIUM"});
103 return dynamic_cast<Beam*
>(object) != 0;
107 return new Beam(name,
this);
116 "The energy hasn't been set. "
117 "Set either \"GAMMA\", \"ENERGY\" or \"PC\".");
123 "The beam particle hasn't been set. "
124 "Set either \"PARTICLE\" or \"MASS\" and \"CHARGE\".");
128 throw OpalException(
"Beam::execute()",
"\"NPART\" must be set.");
136 throw OpalException(
"Beam::find()",
"Beam \"" + name +
"\" not found.");
147 "Beam::getNumberOfParticles()",
148 "Wrong number of particles in beam!. \"NPART\" must be positive");
210 throw OpalException(
"Beam::update()",
"\"GAMMA\" should be greater than 1.");
217 throw OpalException(
"Beam::update()",
"\"ENERGY\" should be greater than \"MASS\".");
224 throw OpalException(
"Beam::update()",
"\"PC\" should be greater than 0.");
235 os <<
"* ************* B E A M ************************************************************ "
240 <<
"* CHARGE " << (charge > 0 ?
'+' :
'-') <<
"e * " << std::abs(charge) <<
" \n"
241 <<
"* MOMENTUM " <<
reference.getP() <<
" [eV/c]\n"
246 os <<
"* ********************************************************************************** "
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.
Definition(int size, const char *name, const char *help)
Constructor for exemplars.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
const std::string & getOpalName() const
Return object name.
Object(int size, const char *name, const char *help)
Constructor for exemplars.
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.
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.
double getMomentum() const
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.