Running brachytherapy example

Hello,

I am new to geant4 and attempting to run the brachytherapy example.
I have compiled geant using;
cmake -DCMAKE_INSTALL_PREFIX=…/geant4.10.06.p02-install -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_GDML=ON -DGEANT4_USE_XM=ON -DGEANT4_USE_QT=ON -DGEANT4_BUILD_MULTITHREADED=ON …/geant4.10.06.p02

When I run the examples B1 and radioactivedecay, the visualization works fine.
However, when I attempt to run the brachytherapy example, the viewer is blank, and I get the following error in the openGL terminal ;
UI session starts …
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–10-100-75-75-m-60-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–11-80-100-100-m-60-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–12-120-75-75-m-70-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–14-100-100-100-m-90-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–17-120-100-100-m-100-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–18-180-75-75-m-110-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–20-140-100-100-m-110-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–24-240-75-75-m-150-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–25-180-100-100-m-150-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–34-240-100-100-m-200-iso8859-1
Visualization verbosity changed to errors (2)
ERROR: G4VisCommandSceneAddVolume::SetNewValue:
No world. Maybe the geometry has not yet been defined.
Try “/run/initialize”
/tracking/storeTrajectory 2
Attributes available for modeling and filtering with
“/vis/modeling/trajectories/create/drawByAttribute” and
“/vis/filtering/trajectories/create/attributeFilter” commands:
G4TrajectoriesModel:
Event ID (EventID): G4int
Run ID (RunID): G4int
G4SmoothTrajectory:
Charge (Ch): unit: e+ (G4double)
Track ID (ID): G4int
Initial kinetic energy (IKE): G4BestUnit (G4double)
Initial momentum magnitude (IMag): G4BestUnit (G4double)
Initial momentum (IMom): G4BestUnit (G4ThreeVector)
No. of points (NTP): G4int
PDG Encoding (PDG): G4int
Parent ID (PID): G4int
Particle Name (PN): G4String
G4SmoothTrajectoryPoint:
Auxiliary Point Position (Aux): G4BestUnit (G4ThreeVector)
Step Position (Pos): G4BestUnit (G4ThreeVector)
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : visman0202
issued by : G4Scene::CalculateExtent
Scene has no extent. Please activate or add something.
The camera needs to have something to point at!
Add a volume. (You may need “/run/initialize”.)
Or use “/vis/scene/add/extent”.
“/vis/scene/list” to see list of models.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
ERROR: G4VisManager::IsValidView ():
Attempt at some drawing operation when scene is empty.
Maybe the geometry has not yet been defined. Try /run/initialize.
Or use “/vis/scene/add/extent”.
ERROR: G4VisManager::IsValidView ():
Attempt at some drawing operation when scene is empty.
Maybe the geometry has not yet been defined. Try /run/initialize.
Or use “/vis/scene/add/extent”.
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : visman0106
issued by : G4VSceneHandler::ProcessScene
The scene has no extent.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : visman0106
issued by : G4VSceneHandler::ProcessScene
The scene has no extent.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
***** COMMAND NOT FOUND </gps/ene/type Arb> *****
***** Batch is interrupted!! *****
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : UIMAN0123
issued by : G4UImanager::ApplyCommand
Command aborted (100)
Error code : 100
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
***** COMMAND NOT FOUND </control/execute iridium_source_primary.mac> *****
***** Batch is interrupted!! *****
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : UIMAN0123
issued by : G4UImanager::ApplyCommand
Command aborted (100)
Error code : 100
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–10-100-75-75-m-60-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–11-80-100-100-m-60-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–12-120-75-75-m-70-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–14-100-100-100-m-90-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–17-120-100-100-m-100-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–18-180-75-75-m-110-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–20-140-100-100-m-110-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–24-240-75-75-m-150-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–25-180-100-100-m-150-iso8859-1
G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font
-adobe-courier-bold-r-normal–34-240-100-100-m-200-iso8859-1
/run/verbose 1
/event /verbose 1
command not found: “/event /verbose 1”
/phantom/selectMaterial Lead
illegal application state – command refused:"/phantom/selectMaterial Lead"
/run/beamOn 10
Geant4 kernel should be initialized
before the first BeamOn(). - BeamOn ignored.
/home/jtyrrell/brachytherapy/g4work/advanced/brachytherapy/iodine_source_primary.mac
command not found: “/home/jtyrrell/brachytherapy/g4work/advanced/brachytherapy/iodine_source_primary.mac”

I have been trying to come up with a solution for quite some time but, have not been able to find one.
Any help would would be greatly appreciated.
Thank you.

Hi

exampleB1 runs OK. That’s a good sign.

I tried examples//advanced/brachytherapy with a similar setup to yours. The way it runs seems to be slightly non-standard and I haven’t figured out yet how to run it, but I thought you might like a preliminary finding.

  • In VisualisationMacro.mac, it says

/vis/open OGLIX 600x600-0+0

which is fine, but it means that it tries to draw an X window. That should be fine (it’s fine for me), but in your case, there is something strange about your X installation that causes it not to find fonts. Normally we would write

/vis/open OGL

as in In exampleB1, which allows the vis system to choose the optimum graphics system, which in your case is a Qt version of OpenGL. If I edit VisualisationMacro.mac (change OGLIX to OGL), I get a blank window. You could try that, but…

  • There are other problems, namely, “command not found”. Maybe I should read the README. A preliminary reading tells me it needs an argument. Forget the bit about $G4WORKDIR - we don’t use that any more, Try

./Brachy FlexiSourceMacro.mac

  • I vaguely recall a problem with X fonts. I’ll see what I can find.

Let me know how you go on. I have to go now. I’ll look again later.

John

Hi again

I was wrong. Looking at Brachy.cc I see the way to get visualisation is to start it without any arguments:

./Brachy

then when the session asks for input, type

/control/execute FlexiSourceMacro.mac

(or with any other macro).

Good luck

John

Hi again

Re the XLoadQueryFont issue, all I can say is: make sure you have a full and up to date installation of X11. On my Mac, all X11 libraries and fonts are ultimately under /usr/X11/. For example the fonts are ib /usr/X11/lib/X11/fonts. (Actually they are in /opt/X11 and the above are symbolic links.)

John

Hi John,

Thanks for the reply.

I started visualization using ./Brachy, which gave me the output I copied into my last post.
I changed the oglix to ogl and input /vis/open OGL. This gave me a blank screen.
However, when I run /control/execute FlexiSourceMacro.mac it seems to work.

But, I still can’t see the actual geometry.

Thank you for your help,
Jason.

Hi Jason,

I think /run/initialize is missing from VisualisationMacro.mac. Can you try adding it somewhere at the beginning (before /vis/drawVolume line)?
That way when you start the application without any argument:

./Brachy

you should see the geometry (it automatically loads VisualisationMacro.mac).

Anna

For me, the detector was simply obscured by the trajectories. If I type /run/beamOn (giving just one trajectory) I can see the detector.

Hi ,

I am still getting the font errors I described but the geometry appears to be working after I added /run/initialize.

Thanks a lot!

Hi Anna and John,

I just have one more minor question.
I have produced a 1D histogram to plot the energy spectrum of gammas produced by the radioactive decay of terbium 160 inside a lead block.

#class tools::histo::h1d
#title energy spectrum (%): gamma
#dimension 1
#axis fixed 100 0 4
#annotation axis_x.title [MeV]
#bin_number 102
entries,Sw,Sw2,Sxw0,Sx2w0
0,0,0,0,0
6480,64.8,0.648,0.613917,0.00671822
5865,58.65,0.5865,3.78063,0.254054
2490,24.9,0.249,2.17144,0.189932
144,1.44,0.0144,0.197894,0.0273862
575,5.75,0.0575,1.11851,0.217887
485,4.85,0.0485,1.04961,0.22727
31,0.31,0.0031,0.0800041,0.0206774
2699,26.99,0.2699,8.06821,2.41199
44,0.44,0.0044,0.148602,0.0502019
125,1.25,0.0125,0.489444,0.191662
9,0.09,0.0009,0.0385254,0.0164977
8,0.08,0.0008,0.0367079,0.0168588
24,0.24,0.0024,0.120672,0.0607047
5,0.05,0.0005,0.0267369,0.014303
3,0.03,0.0003,0.0177131,0.010459
2,0.02,0.0002,0.0121819,0.00742009
2,0.02,0.0002,0.0133872,0.00896179
67,0.67,0.0067,0.457901,0.312962
2,0.02,0.0002,0.0145896,0.0106437
192,1.92,0.0192,1.46933,1.12445
0,0,0,0,0
2921,29.21,0.2921,25.6847,22.5849
0,0,0,0,0
0,0,0,0,0
3572,35.72,0.3572,34.4715,33.2668
112,1.12,0.0112,1.12331,1.12663
8,0.08,0.0008,0.0855239,0.0914293
195,1.95,0.0195,2.16864,2.41185
0,0,0,0,0
1753,17.53,0.1753,20.7097,24.4672
0,0,0,0,0
731,7.31,0.0731,9.29577,11.821
323,3.23,0.0323,4.23461,5.55176
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0

I could not find an explanation in the documentation for the column headings (entries,Sw,Sw2,Sxw0,Sx2w0)
Do you know the meaning of these?

OK. Glad you have succeeded.

Sorry, no. Try the “Getting Started” Forum, which covers examples and g4tools.

Thanks, I did that.
Is there a way to plot histograms without using root in the brachytherapy example? It seems that root is the default and any analysis will not work without it.

Apologies for all these back and forth questions.

No need to apologise.

It does look as if the brachytherapy example is tied to the ROOT plotter - see BrachyAnalysisManager.hh

#ifdef ANALYSIS_USE
#include “TROOT.h”
#include “TFile.h”
#include “TH1F.h”
#include “TH2F.h”
#endif

Normally we recommend an open approach. For example in basic/exampleB3

#include “g4root.hh”
//#include “g4csv.hh”
//#include “g4xml.hh”

and all you have to do is comment out root and uncomment csv, for example.

It looks like the brachytherapy example needs to be brought up to date. But exactly how I do not have the expertise. I hope the examples people can help more, but…maybe…you can figure out how to do this. That would be great!

John