Problem 871

Summary: SetRunID
Product: Geant4 Reporter: aniello.nappi
Component: runAssignee: Makoto.Asai
Status: RESOLVED INVALID    
Severity: trivial CC: aniello.nappi
Priority: P2    
Version: other   
Hardware: All   
OS: All   

Description aniello.nappi 2006-05-31 12:38:48 CEST
I have my implementation of G4UserRunAction and I want to change the run ID,
calling G4Run::SetRunID in my implementation of the virtual method
G4UserRunAction::BeginOfRunAction.
However, since the method is declared as
virtual void BeginOfRunAction(const G4Run* aRun)
I get a compiler error for the statement
aRun->SetRunID(id)
I guess the reason is that somehow the compiler understands that I want to
modify G4Run and that is not allowed since the pointer to G4Run is declared as a
const.

Is that a problem or just poor understanding on my side?
Comment 1 asai 2006-05-31 20:02:59 CEST
It is intentionally set to "const" to avoid any mis-use.
But, given run number is not used in Geant4 kernel, you can
set the number by casting const pointer to non-const pointer.