BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
cavitymodel.h
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef CAVITYMODEL_H
19#define CAVITYMODEL_H
20
21#include <iomanip>
22#include <iostream>
23#include <string>
24
25#include "published.h"
26
27namespace GMAD
28{
34 class CavityModel: public Published<CavityModel> {
35 public:
36 std::string name;
37 std::string type;
38 std::string material;
39 double irisRadius;
47 double thickness;
48
52
54
58 void clear();
60 void PublishMembers();
62 void print()const;
63
65 template <typename T>
66 void set_value(std::string property, T value, bool bExit = true);
67 };
68 template <typename T>
69 void CavityModel::set_value(std::string property, T value, bool bExit)
70 {
71#ifdef BDSDEBUG
72 std::cout << "cavitymodel> Setting value " << std::setw(25) << std::left << property << value << std::endl;
73#endif
74 // member method can throw runtime_error, catch and exit gracefully
75 try
76 {set(this,property,value);}
77 catch(const std::runtime_error&)
78 {
79 std::cerr << "Error: cavitymodel> unknown option \"" << property << "\" with value \"" << value << "\"" << std::endl;
80 if(bExit)
81 {exit(1);}
82 else
83 {std::rethrow_exception(std::current_exception());}
84 }
85 }
86}
87
88#endif
RF CavityModel class for parser.
Definition cavitymodel.h:34
double equatorRadius
equator radius
Definition cavitymodel.h:40
double thickness
thickness
Definition cavitymodel.h:47
double irisHorizontalAxis
iris horizontal axis
Definition cavitymodel.h:44
double irisRadius
iris radius
Definition cavitymodel.h:39
double tangentLineAngle
tangent angle
Definition cavitymodel.h:46
double equatorHorizontalAxis
equator ellipse vertical semi axis;
Definition cavitymodel.h:42
double irisVerticalAxis
Iris axis.
Definition cavitymodel.h:45
double equatorVerticalAxis
equator ellipse horizontal semi axis;
Definition cavitymodel.h:43
double halfCellLength
half cell length
Definition cavitymodel.h:41
std::string name
name
Definition cavitymodel.h:36
void set_value(std::string property, T value, bool bExit=true)
set methods by property name and value
Definition cavitymodel.h:69
CavityModel()
constructor
std::string material
material name
Definition cavitymodel.h:38
std::string type
geometry type
Definition cavitymodel.h:37
void print() const
print some properties
void PublishMembers()
publish members
void clear()
reset
int numberOfCells
number of cells per cavity
Definition cavitymodel.h:53
Class that provides introspection to its members.
Definition published.h:48
void set(CavityModel *instance, const std::string &name, double value)
Definition published.h:100
Parser namespace for GMAD language. Combination of Geant4 and MAD.