BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
optionsBase.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 "optionsBase.h"
20
21#include <iostream>
22
23using namespace GMAD;
24
26{
27 // Default Values for Options
28
29 // executable options
30 inputFileName = "optics.mad";
34 geant4PhysicsMacroFileNameFromExecOptions = false;
35 visDebug = false;
36 outputFileName = "output";
37 outputFormat = "rootevent";
38#ifdef __ROOTDOUBLE__
40#else
42#endif
44 survey = false;
45 surveyFileName = "survey.dat";
46 batch = false;
47
48 verbose = false;
49
51
52 verboseEventBDSIM = false;
56
58
64
65 verboseImportanceSampling = 0;
66
67 verboseSensitivity = false;
68
69 circular = false;
70 seed = -1;
71 randomEngine = "hepjames";
72 nGenerate = 1;
73 recreate = false;
76 writeSeedState = false;
77 useASCIISeedState = false;
80 exportGeometry = false;
81 exportType = "gdml";
82 exportFileName = "geometry";
83 bdsimPath = "";
84
85 // very important options
86 physicsList = ""; //default - only transportation
87 physicsVerbose = false;
88 physicsVerbosity = 1;
89 physicsEnergyLimitLow = 0;
90 physicsEnergyLimitHigh = 0;
91 g4PhysicsUseBDSIMRangeCuts = true;
92 g4PhysicsUseBDSIMCutsAndLimits = true;
93
94 eventOffset = 0;
95 recreateSeedState = true;
96
97 elossHistoBinWidth = 1.0; // m
98
99 ffact = 1.0;
100
101 // beam line offset and rotation
102 beamlineX = 0;
103 beamlineY = 0;
104 beamlineZ = 0;
105 beamlinePhi = 0;
106 beamlineTheta = 0;
107 beamlinePsi = 0;
108 beamlineAxisX = 0;
109 beamlineAxisY = 0;
110 beamlineAxisZ = 0;
111 beamlineAngle = 0;
112 beamlineAxisAngle = false;
113 beamlineS = 0;
114
115 eventNumberOffset = 0;
116
117 // general geometrical parameters
118 checkOverlaps = false;
119 xsize=0.0, ysize=0.0;
120
121 // magnet geometry
122 magnetGeometryType = "polessquare";
123 outerMaterialName = "iron";
124 horizontalWidth = 0.6;
125 thinElementLength = 1e-7;
126 hStyle = false; // vhRatio < 0 as signal to use geometry factory default
127 vhRatio = -1;
128 coilWidthFraction = -1;
129 coilHeightFraction = -1;
130 ignoreLocalMagnetGeometry = false;
131 buildPoleFaceGeometry = true;
132
133 preprocessGDML = true;
134 preprocessGDMLSchema = true;
135
136 // geometry debugging
137 // always split sbends into smaller chunks by default
138 dontSplitSBends = false;
139 includeFringeFields = true;
140 includeFringeFieldsCavities = true;
141
142 yokeFields = true;
143 yokeFieldsMatchLHCGeometry = true;
144 useOldMultipoleOuterFields = false;
145 scalingFieldOuter = 1.0;
146
147 // beam pipe / aperture
148 beampipeThickness = 0.0025;
149 apertureType = "circular";
150 aper1 = 0.025; // also beampipeRadius
151 aper2 = 0;
152 aper3 = 0;
153 aper4 = 0;
154 beampipeMaterial = "StainlessSteel";
155 ignoreLocalAperture = false;
156
157 vacMaterial = "Vacuum";
158 emptyMaterial = "G4_Galactic";
159 worldMaterial = "G4_AIR";
160 worldGeometryFile = "";
161 autoColourWorldGeometryFile = true;
162 importanceWorldGeometryFile = "";
163 importanceVolumeMap = "";
164 worldVolumeMargin = 5; //m
165
166 vacuumPressure = 1e-12;
167
168 // tunnel options
169 buildTunnel = false;
170 buildTunnelStraight = false;
171 tunnelType = "circular";
172 tunnelThickness = 0.1;
174 tunnelMaterial = "concrete";
175 soilMaterial = "soil";
176 buildTunnelFloor = true;
177 tunnelFloorOffset = 1.0; // m
178 tunnelAper1 = 2.0; // m
179 tunnelAper2 = 2.0; // m
180 tunnelVisible = true;
181 tunnelOffsetX = 0;
182 tunnelOffsetY = 0;
183 tunnelMaxSegmentLength = 50.0; // m
184
185 removeTemporaryFiles = true;
186 temporaryDirectory = "";
187
188 // samplers
189 samplerDiameter = 5; // m
190
191 // physics processes
193 turnOnMieScattering = true;
196 scintYieldFactor = 1.0;
202 minimumRange = 0;
204 defaultRangeCut = 1e-3;
205 prodCutPhotons = 1e-3;
206 prodCutElectrons = 1e-3;
207 prodCutPositrons = 1e-3;
208 prodCutProtons = 1e-3;
209 neutronTimeLimit = 1e-6;
211 useLENDGammaNuclear = false;
212 useElectroNuclear = true; // defaults to match g4 em extra physics defaults
213 useMuonNuclear = true;
214 useGammaToMuMu = false;
215 usePositronToMuMu = false;
216 usePositronToHadrons = false;
218
228
229 // biasing options
230 defaultBiasVacuum = "";
231 defaultBiasMaterial = "";
232 biasForWorldVolume = "";
233 biasForWorldContents = "";
234 biasForWorldVacuum = "";
235 worldVacuumVolumeNames = "";
236
237 // tracking options
238 integratorSet = "bdsimmatrix";
239 fieldModulator = "";
240 lengthSafety = 1e-9; // be very careful adjusting this as it affects all the geometry
241 lengthSafetyLarge = 1e-6; // be very careful adjusting this as it affects all the geometry
242 maximumTrackingTime = -1; // s, nonsensical - used for testing
243 maximumStepLength = 20; // m, quite big
244 maximumTrackLength = 1e90; // m, no limit but smaller than DBL_MAX for safe *CLHEP::m
245 chordStepMinimum = 1e-9; // m // minimum step in a field for an integrator
246 chordStepMinimumYoke = 1e-6;
247 deltaIntersection = 1e-8; // m - should be greater than lengthSafety!
248 sampleElementsWithPoleface = false; // affects dipole tracking in certain integrator sets when true
249 nominalMatrixRelativeMomCut = 0.05; // be careful adjusting this as it affects dipolequadrupole tracking
251 dEThresholdForScattering = 1e-11; // GeV
252 backupStepperMomLimit = 0.1; // fraction of unit momentum
253
254 // default value in Geant4, old value 0 - error must be greater than this
255 minimumEpsilonStep = 1e-12; // used to be 1e-25 but since v11.1 this has to be greater than double precision
256 maximumEpsilonStep = 1e-7; // default value in Geant4, old value 1e-7
257 deltaOneStep = 1e-6; // maximum allowed spatial error in position (1um)
258 stopSecondaries = false;
259 killNeutrinos = false;
260 killedParticlesMassAddedToEloss = false;
261 minimumRadiusOfCurvature = 0.05; // 5cm - typical aperture
262
263 // hit generation
264 sensitiveOuter = true;
265 sensitiveBeamPipe = true;
266
267 // output / analysis options
268 numberOfEventsPerNtuple = 0;
269
270 storeMinimalData = false;
271
272 storeApertureImpacts = true;
273 storeApertureImpactsHistograms = true;
274 storeApertureImpactsIons = false;
275 storeApertureImpactsAll = false;
276 apertureImpactsMinimumKE = 0;
277 storeCavityInfo = true;
278 storeCollimatorInfo = false;
279 storeCollimatorHits = false;
280 storeCollimatorHitsLinks = false;
281 storeCollimatorHitsIons = false;
282 storeCollimatorHitsAll = false;
283 collimatorHitsMinimumKE = 0;
284 storeEloss = true;
285 storeElossHistograms = true;
286 storeElossVacuum = false;
287 storeElossVacuumHistograms = false;
288 storeElossTunnel = false;
289 storeElossTunnelHistograms = false;
290 storeElossWorld = false;
291 storeElossWorldIntegral = false;
292 storeElossWorldContents = false;
293 storeElossWorldContentsIntegral = false;
294 storeElossTurn = false;
295 storeElossLinks = false;
296 storeElossLocal = false;
297 storeElossGlobal = false;
298 storeElossTime = false;
299 storeElossStepLength = false;
300 storeElossPreStepKineticEnergy = false;
301 storeElossModelID = false;
302 storeElossPhysicsProcesses = false;
303 storeParticleData = true;
304 storePrimaries = true;
305 storePrimaryHistograms = true;
306
307 storeTrajectory = false;
308
309 storeTrajectoryDepth = 0;
310 storeTrajectoryStepPoints = 0;
311 storeTrajectoryStepPointLast = false;
312 storeTrajectoryParticle = "";
313 storeTrajectoryParticleID = "";
314 storeTrajectorySecondaryParticles = false;
315 storeTrajectoryEnergyThreshold = -1.0;
316 storeTrajectorySamplerID = "";
317 storeTrajectoryELossSRange = "";
318
319 storeTrajectoryTransportationSteps = true;
320 trajNoTransportation = false;
321 storeTrajectoryKineticEnergy = true;
322 storeTrajectoryMomentumVector = false;
323 storeTrajectoryProcesses = false;
324 storeTrajectoryTime = false;
325 storeTrajectoryLocal = false;
326 storeTrajectoryLinks = false;
327 storeTrajectoryIon = false;
328 storeTrajectoryMaterial = false;
329 storeTrajectoryAllVariables = false;
330
331 trajectoryFilterLogicAND = false;
332
333 storeSamplerAll = false;
334 storeSamplerPolarCoords = false;
335 storeSamplerCharge = false;
336 storeSamplerKineticEnergy = true;
337 storeSamplerMass = false;
338 storeSamplerRigidity = false;
339 storeSamplerIon = false;
340
341 trajCutGTZ = 1e99; // minimum z position, so large default value
342 trajCutLTR = 0.0; // maximum radius in mm, so small default value
343 trajConnect = false; // connect disconnected trajectory trees
344
345 storeModel = true;
346
347 samplersSplitLevel = 0;
348 modelSplitLevel = 1;
349 uprootCompatible = 0;
350
351 // circular options
352 nturns = 1;
353 ptcOneTurnMapFileName = "";
354
355 printFractionEvents = 0.1;
356 printFractionTurns = 0.2;
357 printPhysicsProcesses = false;
358
359 // visualisation
361
362 // scoring map
363 nbinsx = 1;
364 nbinsy = 1;
365 nbinsz = 1;
366 nbinse = 1;
367 xmin = -0.5;
368 xmax = 0.5;
369 ymin = -0.5;
370 ymax = 0.5;
371 zmin = 0;
372 zmax = 1;
373 emin = 1e-12;
374 emax = 1e4;
375 useScoringMap = false;
376}
377
378
380{
381 std::cout<<"Options " << std::endl;
382 std::cout<<"n particles : " << nGenerate << std::endl;
383 std::cout<<"BV sign : " << ffact << std::endl;
384 std::cout<<"Optical absorption on : " << turnOnOpticalAbsorption << std::endl;
385 std::cout<<"Mie scattering on : " << turnOnMieScattering << std::endl;
386 std::cout<<"Rayleigh scattering on : " << turnOnRayleighScattering << std::endl;
387 std::cout<<"Optical surface on : " << turnOnOpticalSurface << std::endl;
388}
389
std::string bdsimPath
Definition: optionsBase.h:112
std::string seedStateFileName
Seed state file path.
Definition: optionsBase.h:99
std::string magnetGeometryType
default magnet geometry parameters
Definition: optionsBase.h:154
double beamlineZ
Initial beam line transform w.r.t. the world coordinate frame.
Definition: optionsBase.h:134
int nGenerate
The number of primary events to simulate.
Definition: optionsBase.h:93
std::string physicsList
list of physics processes
Definition: optionsBase.h:115
double muonSplittingThresholdParentEk2
physics parameters
Definition: optionsBase.h:265
double beamlineAngle
Initial beam line transform w.r.t. the world coordinate frame.
Definition: optionsBase.h:141
double beamlineS
Initial beam line transform w.r.t. the world coordinate frame.
Definition: optionsBase.h:143
bool survey
Parameter for survey.
Definition: optionsBase.h:55
double minimumRange
physics parameters
Definition: optionsBase.h:242
std::string outputFileName
Parameter for output format.
Definition: optionsBase.h:48
int muonSplittingFactor
physics parameters
Definition: optionsBase.h:262
double tunnelSoilThickness
tunnel geometry parameters
Definition: optionsBase.h:209
double minimumRadiusOfCurvature
Minimum allowed radius of curvature.
Definition: optionsBase.h:295
std::string outputFormat
Parameter for output format.
Definition: optionsBase.h:49
int verboseSteppingEventContinueFor
Stepping level verbosity.
Definition: optionsBase.h:82
bool beamlineAxisAngle
Initial beam line transform w.r.t. the world coordinate frame.
Definition: optionsBase.h:142
std::string exportFileName
Parameter for controlling geometry export.
Definition: optionsBase.h:107
int seed
The seed value for the random number generator.
Definition: optionsBase.h:91
double tunnelOffsetY
tunnel geometry parameters
Definition: optionsBase.h:218
double tunnelFloorOffset
tunnel geometry parameters
Definition: optionsBase.h:213
int verboseEventContinueFor
Event level verbosity.
Definition: optionsBase.h:73
bool hStyle
H Style dipoles (if not, C Style).
Definition: optionsBase.h:158
double xsize
for element specification
Definition: optionsBase.h:151
std::string particlesToExcludeFromCuts
physics parameters
Definition: optionsBase.h:243
double ffact
magnetic field flip (+1 default, -1: flip sign)
Definition: optionsBase.h:129
double tunnelMaxSegmentLength
tunnel geometry parameters
Definition: optionsBase.h:219
double muonSplittingThresholdParentEk
physics parameters
Definition: optionsBase.h:263
int verboseEventStart
Event level verbosity.
Definition: optionsBase.h:72
bool useLENDGammaNuclear
physics parameters
Definition: optionsBase.h:251
double maximumTrackingTime
Maximum tracking time per track [s].
Definition: optionsBase.h:283
bool dontSplitSBends
geometry debug, don't split bends into multiple segments
Definition: optionsBase.h:170
std::string tunnelMaterial
tunnel geometry parameters
Definition: optionsBase.h:210
bool useASCIISeedState
Whether to use the seed state from an ASCII file.
Definition: optionsBase.h:98
bool tunnelIsInfiniteAbsorber
physics parameters
Definition: optionsBase.h:261
bool verboseSteppingPrimaryOnly
Stepping level verbosity.
Definition: optionsBase.h:83
double muonSplittingExclusionWeight
physics parameters
Definition: optionsBase.h:267
bool collimatorsAreInfiniteAbsorbers
physics parameters
Definition: optionsBase.h:260
int verboseRunLevel
Run level verbosity.
Definition: optionsBase.h:67
bool turnOnOpticalSurface
Physics processes.
Definition: optionsBase.h:232
double prodCutProtons
physics parameters
Definition: optionsBase.h:248
int nSegmentsPerCircle
Number of facets per 2pi in visualisation.
Definition: optionsBase.h:401
std::string soilMaterial
tunnel geometry parameters
Definition: optionsBase.h:211
bool preprocessGDML
geometry control
Definition: optionsBase.h:166
int maximumBetaChangePerStep
physics parameters
Definition: optionsBase.h:238
bool batch
Flag for batch / interactive mode.
Definition: optionsBase.h:59
double minimumKineticEnergy
physics parameters
Definition: optionsBase.h:240
int eventOffset
Event number to start from when recreating from a root file.
Definition: optionsBase.h:123
int verboseTrackingLevel
Tracking verbosity.
Definition: optionsBase.h:76
bool circular
Flag for circular machine.
Definition: optionsBase.h:90
bool checkOverlaps
bdsim options
Definition: optionsBase.h:149
double neutronKineticEnergyLimit
physics parameters
Definition: optionsBase.h:250
double aper1
default beampipe parameters
Definition: optionsBase.h:183
double maximumTrackLength
Maximum permitted track length [m].
Definition: optionsBase.h:285
int verboseEventLevel
Event level verbosity.
Definition: optionsBase.h:71
bool restoreFTPFDiffractionForAGreater10
physics parameters
Definition: optionsBase.h:257
bool turnOnOpticalAbsorption
Physics processes.
Definition: optionsBase.h:229
bool buildTunnelStraight
tunnel geometry parameters
Definition: optionsBase.h:206
std::string inputFileName
Input filename.
Definition: optionsBase.h:40
long maximumTracksPerEvent
physics parameters
Definition: optionsBase.h:239
double backupStepperMomLimit
Fractional momentum limit for reverting to backup steppers.
Definition: optionsBase.h:300
double aper2
default beampipe parameters
Definition: optionsBase.h:184
int outputCompressionLevel
Parameter for output format.
Definition: optionsBase.h:51
double beamlinePhi
Initial beam line transform w.r.t. the world coordinate frame.
Definition: optionsBase.h:135
double maximumStepLength
Maximum permitted step length in any volume.
Definition: optionsBase.h:284
std::string exportType
Parameter for controlling geometry export.
Definition: optionsBase.h:106
double neutronTimeLimit
physics parameters
Definition: optionsBase.h:249
bool recreateSeedState
Load seed state when recreating events.
Definition: optionsBase.h:124
std::string vacMaterial
vacuum material
Definition: optionsBase.h:191
bool verbose
General verbosity.
Definition: optionsBase.h:64
std::string recreateFileName
The file path to recreate a run from.
Definition: optionsBase.h:95
bool teleporterFullTransform
Whether to use the new Transform3D method for the teleporter.
Definition: optionsBase.h:298
bool buildTunnelFloor
tunnel geometry parameters
Definition: optionsBase.h:212
int startFromEvent
Event to start from when recreating.
Definition: optionsBase.h:96
std::string emptyMaterial
material in container volumes
Definition: optionsBase.h:192
bool muonSplittingExcludeWeight1Particles
physics parameters
Definition: optionsBase.h:266
double prodCutPhotons
physics parameters
Definition: optionsBase.h:245
bool generatePrimariesOnly
Whether to only generate primary coordinates and quit, or not.
Definition: optionsBase.h:102
double defaultRangeCut
physics parameters
Definition: optionsBase.h:244
double beamlineAxisY
Initial beam line transform w.r.t. the world coordinate frame.
Definition: optionsBase.h:139
double prodCutElectrons
physics parameters
Definition: optionsBase.h:246
double tunnelAper1
tunnel geometry parameters
Definition: optionsBase.h:214
bool verboseEventBDSIM
Event level verbosity.
Definition: optionsBase.h:70
int maximumPhotonsPerStep
physics parameters
Definition: optionsBase.h:237
std::string beampipeMaterial
default beampipe parameters
Definition: optionsBase.h:187
bool exportGeometry
Parameter for controlling geometry export.
Definition: optionsBase.h:105
int verboseSteppingLevel
Stepping level verbosity.
Definition: optionsBase.h:80
double beampipeThickness
default beampipe parameters
Definition: optionsBase.h:181
bool turnOnRayleighScattering
Physics processes.
Definition: optionsBase.h:231
std::string geant4PhysicsMacroFileName
Geant4 physics macro.
Definition: optionsBase.h:43
void print() const
print some properties
Definition: optionsBase.cc:379
std::string visMacroFileName
Visualisation filename.
Definition: optionsBase.h:41
double scintYieldFactor
physics parameters
Definition: optionsBase.h:236
bool beamPipeIsInfiniteAbsorber
physics parameters
Definition: optionsBase.h:259
double beamlineX
Initial beam line transform w.r.t. the world coordinate frame.
Definition: optionsBase.h:132
std::string apertureType
default beampipe parameters
Definition: optionsBase.h:182
bool verboseSteppingBDSIM
Stepping level verbosity.
Definition: optionsBase.h:79
bool useMuonNuclear
physics parameters
Definition: optionsBase.h:253
bool useElectroNuclear
physics parameters
Definition: optionsBase.h:252
int verboseSteppingEventStart
Stepping level verbosity.
Definition: optionsBase.h:81
std::string surveyFileName
Parameter for survey.
Definition: optionsBase.h:56
bool recreate
Whether to recreate from a file or not.
Definition: optionsBase.h:94
double tunnelAper2
tunnel geometry parameters
Definition: optionsBase.h:215
bool turnOnMieScattering
Physics processes.
Definition: optionsBase.h:230
double beamlineY
Initial beam line transform w.r.t. the world coordinate frame.
Definition: optionsBase.h:133
double beamlineAxisX
Initial beam line transform w.r.t. the world coordinate frame.
Definition: optionsBase.h:138
double tunnelThickness
tunnel geometry parameters
Definition: optionsBase.h:208
std::string randomEngine
Name of random engine to use.
Definition: optionsBase.h:92
double prodCutPositrons
physics parameters
Definition: optionsBase.h:247
bool buildTunnel
tunnel geometry parameters
Definition: optionsBase.h:205
bool outputDoublePrecision
Parameter for output format.
Definition: optionsBase.h:50
bool writeSeedState
Write the seed state each event to a text file.
Definition: optionsBase.h:97
bool visDebug
Flag for visualisation debug.
Definition: optionsBase.h:45
bool useGammaToMuMu
physics parameters
Definition: optionsBase.h:254
double aper4
default beampipe parameters
Definition: optionsBase.h:186
double aper3
default beampipe parameters
Definition: optionsBase.h:185
double minimumKineticEnergyTunnel
physics parameters
Definition: optionsBase.h:241
double tunnelOffsetX
tunnel geometry parameters
Definition: optionsBase.h:217
bool usePositronToMuMu
physics parameters
Definition: optionsBase.h:255
std::string tunnelType
tunnel geometry parameters
Definition: optionsBase.h:207
double beamlineAxisZ
Initial beam line transform w.r.t. the world coordinate frame.
Definition: optionsBase.h:140
double beamlinePsi
Initial beam line transform w.r.t. the world coordinate frame.
Definition: optionsBase.h:137
std::string geant4MacroFileName
Geant4 macro to run.
Definition: optionsBase.h:42
bool trajNoTransportation
kept only for backwards compatibility.
Definition: optionsBase.h:360
bool usePositronToHadrons
physics parameters
Definition: optionsBase.h:256
bool tunnelVisible
tunnel geometry parameters
Definition: optionsBase.h:216
int muonSplittingFactor2
physics parameters
Definition: optionsBase.h:264
double worldVolumeMargin
Padding margin for world volume size.
Definition: optionsBase.h:200
double nominalMatrixRelativeMomCut
Momentum threshold for nominal dipole matrix tracking.
Definition: optionsBase.h:297
double beamlineTheta
Initial beam line transform w.r.t. the world coordinate frame.
Definition: optionsBase.h:136
bool ignoreLocalAperture
default beampipe parameters
Definition: optionsBase.h:188
Parser namespace for GMAD language. Combination of Geant4 and MAD.