This is based on https://geant4-forum.web.cern.ch/t/particle-select-in-examples-basic-b1/5517. John Allison asked to open an issue. The summary of the issue is that in geant4.10.04.p02 there are problems selecting a particle from the command level. I installed from scratch geant4.10.07.p02.tar (geant4.web.cern.ch) on two machines: (1) macos 10.15.7 and (2) Red Hat Enterprise Linux Server 7.9. In both cases I compiled minimally (w/o Qt or so) using cmake -DCMAKE_INSTALL_PREFIX=../g4-install -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_BUILD_MULTITHREADED=OFF -DCMAKE_BUILD_TYPE=Debug -DGEANT4_BUILD_CXXSTD=17 ../geant4.10.07.p02 followed by make VERBOSE=1 -j9 > & make.log & make install Then cd ../g4-install/bin source geant4.csh and cd ../share/Geant4-10.7.2/examples/basic/B1/ mkdir _build && cd _build/ cmake .. make -j8 ./exampleB1 This dumps me into interactive mode (except on the linux machine, where I have to comment the call to /vis/open OGL 600x600-0+0 in vis.mac to avoid a fatal error), where I can do /particle/select mu+ /particle/property/dump I get Particle is not selected yet !! Command ignored. In the simplified builds on both architectures I get complaints from G4OpenGLXViewer, but I think the detector and the physicslist have been built. (The error message regarding the particle selection is the same in these simplified fresh builds as in my normal Qt5-based build where I have no errors from the viewer.) I also tried to use C++11 instead of C++17 (imposed by external constraints for my normal work), but this does not cure the issue. Since I was at it, I also tried installing from scratch with geant4.10.06.p03.tar (Software Download Archive | geant4.web.cern.ch). With this release, I do NOT get the issue. I can select the particle and dump its properties. From my perspective I can reproduce the issue I reported in June in fresh unmodified builds of geant4.10.07.p02 on two different architectures. The issue is not present in geant4.10.06.p03.
Trying vanilla exampleB1 in sequential mode on MacOS and Linux systems with supported compilers and not able to reproduce the problem. Commands work just fine. See output excerpt from interactive session: > /particle/select mu+ > /particle/property/dump --- G4ParticleDefinition --- Particle Name : mu+ PDG particle code : -13 [PDG anti-particle code: 13] Mass [GeV/c2] : 0.105658 Width : 2.99598e-19 Lifetime [nsec] : 2196.98 Charge [e]: 1 Spin : 1/2 Parity : 0 Charge conjugation : 0 Isospin : (I,Iz): (0/2 , 0/2 ) GParity : 0 MagneticMoment [MeV/T] : 2.80272e-13 Quark contents (d,u,s,c,b,t) : 0, 0, 0, 0, 0, 0 AntiQuark contents : 0, 0, 0, 0, 0, 0 Lepton number : -1 Baryon number : 0 Particle type : lepton [mu] G4DecayTable: mu+ 0: BR: 1 [Muon Decay] : e+ nu_e anti_nu_mu
Funny, it did not work for John, cf https://geant4-forum.web.cern.ch/t/particle-select-in-examples-basic-b1/5517/6. It seems to work in the HEAD of the master branch (or whatever it is called).