BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
crystal.h
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2023.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef CRYSTAL_H
20#define CRYSTAL_H
21
22#include <iomanip>
23#include <iostream>
24#include <string>
25
26#include "published.h"
27
28namespace GMAD
29{
36 class Crystal: public Published<Crystal>
37 {
38 public:
39 std::string name;
40 std::string material;
41 std::string data;
42 std::string shape;
43 double lengthX;
44 double lengthY;
45 double lengthZ;
46 double sizeA;
47 double sizeB;
48 double sizeC;
49 double alpha;
50 double beta;
51 double gamma;
52 int spaceGroup;
55 double miscutAngleY;
56
58 Crystal();
60 void clear();
62 void print()const;
64 template <typename T>
65 void set_value(std::string property, T value);
66
67 private:
69 void PublishMembers();
70 };
71
72 template <typename T>
73 void Crystal::set_value(std::string property, T value)
74 {
75#ifdef BDSDEBUG
76 std::cout << "crystal> Setting value " << std::setw(25) << std::left << property << value << std::endl;
77#endif
78 // member method can throw runtime_error, catch and exit gracefully
79 try
80 {set(this,property,value);}
81 catch (const std::runtime_error&)
82 {
83 std::cerr << "Error: crystal> unknown option \"" << property << "\" with value \"" << value << "\"" << std::endl;
84 exit(1);
85 }
86 }
87}
88
89#endif
Crystal class for parser.
Definition: crystal.h:37
void clear()
Reset.
Definition: crystal.cc:29
std::string name
Name of object.
Definition: crystal.h:39
double lengthX
X size.
Definition: crystal.h:43
void PublishMembers()
publish members
Definition: crystal.cc:50
std::string shape
Which geometry to create.
Definition: crystal.h:42
void set_value(std::string property, T value)
Set methods by property name and value.
Definition: crystal.h:73
void print() const
Print some properties.
Definition: crystal.cc:71
double bendingAngleYAxis
Bending angle about Y axis.
Definition: crystal.h:53
Crystal()
Constructor.
Definition: crystal.cc:23
double lengthZ
Z size.
Definition: crystal.h:45
std::string data
Which channelling data to use.
Definition: crystal.h:41
double bendingAngleZAxis
Bending angle about Z axis.
Definition: crystal.h:54
std::string material
Material of crystal.
Definition: crystal.h:40
double lengthY
Y size.
Definition: crystal.h:44
Class that provides introspection to its members.
Definition: published.h:47
void set(Crystal *instance, const std::string &name, double value)
Definition: published.h:99
Parser namespace for GMAD language. Combination of Geant4 and MAD.