Printing of event log

Hi, I am currently trying to lower the verbosity of my output and have been mostly successful with the exception of stopping what seems like an event log, it prints : “Event starts with initial seeds ()” for every event. I can’t seem to find where this originates from. There is no print statement for this in any of the files so I figured it must be a default setting of something.
The simulation is based off example B4a. The verbosity commands I currently have in my macro are:
/process/had/verbose 0
/process/em/verbose 0
/control/verbose 0
/run/verbose 0
/event/verbose 0
/tracking/verbose 0
/process/verbose 0

I’ve found out that even setting all these verbose settings to 0 many things are still printed out by Geant4. Therefore, in my own code I decided to just disable stdout output temporarily when I don’t want the output. Below are the functions I use to do that. I hope you find them useful.

static int outfd = STDOUT_FILENO;

void disable_stdout()
{
	FILE* tmp = fopen("/dev/null", "a+");

	fflush(stdout);

	outfd = dup(STDOUT_FILENO);

	if (outfd == -1 || dup2(fileno(tmp), STDOUT_FILENO) == -1)
		errx(1, "failed to disable stdout");

	fclose(tmp);
}

void enable_stdout()
{
	fflush(stdout);

	if (dup2(outfd, STDOUT_FILENO) == -1)
		errx(1, "failed to enable stdout");

	close(outfd);
}
1 Like

Thank you for the fast reply. This was very helpful.

you could try to set /run/printProgress -1

and in principle, there is also a verbosity build option:

  • GEANT4_BUILD_VERBOSE_CODE : (DEFAULT : ON)
  • If set to ON, build Geant4 libraries with extra verbosity. It can be switched to OFF to give a degree of performance improvement, but you will not have as much information output should you run into problems or need to debug.

https://geant4-userdoc.web.cern.ch/UsersGuides/InstallationGuide/html/installguide.html#advanced-options

1 Like

Hi @amadio ,

May I know where you defined this function in your code ?
I am looking to turn off verbosity in all parts of code even from preinit and init, or idle.
Any suggestions.

VRS

They are defined here:

Have a look at the whole main() function to see how I used it.

Cheers,
-Guilherme

Thankyou @amadio . I will look into it. :slight_smile: