Histogram output in radioactivedecay example

The radioactivedecay example is supposed to print out the histograms in a file named “rdecay01”, but it doesn’t look so. Just in case, I ran ‘/analysis/setActivation true’, but I still do not see the file.
Has any one had a similar problem?

As with many other questions/problems about Geant4, this question also had a very simple answer hidden somewhere in the distributed files, manuals, etc. It’s just quite difficult to know where to find it without knowing what’s going on behind the scene. Here is the answer I found (of course, it’s not the best answer):

To output the histograms, the histograms need be activated by changing the parameter of this function in HistoManager.cc from false to true:
analysisManager->SetH1Activation(ih, true);

Or, use the commands as what is included in Co60.mac (I didn’t have to run /analysis/setActivation true’. Not sure why.):

/analysis/setFileName Co60
/analysis/h1/set 1 150 0. 1500 keV #e+ e-
/analysis/h1/set 2 150 0. 1500 keV #neutrino
/analysis/h1/set 3 150 0. 1500 keV #gamma
/analysis/h1/set 6 100 0. 2500 keV #EkinTot (Q)
/analysis/h1/set 7 150 0. 15e3 keV #P balance
/analysis/h1/set 8 100 0. 100. year #time of life
/analysis/h1/set 9 100 1. 3. MeV #EvisTot

By default, the program outputs a ‘root’ file, which requires a separate program. If you are not familiar with it (like me), go to HisoManager.hh and replace #include “g4root.hh” with #include “g4csv.hh”. Then, the program will output CSV files, which can be read in Excel.

1 Like


Thank you for your feedback. Though you already found the reply to your question, I would like just to add some information that may be useful for new users.

Besides all the general manuals and user guides, each Geant4 example includes a README file, which webified form can be found starting from this page:

In this example README:
there is a section about histograms, including the information about histogram activation.

With best regards,

Thank you very much for the information!