Message: Set Particle Gun Position from UI command Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Set Particle Gun Position from UI command 

Forum: Particles
Date: 31 Dec, 2015
From: Marcus O'Flaherty <Marcus O'Flaherty>

Hopefully a quick question here but I can't find any hints in documentation I've found. I'm trying to define a very simple optical photon gun for debugging.
I've defined it based on example code as:

_gun = new G4ParticleGun(G4OpticalPhoton::Definition());
//_gun->SetParticlePosition(G4ThreeVector(0.*m,0.*m,2.52*m));
_gun->SetParticleMomentumDirection(G4ThreeVector(1.0,0.,0.));
_gun->SetParticleEnergy(3*eV);
_gun->SetParticlePolarization(G4ThreeVector(0.,0.,1.));

Defining the position as above was working, but I was getting some unexpected outputs, so want to move the origin around without recompiling.
The UI command /gun/position 0. 0. 1.97 m , however, doesn't seem to do anything. In particular, I placed a printout in my UserSteppingAction class that prints the PreStepPoint position and for the first step it's always (0,0,0).
I looked at the example Hard01, which mentions this UI command and says that it is only active if a preceding command is given - from what I can tell, all this preceding command does is disable the SetParticlePosition command in GeneratePrimaries - hence my commenting out that line above.

But no luck. Any suggestions?

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

1 Feedback: Re: Set Particle Gun Position from UI command   (Gumplinger Peter - 07 Jan, 2016)
 Add Message Add Message
to: "Set Particle Gun Position from UI command"

 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 ]