How to view geometry after developing a .cpp file

Hi, I recently installed Geant4 10.6 on ubuntu and i am trying to go through the user guide for developers. In order to follow the examples in the document, i will like to find out how to run the .cpp file in Geant4 in order to view it as in the example B1, that i successfully built after installation. Thank you

Is your question about how to execute an example?

Hi Idrissi, thank you for the reply. Yes, how to execute an example. From the example B1 i can see 2 folders “include” and “src” as well as a “cmakelists” file in addition to the .cc file. Do i have to develop all the .hh files in the 'include" folder and the .cc files in the “src” folder?

In your example which contains src and include directories create a new directory ( name it build)… with the terminal place in build ana use following commands :
1- cmake …
2- make
An you find an executable file then use the command ::
3- ./exampleB1 (for B1 Geant4 example )

1 Like

Hi,
you can try this sequence of command:

mkdir $HOME/buildB1
cd $HOME/buildB1
cmake -DGeant4_DIR=$G4COMP $G4EXAMPLES/basic/B1
make
./exampleB1

G4COMP is the path to geant4 installation and G4EXAMPLES to the examples directory, you should change this two to fit you system installation.
Regards,
Kiko

2 Likes

Thank you for this Idrissi

Thank you for the reply Kiko