BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
blmplacement.h
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2024.
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 BLMPLACEMENT_H
20#define BLMPLACEMENT_H
21
22#include <iomanip>
23#include <iostream>
24#include <string>
25
26#include "published.h"
27
28namespace GMAD
29{
38 class BLMPlacement : public Published<BLMPlacement>
39 {
40 public:
41 std::string name;
42 std::string referenceElement;
44 double s;
45 double x;
46 double y;
47 double z;
49 double phi;
50 double theta;
51 double psi;
54 double axisX;
55 double axisY;
56 double axisZ;
57 double angle;
59 bool axisAngle;
60 std::string side;
61 double sideOffset;
62
63 std::string geometryFile;
64 std::string geometryType;
65 std::string blmMaterial;
66 double blm1;
67 double blm2;
68 double blm3;
69 double blm4;
70 std::string scoreQuantity;
71 std::string bias;
72
76 void clear();
78 void print()const;
80 template <typename T>
81 void set_value(std::string property, T value);
82
83 private:
85 void PublishMembers();
86 };
87
88 template <typename T>
89 void BLMPlacement::set_value(std::string property, T value)
90 {
91#ifdef BDSDEBUG
92 std::cout << "blmplacement> Setting value " << std::setw(25) << std::left
93 << property << value << std::endl;
94#endif
95 // member method can throw runtime_error, catch and exit gracefully
96 try
97 {set(this,property,value);}
98 catch (const std::runtime_error&)
99 {
100 std::cerr << "Error: blmplacement> unknown option \"" << property
101 << "\" with value \"" << value << "\"" << std::endl;
102 exit(1);
103 }
104 }
105}
106
107#endif
blm for parser.
double sideOffset
Offset between the geometry and the BLM.
bool axisAngle
Flag to use the axis angle construction of rotation.
void PublishMembers()
publish members
double theta
Euler angle for rotation.
double x
Offset in x.
std::string side
which side to attach to: top, bottom, left, right.
std::string referenceElement
Name of reference element w.r.t. to place to.
std::string name
Name of this samplerplacement.
double psi
Euler angle for rotation.
double phi
Euler angle for rotation.
void print() const
print some properties
BLMPlacement()
constructor
double s
Curvilinear s position to place w.r.t..
int referenceElementNumber
Index of repetition of element if there are multiple uses.
void set_value(std::string property, T value)
set methods by property name and value
double y
Offset in y.
Class that provides introspection to its members.
Definition published.h:49
void set(BLMPlacement *instance, const std::string &name, double value)
Definition published.h:101
Parser namespace for GMAD language. Combination of Geant4 and MAD.