Problem using UImanager::SetMacroSearchPath()

Geant4 Version: 10.7.p04
Operating System: MacOS/CentOS7
Compiler/Version: gcc/11.4.0
CMake Version: CMake 3.18


The CDMS experiment maintains a collection of macro “stubs” in various directories of our release framework. For years, we’ve told our users to spell out the full path to the macro stubs if they want to use them, for instance

/control/execute {CDMS_SUPERSIM}/CDMSgeometry/macros/CUTE_R34_stack.mac

It finally occurred to me that we ought to be using the “macro search path.” So in our code, I added a call in our C++ to set the path myself. I’ve confirmed that the UImanager sees the path I set:

PreInit> /control/getVal MPATH /control/macroPath
PreInit> /control/echo {MPATH}
/Users/kelsey/cdms/supersim/CDMSgeometry/macros:/Users/kelsey/cdms/supersim/CDMSsources/macros:/Users/kelsey/cdms/supersim/CDMSmacros/util

but apparently the path is not being searched properly:

PreInit> /control/execute CUTE_R34_stack.mac     
ERROR: Can not open a macro file <CUTE_R34_stack.mac>. Set macro path with "/control/macroPath" if needed.

Are we required to use the /control/macroPath command, instead of calling the SetMacroSearchPath() function?

Found it, in G4UIcontrolMessenger.cc:

  if(command == macroPathCommand)
  {
    UI->SetMacroSearchPath(newValue);
    UI->ParseMacroSearchPath();
  }

So I need to add that command myself in our CDMS code.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.