BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
blmplacement.h
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
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.
Definition: blmplacement.h:39
double sideOffset
Offset between the geometry and the BLM.
Definition: blmplacement.h:61
bool axisAngle
Flag to use the axis angle construction of rotation.
Definition: blmplacement.h:59
void PublishMembers()
publish members
Definition: blmplacement.cc:60
double theta
Euler angle for rotation.
Definition: blmplacement.h:50
double x
Offset in x.
Definition: blmplacement.h:45
std::string side
which side to attach to: top, bottom, left, right.
Definition: blmplacement.h:60
std::string referenceElement
Name of reference element w.r.t. to place to.
Definition: blmplacement.h:42
std::string name
Name of this samplerplacement.
Definition: blmplacement.h:41
double psi
Euler angle for rotation.
Definition: blmplacement.h:51
double phi
Euler angle for rotation.
Definition: blmplacement.h:49
void print() const
print some properties
Definition: blmplacement.cc:91
BLMPlacement()
constructor
Definition: blmplacement.cc:23
void clear()
reset
Definition: blmplacement.cc:29
double s
Curvilinear s position to place w.r.t..
Definition: blmplacement.h:44
int referenceElementNumber
Index of repetition of element if there are multiple uses.
Definition: blmplacement.h:43
void set_value(std::string property, T value)
set methods by property name and value
Definition: blmplacement.h:89
double y
Offset in y.
Definition: blmplacement.h:46
Class that provides introspection to its members.
Definition: published.h:47
void set(BLMPlacement *instance, const std::string &name, double value)
Definition: published.h:99
Parser namespace for GMAD language. Combination of Geant4 and MAD.