Message: Re: Arbitrary Position Distribution With G4GeneralParticleSource Not Logged In (login)

Re: Arbitrary Position Distribution With G4GeneralParticleSource

Forum: Event and Track Management
Re: Arbitrary Position Distribution With G4GeneralParticleSource
Date: 23 Apr, 2015
From: Marc Verderi <Marc Verderi>

 ```Dear Anders, Your source has a beautiful pattern ! ;) I second Andrew's suggestion for you to write your own PrimaryGeneratorAction class. Your pattern looks too advanced for GPS. You will have to implement the GeneratePrimaries method, which is called at the beginning of each event. Here you can use the G4ParticleGun utility, specifying emission point and time, and particle characteristics. The actual things to be created are vertices + particles coming from each of these vertices. The vertices have to be given the the G4Event in argument. G4ParticleGun is a utility for that, as GPS is. One thing is that you are able to get a 2D display of the source: does it come from an analytic pattern, or an other simulation tool, etc. ? The idea would be to exploit this (display, or analytical form, whatever) as 2D input + intensity to sample your distribution. Cheers, Marc On 04/21/2015 04:55 PM, anders.floderus@gmail.com wrote: > *** Discussion title: Event and Track Management > > Hi, > > I have a particle source that I'd like to implement using the > G4GeneralParticleSource class. I have managed to get the energy and > angular distributions right. The problem is the particle position. The > source is shaped like a disc, but the emission probability is not > uniform across that disc (see attached). Is there any way to bias the > position accordingly? Looking at the code, the position is generated by > drawing two random numbers (x and y) and then making sure that the > corresponding position is within the radius of the disc. The x and y > values can be biased separately, but this is not enough to construct an > arbitrary 2D pattern. > > If I were to employ a G4ParticleGun instead, I could get the desired > behavior by using my 2D distribution to generate the position at random > in the GeneratePrimaries function. This does not seem to work for > G4GeneralParticleSource. Unless I use one of the predefined shapes, it > defaults to emitting particles from the origin. > > Is there any way to make G4GeneralParticleSource generate positions from > an arbitrary 2D distribution? > > // Anders > > Attachment: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2015/04/21/07.48-99458-intensityProfile.png > > ------------------------------------------------------------- > Visit this GEANT4 at hypernews.slac.stanford.edu message (to reply or unsubscribe) at: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/eventtrackmanage/1246.html ```

 Inline Depth: Outline Depth: Add message:

1 Re: Arbitrary Position Distribution With G4GeneralParticleSource   (herr_apa - 23 Apr, 2015)
1 Re: Arbitrary Position Distribution With G4GeneralParticleSource   (Marc Verderi - 23 Apr, 2015)
2 Re: Arbitrary Position Distribution With G4GeneralParticleSource   (michel maire - 23 Apr, 2015)
 to: "Re: Arbitrary Position Distribution With G4GeneralParticleSource"
This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]