|Message: Re: Linear beam rotation using GPS||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
Here is an example of my gps gun macro. YOu can see that there is a direction command. If you keep the position the same and change the direction vector, you could accomplish a rotation of the gun. I hope this helps. If you want to rotate through multiples angles, you could use /control/loop and /control/foreach commands.
bash-4.2$ more gpsGun.mac #/control/verbose 0 #/tracking/verbose 0 #/event/verbose 0 #/gps/verbose 2 #================================================== /gps/particle neutron /gps/number 1 #/gps/position 0. 0. 37. cm #/gps/direction 0. 0. 1. /gps/pos/type Point /gps/energy 1.0 MeV ###/gps/pos/centre 0. 0. 37. cm ##DONE at primary generator action /gps/ang/type iso /gps/ene/type Mono #================================================== #/gps/pos/type Volume #/gps/pos/shape Sphere #/gps/pos/radius 0.25 cm #/gps/ang/type cos #/gps/ene/type Lin #/gps/ene/min 2 MeV #/gps/ene/max 10 MeV #/gps/ene/gradient 1 #/gps/ene/intercept 1
You can do also something similar in the PrimaryGenAction (Notice I am omitting lines and definitions):
[Do the following in your constructor]
gpsGun = new G4GeneralParticleSource();
[Then in GeneratePrimaries memeber function you could do:]
REFERENCE: http://www-zeuthen.desy.de/geant4/geant4.9.3.b01/classG4GeneralParticleSource.html http://www-zeuthen.desy.de/geant4/geant4.9.3.b01/classG4SPSAngDistribution.html
gpsGun->GetCurrentSource()->SetNumberOfParticles(1); gpsGun->GetCurrentSource()->SetParticleDefinition(fwdParticle); // a neutron gpsGun->GetCurrentSource()->GetPosDist()->SetPosDisType("Point"); gpsGun->GetCurrentSource()->GetPosDist()->SetCentreCoords(*dTposition); //vector field indicating pos in space gpsGun->GetCurrentSource()->GetAngDist()->SetAngDistType("iso"); gpsGun->GetCurrentSource()->GetEneDist()->SetEnergyDisType("Mono"); gpsGun->GetCurrentSource()->GetEneDist()->SetMonoEnergy(fwdParticleEkin); //0.1*MeV gpsGun->GeneratePrimaryVertex(anEvent);
Notice my distribution is isotropic so setting up direction is meaningless. In your case, assuming you dont have an iso source, you could do:
gpsGun->GetCurrentSource()->GetAngDist()->SetParticleMomentumDirection(my_momentumAxis); // Argument: G4ParticleMomentum aMomentumDirection
Not sure if there is documentation out there. You could give it a try to see if this helps.