Only a few trajectories are drawn

I wonder why I’m seeing only one or a few trajectories:

main

#include
using namespace std;

#include “G4RunManager.hh”
#include “G4UImanager.hh”
#include “G4VisManager.hh”
#include “G4VisExecutive.hh”
#include “G4UIExecutive.hh”

#include “construction.cc”
#include “physics.cc”
#include “action.cc”

int main(int argc, char** argv)
{
G4RunManager *runManager = new G4RunManager();
runManager->SetUserInitialization(new MyDetectorConstruction());
runManager->SetUserInitialization(new MyPhysicsList());
runManager->SetUserInitialization(new MyActionInitialization());

runManager->Initialize();

// batch mode
G4UIExecutive *ui = 0;
if(argc == 1)
{
ui = new G4UIExecutive(argc, argv);
}

// graphical mode mode
//G4UIExecutive *ui = new G4UIExecutive(argc, argv);

G4VisManager *visManager = new G4VisExecutive();
visManager->Initialize();

G4UImanager *UImanager = G4UImanager::GetUIpointer();

if(ui)
{
UImanager->ApplyCommand(“/control/execute vis.mac”);
ui->SessionStart();
}
else
{
G4String command = "/control/execute- ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}

return 0;
}

vis.mac

/vis/open OGL
/vis/enable
/vis/drawVolume
/vis/scene/add/axes
/vis/scene/add/eventID
/vis/scene/add/trajectories smooth
/vis/scene/endOfEventAction accumulate 1000
/vis/reviewKeptEvents

This is the response I receive when running the program:

response

Visualization Manager instantiating with verbosity “warnings (3)”…
Visualization Manager initialising…
Registering graphics systems…

ou have successfully registered the following graphics systems.
Registered graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
OpenGLImmediateWin32 (OGLIWin32, OGLI)
OpenGLStoredWin32 (OGLSWin32, OGL, OGLS)

Registering model factories…

ou have successfully registered the following model factories.
Registered model factories:
generic
drawByAttribute
drawByCharge
drawByOriginVolume
drawByParticleID
drawByEncounteredVolume

egistered models:
None

Registered filter factories:
attributeFilter
chargeFilter
originVolumeFilter
particleFilter
encounteredVolumeFilter

egistered filters:
None

You have successfully registered the following user vis actions.
Run Duration User Vis Actions: none
End of Event User Vis Actions: none
End of Run User Vis Actions: none

Some /vis commands (optionally) take a string to specify colour.
/vis/list" to see available colours.
ERROR: G4VisManager::IsValidView(): Current view is not valid.
ERROR: G4VisManager::PrintInvalidPointers:
Graphics system is OpenGLStoredWin32 but:
Null scene pointer. Use “/vis/drawVolume” or “/vis/scene/create”.
G4VisManager::Enable: WARNING: visualization remains disabled for
above reasons. Rectifying with valid vis commands will
automatically enable.
G4OpenGLViewer::DrawText: Not implemented for “viewer-0 (OpenGLStoredWin32)”
Called with G4Text: “x”
layout centre, offset (6,6)
4VMarker: position: (1050,0,0), world size: 0, screen size: 12
fill style: no fill
G4VisAttributes: visible, daughters visible, colour: (1,0,0,1) (red)
linestyle: solid, line width: 1, min line segments per circle: 3
drawing style: not forced, auxiliary edge visibility: not forced
line segments per circle: not forced.
time range: (-1e+100,1e+100)
G4AttValue pointer is zero, G4AttDef pointer is zero
/tracking/storeTrajectory 2
Attributes available for modeling and filtering with
“/vis/modeling/trajectories/create/drawByAttribute” and
“/vis/filtering/trajectories/create/attributeFilter” commands:
G4TrajectoriesModel:
Event ID (EventID): G4int
Run ID (RunID): G4int
G4SmoothTrajectory:
Charge (Ch): unit: e+ (G4double)
Track ID (ID): G4int
Initial kinetic energy (IKE): G4BestUnit (G4double)
Initial momentum magnitude (IMag): G4BestUnit (G4double)
Initial momentum (IMom): G4BestUnit (G4ThreeVector)
No. of points (NTP): G4int
PDG Encoding (PDG): G4int
Parent ID (PID): G4int
Particle Name (PN): G4String
G4SmoothTrajectoryPoint:
Auxiliary Point Position (Aux): G4BestUnit (G4ThreeVector)
Step Position (Pos): G4BestUnit (G4ThreeVector)
WARNING: Trajectory storing has been requested. This action may be
reversed with “/tracking/storeTrajectory 0”.
WARNING: The vis manager will keep up to 1000 events.
This may use a lot of memory.
It may be changed with, e.g., “/vis/scene/endOfEventAction accumulate 10”.
ERROR: G4VisCommandReviewKeptEvents::SetNewValue: No kept events,
or kept events not accessible.

/run/beamOn 100

=======================================================================
===== Electromagnetic Physics Parameters ========

PM effect enabled 1
nable creation and use of sampling tables 0
pply cuts on all EM processes 0
se general process 0
nable linear polarisation for gamma 0
nable sampling of quantum entanglement 0
-section factor for integral approach 0.8
in kinetic energy for tables 100 eV
ax kinetic energy for tables 100 TeV
umber of bins per decade of a table 7
erbose level 1
erbose level for worker thread 0
remsstrahlung energy threshold above which
primary e± is added to the list of secondary 100 TeV
remsstrahlung energy threshold above which primary
muon/hadron is added to the list of secondary 100 TeV
owest triplet kinetic energy 1 MeV
nable sampling of gamma linear polarisation 0
D gamma conversion model type 0
D gamma conversion model on isolated ion 0
ivermore data directory livermore

===== Ionisation Parameters ========

tep function for e± (0.2, 1 mm)
tep function for muons/hadrons (0.2, 0.1 mm)
tep function for light ions (0.2, 0.1 mm)
tep function for general ions (0.2, 0.1 mm)
owest e+e- kinetic energy 1 keV
owest muon/hadron kinetic energy 1 keV
luctuations of dE/dx are enabled 1
se ICRU90 data 0
se built-in Birks satuaration 1
uild CSDA range enabled 0
se cut as a final range enabled 0
nable angular generator interface 0
ax kinetic energy for CSDA tables 1 GeV
ax kinetic energy for NIEL computation 0 eV
inear loss limit 0.01
ead data from file for e+e- pair production by mu 0

===== Multiple Scattering Parameters ========

ype of msc step limit algorithm for e± 1
ype of msc step limit algorithm for muons/hadrons 0
sc lateral displacement for e± enabled 1
sc lateral displacement for muons and hadrons 0
rban msc model lateral displacement alg96 1
ange factor for msc step limit for e± 0.04
ange factor for msc step limit for muons/hadrons 0.2
eometry factor for msc step limitation of e± 2.5
afety factor for msc step limit for e± 0.6
kin parameter for msc step limitation of e± 1
ambda limit for msc step limit for e± 1 mm
se Mott correction for e- scattering 0
actor used for dynamic computation of angular
limit between single and multiple scattering 1
ixed angular limit between single
and multiple scattering 3.1416 rad
pper energy limit for e± multiple scattering 100 MeV
ype of electron single scattering model 0
ype of nuclear form-factor 1
creening factor 1

phot: for gamma SubType=12 BuildTable=0
LambdaPrime table from 200 keV to 100 TeV in 61 bins
===== EM models for the G4Region DefaultRegionForTheWorld ======
LivermorePhElectric : Emin= 0 eV Emax= 100 TeV SauterGavrila Fluo

compt: for gamma SubType=13 BuildTable=1
Lambda table from 100 eV to 1 MeV, 7 bins/decade, spline: 1
LambdaPrime table from 1 MeV to 100 TeV in 56 bins
===== EM models for the G4Region DefaultRegionForTheWorld ======
Klein-Nishina : Emin= 0 eV Emax= 100 TeV

conv: for gamma SubType=14 BuildTable=1
Lambda table from 1.022 MeV to 100 TeV, 18 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
BetheHeitlerLPM : Emin= 0 eV Emax= 100 TeV ModifiedTsai

Rayl: for gamma SubType=11 BuildTable=1
Lambda table from 100 eV to 100 keV, 7 bins/decade, spline: 0
LambdaPrime table from 100 keV to 100 TeV in 63 bins
===== EM models for the G4Region DefaultRegionForTheWorld ======
LivermoreRayleigh : Emin= 0 eV Emax= 100 TeV CullenGenerator

msc: for e- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 0 eV Emax= 100 MeV Nbins=42 100 eV - 100 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
WentzelVIUni : Emin= 100 MeV Emax= 100 TeV Nbins=42 100 MeV - 100 TeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm

eIoni: for e- XStype:1 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 1 mm), integ: 1, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
MollerBhabha : Emin= 0 eV Emax= 100 TeV

eBrem: for e- XStype:4 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
LPM flag: 1 for E > 1 GeV, VertexHighEnergyTh(GeV)= 100000
===== EM models for the G4Region DefaultRegionForTheWorld ======
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai

CoulombScat: for e- XStype:1 SubType=1 BuildTable=1
Lambda table from 100 MeV to 100 TeV, 7 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180; pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 100 MeV Emax= 100 TeV

msc: for e+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 0 eV Emax= 100 MeV Nbins=42 100 eV - 100 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
WentzelVIUni : Emin= 100 MeV Emax= 100 TeV Nbins=42 100 MeV - 100 TeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm

eIoni: for e+ XStype:1 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 1 mm), integ: 1, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
MollerBhabha : Emin= 0 eV Emax= 100 TeV

eBrem: for e+ XStype:4 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
LPM flag: 1 for E > 1 GeV, VertexHighEnergyTh(GeV)= 100000
===== EM models for the G4Region DefaultRegionForTheWorld ======
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai

annihil: for e+ XStype:2 SubType=5 BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 100 TeV

CoulombScat: for e+ XStype:1 SubType=1 BuildTable=1
Lambda table from 100 MeV to 100 TeV, 7 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180; pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 100 MeV Emax= 100 TeV

msc: for proton SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm

hIoni: for proton XStype:1 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
Bragg : Emin= 0 eV Emax= 2 MeV
BetheBloch : Emin= 2 MeV Emax= 100 TeV

hBrems: for proton XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi

hPairProd: for proton XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
Sampling table 17x1001; from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi

CoulombScat: for proton XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180; pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV

msc: for GenericIon SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 0 eV Emax= 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm

ionIoni: for GenericIon XStype:1 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.02
Stopping Power data for 17 ion/material pairs
===== EM models for the G4Region DefaultRegionForTheWorld ======
BraggIon : Emin= 0 eV Emax= 2 MeV
BetheBloch : Emin= 2 MeV Emax= 100 TeV

msc: for alpha SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 0 eV Emax= 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm

ionIoni: for alpha XStype:1 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.02
===== EM models for the G4Region DefaultRegionForTheWorld ======
BraggIon : Emin= 0 eV Emax=7.9452 MeV
BetheBloch : Emin=7.9452 MeV Emax= 100 TeV

msc: for anti_proton SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm

hIoni: for anti_proton XStype:1 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU73QO : Emin= 0 eV Emax= 2 MeV
BetheBloch : Emin= 2 MeV Emax= 100 TeV

hBrems: for anti_proton XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi

hPairProd: for anti_proton XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
Sampling table 17x1001; from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi

CoulombScat: for anti_proton XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180; pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV

msc: for kaon+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm

hIoni: for kaon+ XStype:1 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
Bragg : Emin= 0 eV Emax=1.05231 MeV
BetheBloch : Emin=1.05231 MeV Emax= 100 TeV

hBrems: for kaon+ XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi

hPairProd: for kaon+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
Sampling table 18x1001; from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi

CoulombScat: for kaon+ XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180; pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV

msc: for kaon- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm

hIoni: for kaon- XStype:1 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU73QO : Emin= 0 eV Emax=1.05231 MeV
BetheBloch : Emin=1.05231 MeV Emax= 100 TeV

hBrems: for kaon- XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi

hPairProd: for kaon- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
Sampling table 18x1001; from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi

CoulombScat: for kaon- XStype:1 SubType=1 BuildTable=1
Used Lambda table of kaon+
ThetaMin(p) < Theta(degree) < 180; pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV

msc: for mu+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm

muIoni: for mu+ XStype:1 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
Bragg : Emin= 0 eV Emax= 200 keV
BetheBloch : Emin= 200 keV Emax= 1 GeV
MuBetheBloch : Emin= 1 GeV Emax= 100 TeV

muBrems: for mu+ XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
MuBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi

muPairProd: for mu+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
Sampling table 21x1001; from 1 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi

CoulombScat: for mu+ XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180; pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV

msc: for mu- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm

muIoni: for mu- XStype:1 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU73QO : Emin= 0 eV Emax= 200 keV
BetheBloch : Emin= 200 keV Emax= 1 GeV
MuBetheBloch : Emin= 1 GeV Emax= 100 TeV

muBrems: for mu- XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
MuBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi

muPairProd: for mu- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
Sampling table 21x1001; from 1 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi

CoulombScat: for mu- XStype:1 SubType=1 BuildTable=1
Used Lambda table of mu+
ThetaMin(p) < Theta(degree) < 180; pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV

msc: for pi+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm

hIoni: for pi+ XStype:1 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
Bragg : Emin= 0 eV Emax=297.505 keV
BetheBloch : Emin=297.505 keV Emax= 100 TeV

hBrems: for pi+ XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi

hPairProd: for pi+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
Sampling table 20x1001; from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi

CoulombScat: for pi+ XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180; pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV

msc: for pi- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm

hIoni: for pi- XStype:1 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU73QO : Emin= 0 eV Emax=297.505 keV
BetheBloch : Emin=297.505 keV Emax= 100 TeV

hBrems: for pi- XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi

hPairProd: for pi- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0
Sampling table 20x1001; from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi

CoulombScat: for pi- XStype:1 SubType=1 BuildTable=1
Used Lambda table of pi+
ThetaMin(p) < Theta(degree) < 180; pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model.
See commands in /vis/modeling/trajectories/ for other options.
100 events have been kept for refreshing and/or reviewing.
“/vis/reviewKeptEvents” to review them one by one.
“/vis/enable”, then “/vis/viewer/flush” or “/vis/viewer/rebuild” to see them accumulated.

I attached two images. The one which shows the scenario directly at the beginning:

the other one after /run/beamOn 100:

We don’t know what kind of particle you are running, what their trajectory is, or what you expect them to do. This could be an issue with visualization, or your simulation running exactly as it is supposed to. We need more information about what you are trying to do and what you expect to see

1 Like

Sure, sorry, I’m too narrow-focused at the moment.

I positioned a particle source bottom left and want to irradiate those objects in the center with gammas (to imitate an x-ray irradiation). Everything there is Air until now, so “each” particle should leave a trajectory. The objects are indeed working as detectors.

Before, I used to use a particle gun which worked well, I would say. Atm I’m more on the programming level to get everything running until I focus on the actual physics. However, I could see a lot of particles/trajectories.
As I found out that I can’t use a particle gun because I have to rotate the emission angle I switched to particle source. Now I’m only seeing these few trajectories above.

Do you need more code? I’m trying to use as many classes as possible to structure the code (and to improve my understanding of Geant4) but I could also just drop the code that is relevant, for sure.

You can use particle gun and change emission angle using
ParticleGun->SetParticleMomentumDirection(G4ThreeVector(x,y,z));

1 Like

Thank you, this is true. But I also need to change the emission direction.
Is this also doable with a particle gun?

I need to rotate the source.

The command shown by @loydms does exactly what you’re requesting. Note the word Direction in the function name.

Really?
Then I have to check things again. For me, it looked like I can only change the angle cone and I tried a lot of different values and so on…

what is the advantage of a particle source over a particle gun (then)?

True, it’s working. As far as I can figure out the directions are given as vectors in x, y, z.

In principle this is working for me now. Is there also a convenient way to set certain angle ranges? Like an emission angle of [40°, 70°] in y?

Look at G4ThreeVector.h and see which member functions you want to use to specify a particular angular range, or how to do rotations if you want an angular range around a non-default axis.

Thanks, I’ll try to do so.
Is it this file: geant4/ThreeVector.h at master · Geant4/geant4 · GitHub ?

I found Geant4.10: CLHEP::Hep3Vector Class Reference to be easier to look at.

I’ve to admit, it’s quite some years that I used C++. I’m getting back into it but the syntax and the docs are so different than from R or python and so on… however, in the above docs the followings are public functions:

double x;
double y;
double z;

but also

double phi;
double theta;

how do I make sure which of them shall be used?

Those are data members, not functions, and they are private, not public. The public functions will be things like setX(double), setPhi(double) and so on.

ThreeVector stores it’s state internally as Cartesian coordinates, but you can set the vector any way you want. Look at the basic set() function, along with it’s neighbors setRThetaPhi()' (for polar coordintes), setRhoPhiZ()` (for cylindrical coordinates), and so on.

You’ll see that each set function has a one line description of what it does.

1 Like