Argument of the constructor of PrimaryGeneratorAction

_Geant4 Version:4.11.2
_Operating System:Ubuntu24.04
_Compiler/Version:gcc 13.2.0
_CMake Version: 3.27.0

In Fact I have a trivial or stupid question. I don’t understand why the PrimaryGenerator Action constructor requires as an argument a DetectorConstruction* which is not used. For example in the TestEm5 example

PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* DC)
:G4VUserPrimaryGeneratorAction(),
fParticleGun(0),fDetector(DC),fRndmBeam(0),fGunMessenger(0)
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
SetDefaultKinematic();

//create a messenger for this class
fGunMessenger = new PrimaryGeneratorMessenger(this);
}

It is used. Look in GeneratePrimaries() and see how rbeam is computed. If you want to actually see it used when you run the example, then SetRndmBeam() needs to be called with a non-zero argument. Presumably that’s done with a UI command via the Messenger.

Sorry, i forget to thanks you for reply