Problem 871 - SetRunID
Summary: SetRunID
Status: RESOLVED INVALID
Alias: None
Product: Geant4
Classification: Unclassified
Component: run (show other problems)
Version: other
Hardware: All All
: P2 trivial
Assignee: Makoto.Asai
URL:
Depends on:
Blocks:
 
Reported: 2006-05-31 12:38 CEST by aniello.nappi
Modified: 2006-05-31 20:02 CEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
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.