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) 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 BLMPLACEMENT_H
19#define BLMPLACEMENT_H
20
21#include <iomanip>
22#include <iostream>
23#include <string>
24
25#include "published.h"
26
27namespace GMAD
28{
37 class BLMPlacement : public Published<BLMPlacement>
38 {
39 public:
40 std::string name;
41 std::string referenceElement;
43 double s;
44 double x;
45 double y;
46 double z;
48 double phi;
49 double theta;
50 double psi;
53 double axisX;
54 double axisY;
55 double axisZ;
56 double angle;
58 bool axisAngle;
59 std::string side;
60 double sideOffset;
61
62 std::string geometryFile;
63 std::string geometryType;
64 std::string blmMaterial;
65 double blm1;
66 double blm2;
67 double blm3;
68 double blm4;
69 std::string scoreQuantity;
70 std::string bias;
71
75 void clear();
77 void print()const;
79 template <typename T>
80 void set_value(std::string property, T value, bool bExit = true);
81
82 private:
84 void PublishMembers();
85 };
86
87 template <typename T>
88 void BLMPlacement::set_value(std::string property, T value, bool bExit)
89 {
90#ifdef BDSDEBUG
91 std::cout << "blmplacement> Setting value " << std::setw(25) << std::left
92 << property << value << std::endl;
93#endif
94 // member method can throw runtime_error, catch and exit gracefully
95 try
96 {set(this,property,value);}
97 catch (const std::runtime_error&)
98 {
99 std::cerr << "Error: blmplacement> unknown option \"" << property
100 << "\" with value \"" << value << "\"" << std::endl;
101 if(bExit)
102 {exit(1);}
103 else
104 {std::rethrow_exception(std::current_exception());}
105 }
106 }
107}
108
109#endif
blm for parser.
double sideOffset
Offset between the geometry and the BLM.
void set_value(std::string property, T value, bool bExit=true)
set methods by property name and value
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.
double y
Offset in y.
Class that provides introspection to its members.
Definition published.h:48
void set(BLMPlacement *instance, const std::string &name, double value)
Definition published.h:100
Parser namespace for GMAD language. Combination of Geant4 and MAD.