3.1.1.7.2.4. opengate.source.GANSourceDefaultGenerator

3.1.1.7.2.4.1. Module Contents

3.1.1.7.2.4.1.1. Classes

GANSourceDefaultGenerator

This class manage the base components of a particle generator.

class opengate.source.GANSourceDefaultGenerator.GANSourceDefaultGenerator(user_info)[source]

This class manage the base components of a particle generator.

  • In the constructor, the module ‘gaga’ is imported. It is only imported in the constructor to only required

this module if it is used

  • ‘initialize’ function: the GAN is loaded and the list of keys is initialized

  • ‘generator’ function: default generator

  • ‘get_output_keys’ function: map the user defined keys to the ones of the generator. There are two usages, either

with on single primary (3 values for position, direction), or paired primary (6 values).

  • ‘move_backward’ function: consider all particles positions and move their backward according to their direction,

using the factor provided by the user in ‘user_info.backward_distance’. This is useful to allow generating particles that do not intersect with the detector.

  • ‘copy_generated_particle_to_g4’ function: copy all the particles (pos, dir, time, energy) to the cpp part.

__getstate__()[source]
initialize()[source]
initialize_with_lock()[source]
get_output_keys()[source]
get_output_keys_with_lock()[source]
get_key_generated_values(k, pk, n, dim=3)[source]
generator(source)[source]

Main function that will be called from the cpp side every time a batch of particles should be created. Once created here, the particles are copied to cpp. (Yes maybe the copy could be avoided, but I did not manage to do it)

copy_generated_particle_to_g4(source, g, fake)[source]
move_backward(g, fake)[source]