Skip to content
Snippets Groups Projects
Commit 9401c8e2 authored by Marilena Bandieramonte's avatar Marilena Bandieramonte
Browse files

Merge branch 'updateGeoModelExamples' into 'master'

Update GeoModelExamples

See merge request !199
parents 05a6fc5a 8b3efaf1
No related branches found
No related tags found
1 merge request!199Update GeoModelExamples
......@@ -13,38 +13,9 @@ The example program:
* loops over all the RootVolume's children volumes (GeoPhysVol and GeoFullPhysVol instances), printing the name of the GeoLogVol associated to them
## Dependencies
### Install Qt5
To build and run GeoModel I/O libraries, you must have a working Qt5 installation on your computer.
If you are not sure how to install it, please take a look at the Appendix, below.
### GeoModelCore
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelCore.git
mkdir build_gmcore
cd build_gmcore
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelCore
make -j 4
make install
cd ..
```
## Build
From your work folder:
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelExamples.git
mkdir build_hellogeo
cd build_hellogeo
cmake -DCMAKE_INSTALL_PREFIX=../install ../GeoModelExamples/HelloGeo/
make -j4
```
To build the GeoModelExamples please refer to the documentation at [GeoModel website](https://geomodel.web.cern.ch/home/)
## Run
......@@ -53,13 +24,3 @@ Now, you can **run the example** by typing:
```bash
./hellogeo
```
----
## Appendix
### Notes on Qt5
To build and run GeoModel I/O libraries, you must have a working Qt5 installation on your computer. Qt5 classes are used for I/O operations with the underlying SQLite daemon, to store/handle data, and to handle logging.
If you are not sure how to install it, please take a look at [the notes on Qt5, in the GeoModelIO repository](https://gitlab.cern.ch/GeoModelDev/GeoModelIO/blob/master/README_QT5_NOTES.md).
......@@ -13,70 +13,21 @@ The example program:
The example program uses many of the GeoModel packages.
## Dependencies
### Install Qt5
To build and run GeoModel libraries, you must have a working Qt5 installation on your computer.
If you are not sure how to install it, please take a look at the Appendix on Qt5, below.
### Build GeoModelCore
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelCore.git
mkdir build_gmcore
cd build_gmcore
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelCore
make -j 4
make install
```
### Build GeoModelIO
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelIO.git
mkdir build_gmio
cd build_gmio
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelIO
make -j 4
make install
```
## Build
From your work folder:
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelExamples.git
mkdir build_hellogeoRead
cd build_hellogeoRead
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelExamples/HelloGeoRead
make -j4
make install
```
To build the GeoModelExamples please refer to the documentation at [GeoModel website](https://geomodel.web.cern.ch/home/)
## Run
Get sample geometry data to play with:
```bash
wget https://atlas-vp1.web.cern.ch/atlas-vp1/doc_new/sample_datafiles/geometry/geometry-ATLAS-R2-2015-03-01-00.db
ln -s $PWD/geometry-ATLAS-R2-2015-03-01-00.db ../geometry.db
wget https://geomodel.web.cern.ch/atlas-geometry-data/geometry-ATLAS-R3S-2021-03-02-00.db
ln -s $PWD/geometry-ATLAS-R3S-2021-03-02-00.db ../geometry.db
```
Now, you can run the example by typing:
```bash
./hellogeoRead
./hellogeoRead geometry.db
```
----
## Appendix
### Notes on Qt5
To build and run GeoModel I/O libraries, you must have a working Qt5 installation on your computer. Qt5 classes are used for I/O operations with the underlying SQLite daemon, to store/handle data, and to handle logging.
If you are not sure how to install it, please take a look at [the notes on Qt5, in the GeoModelIO repository](https://gitlab.cern.ch/GeoModelDev/GeoModelIO/blob/master/README_QT5_NOTES.md).
......@@ -68,9 +68,10 @@ GeoPhysVol* createTheWorld(GeoPhysVol* world) {
int main(int argc, char* argv[]) {
if (argc != 2) {
fprintf(stderr, "\nERROR!\nusage: %s input.db\n\n", argv[0]);
fprintf(stderr, "\nERROR!\nUsage: %s <geometry.db>\n\n", argv[0]);
return 1;
}
// Get the input SQLite '.db' file containing the geometry
std::string line;
std::string fileName;
......
......@@ -7,7 +7,7 @@ This is built on top of the [`hellogeo` example program](https://gitlab.cern.ch/
The example program:
1. loads the geometry from the `.db` file
1. loads the geometry specified as input in a `.db` file
2. prints all GeoMaterial entries found in the `.db`
3. builds the GeoModel tree, storing it in memory
4. gets the RootVolume of the GeoModel tree and it prints out the number of its children
......@@ -15,122 +15,19 @@ The example program:
6. transforms the GeoModel tree to Geant4 geometry
## Dependencies
### Install Qt5
To build and run GeoModel I/O libraries, you must have a working Qt5 installation on your computer.
If you are not sure how to install it, please take a look at the Appendix, below.
### CLHEP
Geant4 needs [CLHEP](https://gitlab.cern.ch/CLHEP).
We checkout and build the latest release of CLHEP:
```bash
git clone https://gitlab.cern.ch/CLHEP/CLHEP.git
cd CLHEP
git checkout CLHEP_2_4_1_0 # get the latest release
cd ../
mkdir CLHEP_build
cd CLHEP_build
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../CLHEP/
make -j4
make install
```
### Geant4
We checkout and build the latest release of Geant4:
```bash
git clone https://gitlab.cern.ch/geant4/geant4.git
cd geant4
git checkout v10.5.0
cd ../
mkdir build_geant4
cd build_geant4
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../geant4/
make -j 4
make install
```
### Build GeoModel dependencies
#### Build GeoModelCore
```bash
git clone --recurse-submodules ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelCore.git
mkdir build_gmk
cd build_gmk
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelCore
make -j 4
make install
```
#### Build GeoModelIO dependencies
```bash
git clone --recurse-submodules ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelIO.git
mkdir build_gmk
cd build_gmk
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelIO
make -j 4
make install
```
#### Build GeoModelG4 dependencies
```bash
git clone --recurse-submodules ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelG4.git
mkdir build_gmk
cd build_gmk
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelG4
make -j 4
make install
```
## Build
From your work folder:
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelExamples.git
mkdir build_hellogeoRead2G4
cd build_hellogeoRead2G4
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelExamples/HelloGeoRead2G4
make -j4
make install
```
**Note:** If you installed Geant4 in a folder other than the `../install`, then you have to pass the path to Geant4 adding the -DGeant4_DIR option to cmake
```bash
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelG4/ -DGeant4_DIR=<path-to-Geant4-install>/lib/Geant4-10.x.y/
```
To build the GeoModelExamples please refer to the documentation at [GeoModel website](https://geomodel.web.cern.ch/home/)
## Run `hellogeoRead2G4`
Get sample geometry data to play with:
```bash
wget https://atlas-vp1.web.cern.ch/atlas-vp1/doc_new/sample_datafiles/geometry/geometry-ATLAS-R2-2015-03-01-00.db
ln -s $PWD/geometry-ATLAS-R2-2015-03-01-00.db ../geometry.db
wget https://geomodel.web.cern.ch/atlas-geometry-data/geometry-ATLAS-R3S-2021-03-02-00.db
```
Now, you can run the example by typing:
```bash
./hellogeoRead2G4
./hellogeoRead2G4 geometry-ATLAS-R3S-2021-03-02-00.db
```
----
## Appendix
### Notes on Qt5
To build and run GeoModel I/O libraries, you must have a working Qt5 installation on your computer. Qt5 classes are used for I/O operations with the underlying SQLite daemon, to store/handle data, and to handle logging.
If you are not sure how to install it, please take a look at [the notes on Qt5, in the GeoModelIO repository](https://gitlab.cern.ch/GeoModelDev/GeoModelIO/blob/master/README_QT5_NOTES.md).
# The 'helloGeoRead' GeoModel example
# The 'HelloGeoReadNodeAction' GeoModel example
The `helloGeoRead` example shows you how to read persistified GeoModel data in a standalone program.
The `HelloGeoReadNodeAction` example shows you how to read persistified GeoModel data in a standalone program.
The example program:
......@@ -13,70 +13,21 @@ The example program:
The example program uses many of the GeoModel packages.
## Dependencies
### Install Qt5
To build and run GeoModel libraries, you must have a working Qt5 installation on your computer.
If you are not sure how to install it, please take a look at the Appendix on Qt5, below.
### Build GeoModelCore
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelCore.git
mkdir build_gmcore
cd build_gmcore
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelCore
make -j 4
make install
```
### Build GeoModelIO
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelIO.git
mkdir build_gmio
cd build_gmio
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelIO
make -j 4
make install
```
## Build
From your work folder:
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelExamples.git
mkdir build_hellogeoRead
cd build_hellogeoRead
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelExamples/HelloGeoRead
make -j4
make install
```
To build the GeoModelExamples please refer to the documentation at [GeoModel website](https://geomodel.web.cern.ch/home/)
## Run
Get sample geometry data to play with:
```bash
wget https://atlas-vp1.web.cern.ch/atlas-vp1/doc_new/sample_datafiles/geometry/geometry-ATLAS-R2-2015-03-01-00.db
ln -s $PWD/geometry-ATLAS-R2-2015-03-01-00.db ../geometry.db
wget https://geomodel.web.cern.ch/atlas-geometry-data/geometry-ATLAS-R3S-2021-03-02-00.db
ln -s $PWD/geometry-ATLAS-R3S-2021-03-02-00.db ../geometry.db
```
Now, you can run the example by typing:
```bash
./hellogeoRead
./hellogeoReadNodeAction geometry.db
```
----
## Appendix
### Notes on Qt5
To build and run GeoModel I/O libraries, you must have a working Qt5 installation on your computer. Qt5 classes are used for I/O operations with the underlying SQLite daemon, to store/handle data, and to handle logging.
If you are not sure how to install it, please take a look at [the notes on Qt5, in the GeoModelIO repository](https://gitlab.cern.ch/GeoModelDev/GeoModelIO/blob/master/README_QT5_NOTES.md).
// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
/*
* HelloGeo.cpp
* HelloGeoReadNodeAction.cpp
*
* Author: Riccardo Maria BIANCHI @ CERN
* Created on: May, 2022
......@@ -72,7 +72,7 @@ int main(int argc, char *argv[])
if(argc != 2)
{
fprintf(stderr, "\nERROR!\nusage: %s input.db\n\n", argv[0]);
fprintf(stderr, "\nERROR!\nUsage: %s geometry.db\n\n", argv[0]);
return 1;
}
// Get the input SQLite '.db' file containing the geometry
......
......@@ -8,51 +8,10 @@ The example program:
2. Writes the geometry to an SQLite file
3. It accesses the persistent copy of the geometry, as a test
## Dependencies
### Install Qt5
To build and run GeoModel I/O libraries, you must have a working Qt5 installation on your computer.
If you are not sure how to install it, please take a look at the Appendix, below.
#### GeoModelCore
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelCore.git
mkdir build_gmcore
cd build_gmcore
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelCore
make -j 4
make install
cd ..
```
#### GeoModelIO
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelIO.git
mkdir build_gmio
cd build_gmio
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelIO
make -j 4
make install
```
## Build
From your work folder:
To build the GeoModelExamples please refer to the documentation at [GeoModel website](https://geomodel.web.cern.ch/home/)
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelExamples.git
mkdir build_hellogeo
cd build_hellogeo
cmake -DCMAKE_INSTALL_PREFIX=../install ../GeoModelExamples/HelloGeoWrite/
make -j4
```
## Run
......@@ -61,14 +20,3 @@ Now, you can **run the example** by typing:
```bash
./hellogeoWrite
```
----
## Appendix
### Notes on Qt5
To build and run GeoModel I/O libraries, you must have a working Qt5 installation on your computer. Qt5 classes are used for I/O operations with the underlying SQLite daemon, to store/handle data, and to handle logging.
If you are not sure how to install it, please take a look at [the notes on Qt5, in the GeoModelIO repository](https://gitlab.cern.ch/GeoModelDev/GeoModelIO/blob/master/README_QT5_NOTES.md).
// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
/*
* HelloGeo.cpp
* HelloGeoWrite.cpp
*
* Author: Riccardo Maria BIANCHI @ CERN
* Created on: Apr, 2019
......
# The 'helloGeoWrite' GeoModel example
# The 'helloGeoWriteReadWrite' GeoModel example
The `helloGeoWrite` example shows you how to create a simple geometry, by using GeoModel nodes.
The `helloGeoWriteReadWrite` example shows you how to create a simple geometry, by using GeoModel nodes.
The example program:
1. Builds an example geometry:
2. Writes the geometry to an SQLite file
3. It accesses the persistent copy of the geometry, as a test
## Dependencies
### Install Qt5
To build and run GeoModel I/O libraries, you must have a working Qt5 installation on your computer.
If you are not sure how to install it, please take a look at the Appendix, below.
#### GeoModelCore
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelCore.git
mkdir build_gmcore
cd build_gmcore
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelCore
make -j 4
make install
cd ..
```
#### GeoModelIO
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelIO.git
mkdir build_gmio
cd build_gmio
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModelIO
make -j 4
make install
```
4. Reads it back
5. Stores it in a new sqlite file
## Build
From your work folder:
```bash
git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelExamples.git
mkdir build_hellogeo
cd build_hellogeo
cmake -DCMAKE_INSTALL_PREFIX=../install ../GeoModelExamples/HelloGeoWrite/
make -j4
```
To build the GeoModelExamples please refer to the documentation at [GeoModel website](https://geomodel.web.cern.ch/home/)
## Run
Now, you can **run the example** by typing:
```bash
./hellogeoWrite
./hellogeoWriteReadWrite
```
----
## Appendix
### Notes on Qt5
To build and run GeoModel I/O libraries, you must have a working Qt5 installation on your computer. Qt5 classes are used for I/O operations with the underlying SQLite daemon, to store/handle data, and to handle logging.
If you are not sure how to install it, please take a look at [the notes on Qt5, in the GeoModelIO repository](https://gitlab.cern.ch/GeoModelDev/GeoModelIO/blob/master/README_QT5_NOTES.md).
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment