BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
beamBase.cc
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#include "beamBase.h"
20
21#include <iostream>
22
23using namespace GMAD;
24
25BeamBase::BeamBase()
26{
27 particle = "";
29 beamEnergy = 0;
31 beamMomentum = 0;
32 distrType = "reference";
33 xDistrType = "reference";
34 yDistrType = "reference";
35 zDistrType = "reference";
36 spaceDistrType = "reference";
37 directionDistrType = "reference";
38 energyDistrType = "reference";
39 distrFile = "";
40 distrFileFormat = "";
44 nlinesIgnore = 0;
45 nlinesSkip = 0;
46
47 X0 = 0.0;
48 Y0 = 0.0;
49 Z0 = 0.0;
50 S0 = 0.0;
51 Xp0 = 0.0;
52 Yp0 = 0.0;
53 Zp0 = 0.0;
54 T0 = 0.0;
55 E0 = 0.0;
56 Ek0 = 0.0;
57 P0 = 0.0;
58 tilt = 0.0;
59 sigmaT = 0.0;
60 sigmaE = 0.0;
61 sigmaEk = 0.0;
62 sigmaP = 0.0;
63
64 betx = 0.0;
65 bety = 0.0;
66 alfx = 0.0;
67 alfy = 0.0;
68 emitx = 0.0;
69 emity = 0.0;
70 emitNX = 0.0;
71 emitNY = 0.0;
72 dispx = 0.0;
73 dispy = 0.0;
74 dispxp = 0.0;
75 dispyp = 0.0;
76 sigmaX = 0.0;
77 sigmaXp = 0.0;
78 sigmaY = 0.0;
79 sigmaYp = 0.0;
80
81 envelopeX = 0.0;
82 envelopeXp = 0.0;
83 envelopeY = 0.0;
84 envelopeYp = 0.0;
85 envelopeZ = 0.0;
86 envelopeZp = 0.0;
87 envelopeT = 0.0;
88 envelopeE = 0.0;
89 envelopeR = 0.0;
90 envelopeRp = 0.0;
91
92 sigma11 = 0.0,sigma12 = 0.0,sigma13 = 0.0,sigma14 = 0.0,sigma15 = 0.0,sigma16 = 0.0;
93 sigma22 = 0.0,sigma23 = 0.0,sigma24 = 0.0,sigma25 = 0.0,sigma26 = 0.0;
94 sigma33 = 0.0,sigma34 = 0.0,sigma35 = 0.0,sigma36 = 0.0;
95 sigma44 = 0.0,sigma45 = 0.0,sigma46 = 0.0;
96 sigma55 = 0.0,sigma56 = 0.0;
97 sigma66 = 0.0;
98
99 shellX = 0.0;
100 shellXp = 0.0;
101 shellY = 0.0;
102 shellYp = 0.0;
103 shellXWidth = 0.0;
104 shellXpWidth = 0.0;
105 shellYWidth = 0.0;
106 shellYpWidth = 0.0;
107
108 Rmin = 0.0;
109 Rmax = 0.0;
110
111 haloNSigmaXInner = 0.0;
112 haloNSigmaXOuter = 1e9;
113 haloNSigmaYInner = 0.0;
114 haloNSigmaYOuter = 1e9;
115 haloXCutInner = 0.0;
116 haloYCutInner = 0.0;
117 haloXCutOuter = 1e9;
118 haloYCutOuter = 1e9;
119 haloXpCutInner = 0.0;
120 haloYpCutInner = 0.0;
121 haloXpCutOuter = 1e9;
122 haloYpCutOuter = 1e9;
125
126 offsetSampleMean = false;
127
128 eventGeneratorMinX = -1e6;
129 eventGeneratorMaxX = 1e6;
130 eventGeneratorMinY = -1e6;
131 eventGeneratorMaxY = 1e6;
132 eventGeneratorMinZ = -1e6;
133 eventGeneratorMaxZ = 1e6;
135 eventGeneratorMaxXp = 1.1; // > 1 for no ambiguity (max value 1)
143 eventGeneratorMaxT = 1e50;
145 eventGeneratorMaxEK = 1e50;
148}
double dispy
initial twiss parameters
Definition: beamBase.h:82
bool matchDistrFileLength
beam parameters
Definition: beamBase.h:55
double alfy
initial twiss parameters
Definition: beamBase.h:82
std::string particle
beam parameters
Definition: beamBase.h:40
double eventGeneratorMaxYp
Event generator file filter.
Definition: beamBase.h:143
double sigma45
for the gaussian sigma matrix distribution
Definition: beamBase.h:100
double eventGeneratorMaxXp
Event generator file filter.
Definition: beamBase.h:141
double sigmaE
for the gaussian, elliptic shell, ring distributions
Definition: beamBase.h:77
double emity
initial twiss parameters
Definition: beamBase.h:82
double haloXCutOuter
for the halo distribution
Definition: beamBase.h:121
double sigma16
for the gaussian sigma matrix distribution
Definition: beamBase.h:97
double haloNSigmaYInner
for the halo distribution
Definition: beamBase.h:117
double beamKineticEnergy
beam parameters
Definition: beamBase.h:43
double envelopeRp
for the circle/square/box beam distribution
Definition: beamBase.h:93
double eventGeneratorMaxEK
Event generator file filter.
Definition: beamBase.h:151
double haloXpCutOuter
for the halo distribution
Definition: beamBase.h:125
double sigmaX
for the gaussian beam distribution
Definition: beamBase.h:87
std::string distrFileFormat
beam parameters
Definition: beamBase.h:53
double beamEnergy
beam parameters
Definition: beamBase.h:42
double envelopeZp
for the circle/square/box beam distribution
Definition: beamBase.h:91
bool eventGeneratorWarnSkippedParticles
Event generator file filter.
Definition: beamBase.h:153
double shellXp
for the elliptic shell distribution
Definition: beamBase.h:106
double sigma66
for the gaussian sigma matrix distribution
Definition: beamBase.h:102
double haloXCutInner
for the halo distribution
Definition: beamBase.h:119
double envelopeZ
for the circle/square/box beam distribution
Definition: beamBase.h:91
double sigma35
for the gaussian sigma matrix distribution
Definition: beamBase.h:99
double sigma44
for the gaussian sigma matrix distribution
Definition: beamBase.h:100
double haloYpCutInner
for the halo distribution
Definition: beamBase.h:124
double emitNY
initial twiss parameters
Definition: beamBase.h:83
double envelopeE
for the circle/square/box beam distribution
Definition: beamBase.h:92
double eventGeneratorMaxZp
Event generator file filter.
Definition: beamBase.h:145
double sigmaXp
for the gaussian beam distribution
Definition: beamBase.h:87
double eventGeneratorMinYp
Event generator file filter.
Definition: beamBase.h:142
double sigma13
for the gaussian sigma matrix distribution
Definition: beamBase.h:97
double sigma34
for the gaussian sigma matrix distribution
Definition: beamBase.h:99
double betx
initial twiss parameters
Definition: beamBase.h:82
std::string distrFile
beam parameters
Definition: beamBase.h:52
double eventGeneratorMinEK
Event generator file filter.
Definition: beamBase.h:150
std::string directionDistrType
beam parameters
Definition: beamBase.h:50
double haloYCutOuter
for the halo distribution
Definition: beamBase.h:122
double sigmaYp
for the gaussian beam distribution
Definition: beamBase.h:87
double haloNSigmaXInner
for the halo distribution
Definition: beamBase.h:115
bool distrFileFromExecOptions
Required to know how to build the absolute path properly.
Definition: beamBase.h:54
double dispxp
initial twiss parameters
Definition: beamBase.h:82
double envelopeYp
for the circle/square/box beam distribution
Definition: beamBase.h:91
double eventGeneratorMaxZ
Event generator file filter.
Definition: beamBase.h:139
double eventGeneratorMinY
Event generator file filter.
Definition: beamBase.h:136
double sigma12
for the gaussian sigma matrix distribution
Definition: beamBase.h:97
double Ek0
initial beam centroid
Definition: beamBase.h:66
std::string spaceDistrType
beam parameters
Definition: beamBase.h:49
double haloNSigmaYOuter
for the halo distribution
Definition: beamBase.h:118
std::string beamParticleName
beam parameters
Definition: beamBase.h:41
bool removeUnstableWithoutDecay
beam parameters
Definition: beamBase.h:56
double sigma26
for the gaussian sigma matrix distribution
Definition: beamBase.h:98
double haloYCutInner
for the halo distribution
Definition: beamBase.h:120
double tilt
tilt of beam applied as rotation about unit local z
Definition: beamBase.h:71
double sigma25
for the gaussian sigma matrix distribution
Definition: beamBase.h:98
double shellXpWidth
for the elliptic shell distribution
Definition: beamBase.h:107
std::string distrType
beam parameters
Definition: beamBase.h:45
double sigma36
for the gaussian sigma matrix distribution
Definition: beamBase.h:99
double sigma46
for the gaussian sigma matrix distribution
Definition: beamBase.h:100
double eventGeneratorMaxRp
Event generator file filter.
Definition: beamBase.h:147
int nlinesIgnore
Ignore first lines in the input bunch file.
Definition: beamBase.h:58
double emitNX
initial twiss parameters
Definition: beamBase.h:83
double eventGeneratorMinZ
Event generator file filter.
Definition: beamBase.h:138
double envelopeR
for the circle/square/box beam distribution
Definition: beamBase.h:93
double S0
initial beam centroid
Definition: beamBase.h:62
double eventGeneratorMinXp
Event generator file filter.
Definition: beamBase.h:140
double shellYp
for the elliptic shell distribution
Definition: beamBase.h:106
double dispyp
initial twiss parameters
Definition: beamBase.h:82
double sigma14
for the gaussian sigma matrix distribution
Definition: beamBase.h:97
double sigma23
for the gaussian sigma matrix distribution
Definition: beamBase.h:98
double sigma11
for the gaussian sigma matrix distribution
Definition: beamBase.h:97
double eventGeneratorMinZp
Event generator file filter.
Definition: beamBase.h:144
double envelopeX
for the circle/square/box beam distribution
Definition: beamBase.h:91
double shellX
for the elliptic shell distribution
Definition: beamBase.h:106
double P0
initial beam centroid
Definition: beamBase.h:67
std::string zDistrType
beam parameters
Definition: beamBase.h:48
double haloNSigmaXOuter
for the halo distribution
Definition: beamBase.h:116
double dispx
initial twiss parameters
Definition: beamBase.h:82
double alfx
initial twiss parameters
Definition: beamBase.h:82
double emitx
initial twiss parameters
Definition: beamBase.h:82
std::string eventGeneratorParticles
Event generator file filter.
Definition: beamBase.h:152
double sigmaT
bunch length
Definition: beamBase.h:74
double sigma22
for the gaussian sigma matrix distribution
Definition: beamBase.h:98
double bety
initial twiss parameters
Definition: beamBase.h:82
std::string yDistrType
beam parameters
Definition: beamBase.h:47
double Zp0
initial beam centroid
Definition: beamBase.h:63
double Rmax
for the ring beam distribution
Definition: beamBase.h:111
double envelopeXp
for the circle/square/box beam distribution
Definition: beamBase.h:91
double Z0
initial beam centroid
Definition: beamBase.h:62
double sigma33
for the gaussian sigma matrix distribution
Definition: beamBase.h:99
std::string energyDistrType
beam parameters
Definition: beamBase.h:51
double eventGeneratorMaxY
Event generator file filter.
Definition: beamBase.h:137
double eventGeneratorMinT
Event generator file filter.
Definition: beamBase.h:148
double sigma15
for the gaussian sigma matrix distribution
Definition: beamBase.h:97
double eventGeneratorMaxT
Event generator file filter.
Definition: beamBase.h:149
double envelopeY
for the circle/square/box beam distribution
Definition: beamBase.h:91
double haloPSWeightParameter
for the halo distribution
Definition: beamBase.h:127
double sigma55
for the gaussian sigma matrix distribution
Definition: beamBase.h:101
double sigma56
for the gaussian sigma matrix distribution
Definition: beamBase.h:101
double X0
initial beam centroid
Definition: beamBase.h:62
double eventGeneratorMaxX
Event generator file filter.
Definition: beamBase.h:135
double envelopeT
for the circle/square/box beam distribution
Definition: beamBase.h:92
int nlinesSkip
Number of event lines to skip after the ignore lines.
Definition: beamBase.h:59
double eventGeneratorMinRp
Event generator file filter.
Definition: beamBase.h:146
double beamMomentum
beam parameters
Definition: beamBase.h:44
double Xp0
initial beam centroid
Definition: beamBase.h:63
double sigma24
for the gaussian sigma matrix distribution
Definition: beamBase.h:98
double eventGeneratorMinX
Event generator file filter.
Definition: beamBase.h:134
std::string xDistrType
beam parameters
Definition: beamBase.h:46
double shellY
for the elliptic shell distribution
Definition: beamBase.h:106
double Yp0
initial beam centroid
Definition: beamBase.h:63
std::string haloPSWeightFunction
for the halo distribution
Definition: beamBase.h:128
double shellYpWidth
for the elliptic shell distribution
Definition: beamBase.h:107
double haloXpCutInner
for the halo distribution
Definition: beamBase.h:123
double Y0
initial beam centroid
Definition: beamBase.h:62
double haloYpCutOuter
for the halo distribution
Definition: beamBase.h:126
double Rmin
for the ring beam distribution
Definition: beamBase.h:111
double T0
initial beam centroid
Definition: beamBase.h:64
double sigmaY
for the gaussian beam distribution
Definition: beamBase.h:87
double shellXWidth
for the elliptic shell distribution
Definition: beamBase.h:107
double shellYWidth
for the elliptic shell distribution
Definition: beamBase.h:107
double E0
initial beam centroid
Definition: beamBase.h:65
Parser namespace for GMAD language. Combination of Geant4 and MAD.