How to use General Particle Source(GPS) in example B1 from the help of example/advanced/radioprotection?

i am trying to use GPS in example/basic/B1 in place of particle gun with the help of example/advanced/radioprotection but i am getting some errors. i just changed primary file of B1 example to primarygenerator file.
and in some changes i made in file accordingly.
But i am unable to use GPS in B1 example.
can anyone point me out that along with these changes where i have to make changes so i can solve this problem.
also please point me if i have done anything wrong.
Thanks in advance!

1 Like

Hello, if you still need it, I’ve been facing the same problem, to solve it, I have used examples/extended/eventgenerator/exgps to modify PrimaryGenerationaction, RunAction and EventAction (.cc & .hh files) accordingly as the example provided.

These two files will be helpful. Just modify accordingly. (557 Bytes)
B1PrimaryGeneratorAction.hh (445 Bytes)

no, now i am able to do it.

1 Like

It is most simple case and there is no need to change .
Define fGun as generalparticlesource in PGA (I see) … Use gps from macro. You can confine with any physical volume of your choice using (define implicitly in detectorconstruction, if required)
/gps/confine PVname

In case you interested in volumetric source choose type Volume.

Looking the screenshots I suggest you to remove analysis at instance. Also check if you properly defined PGA header.

I wish it work.