3.1.2.6. opengate.engines

3.1.2.6.1. Module Contents

3.1.2.6.1.1. Classes

EngineBase

Base class for all engines (SimulationEngine, VolumeEngine, etc.)

SourceEngine

Source Engine manages the G4 objects of sources at runtime

PhysicsEngine

Class that contains all the information and mechanism regarding physics

ActionEngine

Main object to manage all actions during a simulation.

ActorEngine

This object manages all actors G4 objects at runtime

ParallelWorldEngine

FIXME: Doc ParallelWorldEngine

VolumeEngine

Engine that will create all G4 elements for the hierarchy of volumes.

VisualisationEngine

Main class to manage visualisation

SimulationOutput

FIXME

SimulationEngine

Main class to execute a Simulation (optionally in a separate subProcess)

3.1.2.6.1.2. Functions

start_gdml_visu(filename)

start_vrml_visu(filename)

class opengate.engines.EngineBase(simulation_engine)[source]

Base class for all engines (SimulationEngine, VolumeEngine, etc.)

close()[source]
class opengate.engines.SourceEngine(simulation_engine)[source]

Bases: EngineBase

Source Engine manages the G4 objects of sources at runtime

max_int = 2147483647[source]
close()[source]
release_g4_references()[source]
initialize(run_timing_intervals)[source]
initialize_actors(actors)[source]

3.1.2.6. Parameters

actorsdict

The dictionary ActorEngine.actors which contains key-value pairs “actor_name” : “Actor object”

create_master_source_manager()[source]
create_g4_source_manager(append=True)[source]

This is called by all threads This object is needed here, because it can only be created after physics initialization

start()[source]
class opengate.engines.PhysicsEngine(*args)[source]

Bases: EngineBase

Class that contains all the information and mechanism regarding physics to actually run a simulation. It is associated with a simulation engine.

property user_info_physics_manager[source]
close()[source]
release_g4_references()[source]
release_optical_surface_g4_references()[source]
close_physics_constructors()[source]

This method removes PhysicsConstructors defined in python from the physics list.

It should be called after a simulation run, i.e. when a simulation engine closes, because the RunManager will otherwise attempt to delete the PhysicsConstructor and cause a segfault.

initialize_before_runmanager()[source]

Initialize methods to be called before G4RunManager.Initialize() is called.

initialize_after_runmanager()[source]
initialize_parallel_world_physics()[source]
initialize_physics_list()[source]

Create a Physic List from the Factory

initialize_regions()[source]
initialize_global_cuts()[source]
initialize_g4_em_parameters()[source]
initialize_optical_material_properties()[source]
initialize_optical_surfaces()[source]

Calls initialize() method of each OpticalSurface instance.

initialize_user_limits_physics()[source]
class opengate.engines.ActionEngine(simulation_engine)[source]

Bases: opengate_core.G4VUserActionInitialization, EngineBase

Main object to manage all actions during a simulation.

close()[source]
release_g4_references()[source]
BuildForMaster()[source]
Build()[source]
class opengate.engines.ActorEngine(simulation_engine)[source]

Bases: EngineBase

This object manages all actors G4 objects at runtime

close()[source]
get_actor(name)[source]
create_actors()[source]
initialize(volume_engine=None)[source]
register_all_actions(actor)[source]
register_sensitive_detectors(world_name)[source]
register_sensitive_detector_to_children(actor, lv)[source]
start_simulation()[source]
stop_simulation()[source]
class opengate.engines.ParallelWorldEngine(parallel_world_name, *args)[source]

Bases: opengate_core.G4VUserParallelWorld, EngineBase

FIXME: Doc ParallelWorldEngine

property parallel_world_volume[source]
Construct()[source]

G4 overloaded. Override the Construct method from G4VUserParallelWorld

ConstructSD()[source]
class opengate.engines.VolumeEngine(simulation_engine)[source]

Bases: opengate_core.G4VUserDetectorConstruction, EngineBase

Engine that will create all G4 elements for the hierarchy of volumes. Correspond to the G4VUserDetectorConstruction (inherit) Also manage the list of parallel worlds.

create_parallel_world_engines()[source]
register_to_volumes()[source]
close()[source]
initialize()[source]
initialize_dynamic_parametrisations()[source]
Construct()[source]

G4 overloaded. Override the Construct method from G4VUserDetectorConstruction

check_overlaps(verbose)[source]
ConstructSDandField()[source]

G4 overloaded

get_volume(name)[source]
get_database_material_names(db=None)[source]
dump_build_materials(level=0)[source]
class opengate.engines.VisualisationEngine(simulation_engine)[source]

Bases: EngineBase

Main class to manage visualisation

close()[source]
release_g4_references()[source]
__enter__()[source]
__exit__(type, value, traceback)[source]
initialize_visualisation()[source]
initialize_visualisation_gdml()[source]
initialize_visualisation_vrml()[source]
start_visualisation()[source]
class opengate.engines.SimulationOutput[source]

FIXME

store_actors(simulation_engine)[source]
store_hook_log(simulation_engine)[source]
store_sources(simulation_engine)[source]
get_actor(name)[source]
get_source(name)[source]
get_source_mt(name, thread)[source]
class opengate.engines.SimulationEngine(simulation, new_process=False)[source]

Main class to execute a Simulation (optionally in a separate subProcess)

property g4_state[source]
close_engines()[source]
release_engines()[source]
release_g4_references()[source]
notify_managers()[source]
close()[source]
__enter__()[source]
__exit__(type, value, traceback)[source]
__getstate__()[source]
__setstate__(d)[source]
run_engine()[source]

When the simulation is about to init, if the Simulation object is in a separate process (with ‘spawn’), it has been pickled (copied) and the G4 phys list classes does not exist anymore, so we need to recreate them with ‘create_physics_list_classes’ Also, the StateManager must be recreated.

NK: Yes, but not this way. Each class should take care of recreating attributes which where set to None during pickling by implementing a __setstate__ method. Implementing the resetting somewhere else (maybe in multiple places…) in the code will make it very difficult to maintain.

-> removed the lines and implemented __setstate__ methods for the classes in question

start_and_stop()[source]

Start the simulation. The runs are managed in the SourceManager.

initialize_random_engine()[source]
initialize_g4_verbose()[source]
initialize()[source]

Build the main geant4 objects and initialize them.

create_run_manager()[source]

Get the correct RunManager according to the requested threads and make some basic settings.

apply_all_g4_commands_after_init()[source]
apply_all_g4_commands_before_init()[source]
add_g4_command_after_init(command)[source]
check_volumes_overlap(verbose=True)[source]
enable_user_event_information(actors)[source]
opengate.engines.start_gdml_visu(filename)[source]
opengate.engines.start_vrml_visu(filename)[source]