BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
scorermesh.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 SCORERMESH_H
20#define SCORERMESH_H
21
22#include <iomanip>
23#include <iostream>
24#include <string>
25
26#include "published.h"
27
28namespace GMAD
29{
30 class SamplerPlacement;
31
37 class ScorerMesh : public Published<ScorerMesh>
38 {
39 public:
40 std::string name;
41 std::string scoreQuantity;
42 std::string geometryType;
43
44 int nx;
45 int ny;
46 int nz;
47 int nr;
48 int nphi;
49 int ne;
50 double xsize;
51 double ysize;
52 double zsize;
53 double rsize;
54 double eLow;
55 double eHigh;
56 std::string eScale;
58
59 // placement stuff
60 std::string sequence;
61 std::string referenceElement;
63 double s;
64 double x;
65 double y;
66 double z;
68 double phi;
69 double theta;
70 double psi;
73 double axisX;
74 double axisY;
75 double axisZ;
76 double angle;
78 bool axisAngle;
79
81 ScorerMesh();
83 void clear();
85 void print()const;
87 template <typename T>
88 void set_value(std::string property, T value);
89
90 private:
92 void PublishMembers();
93 };
94
95 template <typename T>
96 void ScorerMesh::set_value(std::string property, T value)
97 {
98#ifdef BDSDEBUG
99 std::cout << "scorermesh> Setting value " << std::setw(25) << std::left
100 << property << value << std::endl;
101#endif
102 // member method can throw runtime_error, catch and exit gracefully
103 try
104 {set(this,property,value);}
105 catch (const std::runtime_error&)
106 {
107 std::cerr << "Error: scorermesh> unknown option \"" << property
108 << "\" with value " << value << std::endl;
109 exit(1);
110 }
111 }
112}
113
114#endif
Class that provides introspection to its members.
Definition: published.h:47
void set(ScorerMesh *instance, const std::string &name, double value)
Definition: published.h:99
ScorerMesh class for parser.
Definition: scorermesh.h:38
void clear()
reset
Definition: scorermesh.cc:29
double phi
Euler angle for rotation.
Definition: scorermesh.h:68
std::string referenceElement
Name of reference element w.r.t. to place to.
Definition: scorermesh.h:61
int ny
Number of bins in y.
Definition: scorermesh.h:45
int ne
Number of bins in E.
Definition: scorermesh.h:49
int nx
Number of bins in x.
Definition: scorermesh.h:44
int nphi
Number of bins in Phi.
Definition: scorermesh.h:48
int nz
Number of bins in z.
Definition: scorermesh.h:46
void print() const
print some properties
Definition: scorermesh.cc:102
double s
Curvilinear s position to place w.r.t..
Definition: scorermesh.h:63
std::string scoreQuantity
Name of scorer object to use.
Definition: scorermesh.h:41
double psi
Euler angle for rotation.
Definition: scorermesh.h:70
int referenceElementNumber
Index of repetition of element if there are multiple uses.
Definition: scorermesh.h:62
std::string eScale
E scaling type.
Definition: scorermesh.h:56
std::string name
Name of this placement.
Definition: scorermesh.h:40
double xsize
X total width.
Definition: scorermesh.h:50
ScorerMesh()
constructor
Definition: scorermesh.cc:23
void PublishMembers()
publish members
Definition: scorermesh.cc:66
double eHigh
E High limit.
Definition: scorermesh.h:55
int nr
Number of bins in R.
Definition: scorermesh.h:47
double eLow
E Low limit.
Definition: scorermesh.h:54
double ysize
Y total width.
Definition: scorermesh.h:51
std::string geometryType
Name of scorermesh geometry to use.
Definition: scorermesh.h:42
double rsize
R total length.
Definition: scorermesh.h:53
std::string sequence
Name of sequence to place.
Definition: scorermesh.h:60
std::string eBinsEdgesFilenamePath
E bins edges filename path.
Definition: scorermesh.h:57
void set_value(std::string property, T value)
set methods by property name and value
Definition: scorermesh.h:96
double theta
Euler angle for rotation.
Definition: scorermesh.h:69
double x
Offset in x.
Definition: scorermesh.h:64
double zsize
Z total width.
Definition: scorermesh.h:52
bool axisAngle
Flag to use the axis angle construction of rotation.
Definition: scorermesh.h:78
double y
Offset in y.
Definition: scorermesh.h:65
Parser namespace for GMAD language. Combination of Geant4 and MAD.