First running B1 on Windows

Hi everyone

Could you help me understand problems in the during running example B1?

c:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\examples\basic\b1 - build\Release>exampleB1.exe
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-06-patch-01 (14-February-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.
Current available graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRep (HepRepXML)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML1FILE (VRML1FILE)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)

Registering model factories…

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

Registered filter factories:
attributeFilter
chargeFilter
originVolumeFilter
particleFilter
encounteredVolumeFilter

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.
ERROR: Can not open a macro file <init_vis.mac>. Set macro path with “/control/macroPath” if needed.

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : UIMAN0123
issued by : G4UImanager::ApplyCommand
Command aborted (400)
Error code : 400
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

PreInit>

1 Like

Hmm, I don’t think I’ve seen these warnings before - @lgarnier, @Allison, could you take a look and advise please?

First warning: OK. Just a warning.
Second warning: I think this is simply that the user is not running the application in the appropriate directory.

1 Like

Allison, thanks for the help.

I am a new user and don’t understand what I have to do. Could you clarify me how to fix it?

And I found information about QT. My problem can regard with QT but I don’t know how to turn on QT on Win10 through cmd.

Hello.
At first, you have to put init_vis.mac and vis.mac files to the folder with .exe.
Next, you have to use bat file like this:

@setlocal enableextensions enabledelayedexpansion
rem @echo off
set G4DATA=c:\nucleardata
set PATH=C:\Program Files\Geant4 10.6\bin
set G4SYSTEM=WIN32-VC
set G4VIS_BUILD_OPENGLWIN32_DRIVER=1
set G4VIS_USE_OPENGLWIN32=1
set G4LEVELGAMMADATA=%G4DATA%/PhotonEvaporation5.5
set G4RADIOACTIVEDATA=%G4DATA%/RadioactiveDecay5.4
set G4LEDATA=%G4DATA%/G4EMLOW7.9.1
set G4NEUTRONHPDATA=%G4DATA%/G4NDL4.6
set G4ABLADATA=%G4DATA%/G4ABLA3.1
set G4REALSURFACEDATA=%G4DATA%/RealSurface2.1.1
set G4SAIDXSDATA=%G4DATA%/G4SAIDDATA2.0
set G4ENSDFSTATEDATA=%G4DATA%/G4ENSDFSTATE2.2
set G4PIIDATA=%G4DATA%/G4PII1.3
set G4INCLDATA=%G4DATA%/G4INCL1.0
set G4PARTICLEXSDATA=%G4DATA%/G4PARTICLEXS2.1
set G4SAIDDATA=%G4DATA%/G4SAIDDATA2.0
exampleB1.exe init_vis.mac
endlocal

Thanks a lot, but example b1 has not worked yet and it show following:

C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\examples\basic\b1 - build\Release>set G4LEDATA=C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\Data\G4EMLOW7.9.1

C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\examples\basic\b1 - build\Release>set G4NEUTRONHPDATA=C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\Data/G4NDL4.6

C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\examples\basic\b1 - build\Release>set G4ABLADATA=C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\Data\G4ABLA3.1

C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\examples\basic\b1 - build\Release>set G4REALSURFACEDATA=C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\Data\RealSurface2.1.1

C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\examples\basic\b1 - build\Release>set G4SAIDXSDATA=C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\Data\G4SAIDDATA2.0

C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\examples\basic\b1 - build\Release>set G4ENSDFSTATEDATA=C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\Data\G4ENSDFSTATE2.2

C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\examples\basic\b1 - build\Release>set G4PIIDATA=C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\Data\G4PII1.3

C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\examples\basic\b1 - build\Release>set G4INCLDATA=C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\Data\G4INCL1.0

C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\examples\basic\b1 - build\Release>set G4PARTICLEXSDATA=C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\Data\G4PARTICLEXS2.1

C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\examples\basic\b1 - build\Release>set G4SAIDDATA=C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\Data\G4SAIDDATA2.0

C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\examples\basic\b1 - build\Release>exampleB1.exe init_vis.mac


Geant4 version Name: geant4-10-06-patch-01 (14-February-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.
Current available graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRep (HepRepXML)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML1FILE (VRML1FILE)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)

Registering model factories…

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

Registered filter factories:
attributeFilter
chargeFilter
originVolumeFilter
particleFilter
encounteredVolumeFilter

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.

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
parameter value (OGL) is not listed in the candidate List.
Candidates are: ATree DAWNFILE HepRepFile HepRepXML RayTracer VRML1FILE VRML2FILE gMocrenFile

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
ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer.
/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
ERROR: Current scene handler not defined. Please select or create one.

Specify view angle:

/vis/viewer/set/viewpointVector -1 0 0
ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer.
/vis/viewer/set/lightsVector -1 0 0
ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer.

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

/vis/viewer/set/style wireframe
ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer.
/vis/viewer/set/auxiliaryEdge true
ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer.
/vis/viewer/set/lineSegmentsPerCircle 100
ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer.

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/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
ERROR: No current sceneHandler. Please create one.

Decorations

Name

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

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
ERROR: G4VisCommandSceneAddScale::SetNewValue: no viewer.
Auto direction needs a viewer.
/vis/scene/add/axes
/vis/scene/add/eventID
/vis/scene/add/date
/vis/scene/add/logo2D
/vis/scene/add/logo
ERROR: G4VisCommandSceneAddLogo::SetNewValue: no viewer.
Auto direction needs a viewer.

Frame

/vis/set/colour red
/vis/set/lineWidth 2
/vis/scene/add/frame
/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

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

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

To get nice view

Make the “World” box invisible

/vis/geometry/set/visibility World 0 false

“Envelope” is transparent blue to represent water

/vis/geometry/set/colour Envelope 0 0 0 1 .3
/vis/viewer/set/style surface
ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer.
/vis/viewer/set/hiddenMarker true
ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer.
/vis/viewer/set/viewpointThetaPhi 120 150
ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer.

Re-establish auto refreshing and verbosity:

/vis/viewer/set/autoRefresh true
ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer.
/vis/verbose warnings
Visualization verbosity changed to warnings (3)

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

#/vis/viewer/flush
Graphics systems deleted.
Visualization Manager deleting…
G4 kernel has come to Quit state.
UserDetectorConstruction deleted.
UserPhysicsList deleted.
UserActionInitialization deleted.
UserRunAction deleted.
UserPrimaryGenerator deleted.
RunManager is deleting RunManagerKernel.
EventManager deleted.
Units table cleared.
TransportationManager deleted.
Total navigation history collections cleaned: 2
================== Deleting memory pools ===================
Pool ID ‘class G4NavigationLevelRep’, size : 0.00288 MB
Pool ID ‘class G4ReferenceCountedHandle’, size : 0.000961 MB
Pool ID ‘class G4CountedObject’, size : 0.000961 MB
Number of memory pools allocated: 3; of which, static: 0
Dynamic pools deleted: 3 / Total memory freed: 0.0048 MB

G4Allocator objects are deleted.
UImanager deleted.
StateManager deleted.
RunManagerKernel is deleted. Good bye :slight_smile:

C:\Geant4\geant4_10_06-install\share\Geant4-10.6.1\examples\basic\b1 - build\Release>PAUSE

That looks like a successful run, in that the issue with finding the macro is resolved. You mentioned Qt in an earlier post, are you wanting that visualization driver?

You are understanding me=)

How do I can turn on QT? I understand how to turn on QT in the direct geant4_10_06-build, but don’t know how turn on in geant4_10_06-install.

Sorry for may be stupid questions but I really would like to run code and receive result.

Try to run without visualization with run1.mac from example B1:
exampleB1.exe run1.mac.

Not a stupid question at all :slight_smile: ! The build and install should share the same configuration. If in geant4_10_06-build you configured and built geant4 itself with Qt support enabled, i.e.

> cmake -DGEANT4_USE_QT=ON <otherargs>
...
> cmake --build . --config Release --target install

then the installed Geant4 will have support for Qt (see the Installation Guide for full details)

When exampleB1 is built against this (as outlined in this section of the Install Guide), it will be built with support for Qt visualisation if the install of Geant4 it uses has Qt support.

I’d suspect that when you configured/installed Geant4, it wasn’t with the GEANT4_USE_QT option? If so, just go back to the directory you built geant4 in and run

> cmake -DGEANT4_USE_QT=ON .
...
> cmake --build . --config Release --target install

and it’ll rebuild/install Geant4 with Qt enabled (you’ll need an install of Qt first). Then rebuild your example and it should have Qt visualisation enabled.

When I work under Windows and I need to look at the geometry, I use the following .mac file:
/run/initialize
/control/verbose 2
/run/verbose 2
/event/verbose 0
/tracking/verbose 1

/vis/scene/create
/vis/open VRML2FILE
/vis/viewer/set/viewpointThetaPhi 270 0 deg
/vis/scene/add/trajectories
/vis/viewer/set/style surface
/tracking/storeTrajectory 1
/vis/scene/endOfEventAction accumulate

/gun/particle gamma
/gun/energy 6 MeV

/run/beamOn 5

The result is g4_00.wrl, which can be viewed in the wrml editor.
Meaning that the interface is usually not needed.

Thanks for advice. When I was reaping the installation I met with an error regarding QT:

c:\Geant4\geant4_10_06-build>cmake -DGEANT4_USE_QT=ON .
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.16/Modules/FindQt4.cmake:1314 (message):
  Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x
Call Stack (most recent call first):
  cmake/Modules/Geant4InterfaceOptions.cmake:117 (find_package)
  cmake/Modules/G4CMakeMain.cmake:64 (include)
  CMakeLists.txt:50 (include)


-- Configuring incomplete, errors occurred!
See also "C:/Geant4/geant4_10_06-build/CMakeFiles/CMakeOutput.log".
See also "C:/Geant4/geant4_10_06-build/CMakeFiles/CMakeError.log".

However, I used initial file from site. If I understood right QT is not necessary and I can get results without it.