_Geant4 Version:4.11.2
_Operating System:Ubuntu24.04
_Compiler/Version:gcc 13.2.0
_CMake Version: 3.27.0
In Fact i would like to understand these lines of code when doing PhysicsList
auto particleIterator = GetParticleIterator();
particleIterator->reset();
while((*particleIterator)())){
}
looking on documentation; Geant4 Classes, i can’t found where this iterator business is declared
could somebody give some infos or where to find them
Thank’s a lot
This is why auto
is evil and should never be used with a strongly typed language. In any event, The Doxygen class documentation (which is linked at the bottom of Geant4 Documentation - Geant4) might help you, or you can find stuff the old fashioned way.
$ grep GetParticleIterator $G4INCLUDE/*List*.hh
will return $G4INCLUDE/G4VUserPhysicsList.hh
as the place to look. There, you’ll see that the returned pointer is G4ParticleTable::G4PTblDicIterator*
.
$ more $G4INCLUDE/G4ParticleTable.hh
will show you
using G4PTblDicIterator =
G4ParticleTableIterator<G4String, G4ParticleDefinition*>;
and a dozen or so lines above that,
#include "G4ParticleTableIterator.hh"
If you want to know the details of the implementation, you can look at that .hh
file.
thank you… i will focuss on these lines…