Varying source_energy and beam_direction for each event

Hello everyone,

I would like to simulate a big number of runs of a single electron hitting my sensor model with a different energy and angle of incidence for each run. It would be preferable to have the outputs of all runs in a single root file as it is the case when doing a simulation with many events.

My question is now: When running a simulation with multiple events, is there a way to define varying DepositionGeant4 input parameters (source_energy and beam_direction) for each event? So e.g. event 1 has source_energy = 1MeV, event 2 has source_energy = 1.1MeV, ….

I searched the manual and forum for a while now for a way to do this, but haven’t found anything, so I would be very thankful for some help!

Hi,I think maybe you can use macro in source_type,this allow us to write a “.mac“ file to control more than one input parameter.You can find detail on Geant4.

Hope its helpful.

This looks promising, I will definetely look into it. Thank you very much