Some built-in commands do not work in my simulation

Hi,
I met some problems on the built-in commands and it confused me that only part of them worked in my simulations. For example, in a simulation on radioactive decay written by myself, the commands:

/gun/particle/ion
/gun/ion 11 22
/analysis/setFileName na22

did not work at all. But the command:

/run/beamOn 1024

worked.
And all those commands work well in the example B1 and rdecay02 that I referenced. This problem made me have to recompile the code everytime to change the radiation source.

So I’m wondering if any libs, variables or initialization might be needed for built-in commands in simulations. But I checked my code with these two examples and had not found obvious mistakes. As the description on built-in command in Documentation is very simple, I want to figure out what problem happened in my simulation or maybe the commands was just unavailable for my simulation.

Thanks!

_Geant4 Version:_geant4-11-02-patch-02 [MT]
_Operating System:_Ubuntu 20.04.6 LTS
_Compiler/Version:_Gcc 9.4.0
_CMake Version:_Cmake 3.16.3


Did you instantiate a particle gun? Did you instantiate the analysis manager?

See what commands are available in your app with ls or help.

Thanks for your reply!
I thought I had successfully instantiate the particle gun and analysis manager, otherwise the simulation should not work correctly. But I don’t know if they should be instantiated in other places (now the particle gun is instantiated in the construct function of PrimaryGeneratorAction and the analysis manager is instantiated in every function in HistoManager):

// in PrimaryGeneratorAction.cc construct function
G4int nofParticles = 1;
fParticleGun = new G4ParticleGun(nofParticles);
\\\
// in HistoManager.cc all functions
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();

And the output of help is below, containing /gun and /analysis commands.
output

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.