Defining mixed sources

Hi,
I would like simulate deposition of electrons and alphas at the same time. I tried it with a GPS source macro and by using the /gps/source/add command. But since this macro command is ignored by the parser in GeneratorActionG4 (Allpix^2 throws a warning) it doesn’t work. As a second idea I tried to instantiate two times the “DepositionGeant4” module but I guess that’s not the intended way either (Allpix^2 throws an error about unique id and module priority).
Finally, there’s a closed issue which suggests a mixed source made of different particle types was one of the desired use cases: https://gitlab.cern.ch/allpix-squared/allpix-squared/issues/110
I hope someone can show me how to do it. :slight_smile:
Cheers,
Oliver

Hi Oliver,

using a macro is the right way to go - probably our filtering of macro commands is a bit too restrictive here. Could you maybe attach the file, so I can have a look?

Currently, we only allow the commands under

/gps/particle
/gps/hist/
/gps/ang/
/gps/pos/
/gps/ene/

but we could add them as long as they do not interfere with e.g. the number of particles emitted etc which we control from the Allpix Squared configuration file.

Cheers,
Simon

Hi Oliver,

I reworked the macro parsing system a bit - as soon as the merge request https://gitlab.cern.ch/allpix-squared/allpix-squared/merge_requests/221 is through, you should be able to use your macro without changes and with as many sources as you like.

Cheers,
Simon

Hi Simon,
thank you for the update. In the mean time I made my own changes and enabled “/gps/ion” as well as “/gps/source/” in the GeneratorActionG4 parser code. This allowed me to declare the following mixed beta and alpha decay which seems to work well:

/gps/source/intensity 200

/gps/particle alpha
/gps/pos/type Plane
/gps/pos/shape Circle
/gps/pos/radius 20 mm

/gps/ene/type User
/gps/hist/type energy

# Gd-148
/gps/hist/point   3.183     100.0

/gps/ang/type iso

/gps/source/add 1

# Sr-90
/gps/particle ion
/gps/ion 38 90 0 0
/gps/ene/mono 0 eV

/gps/pos/type Plane
/gps/pos/shape Circle
/gps/pos/radius 1 mm

/gps/ang/type iso

Are there any side effects with allowing ion sources in the macro file? Because I’d prefer energy spectra from real beta decays (I’m supposing G4 models that).
During the last user meeting, I remember that it was explained where and how to enable the whole decay chain of allpix’s predefined sources like Am241 and Sr90 in the code. Unfortunately I don’t remember how and the G4 api is not simple enough to spot it myself in the code. Could you please point me again to the relevant function calls?

Of course I’d like to understand in this context, if the whole decay chain can be included as well when using GPS source macros with ions. It should only depend on the source macro setting and not allpix’s internals, right?

Hi Oliver,

the predefined ones we are using are “real” beta decays using G4RadioactiveDecay. You might have to activate the decay manually for ions, I’m not sure - that’s rather a G4 question…

We stop the decay chain here:

If you want the full chain, just remove these lines.

Cheers,
Simon

thanks for the link!
My reference about “real” was because I don’t want Gaussian electron beams in the source macro and instead use /gps/ion (which is ignored by Allpix at the moment and I wonder why). And I have to use the source macro functionality since only those allow me to define mixed particle sources. If you could shed some light on my side effect question in the post above related to source macros and use of /gps/ions, I’d be glad.

Cheers,
Oliver

Hi Oliver

there should be no side effects in enabling the whole decay chain, and also not in using ions. If you check the linked MR, the latter will be available soon anyway without modifications necessary (everything below /gps/ in fact).

Cheers,
Simon

Hi Simon,
thank you for the clarification. I had checked the MR but didn’t notice that anything below /gps/ would be fine in the future. Awesome!
Cheers,
Oliver

Hi Oliver,

is merged and should work for you in the master branch now. Release 1.4 is pending.

Cheers,
Simon