OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Beam Class Reference

#include <Beam.h>

Inheritance diagram for Beam:
Inheritance graph
[legend]
Collaboration diagram for Beam:
Collaboration graph
[legend]

Public Member Functions

 Beam ()
 Exemplar constructor. More...
 
virtual ~Beam ()
 
virtual bool canReplaceBy (Object *object)
 Test if replacement is allowed. More...
 
virtual Beamclone (const std::string &name)
 Make clone. More...
 
virtual void execute ()
 Check the BEAM data. More...
 
size_t getNumberOfParticles () const
 Return the number of (macro)particles. More...
 
const PartDatagetReference () const
 Return the embedded CLASSIC PartData. More...
 
double getCurrent () const
 Return the beam current in A. More...
 
double getCharge () const
 Return the charge number in elementary charge. More...
 
double getFrequency () const
 Return the beam frequency in MHz. More...
 
std::string getParticleName () const
 Return Particle's name. More...
 
double getMass () const
 Return Particle's rest mass in GeV. More...
 
double getChargePerParticle () const
 Charge per macro particle in C. More...
 
double getMassPerParticle () const
 Mass per macro particle in GeV/c^2. More...
 
virtual void update ()
 Update the BEAM data. More...
 
void print (std::ostream &os) const
 Print the object. More...
 
- Public Member Functions inherited from Definition
virtual ~Definition ()
 
virtual const std::string getCategory () const
 Return the object category as a string. More...
 
virtual bool shouldTrace () const
 Trace flag. More...
 
virtual bool shouldUpdate () const
 Update flag. More...
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
virtual bool canReplaceBy (Object *object)
 Test if replacement is allowed. More...
 
virtual Objectclone (const std::string &name)=0
 Return a clone. More...
 
void copyAttributes (const Object &)
 Copy attributes from another object. More...
 
virtual void execute ()
 Execute the command. More...
 
virtual AttributefindAttribute (const std::string &name)
 Find an attribute by name. More...
 
virtual const AttributefindAttribute (const std::string &name) const
 Find an attribute by name. More...
 
virtual const std::string getCategory () const =0
 Return the object category as a string. More...
 
virtual bool shouldTrace () const =0
 Trace flag. More...
 
virtual bool shouldUpdate () const =0
 Update flag. More...
 
virtual ObjectmakeTemplate (const std::string &, TokenStream &, Statement &)
 Macro handler function. More...
 
virtual ObjectmakeInstance (const std::string &name, Statement &, const Parser *)
 Macro handler function. More...
 
virtual void parse (Statement &)
 Parse the object. More...
 
virtual void parseShortcut (Statement &, bool eval=true)
 Parser for single-attribute commands. More...
 
virtual void print (std::ostream &) const
 Print the object. More...
 
virtual void printValue (std::ostream &) const
 
virtual void printHelp (std::ostream &) const
 Print help. More...
 
virtual void replace (Object *oldObject, Object *newObject)
 Replace references. More...
 
virtual void update ()
 Update this object. More...
 
bool isBuiltin () const
 True, if [b]this[/b] is a built-in object. More...
 
virtual bool isShared () const
 Shared flag. More...
 
virtual void setShared (bool)
 Set/reset shared flag. More...
 
void setDirty (bool)
 Set/reset the [b]modified[/b] flag. More...
 
bool isDirty () const
 True, if the [b]modified[/b] flag is set. More...
 
void setFlag (bool)
 Flag/unflag this object, e. g. to control output of objects for. More...
 
bool isFlagged () const
 True, if [b]this[/b] is flagged by setFlag(true). More...
 
const ObjectgetBaseObject () const
 Return the object's base type object. More...
 
const std::string & getOpalName () const
 Return object name. More...
 
ObjectgetParent () const
 Return parent pointer. More...
 
bool isTreeMember (const Object *subTree) const
 Test for tree membership. More...
 
void setOpalName (const std::string &name)
 Set object name. More...
 
void setParent (Object *)
 Set parent object. More...
 
void clear ()
 Clear the occurrence counter. More...
 
int increment ()
 Increment and return the occurrence counter. More...
 
int occurrenceCount ()
 Return the occurrence counter. More...
 
void registerReference (Invalidator *a)
 Register a reference to this object. More...
 
void unregisterReference (Invalidator *a)
 Unegister a reference to this object. More...
 
void registerOwnership (const AttributeHandler::OwnerType &itsClass) const
 
- Public Member Functions inherited from RCObject
int addReference () const
 Increment reference count. More...
 
int removeReference () const
 Decrement the reference count. More...
 
bool isShared () const
 Test for sharing. More...
 

Static Public Member Functions

static Beamfind (const std::string &name)
 Find named BEAM. More...
 

Private Member Functions

 Beam (const Beam &)
 
void operator= (const Beam &)
 
 Beam (const std::string &name, Beam *parent)
 

Private Attributes

PartData reference
 

Static Private Attributes

static const double energy_scale
 

Additional Inherited Members

- Public Attributes inherited from Object
std::vector< AttributeitsAttr
 The object attributes. More...
 
- Protected Member Functions inherited from Definition
 Definition (int size, const char *name, const char *help)
 Constructor for exemplars. More...
 
 Definition (const std::string &name, Definition *parent)
 Constructor for clones. More...
 
- Protected Member Functions inherited from Object
 Object (int size, const char *name, const char *help)
 Constructor for exemplars. More...
 
 Object (const std::string &name, Object *parent)
 Constructor for clones. More...
 
- Protected Member Functions inherited from RCObject
 RCObject ()
 Default constructor. More...
 
 RCObject (const RCObject &)
 Copy constructor. More...
 
virtual ~RCObject ()=0
 
RCObjectoperator= (const RCObject &right)
 
- Protected Attributes inherited from Object
bool builtin
 Built-in flag. More...
 
bool modified
 Dirty flag. More...
 
bool flagged
 Object flag. More...
 

Detailed Description

Definition at line 31 of file Beam.h.

Constructor & Destructor Documentation

◆ Beam() [1/3]

Beam::Beam ( )

Exemplar constructor.

Definition at line 54 of file Beam.cpp.

References Object::builtin, clone(), OpalData::define(), OpalData::getInstance(), Object::itsAttr, Attributes::makePredefinedString(), Attributes::makeReal(), Object::registerOwnership(), AttributeHandler::STATEMENT, and update().

Referenced by clone().

Here is the call graph for this function:

◆ ~Beam()

Beam::~Beam ( )
virtual

Definition at line 120 of file Beam.cpp.

◆ Beam() [2/3]

Beam::Beam ( const Beam )
private

◆ Beam() [3/3]

Beam::Beam ( const std::string &  name,
Beam parent 
)
private

Definition at line 114 of file Beam.cpp.

Member Function Documentation

◆ canReplaceBy()

bool Beam::canReplaceBy ( Object object)
virtual

Test if replacement is allowed.

Reimplemented from Object.

Definition at line 124 of file Beam.cpp.

◆ clone()

Beam * Beam::clone ( const std::string &  name)
virtual

Make clone.

Implements Object.

Definition at line 130 of file Beam.cpp.

References Beam(), and name.

Referenced by Beam().

Here is the call graph for this function:

◆ execute()

void Beam::execute ( )
virtual

Check the BEAM data.

Reimplemented from Object.

Definition at line 135 of file Beam.cpp.

References Object::itsAttr, and update().

Here is the call graph for this function:

◆ find()

Beam * Beam::find ( const std::string &  name)
static

Find named BEAM.

Definition at line 156 of file Beam.cpp.

References OpalData::find(), OpalData::getInstance(), and name.

Referenced by TrackCmd::execute(), TrackRun::setupCyclotronTracker(), TrackRun::setupFieldsolver(), TrackRun::setupThickTracker(), and TrackRun::setupTTracker().

Here is the call graph for this function:

◆ getCharge()

double Beam::getCharge ( ) const

Return the charge number in elementary charge.

Definition at line 185 of file Beam.cpp.

References Attributes::getReal(), and Object::itsAttr.

Referenced by getChargePerParticle(), getMassPerParticle(), TrackRun::setupCyclotronTracker(), and update().

Here is the call graph for this function:

◆ getChargePerParticle()

double Beam::getChargePerParticle ( ) const

Charge per macro particle in C.

Definition at line 201 of file Beam.cpp.

References copysign(), getCharge(), getCurrent(), getFrequency(), getNumberOfParticles(), and Units::MHz2Hz.

Referenced by getMassPerParticle(), TrackRun::setDistributionParallelT(), and TrackRun::setupCyclotronTracker().

Here is the call graph for this function:

◆ getCurrent()

double Beam::getCurrent ( ) const

Return the beam current in A.

Definition at line 181 of file Beam.cpp.

References Attributes::getReal(), and Object::itsAttr.

Referenced by getChargePerParticle(), and TrackRun::setupCyclotronTracker().

Here is the call graph for this function:

◆ getFrequency()

double Beam::getFrequency ( ) const

Return the beam frequency in MHz.

Definition at line 197 of file Beam.cpp.

References Attributes::getReal(), and Object::itsAttr.

Referenced by getChargePerParticle(), TrackRun::setupCyclotronTracker(), and TrackRun::setupTTracker().

Here is the call graph for this function:

◆ getMass()

double Beam::getMass ( ) const

Return Particle's rest mass in GeV.

Definition at line 189 of file Beam.cpp.

References Attributes::getReal(), and Object::itsAttr.

Referenced by getMassPerParticle(), TrackRun::setupCyclotronTracker(), and update().

Here is the call graph for this function:

◆ getMassPerParticle()

double Beam::getMassPerParticle ( ) const

Mass per macro particle in GeV/c^2.

Definition at line 207 of file Beam.cpp.

References getCharge(), getChargePerParticle(), getMass(), and Physics::q_e.

Referenced by TrackRun::setupCyclotronTracker(), and TrackRun::setupTTracker().

Here is the call graph for this function:

◆ getNumberOfParticles()

size_t Beam::getNumberOfParticles ( ) const

Return the number of (macro)particles.

Definition at line 166 of file Beam.cpp.

References Attributes::getReal(), and Object::itsAttr.

Referenced by getChargePerParticle(), TrackRun::setDistributionParallelT(), TrackRun::setupCyclotronTracker(), and TrackRun::setupFieldsolver().

Here is the call graph for this function:

◆ getParticleName()

std::string Beam::getParticleName ( ) const

Return Particle's name.

Definition at line 193 of file Beam.cpp.

References Attributes::getString(), and Object::itsAttr.

Referenced by TrackRun::setupCyclotronTracker(), TrackRun::setupTTracker(), and update().

Here is the call graph for this function:

◆ getReference()

const PartData & Beam::getReference ( ) const

Return the embedded CLASSIC PartData.

Definition at line 175 of file Beam.cpp.

References reference, and update().

Referenced by TrackCmd::execute().

Here is the call graph for this function:

◆ operator=()

void Beam::operator= ( const Beam )
private

◆ print()

void Beam::print ( std::ostream &  msg) const
virtual

Print the object.

Reimplemented from Object.

Definition at line 257 of file Beam.cpp.

References abs(), endl(), Object::getOpalName(), PartData::getP(), Attributes::getReal(), Attributes::getString(), Object::itsAttr, and reference.

Referenced by operator<<().

Here is the call graph for this function:

◆ update()

void Beam::update ( )
virtual

Member Data Documentation

◆ energy_scale

const double Beam::energy_scale
staticprivate

Definition at line 96 of file Beam.h.

◆ reference

PartData Beam::reference
private

Definition at line 93 of file Beam.h.

Referenced by getReference(), print(), and update().


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