BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
samplerplacement.cc
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#include "samplerplacement.h"
20
21using namespace GMAD;
22
24{
25 clear();
27}
28
30{
31 name = "";
32 samplerType = "plane";
35 s = 0;
36 x = 0;
37 y = 0;
38 z = 0;
39 phi = 0;
40 theta = 0;
41 psi = 0;
42 axisX = 0;
43 axisY = 0;
44 axisZ = 0;
45 angle = 0;
46 axisAngle = false;
47 apertureModel = "";
48 shape = "circular";
49 aper1 = 0;
50 aper2 = 0;
51 aper3 = 0;
52 aper4 = 0;
53 startAnglePhi = 0;
54 sweepAnglePhi = -1; // -1 to flag we should use 2pi later when we have units
55 startAngleTheta = 0;
56 sweepAngleTheta = -1; // -1 to flag we should use 2pi later when we have units
57 partID.clear();
58 partIDSetID = -1;
59}
60
62{
65 publish("referenceElement", &SamplerPlacement::referenceElement);
66 publish("referenceElementNumber", &SamplerPlacement::referenceElementNumber);
79 publish("apertureModel", &SamplerPlacement::apertureModel);
80 publish("shape", &SamplerPlacement::shape);
81 publish("apertureType", &SamplerPlacement::shape);
82 publish("aper1", &SamplerPlacement::aper1);
83 publish("aper2", &SamplerPlacement::aper2);
84 publish("aper3", &SamplerPlacement::aper3);
85 publish("aper4", &SamplerPlacement::aper4);
86 publish("startAnglePhi", &SamplerPlacement::startAnglePhi);
87 publish("sweepAnglePhi", &SamplerPlacement::sweepAnglePhi);
88 publish("startAngleTheta", &SamplerPlacement::startAngleTheta);
89 publish("sweepAngleTheta", &SamplerPlacement::sweepAngleTheta);
91 // partIDSetID is for internal use only - not published
92}
93
95{
96 std::cout << "SamplerPlacement: "
97 << "name " << name << std::endl
98 << "samplerType " << samplerType << std::endl
99 << "referenceElement" << referenceElement << std::endl
100 << "referenceElementNumber" << referenceElementNumber << std::endl
101 << "s" << s << std::endl
102 << "x " << x << std::endl
103 << "y " << y << std::endl
104 << "z " << z << std::endl
105 << "phi " << phi << std::endl
106 << "theta " << theta << std::endl
107 << "psi " << psi << std::endl
108 << "axisX " << axisX << std::endl
109 << "axisY " << axisY << std::endl
110 << "axisZ " << axisZ << std::endl
111 << "angle " << angle << std::endl
112 << "axisAngle " << axisAngle << std::endl
113 << "apertureMode " << apertureModel << std::endl
114 << "shape " << shape << std::endl
115 << "aper1 " << aper1 << std::endl
116 << "aper2 " << aper2 << std::endl
117 << "aper3 " << aper3 << std::endl
118 << "aper4 " << aper4 << std::endl
119 << "startAnglePhi " << startAnglePhi << std::endl
120 << "sweepAnglePhi " << sweepAnglePhi << std::endl
121 << "startAngleTheta " << startAngleTheta << std::endl
122 << "sweepAngleTheta " << sweepAngleTheta << std::endl
123 << "partID list {";
124 for (auto v : partID)
125 {std::cout << v << ", ";}
126 std::cout << "}" << std::endl
127 << "partIDSet ID " << partIDSetID << std::endl;
128}
void publish(const std::string &name, T C::*mp)
Make pointer to member from class C and type T with accessible with a name.
Definition: published.h:92
int referenceElementNumber
Index of repetition of element if there are multiple uses.
double phi
Euler angle for rotation.
std::string name
Name of this samplerplacement.
std::string referenceElement
Name of reference element w.r.t. to place to.
void PublishMembers()
publish members
std::string samplerType
Plane, Cylinder, Sphere.
std::list< double > partID
List of PDG IDs of which particles to record for - default is empty, so all particles.
void print() const
print some properties
double theta
Euler angle for rotation.
double s
Curvilinear s position to place w.r.t..
double psi
Euler angle for rotation.
bool axisAngle
Flag to use the axis angle construction of rotation.
double x
Offset in x.
int partIDSetID
The unique ID of the particle set given by the parser.
double y
Offset in y.
Parser namespace for GMAD language. Combination of Geant4 and MAD.