Message: Re: Gun more than 1 primary in PrimaryGeneratorAction Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: Gun more than 1 primary in PrimaryGeneratorAction 

Forum: Event and Track Management
Re: Question Gun more than 1 primary in PrimaryGeneratorAction (lu luo)
Re: None Re: Gun more than 1 primary in PrimaryGeneratorAction (Rohin)
Re: None Re: Gun more than 1 primary in PrimaryGeneratorAction (lu luo)
Re: None Re: Gun more than 1 primary in PrimaryGeneratorAction (Rohin)
Re: Ok Re: Gun more than 1 primary in PrimaryGeneratorAction (lu luo)
Date: 19 Jul, 2010
From: Gumplinger Peter <Gumplinger Peter>

> But what I would like to do is to gun n(with n = a very high number)

> particle by specifying it in the macro file because I want a different

> random number for each event as the PrimaryGeneratorAction class is

> called with the same number of the events.

... but what's wrong with just

/run/beamOn a

(no loop in PrimaryGeneratorAction - but random assignment of initial conditions for the one primary). The random number sequence will be different every time PrimaryGeneratorAction is invoked.

With /run/beamOn 1 and:

particleGun = new G4ParticleGun(1); n_particles = a; for(int i = 0;i<n_particles;i++){ ..... particleGun->generatePrimaryVertex(eventpointer); }

in your PrimaryGeneratorAction class you are simulating ONE event with n_particles primaries. Unless these primaries have some kind of time relation to each other, or 'belong to the same initial condition', it is better to simulate them separately from each other (e.g. you may intantiate too many objects during the simulation of the one event with all these primaries and run out of memory - while objects not needed between events are recycled/deleted by the kernel)

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Gun more than 1 primary in PrimaryGeneratorAction   (lu luo - 19 Jul, 2010)
(_ Feedback: Re: Gun more than 1 primary in PrimaryGeneratorAction   (Gumplinger Peter - 19 Jul, 2010)
 Add Message Add Message
to: "Re: Gun more than 1 primary in PrimaryGeneratorAction"

 Subscribe Subscribe

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 ]