Message: Re: Acceptance check with GPS Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: Acceptance check with GPS 

Forum: Event and Track Management
Re: Question Acceptance check with GPS (Nicola Mori)
Date: 19 Aug, 2011
From: Gumplinger Peter <Gumplinger Peter>

Hi Nicola,

I think I understand what you want to do but this is not possible. The method, for example:

G4ParticleGun::GeneratePrimaryVertex(G4Event* evt)

is the one that samples the directions, energies etc. but also immediately calls:

evt->AddPrimaryVertex( vertex );

without giving you the chance to inverne.

And although your PrimaryGeneratorAction::GeneratePrimaries called G4ParticleGun::GeneratePrimaryVertex, you have a pointer to G4ParticleGun, and you can inquire about:

particleGun->GetParticleMomentumDirection()

you cannot loop and call GeneratePrimaryVertex again (if the direction is outside your known acceptance) because that would just add another vertex to the event. G4Event has no RemovePrimaryVertex method.

However, we do offer a G4UserStackingAction where you get the chance to immediately kill a primary track outside your acceptance. The ClassifyNewTrack method is called before a track is being simulated. We have many examples of this functionality, one more complicated one is:

http://www-geant4.kek.jp/lxr/source/examples/extended/eventgenerator/HepMC/HepMCEx01/src/ExN04StackingAction.cc#L52

Peter

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

1 None: Re: Acceptance check with GPS   (Nicola Mori - 20 Aug, 2011)
(_ Feedback: Re: Acceptance check with GPS   (Gumplinger Peter - 23 Aug, 2011)
(_ None: Re: Acceptance check with GPS   (Nicola Mori - 24 Aug, 2011)
(_ Feedback: Re: Acceptance check with GPS   (Gumplinger Peter - 24 Aug, 2011)
 Add Message Add Message
to: "Re: Acceptance check with GPS"

 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 ]