BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSIMClass.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 "BDSIMClass.hh"
20
21#include "BDSExecOptions.hh" // executable command line options
22#include "BDSGlobalConstants.hh" // global parameters
23
24#include <algorithm>
25#include <csignal>
26#include <cstdlib>
27#include <cstdio>
28
29#include "G4EventManager.hh" // Geant4 includes
30#include "G4GenericBiasingPhysics.hh"
31#include "G4GeometryManager.hh"
32#include "G4GeometryTolerance.hh"
33#include "G4PhysicsListHelper.hh"
34#include "G4ParallelWorldPhysics.hh"
35#include "G4ParticleDefinition.hh"
36#include "G4SteppingManager.hh"
37#include "G4TrackingManager.hh"
38#include "G4Version.hh"
39#include "G4VModularPhysicsList.hh"
40#ifdef USE_GEANT4CGALBOOLEAN
41#include "G4BooleanProcessorCGAL.hh"
42#endif
43
44#include "CLHEP/Units/SystemOfUnits.h"
45
46#include "BDSAcceleratorModel.hh"
47#include "BDSAperturePointsLoader.hh"
48#include "BDSBeamPipeFactory.hh"
49#include "BDSBunch.hh"
50#include "BDSBunchFactory.hh"
51#include "BDSCavityFactory.hh"
52#include "BDSColours.hh"
53#include "BDSComponentFactoryUser.hh"
54#include "BDSDebug.hh"
55#include "BDSDetectorConstruction.hh"
56#include "BDSEventAction.hh"
57#include "BDSException.hh"
58#include "BDSFieldFactory.hh"
59#include "BDSFieldLoader.hh"
60#include "BDSGeometryFactory.hh"
61#include "BDSGeometryFactorySQL.hh"
62#include "BDSGeometryWriter.hh"
63#include "BDSIonDefinition.hh"
64#include "BDSMaterials.hh"
65#include "BDSOutput.hh"
66#include "BDSOutputFactory.hh"
67#include "BDSParallelWorldUtilities.hh"
68#include "BDSParser.hh" // Parser
69#include "BDSParticleDefinition.hh"
70#include "BDSPhysicsUtilities.hh"
71#include "BDSPrimaryGeneratorAction.hh"
72#include "BDSRandom.hh" // for random number generator from CLHEP
73#include "BDSRunAction.hh"
74#include "BDSRunManager.hh"
75#include "BDSSamplerRegistry.hh"
76#include "BDSSDManager.hh"
77#include "BDSSteppingAction.hh"
78#include "BDSStackingAction.hh"
79#include "BDSTemporaryFiles.hh"
80#include "BDSTrackingAction.hh"
81#include "BDSUtilities.hh"
82#include "BDSVisManager.hh"
83#include "BDSWarning.hh"
84
85#include "FTFP_BERT.hh"
86#include "BDSPhysicsMilli.hh"
87
89 ignoreSIGINT(false),
90 usualPrintOut(true),
91 initialised(false),
92 initialisationResult(1),
93 argcCache(0),
94 argvCache(nullptr),
95 parser(nullptr),
96 bdsOutput(nullptr),
97 bdsBunch(nullptr),
98 runManager(nullptr),
99 userComponentFactory(nullptr),
100 userPhysicsList(nullptr),
101 realWorld(nullptr)
102{;}
103
105 ignoreSIGINT(false),
106 usualPrintOut(true),
107 initialised(false),
108 initialisationResult(1),
109 argcCache(0),
110 argvCache(nullptr),
111 parser(parserIn),
112 bdsOutput(nullptr),
113 bdsBunch(nullptr),
114 runManager(nullptr),
115 userComponentFactory(nullptr),
116 userPhysicsList(nullptr),
117 realWorld(nullptr)
118{
120}
121
122
123BDSIM::BDSIM(int argc, char** argv, bool usualPrintOutIn):
124 ignoreSIGINT(false),
125 usualPrintOut(usualPrintOutIn),
126 initialised(false),
127 initialisationResult(1),
128 argcCache(argc),
129 argvCache(argv),
130 parser(nullptr),
131 bdsOutput(nullptr),
132 bdsBunch(nullptr),
133 runManager(nullptr),
134 userComponentFactory(nullptr),
135 userPhysicsList(nullptr),
136 realWorld(nullptr)
137{
139}
140
141int BDSIM::Initialise(int argc, char** argv, bool usualPrintOutIn)
142{
143 argcCache = argc;
144 argvCache = argv;
145 usualPrintOut = usualPrintOutIn;
148}
149
151{
152
153#ifdef USE_GEANT4CGALBOOLEAN
154 G4BooleanSolid::SetExternalBooleanProcessor(new G4BooleanProcessorCGAL());
155#endif
156
158 const BDSExecOptions* execOptions = new BDSExecOptions(argcCache,argvCache);
159 if (usualPrintOut)
160 {execOptions->Print();}
161 ignoreSIGINT = execOptions->IgnoreSIGINT(); // different sig catching for cmake
162
163 execOptions->PrintCopyright();
164#ifdef BDSDEBUG
165 G4cout << __METHOD_NAME__ << "DEBUG mode is on." << G4endl;
166#endif
167
169 if (!parser) {
170 parser = BDSParser::Instance(execOptions->InputFileName());
172 }
173
174 parser->AmalgamateOptions(execOptions->Options());
175 parser->AmalgamateBeam(execOptions->Beam(),
176 execOptions->Options().recreate);
179
180
183
185 delete execOptions;
186
191
193 BDSRandom::CreateRandomNumberGenerator(globals->RandomEngine());
194 BDSRandom::SetSeed(); // set the seed from options
195
197 bdsOutput = BDSOutputFactory::CreateOutput(globals->OutputFormat(),
198 globals->OutputFileName());
199
202 {
203 G4cerr << "No Geant4 environmental variables found - please source geant4.sh environment" << G4endl;
204 G4cout << "A common fault is the wrong Geant4 environment as compared to the one BDSIM was compiled with." << G4endl;
205 return 1;
206 }
207
211
214
216 auto parallelWorldsRequiringPhysics = BDS::ConstructAndRegisterParallelWorlds(realWorld,
218 realWorld->BuildPlacementFieldsWorld());
219 runManager->SetUserInitialization(realWorld);
220
223#ifdef BDSDEBUG
224 G4cout << __METHOD_NAME__ << "> Constructing physics processes" << G4endl;
225#endif
226 G4String physicsListName = parser->GetOptions().physicsList;
227
228#if G4VERSION_NUMBER > 1049
229 // from 10.5 onwards they have a looping particle killer that warnings and kills particles
230 // deemed to be looping that are <100 MeV. This is unrelated to the primary energy so troublesome.
231 // set to the 'low' limits here ~10keV. This must be done before any physics is created as the
232 // parameters are copied into the transportation physics process for each particle and it's very
233 // hard to sift through and fix afterwards
234 G4PhysicsListHelper::GetPhysicsListHelper()->UseLowLooperThresholds();
235#endif
236 // sampler physics process for parallel world tracking must be instantiated BEFORE
237 // regular physics.
238 // Note, we purposively don't create a parallel world process for the curvilinear
239 // world as we don't need the track information from it - unreliable that way. We
240 // query the geometry directly using our BDSAuxiliaryNavigator class.
241 auto parallelWorldPhysics = BDS::ConstructParallelWorldPhysics(parallelWorldsRequiringPhysics);
242 G4int physicsVerbosity = globals->PhysicsVerbosity();
243 G4VModularPhysicsList* physList;
244 if(BDSGlobalConstants::Instance()->enableMillicharge())
245 {
246 G4cout << "Using millicharged physics" << G4endl;
247 physList = new FTFP_BERT();
248 physList->ReplacePhysics(new BDSPhysicsMilli("G4millicharged",physicsVerbosity));
249 }
250 else if (userPhysicsList)
251 {
252 G4cout << "Using externally registered user defined physics list" << G4endl;
253 physList = userPhysicsList;
254 }
255 else
256 {physList = BDS::BuildPhysics(physicsListName, physicsVerbosity);}
257
258 // create geometry sampler and register importance sampling biasing. Has to be here
259 // before physicsList is "initialised" in run manager.
260 if (BDSGlobalConstants::Instance()->UseImportanceSampling())
261 {BDS::RegisterImportanceBiasing(parallelWorldsRequiringPhysics,physList);}
262
263 // Construction of the physics lists defines the necessary particles and therefore
264 // we can calculate the beam rigidity for the particle the beam is designed w.r.t. This
265 // must happen before the geometry is constructed (which is called by
266 // runManager->Initialize()).
267 BDSParticleDefinition* designParticle = nullptr;
268 BDSParticleDefinition* beamParticle = nullptr;
269 G4bool beamDifferentFromDesignParticle = false;
271 globals->FFact(),
272 designParticle,
273 beamParticle,
274 beamDifferentFromDesignParticle);
275 G4double minEK = globals->MinimumKineticEnergy();
276 if (beamParticle->KineticEnergy() < minEK && BDS::IsFinite(minEK))
277 {throw BDSException("option, minimumKineticEnergy is higher than kinetic energy of the beam - all primary particles wil be killed!");}
278 if (usualPrintOut)
279 {
280 G4cout << "Design particle properties: " << G4endl << *designParticle;
281 if (beamDifferentFromDesignParticle)
282 {G4cout << "Beam particle properties: " << G4endl << *beamParticle;}
283 }
284 // update rigidity where needed
285 realWorld->SetDesignParticle(designParticle);
287 BDSGeometryFactorySQL::SetDefaultRigidity(designParticle->BRho()); // used for sql field loading
288
289 // Muon splitting - optional - should be done *after* biasing to work with it - TBC it's before...
290 BDS::BuildMuonBiasing(physList);
291
292 BDS::RegisterSamplerPhysics(parallelWorldPhysics, physList);
293 auto biasPhysics = BDS::BuildAndAttachBiasWrapper(parser->GetBiasing());
294 if (biasPhysics)//could be nullptr and can't be passed to geant4 like this
295 {physList->RegisterPhysics(biasPhysics);}
296 runManager->SetUserInitialization(physList);
297
300 parser->GetBeam(),
301 globals->BeamlineTransform(),
302 globals->BeamlineS(),
303 globals->GeneratePrimariesOnly());
304 G4cout << "Bunch distribution: \"" << bdsBunch->Name() << "\"" << G4endl;
307 delete beamParticle;
311
315 if (globals->GeneratePrimariesOnly())
316 {
317 GeneratePrimariesOnly(globals);
318 return 0;
319 }
320
322 G4GeometryTolerance* theGeometryTolerance = G4GeometryTolerance::GetInstance();
323 if (usualPrintOut)
324 {
325 G4cout << __METHOD_NAME__ << "Geometry Tolerances: " << G4endl;
326 G4cout << __METHOD_NAME__ << std::setw(12) << "Surface: " << std::setw(7) << theGeometryTolerance->GetSurfaceTolerance() << " mm" << G4endl;
327 G4cout << __METHOD_NAME__ << std::setw(12) << "Angular: " << std::setw(7) << theGeometryTolerance->GetAngularTolerance() << " rad" << G4endl;
328 G4cout << __METHOD_NAME__ << std::setw(12) << "Radial: " << std::setw(7) << theGeometryTolerance->GetRadialTolerance() << " mm" << G4endl;
329 }
330
332 BDSEventAction* eventAction = new BDSEventAction(bdsOutput);
333 runManager->SetUserAction(eventAction);
334
335 BDSRunAction* runAction = new BDSRunAction(bdsOutput,
336 bdsBunch,
338 eventAction,
339 globals->StoreTrajectorySamplerID());
340 runManager->SetUserAction(runAction);
341
342 // Only add stepping action if it is actually used, so do check here (for performance reasons)
343 G4int verboseSteppingEventStart = globals->VerboseSteppingEventStart();
344 G4int verboseSteppingEventStop = BDS::VerboseEventStop(verboseSteppingEventStart,
345 globals->VerboseSteppingEventContinueFor());
346 if (globals->VerboseSteppingBDSIM())
347 {
348 runManager->SetUserAction(new BDSSteppingAction(true,
349 verboseSteppingEventStart,
350 verboseSteppingEventStop));
351 }
352
353 runManager->SetUserAction(new BDSTrackingAction(globals->Batch(),
354 globals->StoreTrajectory(),
355 globals->StoreTrajectoryOptions(),
356 eventAction,
357 verboseSteppingEventStart,
358 verboseSteppingEventStop,
359 globals->VerboseSteppingPrimaryOnly(),
360 globals->VerboseSteppingLevel()));
361
362 runManager->SetUserAction(new BDSStackingAction(globals));
363
364 auto primaryGeneratorAction = new BDSPrimaryGeneratorAction(bdsBunch, parser->GetBeam(), globals->Batch());
365 // possibly updated after the primary generator as loaded a beam file
366 eventAction->SetPrintModulo(BDSGlobalConstants::Instance()->PrintModuloEvents());
367 runManager->SetUserAction(primaryGeneratorAction);
368 BDSFieldFactory::SetPrimaryGeneratorAction(primaryGeneratorAction);
369
372
374 if (globals->UseImportanceSampling())
375 {BDS::AddIStore(parallelWorldsRequiringPhysics);}
376
379
380 if (usualPrintOut && globals->PhysicsVerbose())
381 {
384 }
385
389 runManager->SetVerboseLevel(std::min(globals->VerboseRunLevel(), globals->PhysicsVerbosity()));
390 G4EventManager::GetEventManager()->SetVerboseLevel(globals->VerboseEventLevel());
391 G4EventManager::GetEventManager()->GetTrackingManager()->SetVerboseLevel(globals->VerboseTrackingLevel());
392
394 G4bool bCloseGeometry = G4GeometryManager::GetInstance()->CloseGeometry();
395 if (!bCloseGeometry)
396 {
397 G4cerr << __METHOD_NAME__ << "error - geometry not closed." << G4endl;
398 return 1;
399 }
400
401 if (globals->ExportGeometry())
402 {
403 BDSGeometryWriter geometrywriter;
404 geometrywriter.ExportGeometry(globals->ExportType(),
405 globals->ExportFileName());
406 }
407
408 initialised = true;
409 return 0;
410}
411
412void BDSIM::BeamOn(int nGenerate)
413{
415 {return;} // a mode where we don't do anything
416
417 G4cout.precision(10);
419 struct sigaction act;
420 act.sa_handler = &BDS::HandleAborts;
421 sigemptyset(&act.sa_mask);
422 act.sa_flags = 0;
423 if (!ignoreSIGINT)
424 {sigaction(SIGINT, &act, nullptr);}
425 sigaction(SIGABRT, &act, nullptr);
426 sigaction(SIGTERM, &act, nullptr);
427 sigaction(SIGSEGV, &act, nullptr);
428
430 try
431 {
432 if (!BDSGlobalConstants::Instance()->Batch()) // Interactive mode
433 {
434 BDSVisManager visManager = BDSVisManager(BDSGlobalConstants::Instance()->VisMacroFileName(),
435 BDSGlobalConstants::Instance()->Geant4MacroFileName(),
436 realWorld,
437 BDSGlobalConstants::Instance()->VisVerbosity());
438 visManager.StartSession(argcCache, argvCache);
439 }
440 else
441 {// batch mode
442 if (nGenerate < 0)
444 else
445 {runManager->BeamOn(nGenerate);}
446 }
447 }
448 catch (const BDSException& exception)
449 {
450 // don't do this for now in case it's dangerous and we try tracking with open geometry
451 //G4GeometryManager::GetInstance()->OpenGeometry();
452 throw exception;
453 }
454}
455
457{
459 G4GeometryManager::GetInstance()->OpenGeometry();
460
461#ifdef BDSDEBUG
462 G4cout << __METHOD_NAME__ << "deleting..." << G4endl;
463#endif
464 delete bdsOutput;
465
466 try
467 {
468 // order important here because of singletons relying on each other
469 delete BDSSDManager::Instance();
473 delete BDSAcceleratorModel::Instance();
475 delete BDSFieldFactory::Instance(); // this uses BDSGlobalConstants which uses BDSMaterials
477 delete BDSMaterials::Instance();
478
479 // instances not used in this file, but no other good location for deletion
480 if (initialisationResult < 2)
481 {
482 delete BDSColours::Instance();
486 }
487 }
488 catch (...)
489 {;} // ignore any exception as this is a destructor
490
491 delete runManager;
492 delete bdsBunch;
493
494 if (usualPrintOut)
495 {G4cout << __METHOD_NAME__ << "End of Run. Thank you for using BDSIM!" << G4endl;}
496}
497
498void BDSIM::RegisterUserComponent(const G4String& componentTypeName,
499 BDSComponentConstructor* componentConstructor)
500{
501 if (initialised)
502 {BDS::Warning(__METHOD_NAME__, "BDSIM kernel already initialised - this component will not be available");}
505
506 userComponentFactory->RegisterComponent(componentTypeName,
507 componentConstructor);
508}
509
511{
512 // output creation is duplicated below but with this if loop, we exit so ok.
514 const G4int nToGenerate = globals->NGenerate();
515 const G4int printModulo = globals->PrintModuloEvents();
516 bdsBunch->BeginOfRunAction(nToGenerate, globals->Batch());
517 auto flagsCache(G4cout.flags());
518 for (G4int i = 0; i < nToGenerate; i++)
519 {
520 if (i%printModulo == 0)
521 {G4cout << "\r Primary> " << std::fixed << i << " of " << nToGenerate << G4endl;}
523 // always pull particle definition in case it's updated
525 bdsOutput->FillEventPrimaryOnly(coords, pDef);
526 }
527 G4cout.flags(flagsCache); // restore cout flags
528 // Write options now the file is open
531
532 // Write beam
534 bdsOutput->FillBeam(bb);
535
537}
static BDSAperturePointsCache * Instance()
Access the singleton instance.
void ClearCachedFiles()
Delete all cached points from memory and clear the map of files loaded.
static BDSBeamPipeFactory * Instance()
Singleton accessor.
static BDSBunch * CreateBunch(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const G4Transform3D &beamlineTransform=G4Transform3D::Identity, G4double beamlineS=0, G4bool generatePrimariesOnlyIn=false)
factory method
virtual void BeginOfRunAction(G4int numberOfEvents, G4bool batchMode)
Definition BDSBunch.cc:285
virtual G4bool ExpectChangingParticleType() const
A hint of whether we expect to require and extended particle set (ie pions, kaons,...
Definition BDSBunch.hh:80
virtual const BDSParticleDefinition * ParticleDefinition() const
Access the beam particle definition.
Definition BDSBunch.hh:96
G4String Name() const
Distribution name.
Definition BDSBunch.hh:145
virtual BDSParticleCoordsFullGlobal GetNextParticleValid(G4int maxTries=100)
Definition BDSBunch.cc:234
static BDSCavityFactory * Instance()
Singleton accessor.
static BDSColours * Instance()
singleton pattern
Definition BDSColours.cc:33
Interface class the developer should derive to construct their element.
Factory for user specified accelerator components.
void RegisterComponent(const G4String &componentTypeName, BDSComponentConstructor *componentConstructor)
Register a constructor instance by a given name.
Class that constructs a Geant4 model of an accelerator.
void SetDesignParticle(const BDSParticleDefinition *defIn)
Set the (initial) design particle definition.
Process information at the event level.
void SetPrintModulo(G4int printModuloIn)
General exception with possible name of object and message.
Executable option processing for BDSIM.
const GMAD::Options & Options() const
Accessor for options generated by command line parsing.
void Print() const
Print out the commands and their set values.
G4bool IgnoreSIGINT() const
Accessor.
const GMAD::Beam & Beam() const
Accessor for beam options generate by command line parsing.
void PrintCopyright() const
Print out the copyright information (no exit).
G4String InputFileName() const
Acessor for convenience for the one thing that's needed before the parser options.
static void SetDesignParticle(const BDSParticleDefinition *designParticleIn)
Update the internal cache of the rigidity.
static void SetPrimaryGeneratorAction(BDSPrimaryGeneratorAction *pgaIn)
Update the internal cache of the primary generator action.
static BDSFieldFactory * Instance()
Public accessor method for singleton pattern.
static BDSFieldLoader * Instance()
Singleton accessor.
static BDSGeometryFactory * Instance()
Singleton accessor.
A class for writing fully constructed geometry from BDSIM out to other formats.
void ExportGeometry(const G4String &geometryType, const G4String &geometryFileName)
A class that holds global options and constants.
static BDSGlobalConstants * Instance()
Access method.
BDS::TrajectoryOptions StoreTrajectoryOptions() const
options that require some implementation.
G4bool UseImportanceSampling() const
Is importance sampling being used.
BDSRunManager * runManager
Cache of main objects in BDSIM.
BDSOutput * bdsOutput
Cache of main objects in BDSIM.
void RegisterUserComponent(const G4String &componentTypeName, BDSComponentConstructor *componentConstructor)
void BeamOn(int nGenerate=-1)
int Initialise()
The main function where everything is constructed.
~BDSIM()
The destructor opens the geometry in Geant4 and deletes everything.
BDSComponentFactoryUser * userComponentFactory
Optional user registered component factory.
BDSBunch * bdsBunch
Cache of main objects in BDSIM.
bool ignoreSIGINT
For cmake testing.
Definition BDSIMClass.hh:98
void GeneratePrimariesOnly(const BDSGlobalConstants *globals)
BDSDetectorConstruction * realWorld
Cache of main objects in BDSIM.
int initialisationResult
Possible to not finish initialisation but have completed ok - flag for this.
G4VModularPhysicsList * userPhysicsList
Optional user registered physics list.
int argcCache
Cache of argc.
char ** argvCache
Cache of argv.
bool usualPrintOut
Whether to allow the usual cout output.
Definition BDSIMClass.hh:99
BDSParser * parser
Cache of main objects in BDSIM.
bool initialised
Whether initialisation was completed safely.
static BDSMaterials * Instance()
Singleton pattern access.
void PrepareRequiredMaterials(G4bool verbose=false)
converts parser material list
static BDSOutput * CreateOutput(BDSOutputType format, const G4String &fileName, G4int fileNumberOffset=-1, G4int compressionLevel=-1)
factory method
virtual void NewFile()=0
Open a new file. This should call WriteHeader() in it.
void FillEventPrimaryOnly(const BDSParticleCoordsFullGlobal &coords, const BDSParticleDefinition *particle)
Definition BDSOutput.cc:273
void FillBeam(const GMAD::BeamBase *beam)
Definition BDSOutput.cc:211
void FillOptions(const GMAD::OptionsBase *options)
Definition BDSOutput.cc:218
virtual void CloseFile()=0
Const entry to parser objects.
Definition BDSParser.hh:37
void AmalgamateBeam(const GMAD::Beam &beamIn, bool recreate)
Amalgamate the input beam definition with the ones stored in teh parser.
Definition BDSParser.cc:75
const GMAD::OptionsBase * GetOptionsBase() const
Return bare options base class.
Definition BDSParser.hh:54
void CheckOptions()
Check options for consistency. This also checks the beam options.
Definition BDSParser.cc:94
static BDSParser * Instance()
Access method.
Definition BDSParser.cc:30
const GMAD::Beam & GetBeam() const
Return beam.
Definition BDSParser.hh:57
const GMAD::Options & GetOptions() const
Return options.
Definition BDSParser.hh:51
void AmalgamateOptions(const GMAD::Options &optionsIn)
Amalgamate the input options with the ones stored in the parser.
Definition BDSParser.cc:86
const GMAD::BeamBase * GetBeamBase() const
Return bare beam base class.
Definition BDSParser.hh:63
const GMAD::FastList< GMAD::PhysicsBiasing > & GetBiasing() const
Return biasing list.
Definition BDSParser.hh:93
A set of particle coordinates in both local and global.
Wrapper for particle definition.
G4String Name() const
Accessor.
G4double KineticEnergy() const
Accessor.
G4double BRho() const
Accessor.
G4bool IsAnIon() const
Accessor.
EM processes for millicharged particles.
Generates primary particle vertices using BDSBunch.
Control over the beginning and end of run actions.
Wrapper from G4RunManager that provides more output.
virtual void Initialize()
virtual void BeamOn(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
Altered BeamOn function to account for Placet synchronisation.
static BDSSamplerRegistry * Instance()
Accessor for registry.
BDSIM's Geant4 stacking action.
Provide extra output for Geant4 through a verbose stepping action.
static BDSTemporaryFiles * Instance()
Singleton accessor.
Action to decide whether or not to store trajectory information.
The BDS Visualisation Manager.
void StartSession(int argc, char **argv)
Start interactive mode.
Options for a beam distribution.
Definition beamBase.h:35
Basic options class independent of Geant4.
Definition optionsBase.h:36
std::string physicsList
list of physics processes
bool verbose
General verbosity.
Definition optionsBase.h:65
bool recreate
Whether to recreate from a file or not.
Definition optionsBase.h:95
std::vector< G4ParallelWorldPhysics * > ConstructParallelWorldPhysics(const std::vector< G4VUserParallelWorld * > &worlds)
Construct the parallel physics process for each sampler world.
void PrintDefinedParticles()
void RegisterSamplerPhysics(const std::vector< G4ParallelWorldPhysics * > &processes, G4VModularPhysicsList *physicsList)
Register each parallel physics process to the main physics list.
void RegisterImportanceBiasing(const std::vector< G4VUserParallelWorld * > &worlds, G4VModularPhysicsList *physicsList)
Create importance geometry sampler and register importance biasing with physics list.
std::vector< G4VUserParallelWorld * > ConstructAndRegisterParallelWorlds(G4VUserDetectorConstruction *massWorld, G4bool buildSamplerWorld, G4bool buildPlacementFieldsWorld)
void PrintPrimaryParticleProcesses(const G4String &primaryParticleName)
void BuildMuonBiasing(G4VModularPhysicsList *physicsList)
Build muon splitting biasing and wrap the various processes in the physics list.
G4bool Geant4EnvironmentIsSet()
Check if the geant4 environmental variables necessary for a run are set.
void ConstructExtendedParticleSet()
void HandleAborts(int signal_number)
void ConstructDesignAndBeamParticle(const GMAD::Beam &beamDefinition, G4double ffact, BDSParticleDefinition *&designParticle, BDSParticleDefinition *&beamParticle, G4bool &beamDifferentFromDesignParticle)
G4int VerboseEventStop(G4int verboseEventStart, G4int verboseEventContinueFor)
void AddIStore(const std::vector< G4VUserParallelWorld * > &worlds)
Get store, and prepare importance sampling for importance geometry sampler.
G4bool IsFinite(G4double value, G4double tolerance=std::numeric_limits< double >::epsilon())
G4VModularPhysicsList * BuildPhysics(const G4String &physicsList, G4int verbosity=1)