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