Saving .mac geometry settings at the EndOfRunAction

Hello everyone,

I am trying to save at the EndOfRunAction a Ntuple containing exclusively run metadata (e.g., which settings I have setup on my .mac file when building the detector).

When constructing the detector during G4VUserDetectorConstruction I am using the following code to access the messenger:

fMessenger = new G4GenericMessenger(this,“/ptfe/surface/”,“…”);
fMessenger->DeclareProperty(“activateRoughness”,fActivateRoughness,“…”);
fMessenger->DeclareProperty(“numberFeaturesSide”,fNumberFeaturesSide,“…”);
fMessenger->DeclarePropertyWithUnit(“baseWidth”,“um”,fBaseWidth,“…”);

This works fine, since I can printout the values of those variables.
I would like to then access the same commands during EndOfRunAction, so I run:

fMessenger = new G4GenericMessenger(this,“/ptfe/surface/”,“…”);
fMessenger->DeclareProperty(“activateRoughness”,lActivateRoughness,“…”);
fMessenger->DeclareProperty(“numberFeaturesSide”,lNumberFeaturesSide,“…”);
fMessenger->DeclarePropertyWithUnit(“baseWidth”,“um”,lBaseWidth,“…”);

However when I do:

printf(“Params:%i,%.1f,%.1f,%.1f\n”,lNumberFeaturesSide,lFeaturesSpacing,lFeaturesHeight,lBaseWidth);

I can see I still have the default values, and those variables have not been assigned the values from the commands. Can anybody help me with this?

Many thanks