OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Beam.h
Go to the documentation of this file.
1 #ifndef OPAL_Beam_HH
2 #define OPAL_Beam_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: Beam.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: Beam
13 //
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:33:44 $
17 // $Author: Andreas Adelmann $
18 //
19 // ------------------------------------------------------------------------
20 
22 #include "Algorithms/PartData.h"
23 
24 #include <ostream>
25 
26 class Inform;
27 
28 // Class Beam
29 // ------------------------------------------------------------------------
31 // A BEAM definition is used by most physics commands to define the
32 // particle charge and the reference momentum, together with some other
33 // data.
34 
35 class Beam: public Definition {
36 
37 public:
38 
40  Beam();
41 
42  virtual ~Beam();
43 
45  // Can replace only by another BEAM.
46  virtual bool canReplaceBy(Object *object);
47 
49  virtual Beam *clone(const std::string &name);
50 
52  virtual void execute();
53 
55  static Beam *find(const std::string &name);
56 
58  double getEX() const;
59 
61  double getEY() const;
62 
64  double getET() const;
65 
66  //ff => get gamma value
67  double getGamma() const;
68 
69  //ff => get PC value
70  double getPC() const;
71 
73  size_t getNumberOfParticles();
74 
76  size_t getNumberOfSlices();
77 
79  const PartData &getReference() const;
80 
82  double getCurrent() const;
83 
85  double getCharge() const;
86 
88  double getFrequency() const;
89 
91  std::string getParticleName() const;
92 
94  double getMass() const;
95 
97  void setEX(double);
98 
100  void setEY(double);
101 
103  void setET(double);
104 
106  virtual void update();
107 
108  void print(std::ostream &os) const;
109 
110 private:
111 
112  // Not implemented.
113  Beam(const Beam &);
114  void operator=(const Beam &);
115 
116  // Clone constructor.
117  Beam(const std::string &name, Beam *parent);
118 
119  // The particle reference data.
121 
122  // The converstion from GeV to eV.
123  static const double energy_scale;
124 };
125 
126 inline std::ostream &operator<<(std::ostream &os, const Beam &b) {
127  b.print(os);
128  return os;
129 }
130 
131 
132 #endif // OPAL_Beam_HH
void setEX(double)
Store emittance for mode 1.
Definition: Beam.cpp:209
std::ostream & operator<<(std::ostream &os, const Attribute &attr)
Definition: Attribute.cpp:167
virtual bool canReplaceBy(Object *object)
Test if replacement is allowed.
Definition: Beam.cpp:134
void setET(double)
Store emittance for mode 3.
Definition: Beam.cpp:219
std::string getParticleName() const
Return Particle&#39;s name.
Definition: Beam.cpp:201
The base class for all OPAL definitions.
Definition: Definition.h:30
double getPC() const
Definition: Beam.cpp:303
double getMass() const
Return Particle&#39;s rest mass in GeV.
Definition: Beam.cpp:197
size_t getNumberOfSlices()
Return the number of slices.
Definition: Beam.cpp:164
double getCurrent() const
Return the beam current in A.
Definition: Beam.cpp:189
virtual void execute()
Check the BEAM data.
Definition: Beam.cpp:145
Particle reference data.
Definition: PartData.h:38
double getET() const
Return emittance for mode 3.
Definition: Beam.cpp:178
double getEY() const
Return emittance for mode 2.
Definition: Beam.cpp:173
virtual void update()
Update the BEAM data.
Definition: Beam.cpp:224
static const double energy_scale
Definition: Beam.h:123
size_t getNumberOfParticles()
Return the number of (macro)particles.
Definition: Beam.cpp:160
virtual ~Beam()
Definition: Beam.cpp:130
double getCharge() const
Return the charge number in elementary charge.
Definition: Beam.cpp:193
double getGamma() const
Definition: Beam.cpp:298
void print(std::ostream &os) const
Print the object.
Definition: Beam.cpp:308
static Beam * find(const std::string &name)
Find named BEAM.
Definition: Beam.cpp:150
double getFrequency() const
Return the beam frequency in MHz.
Definition: Beam.cpp:205
double getEX() const
Return emittance for mode 1.
Definition: Beam.cpp:168
virtual Beam * clone(const std::string &name)
Make clone.
Definition: Beam.cpp:140
void operator=(const Beam &)
const PartData & getReference() const
Return the embedded CLASSIC PartData.
Definition: Beam.cpp:183
The base class for all OPAL objects.
Definition: Object.h:48
The BEAM definition.
Definition: Beam.h:35
const std::string name
PartData reference
Definition: Beam.h:120
void setEY(double)
Store emittance for mode 2.
Definition: Beam.cpp:214
Definition: Inform.h:41
Beam()
Exemplar constructor.
Definition: Beam.cpp:67