OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Beam.h
Go to the documentation of this file.
1//
2// Class Beam
3// The class for the OPAL BEAM command.
4// A BEAM definition is used by most physics commands to define the
5// particle charge and the reference momentum, together with some other data.
6//
7// Copyright (c) 200x - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
8// All rights reserved
9//
10// This file is part of OPAL.
11//
12// OPAL is free software: you can redistribute it and/or modify
13// it under the terms of the GNU General Public License as published by
14// the Free Software Foundation, either version 3 of the License, or
15// (at your option) any later version.
16//
17// You should have received a copy of the GNU General Public License
18// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
19//
20#ifndef OPAL_Beam_HH
21#define OPAL_Beam_HH
22
24#include "Algorithms/PartData.h"
25
26#include <ostream>
27#include <string>
28
29class Inform;
30
31class Beam: public Definition {
32
33public:
35 Beam();
36
37 virtual ~Beam();
38
40 // Can replace only by another BEAM.
41 virtual bool canReplaceBy(Object* object);
42
44 virtual Beam* clone(const std::string& name);
45
47 virtual void execute();
48
50 static Beam* find(const std::string& name);
51
53 size_t getNumberOfParticles() const;
54
56 const PartData& getReference() const;
57
59 double getCurrent() const;
60
62 double getCharge() const;
63
65 double getFrequency() const;
66
68 std::string getParticleName() const;
69
71 double getMass() const;
72
74 double getChargePerParticle() const;
75
77 double getMassPerParticle() const;
78
80 virtual void update();
81
82 void print(std::ostream& os) const;
83
84private:
85 // Not implemented.
86 Beam(const Beam&);
87 void operator=(const Beam&);
88
89 // Clone constructor.
90 Beam(const std::string& name, Beam* parent);
91
92 // The particle reference data.
94
95 // The converstion from GeV to eV.
96 static const double energy_scale;
97};
98
99inline std::ostream &operator<<(std::ostream& os, const Beam& b) {
100 b.print(os);
101 return os;
102}
103
104#endif // OPAL_Beam_HH
std::ostream & operator<<(std::ostream &os, const Beam &b)
Definition: Beam.h:99
const std::string name
The base class for all OPAL definitions.
Definition: Definition.h:30
The base class for all OPAL objects.
Definition: Object.h:48
Particle reference data.
Definition: PartData.h:35
Definition: Beam.h:31
std::string getParticleName() const
Return Particle's name.
Definition: Beam.cpp:193
double getCurrent() const
Return the beam current in A.
Definition: Beam.cpp:181
void operator=(const Beam &)
double getChargePerParticle() const
Charge per macro particle in C.
Definition: Beam.cpp:201
virtual void execute()
Check the BEAM data.
Definition: Beam.cpp:135
static Beam * find(const std::string &name)
Find named BEAM.
Definition: Beam.cpp:156
double getCharge() const
Return the charge number in elementary charge.
Definition: Beam.cpp:185
virtual Beam * clone(const std::string &name)
Make clone.
Definition: Beam.cpp:130
PartData reference
Definition: Beam.h:93
double getFrequency() const
Return the beam frequency in MHz.
Definition: Beam.cpp:197
size_t getNumberOfParticles() const
Return the number of (macro)particles.
Definition: Beam.cpp:166
double getMassPerParticle() const
Mass per macro particle in GeV/c^2.
Definition: Beam.cpp:207
double getMass() const
Return Particle's rest mass in GeV.
Definition: Beam.cpp:189
virtual void update()
Update the BEAM data.
Definition: Beam.cpp:211
void print(std::ostream &os) const
Print the object.
Definition: Beam.cpp:257
Beam()
Exemplar constructor.
Definition: Beam.cpp:54
const PartData & getReference() const
Return the embedded CLASSIC PartData.
Definition: Beam.cpp:175
virtual bool canReplaceBy(Object *object)
Test if replacement is allowed.
Definition: Beam.cpp:124
Beam(const Beam &)
virtual ~Beam()
Definition: Beam.cpp:120
static const double energy_scale
Definition: Beam.h:96
Definition: Inform.h:42