OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
OpalStripper.cpp
Go to the documentation of this file.
1//
2// Class OpalStripper
3// The Stripper element
4//
5// Copyright (c) 2011, Jianjun Yang, Paul Scherrer Institut, Villigen PSI, Switzerland
6// Copyright (c) 2014, 2017-2018, Paul Scherrer Institut, Villigen PSI, Switzerland
7// All rights reserved
8//
9// Implemented as part of the PhD thesis
10// "Beam dynamics in high intensity cyclotrons including neighboring bunch effects"
11// and the paper
12// "Beam dynamics in high intensity cyclotrons including neighboring bunch effects:
13// Model, implementation, and application"
14// (https://journals.aps.org/prab/pdf/10.1103/PhysRevSTAB.13.064201)
15//
16// This file is part of OPAL.
17//
18// OPAL is free software: you can redistribute it and/or modify
19// it under the terms of the GNU General Public License as published by
20// the Free Software Foundation, either version 3 of the License, or
21// (at your option) any later version.
22//
23// You should have received a copy of the GNU General Public License
24// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
25//
30#include "Physics/Physics.h"
31#include "Physics/Units.h"
32
33
35 OpalElement(SIZE, "STRIPPER",
36 "The \"STRIPPER\" element defines a Stripper.") {
37
39 ("XSTART", " Start of x coordinate [mm]");
41 ("XEND", " End of x coordinate, [mm]");
43 ("YSTART", "Start of y coordinate, [mm]");
45 ("YEND", "End of y coordinate, [mm]");
47 ("WIDTH", "Width of the stripper [mm], NOT used");
49 ("OPCHARGE", "Charge number of the outcome particle");
51 ("OPMASS", "Mass of the outcome particle [GeV/c^2]");
53 ("OPYIELD", "Yield (Particle number of the outcome particle) per income particle");
55 ("STOP", "Option Whether stop tracking at the stripper. Default: true", true);
56
58
59 setElement(new StripperRep("STRIPPER"));
60}
61
62
63OpalStripper::OpalStripper(const std::string &name, OpalStripper *parent):
64 OpalElement(name, parent) {
66}
67
68
70{}
71
72
74 return new OpalStripper(name, this);
75}
76
77
80
81 StripperRep *strp = dynamic_cast<StripperRep *>(getElement());
82
87
88 double length = Attributes::getReal(itsAttr[LENGTH]);
89 double opcharge = Attributes::getReal(itsAttr[OPCHARGE]);
90 double opmass = Attributes::getReal(itsAttr[OPMASS]);
91 double opyield = Attributes::getReal(itsAttr[OPYIELD]);
92 bool stop = Attributes::getBool(itsAttr[STOP]);
93
94 strp->setElementLength(length);
95 strp->setDimensions(xstart, xend, ystart, yend);
96 strp->setOPCharge(opcharge);
97 strp->setOPMass(opmass);
98 strp->setOPYield(opyield);
99 strp->setStop(stop);
101
102 // Transmit "unknown" attributes.
104}
@ SIZE
Definition: IndexMap.cpp:174
const std::string name
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
Definition: Attributes.cpp:90
double getReal(const Attribute &attr)
Return real value.
Definition: Attributes.cpp:252
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Definition: Attributes.cpp:240
bool getBool(const Attribute &attr)
Return logical value.
Definition: Attributes.cpp:100
std::string getString(const Attribute &attr)
Get string value.
Definition: Attributes.cpp:343
constexpr double mm2m
Definition: Units.h:29
ElementBase * getElement() const
Return the embedded CLASSIC element.
Definition: Element.h:120
void setElement(ElementBase *)
Assign new CLASSIC element.
Definition: Element.h:125
std::vector< Attribute > itsAttr
The object attributes.
Definition: Object.h:216
virtual void setElementLength(double length)
Set design length.
Definition: ElementBase.h:418
void setOutputFN(std::string fn)
Set output filename.
void setDimensions(double xstart, double xend, double ystart, double yend)
Set dimensions and consistency checks.
void setOPCharge(double charge)
Member variable access.
Definition: Stripper.cpp:65
void setStop(bool stopflag)
Definition: Stripper.cpp:77
void setOPYield(double yield)
Definition: Stripper.cpp:73
void setOPMass(double mass)
Definition: Stripper.cpp:69
virtual void updateUnknown(ElementBase *)
Transmit the `‘unknown’' (not known to OPAL) attributes to CLASSIC.
virtual void update()
Update the embedded CLASSIC element.
void registerOwnership() const
virtual OpalStripper * clone(const std::string &name)
Make clone.
virtual void update()
Update the embedded CLASSIC septum.
virtual ~OpalStripper()