B1 Example debug error

I have followed all of the steps on the installation guide and have just tried to execute the B1 example after setting the environment variables, but when doing so it says that there is a debug error which doesn’t allow me to retry. I am very new to all of this so any help is appreciated!

Can you post the actual output?

To confirm, you have successfully built/compiled the example, but when you try and run the executable you get the error?

I am now experiencing issues with the initial build of Geant 4 which is now producing errors. I will try all again and get back to you with the B1 example build.

These are the errors that appear when trying to run the executable for the B1 example. I have followed the steps on the installation guide and changed the path and added another environment variable.
image
image
image
image

See the Postinstall Setup section of the Install Guide.

It looks like the path to the Geant4 DLLs is missing from the PATH environment variable for the session.

Thanks for your reply. I have set all the environment variables like it said to do in the setup section and have set the path to the folder that contains G4TREE.dir but I am still shown the same errors.

Did you make any changes to the build/install of geant4 itself? and if so have you re-run the cmake step in the build directory for B1 example since making any those changes? Your copy of the B1 example may be looking for things from the older install.

If you navigate to C:\Users\????\Documents\Geant4\geant_10_07\geant_4_build\source i.e. the directory you added to Path, do you see .dll files?

If not, it looks like you have added the wrong path to the environment variable in the step linked in the post above.

I have made sure that the directory I added to the path leads to the .dll files and I have also re-run the cmake step but I am now having problems running this step as it says the installation prefix for geant4 cannot be found. I think I will try again through all of the steps with all of the advice and hopefully all of the files should be in the correct place to be found by Cmake.

After reinstalling and making sure that all of the files have been saved to the correct places and that all of the directory have been directed correctly, I am encountering the debug problem again.
image

A couple of things to try:

  • When you run the example from the command prompt, what is output in the terminal? This usually prints a bit more than the above window.
  • In that same terminal, what does the set command output for the environment variables?
  • Did you compile/link the example with the same build mode (e.g. Release)?
  • What visualisation drivers, if any, did you enable when installing Geant4 (not the example)?

This is the output that I am recieving once I have changed the build mode to both be release instead of debug. I have also tried setting the environment variable STATEDATA to the correct file but that message still appears

The variable is G4ENSDFSTATEDATA and looks like you set it here:

Can you check that it (and the other variables listed there) are set in the session you are running in? PATH at least must be right as the program wouldn’t have run to this point otherwise.

Yes they are all set the same and the message is still the same.


Looks like the macro files have not been copied to your build directory during the cmake step

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

Don’t know why they would not have been, but for the moment, you should be able to fix this by copying all files ending .mac from the source directory into the build directory.

Thank you I will try this.

When trying to run the application, the output seems to show no errors and another window opens which is shown below. However, I cannot interact with the other window as it says that it is not responding every time I try to open it. Is this something to do with my system or is there another issue I need to resolve.
image
Available UI session types: [ Win32, GAG, csh ]

-------- WWWW ------- G4Exception-START -------- WWWW -------

*** ExceptionHandler is not defined ***
*** G4Exception : UI0002
issued by : G4UIExecutive::G4UIExecutive()
Specified session type is not build in your system,
or no session type is specified.
A fallback session type is used.
*** This is just a warning message. ***
-------- WWWW ------- G4Exception-END -------- WWWW -------


Geant4 version Name: geant4-10-07 (4-December-2020)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
: NIM A 835 (2016), 186-225
WWW : http://geant4.org/


<<< Reference Physics List QBBC
Visualization Manager instantiating with verbosity “warnings (3)”…
Visualization Manager initialising…
Registering graphics systems…

You have successfully registered the following graphics systems.
Registered graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRep (HepRepXML)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML1FILE (VRML1FILE)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
OpenGLImmediateWin32 (OGLIWin32, OGLI)
OpenGLStoredWin32 (OGLSWin32, OGL, OGLS)

Registering model factories…

You have successfully registered the following model factories.
Registered model factories:
generic
drawByAttribute
drawByCharge
drawByOriginVolume
drawByParticleID
drawByEncounteredVolume

Registered models:
None

Registered filter factories:
attributeFilter
chargeFilter
originVolumeFilter
particleFilter
encounteredVolumeFilter

Registered filters:
None

You have successfully registered the following user vis actions.
Run Duration User Vis Actions: none
End of Event User Vis Actions: none
End of Run User Vis Actions: none

Some /vis commands (optionally) take a string to specify colour.
“/vis/list” to see available colours.
/control/saveHistory
/run/verbose 2

Change the default number of threads (in multi-threaded mode)

#/run/numberOfThreads 4

Initialize kernel

/run/initialize
userDetector->Construct() start.
Checking overlaps for volume Envelope (G4Box) … OK!
Checking overlaps for volume Shape1 (G4Cons) … OK!
Checking overlaps for volume Shape2 (G4Trd) … OK!
World is registered to the default region.
physicsList->Construct() start.

HadronInelasticQBBC Construct Process:

Emin(FTFP)= 3 GeV; Emax(FTFP)= 100000 GeV
Emin(BERT)= 1 GeV; Emax(BERT)= 6 GeV; Emax(BERTpions)= 12 GeV;
Emin(BIC) = 0 GeV; Emax(BIC)= 1.5 GeV.

Adding tracking cuts for neutron TimeCut(ns)= 10000 KinEnergyCut(MeV)= 0

physicsList->CheckParticleList() start.
physicsList->setCut() start.

Visualization setting

/control/execute vis.mac

Macro file for the visualization setting in the initialization phase

of the B1 example when running in interactive mode

Use these open statements to open selected visualization

Use this open statement to create an OpenGL view:

/vis/open OGL 600x600-0+0
/vis/sceneHandler/create OGL
/vis/viewer/create ! ! 600x600-0+0
/vis/viewer/refresh

Use this open statement to create an OpenInventor view:

#/vis/open OI

Use this open statement to create a .prim file suitable for

viewing in DAWN:

#/vis/open DAWNFILE

Use this open statement to create a .heprep file suitable for

viewing in HepRApp:

#/vis/open HepRepFile

Use this open statement to create a .wrl file suitable for

viewing in a VRML viewer:

#/vis/open VRML2FILE

Disable auto refresh and quieten vis messages whilst scene and

trajectories are established:

/vis/viewer/set/autoRefresh false
/vis/verbose errors
Visualization verbosity changed to errors (2)

Draw geometry:

/vis/drawVolume
/vis/scene/create
/vis/scene/add/volume world -1 -1 none m 0 0 0 0 0 0
/vis/sceneHandler/attach

Specify view angle:

/vis/viewer/set/viewpointVector -1 0 0
/vis/viewer/set/lightsVector -1 0 0

Specify style (surface, wireframe, auxiliary edges,…)

/vis/viewer/set/style wireframe
/vis/viewer/set/auxiliaryEdge true
/vis/viewer/set/lineSegmentsPerCircle 100

Draw smooth trajectories at end of event, showing trajectory points

as markers 2 pixels wide:

/vis/scene/add/trajectories smooth
/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)
/vis/scene/notifyHandlers
/vis/modeling/trajectories/create/drawByCharge
/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
/vis/scene/notifyHandlers scene-0
/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
/vis/scene/notifyHandlers scene-0

(if too many tracks cause core dump => /tracking/storeTrajectory 0)

Draw hits at end of event:

#/vis/scene/add/hits

To draw only gammas:

#/vis/filtering/trajectories/create/particleFilter
#/vis/filtering/trajectories/particleFilter-0/add gamma

To invert the above, drawing all particles except gammas,

keep the above two lines but also add:

#/vis/filtering/trajectories/particleFilter-0/invert true

Many other options are available with /vis/modeling and /vis/filtering.

For example, to select colour by particle ID:

#/vis/modeling/trajectories/create/drawByParticleID
#/vis/modeling/trajectories/drawByParticleID-0/default/setDrawStepPts true

To select or override default colours (note: e+ is blue by default):

#/vis/modeling/trajectories/list
#/vis/modeling/trajectories/drawByParticleID-0/set e+ yellow

To superimpose all of the events from a given run:

/vis/scene/endOfEventAction accumulate

Decorations

Name

/vis/set/textColour green
/vis/set/textLayout right
/vis/scene/add/text2D 0.9 -.9 24 ! ! exampleB1
/vis/scene/notifyHandlers

or, if your system does not support right-adjustment

#/vis/scene/add/text2D 0 -.9 24 ! ! exampleB1
/vis/set/textLayout
/vis/set/textColour

Axes, scale, etc.

/vis/scene/add/scale
/vis/scene/notifyHandlers
/vis/scene/add/axes
/vis/scene/notifyHandlers
/vis/scene/add/eventID
/vis/scene/notifyHandlers
/vis/scene/add/date
/vis/scene/notifyHandlers
/vis/scene/add/logo2D
/vis/scene/notifyHandlers
/vis/scene/add/logo
/vis/scene/notifyHandlers

Frame

/vis/set/colour red
/vis/set/lineWidth 2
/vis/scene/add/frame
/vis/scene/notifyHandlers
/vis/set/colour
/vis/set/lineWidth

Attach text to one edge of Shape1, with a small, fixed offset

/vis/scene/add/text 0 6 -4 cm 18 4 4 Shape1
/vis/scene/notifyHandlers

Attach text to one corner of Shape2, with a small, fixed offset

/vis/scene/add/text 6 7 10 cm 18 4 4 Shape2
/vis/scene/notifyHandlers

To get nice view

Make the “World” box invisible

/vis/geometry/set/visibility World 0 false
/vis/scene/notifyHandlers

“Envelope” is transparent blue to represent water

/vis/geometry/set/colour Envelope 0 0 0 1 .3
/vis/scene/notifyHandlers
/vis/viewer/set/style surface
/vis/viewer/set/hiddenMarker true
/vis/viewer/set/viewpointThetaPhi 120 150

Re-establish auto refreshing and verbosity:

/vis/viewer/set/autoRefresh true
/vis/viewer/refresh
G4OpenGLViewer::DrawText: Not implemented for “viewer-0 (OpenGLStoredWin32)”
Called with G4Text: “exampleB1”
layout right, offset (0,0)
G4VMarker: position: (0.9,-0.9,0), world size: 0, screen size: 24
fill style: no fill
G4VisAttributes: visible, daughters visible, colour: (0,1,0,1) (green)
linestyle: solid, line width: 1, min line segments per circle: 3
drawing style: not forced, auxiliary edge visibility: not forced
line segments per circle: not forced.
time range: (-1e+100,1e+100)
G4AttValue pointer is zero, G4AttDef pointer is zero
/vis/verbose warnings
Visualization verbosity changed to warnings (3)

For file-based drivers, use this to create an empty detector view:

#/vis/viewer/flush
Idle>

The simple Win32 window is not interactive. You can change views and styles with vis commands, e.g., /vis/viewer/set/viewpointThetaPhi 45 50 deg, but that’s it.

If you want an interactive window on Windows the best option is to install and build with Qt. See Installation Guide.

Thank you for your help.