From e513ad7a9d34a11f5aff590cff2f1e729b96f11c Mon Sep 17 00:00:00 2001 From: Riccardo Maria Bianchi <riccardo.maria.bianchi@cern.ch> Date: Sat, 27 Jun 2020 03:02:56 +0200 Subject: [PATCH] First working CMake setup with 'switches' for the new monorepo --- CMakeLists.txt | 44 +++- FullSimLight/CMakeLists.txt | 26 +-- GeoModelExamples/CMakeLists.txt | 20 +- GeoModelExamples/GeoActions/CMakeLists.txt | 28 +-- GeoModelExamples/GeoActions/main.cpp | 8 +- .../GeoShapeExamples/CMakeLists.txt | 25 +-- GeoModelExamples/GeoShapeExamples/main.cpp | 33 +-- GeoModelExamples/GeoShiftUnion/CMakeLists.txt | 24 +-- GeoModelExamples/GeoShiftUnion/main.cpp | 31 +-- .../CMakeLists.txt | 23 +-- .../GeoTessellatedSolidExamples/main.cpp | 107 +++++----- .../GeoTessellatedSolidExamples/main.cpp.bkp | 175 ---------------- .../HelloDummyMaterial/CMakeLists.txt | 27 +-- GeoModelExamples/HelloDummyMaterial/main.cpp | 35 ++-- GeoModelExamples/HelloGeo/CMakeLists.txt | 21 +- GeoModelExamples/HelloGeo/main.cpp | 8 +- GeoModelExamples/HelloGeoRead/CMakeLists.txt | 29 +-- GeoModelExamples/HelloGeoRead/main.cpp | 48 +++-- .../HelloGeoRead2G4/CMakeLists.txt | 30 +-- GeoModelExamples/HelloGeoRead2G4/main.cpp | 69 ++++--- GeoModelExamples/HelloGeoWrite/CMakeLists.txt | 26 +-- GeoModelExamples/HelloGeoWrite/main.cpp | 13 +- .../HelloToyDetectorFactory/CMakeLists.txt | 20 +- .../src/CentralScrutinizer.cxx | 4 +- .../src/CentralScrutinizer.h | 4 +- .../src/ForwardScrutinizer.h | 4 +- .../src/GeoModelExperiment.cxx | 8 +- .../src/GeoModelExperiment.h | 7 +- .../src/ToyDetectorFactory.cxx | 9 +- .../src/ToyDetectorFactory.h | 12 +- .../src/ToyDetectorManager.cxx | 5 +- .../src/ToyDetectorManager.h | 8 +- .../HelloToyDetectorFactory/src/main.cpp | 38 ++-- GeoModelExamples/cmake/PrintBuildInfo.cmake | 4 - GeoModelG4/CMakeLists.txt | 11 +- GeoModelG4/GeoMaterial2G4/CMakeLists.txt | 10 +- GeoModelG4/GeoModel2G4/CMakeLists.txt | 6 +- GeoModelG4/GeoSpecialShapes/CMakeLists.txt | 9 +- GeoModelIO/CMakeLists.txt | 2 +- GeoModelIO/GeoModelRead/CMakeLists.txt | 2 +- GeoModelIO/GeoModelRead/src/ReadGeoModel.cpp | 190 +++++++++--------- GeoModelIO/GeoModelWrite/CMakeLists.txt | 2 +- GeoModelIO/TFPersistification/CMakeLists.txt | 2 +- GeoModelTools/CMakeLists.txt | 4 +- .../ExpressionEvaluator/CMakeLists.txt | 2 +- GeoModelTools/GMCAT/CMakeLists.txt | 6 +- GeoModelVisualization/CMakeLists.txt | 15 +- .../GXClashPointSystems/CMakeLists.txt | 11 +- .../GeoModelExplorer/CMakeLists.txt | 13 +- .../GeoModelExplorer/src/main.cxx | 34 ++-- GeoModelVisualization/VP1Base/CMakeLists.txt | 2 +- .../VP1GeometryPlugin/CMakeLists.txt | 6 +- .../VP1GeometrySystems/CMakeLists.txt | 25 +-- GeoModelVisualization/VP1Gui/CMakeLists.txt | 5 +- .../VP1GuideLineSystems/CMakeLists.txt | 18 +- .../VP1HEPVis/CMakeLists.txt | 21 +- README.md | 118 +++++++++++ cmake/PrintBuildInfo.cmake | 4 +- documentation/.gitlab-ci.yml | 16 ++ documentation/docs/dev/contribs.md | 10 +- documentation/docs/dev/index.md | 16 +- 61 files changed, 698 insertions(+), 835 deletions(-) delete mode 100644 GeoModelExamples/GeoTessellatedSolidExamples/main.cpp.bkp delete mode 100644 GeoModelExamples/cmake/PrintBuildInfo.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 4325b72ab..4f89f1ee8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,10 +9,14 @@ project( "GeoModel" VERSION 1.0.0 LANGUAGES CXX ) # === Project wide setup === # Make the module directory visible to CMake. list( APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ) +# Define color codes for CMake messages +include( cmake_colors_defs ) # Set build and C++ default options -include ( configure_cpp_options ) +include( configure_cpp_options ) # Use the GNU install directory names. include( GNUInstallDirs ) +# Set a default build type +include( BuildType ) # Print Build Info on screen include( PrintBuildInfo ) @@ -20,8 +24,15 @@ include( PrintBuildInfo ) add_subdirectory(dependencies) # === Main targets built by this project === -option(GEOMODEL_BUILD_VISUALIZATION "Enable building GeoModelVisualization" OFF) +# switches to let users build specific packages on request +option(GEOMODEL_BUILD_EXAMPLES "Enable the build of GeoModelExamples" OFF) +option(GEOMODEL_BUILD_EXAMPLES_W_GEANT4 "Enable the build of GeoModelExamples, including the ones concerning the interface GeoModel->Geant4" OFF) +option(GEOMODEL_BUILD_VISUALIZATION "Enable the build of GeoModelVisualization" OFF) +option(GEOMODEL_BUILD_GEOMODELG4 "Enable the build of GeoModelG4" OFF) +option(GEOMODEL_BUILD_FULLSIMLIGHT "Enable the build of FullSimLight" OFF) + +# a list to keep track of the packages we build set(BUILT_PACKAGES "") add_subdirectory(GeoModelCore) @@ -30,17 +41,38 @@ add_subdirectory(GeoModelIO) list( APPEND BUILT_PACKAGES "GeoModelIO") add_subdirectory(GeoModelTools) list( APPEND BUILT_PACKAGES "GeoModelTools") + if(GEOMODEL_BUILD_VISUALIZATION) add_subdirectory(GeoModelVisualization) list( APPEND BUILT_PACKAGES "GeoModelVisualization") endif() -message(STATUS "-----") +if(GEOMODEL_BUILD_EXAMPLES) + add_subdirectory(GeoModelExamples) + list( APPEND BUILT_PACKAGES "GeoModelExamples") +endif() + + +if(GEOMODEL_BUILD_GEOMODELG4 OR GEOMODEL_BUILD_EXAMPLES_W_GEANT4) + add_subdirectory(GeoModelG4) + list( APPEND BUILT_PACKAGES "GeoModelG4") +endif() + +if(GEOMODEL_BUILD_FULLSIMLIGHT) + add_subdirectory(GeoModelG4) + list( APPEND BUILT_PACKAGES "GeoModelG4") + add_subdirectory(FullSimLight) + list( APPEND BUILT_PACKAGES "FullSimLight") +endif() + + + +# Let the users know which and how many packages they are building list(LENGTH BUILT_PACKAGES BUILT_PACKAGES_LENGTH) list(JOIN BUILT_PACKAGES ", " BUILT_PACKAGES_STR) -message( STATUS "Building the following ${BUILT_PACKAGES_LENGTH} packages: ${BUILT_PACKAGES_STR}") -message(STATUS "-----") - +message(STATUS "${BoldWhite}-----${ColourReset}") +message( STATUS "${BoldGreen}Building the following ${BUILT_PACKAGES_LENGTH} packages: ${BUILT_PACKAGES_STR}${ColourReset}") +message(STATUS "${BoldWhite}-----${ColourReset}") # === Things typically only needed if we are the top level project === # if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) diff --git a/FullSimLight/CMakeLists.txt b/FullSimLight/CMakeLists.txt index 4d2a47044..85d51c04e 100644 --- a/FullSimLight/CMakeLists.txt +++ b/FullSimLight/CMakeLists.txt @@ -8,7 +8,7 @@ project(fullSimLight) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS ON) - + # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -16,9 +16,9 @@ add_subdirectory(MagneticField) # Dependencies. ## GeoModel dependencies. -find_package( GeoModelCore 3.2.0 REQUIRED ) -find_package( GeoModelIO 3.2.0 REQUIRED ) -find_package( GeoModelG4 REQUIRED ) +# find_package( GeoModelCore 3.2.0 REQUIRED ) +# find_package( GeoModelIO 3.2.0 REQUIRED ) +# find_package( GeoModelG4 REQUIRED ) find_package( nlohmann_json QUIET ) # You need to tell CMake where to find the ROOT installation. This can be done in a number of ways: @@ -78,27 +78,27 @@ target_link_libraries(testMagneticField ${Geant4_LIBRARIES} MagFieldServices Mag if( nlohmann_json_FOUND ) -target_link_libraries(fullSimLight GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelRead GeoModelCore::GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces nlohmann_json::nlohmann_json ) +target_link_libraries(fullSimLight GeoModelDBManager GeoModelRead GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces nlohmann_json::nlohmann_json ) -target_link_libraries(gmclash GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelRead GeoModelCore::GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces nlohmann_json::nlohmann_json ) +target_link_libraries(gmclash GeoModelDBManager GeoModelRead GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces nlohmann_json::nlohmann_json ) -target_link_libraries(gmgeantino GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelRead GeoModelCore::GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces nlohmann_json::nlohmann_json ) +target_link_libraries(gmgeantino GeoModelDBManager GeoModelRead GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces nlohmann_json::nlohmann_json ) -target_link_libraries(gmtogdml GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelRead GeoModelCore::GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces nlohmann_json::nlohmann_json ) +target_link_libraries(gmtogdml GeoModelDBManager GeoModelRead GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces nlohmann_json::nlohmann_json ) #target_link_libraries(plotGeantinoMaps ${ROOT_LIBRARIES}) else() -message(STATUS "'nlohmann_json' not found by CMake!! Anyway, if you installed the single header file in a standard system include dir, I will be able to use it.") +message(STATUS "WARNING - 'nlohmann_json' not found by CMake!! Anyway, if you installed the single header file in a standard system include dir, I will be able to use it.") -target_link_libraries(gmclash GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelRead GeoModelCore::GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces) +target_link_libraries(gmclash GeoModelDBManager GeoModelRead GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces) -target_link_libraries(fullSimLight GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelRead GeoModelCore::GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces) +target_link_libraries(fullSimLight GeoModelDBManager GeoModelRead GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces) -target_link_libraries(gmgeantino GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelRead GeoModelCore::GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces) +target_link_libraries(gmgeantino GeoModelDBManager GeoModelRead GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces) -target_link_libraries(gmtogdml GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelRead GeoModelCore::GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces) +target_link_libraries(gmtogdml GeoModelDBManager GeoModelRead GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES} MagFieldServices MagFieldInterfaces) #target_link_libraries(plotGeantinoMaps ${ROOT_LIBRARIES}) diff --git a/GeoModelExamples/CMakeLists.txt b/GeoModelExamples/CMakeLists.txt index f47096af6..c7859b6e6 100644 --- a/GeoModelExamples/CMakeLists.txt +++ b/GeoModelExamples/CMakeLists.txt @@ -1,4 +1,9 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +################################################################################ +# Package: GeoModelExamples +# author: Riccardo Maria BIANCHI @ CERN - Nov, 2018 +################################################################################ # Set up the project. cmake_minimum_required( VERSION 3.1 ) @@ -17,11 +22,8 @@ add_subdirectory( GeoShapeExamples ) add_subdirectory( GeoShiftUnion ) add_subdirectory( GeoTessellatedSolidExamples ) -# GeoModel <--> Geant4 examples -# add_subdirectory( HelloGeoRead2G4 ) - -# Make the module directory visible to CMake. -# list( APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ) - -# Print Build Info on screen -include(cmake/PrintBuildInfo.cmake) +# GeoModel <--> Geant4 examples are built on explicit request only +if(GEOMODEL_BUILD_EXAMPLES_W_GEANT4) + add_subdirectory( HelloGeoRead2G4 ) + # list( APPEND BUILT_PACKAGES "HelloGeoRead2G4") +endif() diff --git a/GeoModelExamples/GeoActions/CMakeLists.txt b/GeoModelExamples/GeoActions/CMakeLists.txt index 7d908126e..d9a16e743 100644 --- a/GeoModelExamples/GeoActions/CMakeLists.txt +++ b/GeoModelExamples/GeoActions/CMakeLists.txt @@ -1,30 +1,17 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + ################################################################################ -# Package: HelloGeo -# author: Riccardo Maria BIANCHI <rbianchi@cern.ch> - Nov, 2018 +# Package: GeoActions +# author: Riccardo Maria BIANCHI @ CERN - Nov, 2018 ################################################################################ cmake_minimum_required(VERSION 3.1.0) project(GeoActions) -# Compile with C++14 //TODO: Should move this to >= C++14 -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -# Print Build Info on screen -include(../cmake/PrintBuildInfo.cmake) - -# Find includes in corresponding build directories +# Find includes in current dir set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Dependencies. -## GeoModel dependencies. -find_package( GeoModelCore REQUIRED ) -## External Dependencies. -find_package(Qt5 COMPONENTS Core Sql Widgets REQUIRED) # TODO: remove Qt dependency, which comes from GeoModelDBManager - - # Populate a CMake variable with the sources set(SRCS main.cpp MyVolAction.cxx MyVolActionFilter.cxx ) @@ -32,7 +19,4 @@ set(SRCS main.cpp MyVolAction.cxx MyVolActionFilter.cxx ) add_executable( geoActions ${SRCS} ) # Link all needed libraries -target_link_libraries( geoActions GeoModelCore::GeoModelKernel Qt5::Core ) - -# Set include directories -# target_include_directories( geoActions SYSTEM PUBLIC ${GeoModelWrite_INCLUDE_DIRS} ) +target_link_libraries( geoActions GeoModelKernel ) diff --git a/GeoModelExamples/GeoActions/main.cpp b/GeoModelExamples/GeoActions/main.cpp index 358765191..df05a0199 100644 --- a/GeoModelExamples/GeoActions/main.cpp +++ b/GeoModelExamples/GeoActions/main.cpp @@ -1,8 +1,11 @@ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + /* * main.cpp * * Author: Riccardo Maria BIANCHI @ CERN * Created on: Oct, 2019 + * */ #include "MyVolAction.h" @@ -14,11 +17,9 @@ #include "GeoModelKernel/GeoNameTag.h" #include "GeoModelKernel/GeoDefinitions.h" -#include <QDebug> -#include <QFileInfo> - #include <iostream> + // Units #include "GeoModelKernel/Units.h" #define SYSTEM_OF_UNITS GeoModelKernelUnits // so we will get, e.g., 'GeoModelKernelUnits::cm' @@ -119,6 +120,5 @@ int main(int argc, char *argv[]) world->apply(&actionFilter); - return 0; } diff --git a/GeoModelExamples/GeoShapeExamples/CMakeLists.txt b/GeoModelExamples/GeoShapeExamples/CMakeLists.txt index 3376c73c6..66a87e752 100644 --- a/GeoModelExamples/GeoShapeExamples/CMakeLists.txt +++ b/GeoModelExamples/GeoShapeExamples/CMakeLists.txt @@ -1,26 +1,17 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + ################################################################################ -# Package: HelloGeo -# author: Riccardo Maria BIANCHI <rbianchi@cern.ch> - Nov, 2018 +# Package: GeoShapeExamples +# author: Riccardo Maria BIANCHI @ CERN - Nov, 2018 ################################################################################ cmake_minimum_required(VERSION 3.1.0) project(GeoShapeExamples) -# Print Build Info on screen -include(../cmake/PrintBuildInfo.cmake) - -# Find includes in corresponding build directories +# Find includes in current dir set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Dependencies. -## GeoModel dependencies. -find_package( GeoModelCore 3.2.0 REQUIRED ) -find_package( GeoModelIO 3.2.0 REQUIRED ) -## External Dependencies. -find_package(Qt5 COMPONENTS Core Widgets REQUIRED) # TODO: remove Qt dependency, which comes from GeoModelDBManager - - # Populate a CMake variable with the sources set(SRCS main.cpp ) @@ -28,8 +19,4 @@ set(SRCS main.cpp ) add_executable( geoShapeExamples ${SRCS} ) # Link all needed libraries -target_link_libraries( geoShapeExamples GeoModelCore::GeoModelKernel GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelWrite Qt5::Core ) -#target_link_libraries( geoShapeExamples GeoModelKernel Qt5::Core Qt5::Sql GeoModelDBManager /Users/rbianchi/code_work_local/atlas/geomodel_packages_tests_21Jun2019/install/lib/libGeoModelWrite.dylib ) - -# Set include directories -# target_include_directories( geoShapeExamples SYSTEM PUBLIC ${GeoModelWrite_INCLUDE_DIRS} ) +target_link_libraries( geoShapeExamples GeoModelKernel GeoModelDBManager GeoModelWrite ) diff --git a/GeoModelExamples/GeoShapeExamples/main.cpp b/GeoModelExamples/GeoShapeExamples/main.cpp index c2d3c5f7f..73313f468 100644 --- a/GeoModelExamples/GeoShapeExamples/main.cpp +++ b/GeoModelExamples/GeoShapeExamples/main.cpp @@ -1,8 +1,11 @@ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + /* * main.cpp * + * Author: Riccardo Maria BIANCHI @ CERN * Created on: Aug, 2019 - * Author: Riccardo Maria BIANCHI <riccardo.maria.bianchi@cern.ch> + * */ // GeoShape nodes @@ -21,12 +24,10 @@ #include "GeoModelDBManager/GMDBManager.h" #include "GeoModelWrite/WriteGeoModel.h" -// Qt5 -#include <QDebug> -#include <QFileInfo> - // C++ #include <iostream> +#include <fstream> +#include <cstdlib> // EXIT_FAILURE // Units @@ -145,19 +146,19 @@ int main(int argc, char *argv[]) //------------------------------------// // Writing the geometry to file - QString path = "geometry.db"; - - // check if DB file exists. If not, return. - // TODO: this check should go in the 'GMDBManager' constructor. - if ( QFileInfo(path).exists() ) { - qWarning() << "\n\tERROR!! A '" << path << "' file exists already!! Please, remove it before running this program."; - qWarning() << "\tReturning..." << "\n"; - // return; - exit(1); - } + std::string path = "geometry.db"; + + // check if DB file exists. If not, return. + // FIXME: TODO: this check should go in the 'GMDBManager' constructor. + std::ifstream infile(path.c_str()); + if ( infile.good() ) { + std::cout << "\n\tERROR!! A '" << path << "' file exists already!! Please, remove, move, or rename it before running this program. Exiting..."; + exit(EXIT_FAILURE); + } + infile.close(); // open the DB connection - GMDBManager db(path.toStdString()); + GMDBManager db(path); // check the DB connection if (db.checkIsDBOpen()) diff --git a/GeoModelExamples/GeoShiftUnion/CMakeLists.txt b/GeoModelExamples/GeoShiftUnion/CMakeLists.txt index 06e33dc40..b9068e01e 100644 --- a/GeoModelExamples/GeoShiftUnion/CMakeLists.txt +++ b/GeoModelExamples/GeoShiftUnion/CMakeLists.txt @@ -1,26 +1,17 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + ################################################################################ -# Package: HelloGeo -# author: Riccardo Maria BIANCHI <rbianchi@cern.ch> - Nov, 2018 +# Package: GeoShiftUnion +# author: Riccardo Maria BIANCHI @ CERN - Nov, 2018 ################################################################################ cmake_minimum_required(VERSION 3.1.0) project(GeoShiftUnion) -# Print Build Info on screen -include(../cmake/PrintBuildInfo.cmake) - -# Find includes in corresponding build directories +# Find includes in current dir set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Dependencies. -## GeoModel dependencies. -find_package( GeoModelCore 3.2.0 REQUIRED ) -find_package( GeoModelIO 3.2.0 REQUIRED ) -## External Dependencies. -find_package(Qt5 COMPONENTS Core Widgets REQUIRED) # TODO: remove Qt dependency, which comes from GeoModelDBManager - - # Populate a CMake variable with the sources set(SRCS main.cpp ) @@ -28,7 +19,4 @@ set(SRCS main.cpp ) add_executable( geoShiftUnion ${SRCS} ) # Link all needed libraries -target_link_libraries( geoShiftUnion GeoModelCore::GeoModelKernel GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelWrite Qt5::Core ) - -# Set include directories -# target_include_directories( geoShiftUnion SYSTEM PUBLIC ${GeoModelWrite_INCLUDE_DIRS} ) +target_link_libraries( geoShiftUnion GeoModelKernel GeoModelDBManager GeoModelWrite ) diff --git a/GeoModelExamples/GeoShiftUnion/main.cpp b/GeoModelExamples/GeoShiftUnion/main.cpp index 9593b5119..2c51eed4f 100644 --- a/GeoModelExamples/GeoShiftUnion/main.cpp +++ b/GeoModelExamples/GeoShiftUnion/main.cpp @@ -1,25 +1,28 @@ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + /* * main.cpp * + * Author: Riccardo Maria BIANCHI @ CERN * Created on: Apr, 2019 - * Author: Riccardo Maria BIANCHI <riccardo.maria.bianchi@cern.ch> + * */ +// GeoModel includes #include "GeoModelKernel/GeoBox.h" #include "GeoModelKernel/GeoLogVol.h" #include "GeoModelKernel/GeoPhysVol.h" #include "GeoModelKernel/GeoShapeShift.h" #include "GeoModelKernel/GeoShapeUnion.h" #include "GeoModelKernel/GeoNameTag.h" - #include "GeoModelDBManager/GMDBManager.h" - #include "GeoModelWrite/WriteGeoModel.h" -#include <QDebug> -#include <QFileInfo> - +// C++ includes #include <iostream> +#include <fstream> +#include <cstdlib> // EXIT_FAILURE + // Units #include "GeoModelKernel/Units.h" @@ -103,19 +106,19 @@ int main(int argc, char *argv[]) //------------------------------------------------------------------------------------// // Writing the geometry to file //------------------------------------------------------------------------------------// - QString path = "geometry.db"; + std::string path = "geometry.db"; // check if DB file exists. If not, return. - // TODO: this check should go in the 'GMDBManager' constructor. - if ( QFileInfo(path).exists() ) { - qWarning() << "\n\tERROR!! A '" << path << "' file exists already!! Please, remove it before running this program."; - qWarning() << "\tReturning..." << "\n"; - // return; - exit(1); + // FIXME: TODO: this check should go in the 'GMDBManager' constructor. + std::ifstream infile(path.c_str()); + if ( infile.good() ) { + std::cout << "\n\tERROR!! A '" << path << "' file exists already!! Please, remove, move, or rename it before running this program. Exiting..."; + exit(EXIT_FAILURE); } + infile.close(); // open the DB connection - GMDBManager db(path.toStdString()); + GMDBManager db(path); // check the DB connection if (db.checkIsDBOpen()) diff --git a/GeoModelExamples/GeoTessellatedSolidExamples/CMakeLists.txt b/GeoModelExamples/GeoTessellatedSolidExamples/CMakeLists.txt index e644adac7..2c020866f 100644 --- a/GeoModelExamples/GeoTessellatedSolidExamples/CMakeLists.txt +++ b/GeoModelExamples/GeoTessellatedSolidExamples/CMakeLists.txt @@ -1,27 +1,17 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + ################################################################################ # Package: GeoTessellatedSolidExample -# author: Riccardo Maria BIANCHI <rbianchi@cern.ch> - Sep, 2019 +# author: Riccardo Maria BIANCHI @ CERN - Sep, 2019 ################################################################################ cmake_minimum_required(VERSION 3.1.0) project(GeoTessellatedSolidExample) -# Print Build Info on screen -include(../cmake/PrintBuildInfo.cmake) - -# Find includes in corresponding build directories +# Find includes in current dir set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Dependencies. -## GeoModel dependencies. -find_package( GeoModelCore 3.2.0 REQUIRED ) -find_package( GeoModelIO 3.2.0 REQUIRED ) -find_package( Eigen3 REQUIRED ) -## External Dependencies. -find_package(Qt5 COMPONENTS Core Widgets REQUIRED) # TODO: remove Qt dependency, which comes from GeoModelDBManager - - # Populate a CMake variable with the sources set(SRCS main.cpp ) @@ -29,7 +19,4 @@ set(SRCS main.cpp ) add_executable( geoTessellatedExample ${SRCS} ) # Link all needed libraries -target_link_libraries( geoTessellatedExample GeoModelCore::GeoModelKernel GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelWrite Qt5::Core ) - -# Set include directories -#target_include_directories( geoTessellatedExample SYSTEM PUBLIC ${GeoModelWrite_INCLUDE_DIRS} ${GeoModelKernel_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIR} ) +target_link_libraries( geoTessellatedExample GeoModelKernel GeoModelDBManager GeoModelWrite ) diff --git a/GeoModelExamples/GeoTessellatedSolidExamples/main.cpp b/GeoModelExamples/GeoTessellatedSolidExamples/main.cpp index 22e4ec36b..1f8e5e4fe 100644 --- a/GeoModelExamples/GeoTessellatedSolidExamples/main.cpp +++ b/GeoModelExamples/GeoTessellatedSolidExamples/main.cpp @@ -1,31 +1,31 @@ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + /* * main.cpp * + * Author: Riccardo Maria BIANCHI @ CERN * Created on: Sep, 2019 - * Author: Riccardo Maria BIANCHI <riccardo.maria.bianchi@cern.ch> + * */ -// GeoShape nodes +// GeoModel includes +// GeoModel GeoShape nodes #include "GeoModelKernel/GeoBox.h" #include "GeoModelKernel/GeoTorus.h" #include "GeoModelKernel/GeoTessellatedSolid.h" - -// Geo core classes +// GeoModel classes #include "GeoModelKernel/GeoLogVol.h" #include "GeoModelKernel/GeoPhysVol.h" #include "GeoModelKernel/GeoNameTag.h" #include "GeoModelKernel/GeoTransform.h" - -// Geo I/O +// GeoModel I/O #include "GeoModelDBManager/GMDBManager.h" #include "GeoModelWrite/WriteGeoModel.h" -// Qt5 -#include <QDebug> -#include <QFileInfo> - // C++ #include <iostream> +#include <fstream> +#include <cstdlib> // EXIT_FAILURE // Units @@ -37,39 +37,38 @@ int main(int argc, char *argv[]) { - //-----------------------------------------------------------------------------------// - // Define the materials that we shall use. // - // ----------------------------------------------------------------------------------// - - // Define the units - #define gr SYSTEM_OF_UNITS::gram - #define mole SYSTEM_OF_UNITS::mole - #define cm3 SYSTEM_OF_UNITS::cm3 - - // Define the chemical elements - GeoElement* Nitrogen = new GeoElement ("Nitrogen" ,"N" , 7.0 , 14.0067 *gr/mole); - GeoElement* Oxygen = new GeoElement ("Oxygen" ,"O" , 8.0 , 15.9995 *gr/mole); - GeoElement* Argon = new GeoElement ("Argon" ,"Ar" , 18.0 , 39.948 *gr/mole); - GeoElement* Hydrogen = new GeoElement ("Hydrogen" ,"H" , 1.0 , 1.00797 *gr/mole); - GeoElement* Iron = new GeoElement ("Iron" ,"Fe" , 26.0 , 55.847 *gr/mole); - GeoElement* Carbon = new GeoElement ("Carbon" ,"C" , 6.0 , 12.0107 *gr/mole); - GeoElement* Sillicon = new GeoElement ("Silicon" ,"Si" , 14.0 , 28.085 *gr/mole); - - // Define the materials - - double densityOfAir=0.001214 *gr/cm3; - GeoMaterial *air = new GeoMaterial("Air", densityOfAir); - air->add(Nitrogen , 0.7494); - air->add(Oxygen, 0.2369); - air->add(Argon, 0.0129); - air->add(Hydrogen, 0.0008); - air->lock(); - - GeoMaterial* steel = new GeoMaterial("Steel", 7.9 *gr/cm3); - steel->add(Iron , 0.98); - steel->add(Carbon, 0.02); - steel->lock(); - + //-----------------------------------------------------------------------------------// + // Define the materials that we shall use. // + // ----------------------------------------------------------------------------------// + + // Define the units + #define gr SYSTEM_OF_UNITS::gram + #define mole SYSTEM_OF_UNITS::mole + #define cm3 SYSTEM_OF_UNITS::cm3 + + // Define the chemical elements + GeoElement* Nitrogen = new GeoElement ("Nitrogen" ,"N" , 7.0 , 14.0067 *gr/mole); + GeoElement* Oxygen = new GeoElement ("Oxygen" ,"O" , 8.0 , 15.9995 *gr/mole); + GeoElement* Argon = new GeoElement ("Argon" ,"Ar" , 18.0 , 39.948 *gr/mole); + GeoElement* Hydrogen = new GeoElement ("Hydrogen" ,"H" , 1.0 , 1.00797 *gr/mole); + GeoElement* Iron = new GeoElement ("Iron" ,"Fe" , 26.0 , 55.847 *gr/mole); + GeoElement* Carbon = new GeoElement ("Carbon" ,"C" , 6.0 , 12.0107 *gr/mole); + GeoElement* Sillicon = new GeoElement ("Silicon" ,"Si" , 14.0 , 28.085 *gr/mole); + + // Define the materials + + double densityOfAir=0.001214 *gr/cm3; + GeoMaterial *air = new GeoMaterial("Air", densityOfAir); + air->add(Nitrogen , 0.7494); + air->add(Oxygen, 0.2369); + air->add(Argon, 0.0129); + air->add(Hydrogen, 0.0008); + air->lock(); + + GeoMaterial* steel = new GeoMaterial("Steel", 7.9 *gr/cm3); + steel->add(Iron , 0.98); + steel->add(Carbon, 0.02); + steel->lock(); //-----------------------------------------------------------------------------------// // create the world volume container and @@ -234,19 +233,19 @@ int main(int argc, char *argv[]) //------------------------------------// // Writing the geometry to file - QString path = "geometry.db"; - - // check if DB file exists. If not, return. - // TODO: this check should go in the 'GMDBManager' constructor. - if ( QFileInfo(path).exists() ) { - qWarning() << "\n\tERROR!! A '" << path << "' file exists already!! Please, remove it before running this program."; - qWarning() << "\tReturning..." << "\n"; - // return; - exit(1); - } + std::string path = "geometry.db"; + + // check if DB file exists. If not, return. + // FIXME: TODO: this check should go in the 'GMDBManager' constructor. + std::ifstream infile(path.c_str()); + if ( infile.good() ) { + std::cout << "\n\tERROR!! A '" << path << "' file exists already!! Please, remove, move, or rename it before running this program. Exiting..."; + exit(EXIT_FAILURE); + } + infile.close(); // open the DB connection - GMDBManager db(path.toStdString()); + GMDBManager db(path); // check the DB connection if (db.checkIsDBOpen()) diff --git a/GeoModelExamples/GeoTessellatedSolidExamples/main.cpp.bkp b/GeoModelExamples/GeoTessellatedSolidExamples/main.cpp.bkp deleted file mode 100644 index c5a30a3ff..000000000 --- a/GeoModelExamples/GeoTessellatedSolidExamples/main.cpp.bkp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * HelloGeo.cpp - * - * Created on: Apr, 2019 - * Author: Riccardo Maria BIANCHI <riccardo.maria.bianchi@cern.ch> - */ - -// GeoShape nodes -#include "GeoModelKernel/GeoBox.h" -#include "GeoModelKernel/GeoTorus.h" -#include "GeoModelKernel/GeoTessellatedSolid.h" - -// Geo core classes -#include "GeoModelKernel/GeoLogVol.h" -#include "GeoModelKernel/GeoPhysVol.h" -#include "GeoModelKernel/GeoNameTag.h" -#include "GeoModelKernel/GeoTransform.h" - -// Geo I/O -#include "GeoModelDBManager/GMDBManager.h" -#include "GeoModelWrite/WriteGeoModel.h" - -// Qt5 -#include <QDebug> -#include <QFileInfo> - -// C++ -#include <iostream> - - -// Units -#include "GeoModelKernel/Units.h" -#define SYSTEM_OF_UNITS GeoModelKernelUnits // so we will get, e.g., 'GeoModelKernelUnits::cm' - - -int main(int argc, char *argv[]) -{ - //-----------------------------------------------------------------------------------// - // create the world volume container and - // get the 'world' volume, i.e. the root volume of the GeoModel tree - std::cout << "Creating the 'world' volume, i.e. the root volume of the GeoModel tree..." << std::endl; - double densityOfAir = 0.1; - const GeoMaterial* worldMat = new GeoMaterial("std::Air", densityOfAir); - const GeoBox* worldBox = new GeoBox(1000*SYSTEM_OF_UNITS::cm, 1000*SYSTEM_OF_UNITS::cm, 1000*SYSTEM_OF_UNITS::cm); - const GeoLogVol* worldLog = new GeoLogVol("WorldLog", worldBox, worldMat); - GeoPhysVol* world = new GeoPhysVol(worldLog); - - - //----------------------------------------------------------------------------------// - // Get the materials - // const GeoMaterial* matIron = theMaterialManager->getMaterial("std::Iron"); // Athena code - // Bogus densities. Later: read from database. - double densityOfIron= 0.7; - const GeoMaterial *matIron = new GeoMaterial("Iron Toy",densityOfIron); - - - //-----------------------------------------------------------------------------------// - // Create the shapes: // - - // A box - GeoBox* box = new GeoBox(50*SYSTEM_OF_UNITS::cm, 50*SYSTEM_OF_UNITS::cm, 50*SYSTEM_OF_UNITS::cm); - - // A torus - GeoTorus* torus = new GeoTorus(10*SYSTEM_OF_UNITS::cm /*Rmin*/, 20*SYSTEM_OF_UNITS::cm /*Rmax*/, 50*SYSTEM_OF_UNITS::cm /*Rtor*/, 0*SYSTEM_OF_UNITS::degree/*SPhi*/, 270*SYSTEM_OF_UNITS::degree/*DPhi*/); - - // A Tessellated Solid : - // a triangle pyramid made out of 4 triangles - // Front facet - GeoFacetVertex v1P = GeoFacetVertex( 0.0f, 1.0f, 0.0f)*(50*SYSTEM_OF_UNITS::cm); - GeoFacetVertex v2P = GeoFacetVertex(-1.0f, -1.0f, 1.0f)*(50*SYSTEM_OF_UNITS::cm); - GeoFacetVertex v3P = GeoFacetVertex(1.0f, -1.0f, 1.0f)*(50*SYSTEM_OF_UNITS::cm); - GeoTriangularFacet* triFacet1Pyr = new GeoTriangularFacet(v1P, v2P, v3P, GeoFacet::ABSOLUTE); - // Right facet - GeoFacetVertex v4P = GeoFacetVertex(0.0f, 1.0f, 0.0f)*(50*SYSTEM_OF_UNITS::cm); - GeoFacetVertex v5P = GeoFacetVertex(1.0f, -1.0f, 1.0f)*(50*SYSTEM_OF_UNITS::cm); - GeoFacetVertex v6P = GeoFacetVertex(1.0f, -1.0f, -1.0f)*(50*SYSTEM_OF_UNITS::cm); - GeoTriangularFacet* triFacet2Pyr = new GeoTriangularFacet(v4P, v5P, v6P, GeoFacet::ABSOLUTE); - // Back facet - GeoFacetVertex v7P = GeoFacetVertex(0.0f, 1.0f, 0.0f)*(50*SYSTEM_OF_UNITS::cm); - GeoFacetVertex v8P = GeoFacetVertex(1.0f, -1.0f, -1.0f)*(50*SYSTEM_OF_UNITS::cm); - GeoFacetVertex v9P = GeoFacetVertex(-1.0f, -1.0f, -1.0f)*(50*SYSTEM_OF_UNITS::cm); - GeoTriangularFacet* triFacet3Pyr = new GeoTriangularFacet(v7P, v8P, v9P, GeoFacet::ABSOLUTE); - // Left facet - GeoFacetVertex v10P = GeoFacetVertex( 0.0f, 1.0f, 0.0f)*(50*SYSTEM_OF_UNITS::cm); - GeoFacetVertex v11P = GeoFacetVertex(-1.0f,-1.0f,-1.0f)*(50*SYSTEM_OF_UNITS::cm); - GeoFacetVertex v12P = GeoFacetVertex(-1.0f,-1.0f, 1.0f)*(50*SYSTEM_OF_UNITS::cm); - GeoTriangularFacet* triFacet4Pyr = new GeoTriangularFacet(v10P, v11P, v12P, GeoFacet::ABSOLUTE); - // build the tessellated solid - GeoTessellatedSolid* tessPyramid = new GeoTessellatedSolid(); - tessPyramid->addFacet(triFacet1Pyr); - tessPyramid->addFacet(triFacet2Pyr); - tessPyramid->addFacet(triFacet3Pyr); - tessPyramid->addFacet(triFacet4Pyr); - - - - //------------------------------------// - // Define the space transforms to place the boxes: - GeoTrf::Translate3D Tr1(-75*SYSTEM_OF_UNITS::cm, 0, 0); // cube - GeoTrf::Translate3D Tr2( 75*SYSTEM_OF_UNITS::cm, 0, 0); // torus - GeoTrf::Translate3D Tr3( -75*SYSTEM_OF_UNITS::cm, -150*SYSTEM_OF_UNITS::cm, 0); // tessellated solid quad -// GeoTrf::Translate3D Tr4( 75*SYSTEM_OF_UNITS::cm, -150*SYSTEM_OF_UNITS::cm, 0); // tessellated solid tri -// GeoTrf::Translate3D Tr5( -75*SYSTEM_OF_UNITS::cm, -225*SYSTEM_OF_UNITS::cm, 0); // tessellated solid triquad -// GeoTrf::Translate3D Tr6( 75*SYSTEM_OF_UNITS::cm, -225*SYSTEM_OF_UNITS::cm, 0); // tessellated solid pyramid - - GeoTransform* tr1 = new GeoTransform(Tr1); - GeoTransform* tr2 = new GeoTransform(Tr2); - GeoTransform* tr3 = new GeoTransform(Tr3); -// GeoTransform* tr4 = new GeoTransform(Tr4); -// GeoTransform* tr5 = new GeoTransform(Tr5); -// GeoTransform* tr6 = new GeoTransform(Tr6); - - - //------------------------------------// - // Bundle the resulting compound object with a material into a logical volume, and create a physical volume with that: - GeoLogVol* boxLog = new GeoLogVol("Box",box,matIron); - GeoPhysVol* boxPhys = new GeoPhysVol(boxLog); - - GeoLogVol* torusLog = new GeoLogVol("Torus",torus,matIron); - GeoPhysVol* torusPhys = new GeoPhysVol(torusLog); - - GeoLogVol* tessLog = new GeoLogVol("Tessellated Pyramid",tessPyramid,matIron); - GeoPhysVol* tessPhys = new GeoPhysVol(tessLog); - - - - //------------------------------------// - // Now insert all of this into the world... // - world->add(tr1); - world->add(boxPhys); - world->add(tr2); - world->add(torusPhys); - world->add(tr3); - world->add(tessPhys); - - - //------------------------------------// - // Writing the geometry to file - QString path = "geometry.db"; - - // check if DB file exists. If not, return. - // TODO: this check should go in the 'GMDBManager' constructor. - if ( QFileInfo(path).exists() ) { - qWarning() << "\n\tERROR!! A '" << path << "' file exists already!! Please, remove it before running this program."; - qWarning() << "\tReturning..." << "\n"; - // return; - exit(1); - } - - // open the DB connection - GMDBManager db(path); - - // check the DB connection - if (db.isOpen()) - qDebug() << "OK! Database is open!"; - else { - qDebug() << "Database ERROR!! Exiting..."; - return 1; - } - - std::cout << "Dumping the GeoModel geometry to the DB file..." << std::endl; - // Dump the tree volumes into a DB - GeoModelIO::WriteGeoModel dumpGeoModelGraph(db); // init the GeoModel node action - world->exec(&dumpGeoModelGraph); // visit all nodes in the GeoModel tree - dumpGeoModelGraph.saveToDB(); // save to the local SQlite DB file - std::cout << "DONE. Geometry saved." <<std::endl; - - std::cout << "\nTest - list of all the GeoMaterial nodes in the persistified geometry:" << std::endl; - db.printAllMaterials(); - std::cout << "\nTest - list of all the GeoShape nodes in the persistified geometry:" << std::endl; - db.printAllShapes(); - - - return 0; -} diff --git a/GeoModelExamples/HelloDummyMaterial/CMakeLists.txt b/GeoModelExamples/HelloDummyMaterial/CMakeLists.txt index 4b2a02006..27767611f 100644 --- a/GeoModelExamples/HelloDummyMaterial/CMakeLists.txt +++ b/GeoModelExamples/HelloDummyMaterial/CMakeLists.txt @@ -1,31 +1,17 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + ################################################################################ # Package: HelloDummyMaterial -# author: Riccardo Maria BIANCHI <rbianchi@cern.ch> - Nov, 2019 +# author: Riccardo Maria BIANCHI @ CERN - Nov, 2019 ################################################################################ cmake_minimum_required(VERSION 3.1.0) project(HelloDummyMaterial) -# Compile with C++14 -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -# Print Build Info on screen -include(../cmake/PrintBuildInfo.cmake) - -# Find includes in corresponding build directories +# Find includes in current dir set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Dependencies. -## GeoModel dependencies. -find_package( GeoModelCore 3.2.0 REQUIRED ) -find_package( GeoModelIO 3.2.0 REQUIRED ) -find_package( Eigen3 REQUIRED ) -## External Dependencies. -find_package(Qt5 COMPONENTS Core Widgets REQUIRED) # TODO: remove Qt dependency, which comes from GeoModelDBManager - # Populate a CMake variable with the sources set(SRCS main.cpp ) @@ -33,7 +19,4 @@ set(SRCS main.cpp ) add_executable( helloDummyMaterial ${SRCS} ) # Link all needed libraries -target_link_libraries( helloDummyMaterial GeoModelCore::GeoModelKernel GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelWrite Qt5::Core ) - -# Set include directories -#target_include_directories( helloDummyMaterial SYSTEM PUBLIC ${GeoModelWrite_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIR} ) +target_link_libraries( helloDummyMaterial GeoModelKernel GeoModelDBManager GeoModelWrite ) diff --git a/GeoModelExamples/HelloDummyMaterial/main.cpp b/GeoModelExamples/HelloDummyMaterial/main.cpp index 29384a1a9..9fae70320 100644 --- a/GeoModelExamples/HelloDummyMaterial/main.cpp +++ b/GeoModelExamples/HelloDummyMaterial/main.cpp @@ -1,23 +1,26 @@ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + /* * HelloDummyMaterial.cpp * + * Author: Riccardo Maria BIANCHI @ CERN * Created on: Apr, 2019 - * Author: Riccardo Maria BIANCHI <riccardo.maria.bianchi@cern.ch> + * */ +// GeoModel includes #include "GeoModelKernel/GeoBox.h" #include "GeoModelKernel/GeoPhysVol.h" #include "GeoModelKernel/GeoFullPhysVol.h" #include "GeoModelKernel/GeoNameTag.h" - #include "GeoModelDBManager/GMDBManager.h" - #include "GeoModelWrite/WriteGeoModel.h" -#include <QDebug> -#include <QFileInfo> - +// C++ includes #include <iostream> +#include <fstream> +#include <cstdlib> // EXIT_FAILURE + // Units #include "GeoModelKernel/Units.h" @@ -82,19 +85,19 @@ int main(int argc, char *argv[]) //------------------------------------------------------------------------------------// // Writing the geometry to file //------------------------------------------------------------------------------------// - QString path = "geometry.db"; - - // check if DB file exists. If not, return. - // TODO: this check should go in the 'GMDBManager' constructor. - if ( QFileInfo(path).exists() ) { - qWarning() << "\n\tERROR!! A '" << path << "' file exists already!! Please, remove it before running this program."; - qWarning() << "\tReturning..." << "\n"; - // return; - exit(1); + std::string path = "geometry.db"; + + // check if DB file exists. If not, return. + // FIXME: TODO: this check should go in the 'GMDBManager' constructor. + std::ifstream infile(path.c_str()); + if ( infile.good() ) { + std::cout << "\n\tERROR!! A '" << path << "' file exists already!! Please, remove, move, or rename it before running this program. Exiting..."; + exit(EXIT_FAILURE); } + infile.close(); // open the DB connection - GMDBManager db(path.toStdString()); + GMDBManager db(path); // check the DB connection if (db.checkIsDBOpen()) diff --git a/GeoModelExamples/HelloGeo/CMakeLists.txt b/GeoModelExamples/HelloGeo/CMakeLists.txt index e25b5883a..fd3774294 100644 --- a/GeoModelExamples/HelloGeo/CMakeLists.txt +++ b/GeoModelExamples/HelloGeo/CMakeLists.txt @@ -1,28 +1,17 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + ################################################################################ # Package: HelloGeo -# author: Riccardo Maria BIANCHI <rbianchi@cern.ch> - Nov, 2018 +# author: Riccardo Maria BIANCHI @ CERN - Nov, 2018 ################################################################################ cmake_minimum_required(VERSION 3.1.0) project(HelloGeo) -# Compile with C++14 -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - - -# Print Build Info on screen -include(../cmake/PrintBuildInfo.cmake) - -# Find includes in corresponding build directories +# Find includes in current dir set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Dependencies. -## GeoModel dependencies. -find_package( GeoModelCore REQUIRED ) - # Populate a CMake variable with the sources set(SRCS main.cpp ) @@ -30,4 +19,4 @@ set(SRCS main.cpp ) add_executable( hellogeo ${SRCS} ) # Link all needed libraries -target_link_libraries( hellogeo GeoModelCore::GeoModelKernel) +target_link_libraries( hellogeo GeoModelKernel) diff --git a/GeoModelExamples/HelloGeo/main.cpp b/GeoModelExamples/HelloGeo/main.cpp index 6589dfad1..9403301d3 100644 --- a/GeoModelExamples/HelloGeo/main.cpp +++ b/GeoModelExamples/HelloGeo/main.cpp @@ -1,17 +1,23 @@ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + /* * HelloGeo.cpp * + * Author: Riccardo Maria BIANCHI @ CERN * Created on: Apr, 2019 - * Author: Riccardo Maria BIANCHI <riccardo.maria.bianchi@cern.ch> + * */ +// GeoModel includes #include "GeoModelKernel/GeoBox.h" #include "GeoModelKernel/GeoPhysVol.h" #include "GeoModelKernel/GeoFullPhysVol.h" #include "GeoModelKernel/GeoNameTag.h" +// C++ includes #include <iostream> + // Units #include "GeoModelKernel/Units.h" #define SYSTEM_OF_UNITS GeoModelKernelUnits // so we will get, e.g., 'GeoModelKernelUnits::cm' diff --git a/GeoModelExamples/HelloGeoRead/CMakeLists.txt b/GeoModelExamples/HelloGeoRead/CMakeLists.txt index 5c2d75220..a71350d7b 100644 --- a/GeoModelExamples/HelloGeoRead/CMakeLists.txt +++ b/GeoModelExamples/HelloGeoRead/CMakeLists.txt @@ -1,34 +1,17 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + ################################################################################ -# Package: HelloGeo -# author: Riccardo Maria BIANCHI <rbianchi@cern.ch> - Nov, 2018 +# Package: HelloGeoRead +# author: Riccardo Maria BIANCHI @ CERN - Nov, 2018 ################################################################################ cmake_minimum_required(VERSION 3.1.0) project(HelloGeoRead) -# Compile with C++14 -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -# Print Build Info on screen -include(../cmake/PrintBuildInfo.cmake) - -# Find includes in corresponding build directories +# Find includes in current dir set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Instruct CMake to run moc automatically when needed -set(CMAKE_AUTOMOC ON) - -# Dependencies. -## GeoModel dependencies. -find_package( GeoModelCore 3.2.0 REQUIRED ) -find_package( GeoModelIO 3.2.0 REQUIRED ) -find_package( Eigen3 REQUIRED ) -## External Dependencies. -find_package(Qt5 COMPONENTS Core Widgets REQUIRED) # TODO: remove Qt dependency, which comes from GeoModelDBManager - # Populate a CMake variable with the sources set(SRCS main.cpp ) @@ -36,4 +19,4 @@ set(SRCS main.cpp ) add_executable( hellogeoRead ${SRCS} ) # Link all needed libraries -target_link_libraries( hellogeoRead Qt5::Core GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelRead GeoModelCore::GeoModelKernel) +target_link_libraries( hellogeoRead GeoModelDBManager GeoModelRead GeoModelKernel) diff --git a/GeoModelExamples/HelloGeoRead/main.cpp b/GeoModelExamples/HelloGeoRead/main.cpp index 913e00bcc..c7339e32e 100644 --- a/GeoModelExamples/HelloGeoRead/main.cpp +++ b/GeoModelExamples/HelloGeoRead/main.cpp @@ -1,24 +1,26 @@ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + /* * HelloGeo.cpp * + * Author: Riccardo Maria BIANCHI @ CERN * Created on: Nov, 2018 - * Author: Riccardo Maria BIANCHI <riccardo.maria.bianchi@cern.ch> + * */ +// GeoModel includes #include "GeoModelDBManager/GMDBManager.h" #include "GeoModelRead/ReadGeoModel.h" - #include "GeoModelKernel/GeoBox.h" #include "GeoModelKernel/GeoPhysVol.h" #include "GeoModelKernel/GeoFullPhysVol.h" #include "GeoModelKernel/GeoNameTag.h" -#include <QCoreApplication> -#include <QString> -#include <QDebug> -#include <QFileInfo> - +// C++ includes #include <iostream> +#include <fstream> +#include <cstdlib> // EXIT_FAILURE + // Units #include "GeoModelKernel/Units.h" @@ -71,13 +73,23 @@ int main(int argc, char *argv[]) const std::string path = "../geometry.db"; std::cout << "Using this DB file:" << path << std::endl; - // check if DB file exists. If not, return - if (! QFileInfo(QString::fromStdString(path)).exists() ) { - // std::cout << "ERROR!! DB '" << path << "' does not exist!! Exiting..."; // FIXME: path with std::string - std::cout << "ERROR!! DB does not exist!! Exiting...\n"; - // return; - throw; + // // check if DB file exists. If not, return + // if (! QFileInfo(QString::fromStdString(path)).exists() ) { + // // std::cout << "ERROR!! DB '" << path << "' does not exist!! Exiting..."; // FIXME: path with std::string + // std::cout << "ERROR!! DB does not exist!! Exiting...\n"; + // // return; + // throw; + // } + + // check if DB file exists. If not, return. + // FIXME: TODO: this check should go in the 'GMDBManager' constructor. + std::ifstream infile(path.c_str()); + if ( infile.good() ) { + std::cout << "\n\tERROR!! A '" << path << "' file exists already!! Please, remove, move, or rename it before running this program. Exiting..."; + exit(EXIT_FAILURE); } + infile.close(); + // open the DB GMDBManager* db = new GMDBManager(path); @@ -99,12 +111,12 @@ int main(int argc, char *argv[]) /* setup the GeoModel reader */ GeoModelIO::ReadGeoModel readInGeo = GeoModelIO::ReadGeoModel(db); - qDebug() << "OK! ReadGeoModel is set."; + std::cout << "OK! ReadGeoModel is set." << std::endl; /* build the GeoModel geometry */ GeoPhysVol* dbPhys = readInGeo.buildGeoModel(); // builds the whole GeoModel tree in memory - qDebug() << "ReadGeoModel::buildGeoModel() done."; + std::cout << "ReadGeoModel::buildGeoModel() done." << std::endl; // create the world volume container and // get the 'world' volume, i.e. the root volume of the GeoModel tree @@ -144,19 +156,19 @@ int main(int argc, char *argv[]) } } else if ( dynamic_cast<const GeoNameTag*>( &(*( nodeLink ))) ) { - qDebug() << "\t" << "the child n. " << idx << " is a GeoNameTag"; + std::cout << "\t" << "the child n. " << idx << " is a GeoNameTag" << std::endl; const GeoNameTag *childVol = dynamic_cast<const GeoNameTag*>(&(*( nodeLink ))); std::cout << "\t\t GeoNameTag's name: " << childVol->getName() << std::endl; } else if ( dynamic_cast<const GeoMaterial*>( &(*( nodeLink ))) ) { - qDebug() << "\t" << "the child n. " << idx << " is a GeoMaterial"; + std::cout << "\t" << "the child n. " << idx << " is a GeoMaterial" << std::endl; const GeoMaterial *childVol = dynamic_cast<const GeoMaterial*>(&(*( nodeLink ))); std::cout << "\t\t GeoMaterial's name: " << childVol->getName() << std::endl; std::cout << "\t\t GeoMaterial's number of elements: " << childVol->getNumElements() << std::endl; } } - qDebug() << "Everything done."; + std::cout << "Everything done." << std::endl; // return app.exec(); return 0; diff --git a/GeoModelExamples/HelloGeoRead2G4/CMakeLists.txt b/GeoModelExamples/HelloGeoRead2G4/CMakeLists.txt index 640707d3a..b985d578e 100644 --- a/GeoModelExamples/HelloGeoRead2G4/CMakeLists.txt +++ b/GeoModelExamples/HelloGeoRead2G4/CMakeLists.txt @@ -1,37 +1,19 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + ################################################################################ -# Package: HelloGeo2G4 -# author: Riccardo Maria BIANCHI <rbianchi@cern.ch> - Nov, 2018 +# Package: HelloGeoRead2G4 +# author: Riccardo Maria BIANCHI @ CERN - Nov, 2018 ################################################################################ cmake_minimum_required(VERSION 3.1.0) project(HelloGeoRead2G4) -# Compile with C++14 -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -# Print Build Info on screen -include(../cmake/PrintBuildInfo.cmake) - -# Find includes in corresponding build directories +# Find includes in current dir set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Dependencies. -## GeoModel dependencies. -find_package( GeoModelCore 3.2.0 REQUIRED ) -find_package( GeoModelIO 3.2.0 REQUIRED ) -find_package( GeoModelG4 REQUIRED ) ## External dependencies. find_package( Geant4 REQUIRED ) - -### External Dependencies -# Find the Qt5 libraries, used e.g. to interface with the SQlite DB -find_package(Qt5 COMPONENTS Core Widgets REQUIRED) # TODO: remove Qt dependency, which comes from GeoModelDBManager -# Instruct CMake to run Qt5 moc automatically when needed -set(CMAKE_AUTOMOC ON) # TODO: do we need this here?? - # include Geant4 headers include(${Geant4_USE_FILE}) @@ -42,4 +24,4 @@ set( SRCS main.cpp ) add_executable( hellogeoRead2G4 ${SRCS} ) # Link all needed libraries -target_link_libraries( hellogeoRead2G4 Qt5::Core GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelRead GeoModelCore::GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES}) +target_link_libraries( hellogeoRead2G4 GeoModelDBManager GeoModelRead GeoModelKernel GeoModel2G4 ${Geant4_LIBRARIES}) diff --git a/GeoModelExamples/HelloGeoRead2G4/main.cpp b/GeoModelExamples/HelloGeoRead2G4/main.cpp index f1d1c59f4..398b5b709 100644 --- a/GeoModelExamples/HelloGeoRead2G4/main.cpp +++ b/GeoModelExamples/HelloGeoRead2G4/main.cpp @@ -1,28 +1,30 @@ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + /* * HelloGeo.cpp * + * Author: Riccardo Maria BIANCHI @ CERN * Created on: Nov, 2018 - * Author: Riccardo Maria BIANCHI <riccardo.maria.bianchi@cern.ch> + * */ +// GeoModel includes +#include "GeoModel2G4/ExtParameterisedVolumeBuilder.h" #include "GeoModelDBManager/GMDBManager.h" #include "GeoModelRead/ReadGeoModel.h" -#include "GeoModel2G4/ExtParameterisedVolumeBuilder.h" -#include "G4LogicalVolume.hh" - -// #include "GeoModelUtilities/GeoModelExperiment.h" - #include "GeoModelKernel/GeoBox.h" #include "GeoModelKernel/GeoPhysVol.h" #include "GeoModelKernel/GeoFullPhysVol.h" #include "GeoModelKernel/GeoNameTag.h" -#include <QCoreApplication> -#include <QString> -#include <QDebug> -#include <QFileInfo> +// Geant4 includes +#include "G4LogicalVolume.hh" +// C++ includes #include <iostream> +#include <fstream> +#include <cstdlib> // EXIT_FAILURE + // Units #include "GeoModelKernel/Units.h" @@ -47,33 +49,34 @@ -int main(int argc, char *argv[]) +// TODO: int main(int argc, char *argv[]) +int main() { - QCoreApplication app(argc, argv); - - // GET GEOMETRY FROM LOCAL DB - // Set valid db path before first run - static const QString path = "../geometry.db"; - qDebug() << "Using this DB file:" << path; - - // check if DB file exists. If not, return - if (! QFileInfo(path).exists() ) { - qWarning() << "ERROR!! DB '" << path << "' does not exist!!"; - qWarning() << "Returning..." << "\n"; - // return; - throw; + + // Set a valid local geometry db path before first run + static const std::string path = "../geometry.db"; + + std::cout << "Using this DB file:" << path << std::endl; + + // check if DB file exists. If not, return. + // FIXME: TODO: this check should go in the 'GMDBManager' constructor. + std::ifstream infile(path.c_str()); + if ( infile.good() ) { + std::cout << "\n\tERROR!! A '" << path << "' file exists already!! Please, remove, move, or rename it before running this program. Exiting..."; + exit(EXIT_FAILURE); } + infile.close(); // open the DB - GMDBManager* db = new GMDBManager(path.toStdString()); + GMDBManager* db = new GMDBManager(path); + /* Open database */ if (db->checkIsDBOpen()) { std::cout << "OK! Database is open!\n"; } else { std::cout << "Database is not open!\n"; - // return; - throw; + exit(EXIT_FAILURE); } // -- testing the input database @@ -82,12 +85,12 @@ int main(int argc, char *argv[]) /* setup the GeoModel reader */ GeoModelIO::ReadGeoModel readInGeo = GeoModelIO::ReadGeoModel(db); - qDebug() << "ReadGeoModel set."; + std::cout << "ReadGeoModel set.\n"; /* build the GeoModel geometry */ GeoPhysVol* world = readInGeo.buildGeoModel(); // builds the whole GeoModel tree in memory and get an handle to the 'world' volume - qDebug() << "ReadGeoModel::buildGeoModel() done."; + std::cout << "ReadGeoModel::buildGeoModel() done.\n"; @@ -124,7 +127,7 @@ int main(int argc, char *argv[]) std::cout<< " and it has "<<childVol->getNChildVols()<<" child volumes\n"; } } else if ( dynamic_cast<const GeoNameTag*>( &(*( nodeLink ))) ) { - qDebug() << "\t" << "the child n. " << idx << " is a GeoNameTag"; + std::cout << "\t" << "the child n. " << idx << " is a GeoNameTag\n"; const GeoNameTag *childVol = dynamic_cast<const GeoNameTag*>(&(*( nodeLink ))); std::cout << "\t\tGeoNameTag's name: " << childVol->getName() << std::endl; //std::cout<< " and it has "<<childVol->getNChildVols()<<" child volumes\n"; @@ -136,7 +139,9 @@ int main(int argc, char *argv[]) std::cout << "Building G4 geometry."<<std::endl; G4LogicalVolume* g4World = builder->Build(world); - qDebug() << "Everything done."; + std::cout << "This is the newly-created Geant4 G4LogicalVolume, ready to be used: " << g4World << std::endl; + + std::cout << "Everything done.\n"; - return app.exec(); + return 0; } diff --git a/GeoModelExamples/HelloGeoWrite/CMakeLists.txt b/GeoModelExamples/HelloGeoWrite/CMakeLists.txt index 75ae22709..9e88afb85 100644 --- a/GeoModelExamples/HelloGeoWrite/CMakeLists.txt +++ b/GeoModelExamples/HelloGeoWrite/CMakeLists.txt @@ -1,31 +1,17 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + ################################################################################ -# Package: HelloGeo -# author: Riccardo Maria BIANCHI <rbianchi@cern.ch> - Nov, 2018 +# Package: HelloGeoWrite +# author: Riccardo Maria BIANCHI @ CERN - Nov, 2018 ################################################################################ cmake_minimum_required(VERSION 3.1.0) project(HelloGeoWrite) -# Compile with C++17 -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -# Print Build Info on screen -include(../cmake/PrintBuildInfo.cmake) - -# Find includes in corresponding build directories +# Find includes in current dir set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Dependencies. -## GeoModel dependencies. -find_package( GeoModelCore 3.2.0 REQUIRED ) -find_package( GeoModelIO 3.2.0 REQUIRED ) -find_package( Eigen3 REQUIRED ) -## External Dependencies. -find_package(Qt5 COMPONENTS Core Widgets REQUIRED) # TODO: remove Qt dependency, which comes from GeoModelDBManager - # Populate a CMake variable with the sources set(SRCS main.cpp ) @@ -33,4 +19,4 @@ set(SRCS main.cpp ) add_executable( hellogeoWrite ${SRCS} ) # Link all needed libraries -target_link_libraries( hellogeoWrite GeoModelCore::GeoModelKernel GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelWrite Qt5::Core ) +target_link_libraries( hellogeoWrite GeoModelKernel GeoModelDBManager GeoModelWrite ) diff --git a/GeoModelExamples/HelloGeoWrite/main.cpp b/GeoModelExamples/HelloGeoWrite/main.cpp index 50d65f90f..b35d09f64 100644 --- a/GeoModelExamples/HelloGeoWrite/main.cpp +++ b/GeoModelExamples/HelloGeoWrite/main.cpp @@ -1,24 +1,25 @@ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + /* * HelloGeo.cpp * + * Author: Riccardo Maria BIANCHI @ CERN * Created on: Apr, 2019 - * Author: Riccardo Maria BIANCHI <riccardo.maria.bianchi@cern.ch> + * */ +// GeoModel includes #include "GeoModelKernel/GeoBox.h" #include "GeoModelKernel/GeoPhysVol.h" #include "GeoModelKernel/GeoFullPhysVol.h" #include "GeoModelKernel/GeoNameTag.h" - #include "GeoModelDBManager/GMDBManager.h" - #include "GeoModelWrite/WriteGeoModel.h" -#include <QDebug> -#include <QFileInfo> - +// C++ includes #include <iostream> #include <fstream> +#include <cstdlib> // EXIT_FAILURE // Units diff --git a/GeoModelExamples/HelloToyDetectorFactory/CMakeLists.txt b/GeoModelExamples/HelloToyDetectorFactory/CMakeLists.txt index c91200c80..16e90740a 100644 --- a/GeoModelExamples/HelloToyDetectorFactory/CMakeLists.txt +++ b/GeoModelExamples/HelloToyDetectorFactory/CMakeLists.txt @@ -1,25 +1,17 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + ################################################################################ -# Package: HelloGeo -# author: Riccardo Maria BIANCHI <rbianchi@cern.ch> - Nov, 2018 +# Package: HelloToyDetectorFactory +# author: Riccardo Maria BIANCHI @ CERN - Nov, 2018 ################################################################################ cmake_minimum_required(VERSION 3.1.0) project(HelloToyDetectorFactory) -# Print Build Info on screen -include(../cmake/PrintBuildInfo.cmake) - -# Find includes in corresponding build directories +# Find includes in current dir set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Dependencies. -## GeoModel dependencies. -find_package( GeoModelCore 3.2.0 REQUIRED ) -find_package( GeoModelIO 3.2.0 REQUIRED ) -## External Dependencies. -find_package(Qt5 COMPONENTS Core Widgets REQUIRED) # TODO: remove Qt dependency, which comes from GeoModelDBManager - # Populate a CMake variable with the sources FILE(GLOB SRCS src/main.cpp src/*.cxx ) @@ -27,4 +19,4 @@ FILE(GLOB SRCS src/main.cpp src/*.cxx ) add_executable( helloToyDetectorFactory ${SRCS} ) # Link all needed libraries -target_link_libraries( helloToyDetectorFactory GeoModelCore::GeoModelKernel GeoModelIO::GeoModelDBManager GeoModelIO::GeoModelWrite Qt5::Core) +target_link_libraries( helloToyDetectorFactory GeoModelKernel GeoModelDBManager GeoModelWrite ) diff --git a/GeoModelExamples/HelloToyDetectorFactory/src/CentralScrutinizer.cxx b/GeoModelExamples/HelloToyDetectorFactory/src/CentralScrutinizer.cxx index e09b5847c..610217ab0 100755 --- a/GeoModelExamples/HelloToyDetectorFactory/src/CentralScrutinizer.cxx +++ b/GeoModelExamples/HelloToyDetectorFactory/src/CentralScrutinizer.cxx @@ -1,6 +1,4 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #include "CentralScrutinizer.h" diff --git a/GeoModelExamples/HelloToyDetectorFactory/src/CentralScrutinizer.h b/GeoModelExamples/HelloToyDetectorFactory/src/CentralScrutinizer.h index 4b46855f7..98641c10a 100755 --- a/GeoModelExamples/HelloToyDetectorFactory/src/CentralScrutinizer.h +++ b/GeoModelExamples/HelloToyDetectorFactory/src/CentralScrutinizer.h @@ -1,6 +1,4 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #ifndef CentralScrutinizer_h #define CentralScrutinizer_h 1 diff --git a/GeoModelExamples/HelloToyDetectorFactory/src/ForwardScrutinizer.h b/GeoModelExamples/HelloToyDetectorFactory/src/ForwardScrutinizer.h index 86cd1d35a..eb703c376 100755 --- a/GeoModelExamples/HelloToyDetectorFactory/src/ForwardScrutinizer.h +++ b/GeoModelExamples/HelloToyDetectorFactory/src/ForwardScrutinizer.h @@ -1,6 +1,4 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #ifndef ForwardScrutinizer_h #define ForwardScrutinizer_h 1 diff --git a/GeoModelExamples/HelloToyDetectorFactory/src/GeoModelExperiment.cxx b/GeoModelExamples/HelloToyDetectorFactory/src/GeoModelExperiment.cxx index 9d7e96c5d..cce3f4559 100644 --- a/GeoModelExamples/HelloToyDetectorFactory/src/GeoModelExperiment.cxx +++ b/GeoModelExamples/HelloToyDetectorFactory/src/GeoModelExperiment.cxx @@ -1,15 +1,17 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// local includes #include "GeoModelExperiment.h" +// GeoModel includes #include "GeoModelKernel/GeoPhysVol.h" #include "GeoModelKernel/GeoVDetectorManager.h" +// C++ includes #include <algorithm> #include <sstream> #include <stdexcept> + /** ** Constructor(s) **/ diff --git a/GeoModelExamples/HelloToyDetectorFactory/src/GeoModelExperiment.h b/GeoModelExamples/HelloToyDetectorFactory/src/GeoModelExperiment.h index c73466f81..aa8032638 100644 --- a/GeoModelExamples/HelloToyDetectorFactory/src/GeoModelExperiment.h +++ b/GeoModelExamples/HelloToyDetectorFactory/src/GeoModelExperiment.h @@ -1,6 +1,4 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration //-------------------------------------------------------------------------------------------// // // @@ -15,7 +13,10 @@ #ifndef GEOMODELSVC_GEOMODELEXPERIMENT_H #define GEOMODELSVC_GEOMODELEXPERIMENT_H +// GeoModel includes #include "GeoModelKernel/GeoVPhysVol.h" + +// C++ includes #include <set> #include <string> #include <vector> diff --git a/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorFactory.cxx b/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorFactory.cxx index 09abb88c4..384a2eb46 100644 --- a/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorFactory.cxx +++ b/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorFactory.cxx @@ -1,10 +1,10 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// local includes #include "ToyDetectorFactory.h" #include "CentralScrutinizer.h" +// GeoModel includes #include "GeoModelKernel/GeoDefinitions.h" #include "GeoModelKernel/GeoMaterial.h" #include "GeoModelKernel/GeoBox.h" @@ -17,13 +17,12 @@ #include "GeoModelKernel/GeoSerialDenominator.h" #include "GeoModelKernel/GeoAlignableTransform.h" #include "GeoModelKernel/GeoSerialTransformer.h" - #include "GeoGenericFunctions/AbsFunction.h" #include "GeoGenericFunctions/Variable.h" #include "GeoGenericFunctions/Sin.h" #include "GeoGenericFunctions/Cos.h" -// #include "GaudiKernel/SystemOfUnits.h" + // Units #include "GeoModelKernel/Units.h" #define SYSTEM_OF_UNITS GeoModelKernelUnits // so we will get, e.g., 'GeoModelKernelUnits::cm' diff --git a/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorFactory.h b/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorFactory.h index cd30c874a..08e15e872 100644 --- a/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorFactory.h +++ b/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorFactory.h @@ -1,12 +1,14 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #ifndef ToyDetectorFactory_h #define ToyDetectorFactory_h 1 -#include "GeoModelKernel/GeoVDetectorFactory.h" + +// local includes #include "ToyDetectorManager.h" -// class StoreGateSvc; + +// GeoModel includes +#include "GeoModelKernel/GeoVDetectorFactory.h" + class ToyDetectorFactory : public GeoVDetectorFactory { diff --git a/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorManager.cxx b/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorManager.cxx index 152cf80a4..182476bd9 100755 --- a/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorManager.cxx +++ b/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorManager.cxx @@ -1,7 +1,6 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// local includes #include "ToyDetectorManager.h" #include "ForwardScrutinizer.h" #include "CentralScrutinizer.h" diff --git a/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorManager.h b/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorManager.h index f82958940..1a347ccc9 100644 --- a/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorManager.h +++ b/GeoModelExamples/HelloToyDetectorFactory/src/ToyDetectorManager.h @@ -1,12 +1,14 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #ifndef ToyDetectorManager_h #define ToyDetectorManager_h 1 + +// GeoModel includes #include "GeoModelKernel/GeoVPhysVol.h" #include "GeoModelKernel/GeoVDetectorManager.h" + +// FWD declarations class CentralScrutinizer; class ForwardScrutinizer; diff --git a/GeoModelExamples/HelloToyDetectorFactory/src/main.cpp b/GeoModelExamples/HelloToyDetectorFactory/src/main.cpp index a69bf3e38..1317ab5b7 100644 --- a/GeoModelExamples/HelloToyDetectorFactory/src/main.cpp +++ b/GeoModelExamples/HelloToyDetectorFactory/src/main.cpp @@ -1,28 +1,30 @@ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + /* * HelloGeo.cpp * + * Author: Riccardo Maria BIANCHI @ CERN * Created on: Nov, 2018 - * Author: Riccardo Maria BIANCHI <riccardo.maria.bianchi@cern.ch> + * */ - +// local includes #include "GeoModelExperiment.h" #include "ToyDetectorFactory.h" +// GeoModel includes #include "GeoModelKernel/GeoBox.h" #include "GeoModelKernel/GeoNameTag.h" #include "GeoModelKernel/GeoPhysVol.h" #include "GeoModelKernel/GeoFullPhysVol.h" - #include "GeoModelDBManager/GMDBManager.h" - #include "GeoModelWrite/WriteGeoModel.h" -#include <QDebug> -#include <QString> -#include <QFileInfo> - +// C++ includes #include <iostream> +#include <fstream> +#include <cstdlib> // EXIT_FAILURE + // Units #include "GeoModelKernel/Units.h" @@ -136,19 +138,19 @@ int main(int argc, char *argv[]) //------------------------------------------------------------// // --- writing the newly created Geometry to a local file --- // - QString path = "geometry.db"; + std::string path = "geometry.db"; // check if DB file exists. If not, return. - // TODO: this check should go in the 'GMDBManager' constructor. - if ( QFileInfo(path).exists() ) { - qWarning() << "\n\tERROR!! A '" << path << "' file exists already!! Please, remove it before running this program."; - qWarning() << "\tReturning..." << "\n"; - // return; - exit(1); + // FIXME: TODO: this check should go in the 'GMDBManager' constructor. + std::ifstream infile(path.c_str()); + if ( infile.good() ) { + std::cout << "\n\tERROR!! A '" << path << "' file exists already!! Please, remove, move, or rename it before running this program. Exiting..."; + exit(EXIT_FAILURE); } + infile.close(); // open the DB connection - GMDBManager db(path.toStdString()); + GMDBManager db(path); // check the DB connection if (db.checkIsDBOpen()) @@ -163,9 +165,7 @@ int main(int argc, char *argv[]) GeoModelIO::WriteGeoModel dumpGeoModelGraph(db); // init the GeoModel node action world->exec(&dumpGeoModelGraph); // visit all nodes in the GeoModel tree dumpGeoModelGraph.saveToDB(); // save to the local SQlite DB file - std::cout << "DONE. Geometry saved to the file '" << path.toStdString() << "'.\n" <<std::endl; - - + std::cout << "DONE. Geometry saved to the file '" << path << "'.\n" <<std::endl; return 0; //app.exec(); } diff --git a/GeoModelExamples/cmake/PrintBuildInfo.cmake b/GeoModelExamples/cmake/PrintBuildInfo.cmake deleted file mode 100644 index 0bb7b5d42..000000000 --- a/GeoModelExamples/cmake/PrintBuildInfo.cmake +++ /dev/null @@ -1,4 +0,0 @@ -message(STATUS "-----") -message(STATUS "Building with type: ${CMAKE_BUILD_TYPE}") -message(STATUS "Using C++ standard: ${CMAKE_CXX_STANDARD}") -message(STATUS "-----") diff --git a/GeoModelG4/CMakeLists.txt b/GeoModelG4/CMakeLists.txt index 56850cf5a..6b44445be 100644 --- a/GeoModelG4/CMakeLists.txt +++ b/GeoModelG4/CMakeLists.txt @@ -3,9 +3,13 @@ cmake_minimum_required( VERSION 3.1 ) project( "GeoModelG4" VERSION 1.1.0 LANGUAGES CXX ) -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) +# set(CMAKE_CXX_STANDARD 17) +# set(CMAKE_CXX_STANDARD_REQUIRED ON) +# set(CMAKE_CXX_EXTENSIONS OFF) + +# External dependencies: +find_package( Geant4 REQUIRED ) +# find_package( GeoModelCore 3.2.0 REQUIRED ) # Set up the build of the three libraries of the project. @@ -18,4 +22,3 @@ install(EXPORT GeoSpecialShapes-export FILE GeoModelG4-GeoSpecialShapes.cmake DE install(EXPORT GeoMaterial2G4-export FILE GeoModelG4-GeoMaterial2G4.cmake DESTINATION lib/cmake/GeoModelG4) install(EXPORT GeoModel2G4-export FILE GeoModelG4-GeoModel2G4.cmake DESTINATION lib/cmake/GeoModelG4) install(FILES cmake/GeoModelG4Config.cmake DESTINATION lib/cmake/GeoModelG4) - diff --git a/GeoModelG4/GeoMaterial2G4/CMakeLists.txt b/GeoModelG4/GeoMaterial2G4/CMakeLists.txt index 24134c55b..a2cface1c 100644 --- a/GeoModelG4/GeoMaterial2G4/CMakeLists.txt +++ b/GeoModelG4/GeoMaterial2G4/CMakeLists.txt @@ -5,9 +5,9 @@ cmake_minimum_required(VERSION 3.10) project( "GeoMaterial2G4" VERSION 1.1.0 LANGUAGES CXX ) -# External dependencies: -find_package( Geant4 REQUIRED ) -find_package( GeoModelCore 3.2.0 REQUIRED ) +# # External dependencies: +# find_package( Geant4 REQUIRED ) +# find_package( GeoModelCore 3.2.0 REQUIRED ) # Project's Settings set(CMAKE_CXX_STANDARD 17) @@ -27,7 +27,7 @@ include(${Geant4_USE_FILE}) # Set target and properties add_library( GeoMaterial2G4 SHARED ${HEADERS} ${SOURCES} ) -target_link_libraries( GeoMaterial2G4 PUBLIC ${Geant4_LIBRARIES} GeoModelCore::GeoModelKernel ) +target_link_libraries( GeoMaterial2G4 PUBLIC ${Geant4_LIBRARIES} GeoModelKernel ) target_include_directories( GeoMaterial2G4 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:include> ) @@ -38,7 +38,7 @@ set_property( TARGET GeoMaterial2G4 PROPERTY PUBLIC_HEADER ${HEADERS} ) set_target_properties( GeoMaterial2G4 PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} ) - + # new test GeoModelG4 install( TARGETS GeoMaterial2G4 EXPORT GeoMaterial2G4-export LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GeoMaterial2G4 ) diff --git a/GeoModelG4/GeoModel2G4/CMakeLists.txt b/GeoModelG4/GeoModel2G4/CMakeLists.txt index 95ff1faf5..75a59d530 100644 --- a/GeoModelG4/GeoModel2G4/CMakeLists.txt +++ b/GeoModelG4/GeoModel2G4/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 3.10) # Declare the package name project( "GeoModel2G4" VERSION 1.1.0 LANGUAGES CXX ) -# External dependencies: -find_package( Geant4 REQUIRED ) +# # External dependencies: +# find_package( Geant4 REQUIRED ) # GeoModel dependencies -find_package( GeoModelCore 3.2.0 REQUIRED ) +# find_package( GeoModelCore 3.2.0 REQUIRED ) ########################################################## # NOTE! The original package also needs this Athena stuff: diff --git a/GeoModelG4/GeoSpecialShapes/CMakeLists.txt b/GeoModelG4/GeoSpecialShapes/CMakeLists.txt index ad0ebb5f0..021337aee 100644 --- a/GeoModelG4/GeoSpecialShapes/CMakeLists.txt +++ b/GeoModelG4/GeoSpecialShapes/CMakeLists.txt @@ -5,8 +5,8 @@ # Package: GeoSpecialShapes ################################################################################ -find_package( Geant4 REQUIRED ) -find_package(GeoModelCore 3.2.0 REQUIRED) +# find_package( Geant4 REQUIRED ) +# find_package(GeoModelCore 3.2.0 REQUIRED) # Use the GNU install directory names. include( GNUInstallDirs ) # it defines CMAKE_INSTALL_LIBDIR @@ -21,7 +21,7 @@ file( GLOB HEADERS GeoSpecialShapes/*.h src/LArWheelCalculator_Impl/*.h) # Set the library. add_library( GeoSpecialShapes SHARED ${HEADERS} ${SOURCES} ) target_link_libraries( GeoSpecialShapes PUBLIC -PRIVATE GeoModelCore::GeoModelKernel ${Geant4_LIBRARIES}) +PRIVATE GeoModelKernel ${Geant4_LIBRARIES}) target_include_directories( GeoSpecialShapes PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:include> ${GEANT4_INCLUDE_DIRS}) @@ -35,6 +35,3 @@ set_target_properties( GeoSpecialShapes PROPERTIES # new test GeoModelG4 install( TARGETS GeoSpecialShapes EXPORT GeoSpecialShapes-export LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GeoSpecialShapes ) - - - diff --git a/GeoModelIO/CMakeLists.txt b/GeoModelIO/CMakeLists.txt index 56a5a3b43..52ba5759a 100644 --- a/GeoModelIO/CMakeLists.txt +++ b/GeoModelIO/CMakeLists.txt @@ -25,7 +25,7 @@ list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ) # --------------------------- # Project's dependencies. -find_package( GeoModelCore 3.2.0 REQUIRED ) +# find_package( GeoModelCore 3.2.0 REQUIRED ) find_package( SQLite3 QUIET ) # Set sub-packages to build. diff --git a/GeoModelIO/GeoModelRead/CMakeLists.txt b/GeoModelIO/GeoModelRead/CMakeLists.txt index 04aabc25b..1b5fcb337 100644 --- a/GeoModelIO/GeoModelRead/CMakeLists.txt +++ b/GeoModelIO/GeoModelRead/CMakeLists.txt @@ -12,7 +12,7 @@ file( GLOB HEADERS GeoModelRead/*.h ) # Set up the library. add_library( GeoModelRead SHARED ${HEADERS} ${SOURCES} ) target_link_libraries( GeoModelRead PUBLIC -GeoModelCore::GeoModelKernel GeoModelDBManager TFPersistification ) +GeoModelKernel GeoModelDBManager TFPersistification ) target_include_directories( GeoModelRead PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:include> ) diff --git a/GeoModelIO/GeoModelRead/src/ReadGeoModel.cpp b/GeoModelIO/GeoModelRead/src/ReadGeoModel.cpp index 811905aa0..88b0d2d3d 100644 --- a/GeoModelIO/GeoModelRead/src/ReadGeoModel.cpp +++ b/GeoModelIO/GeoModelRead/src/ReadGeoModel.cpp @@ -123,7 +123,7 @@ ReadGeoModel::ReadGeoModel(GMDBManager* db, unsigned long* progress) : m_deepDeb } // build caches m_dbManager->loadGeoNodeTypesAndBuildCache(); - + // Check if the user asked for running in serial or multi-threading mode if ( "" != getEnvVar("GEOMODEL_ENV_IO_NTHREADS")) @@ -204,7 +204,7 @@ GeoPhysVol* ReadGeoModel::buildGeoModelPrivate() // get DB metadata m_tableID_toTableName = m_dbManager->getAll_TableIDsNodeTypes(); m_tableName_toTableID = m_dbManager->getAll_NodeTypesTableIDs(); - + auto end = std::chrono::system_clock::now(); // timing: get end time auto diff = std::chrono::duration_cast < std::chrono::seconds > (end - start).count(); if (m_timing || m_debug || m_deepDebug) { @@ -218,17 +218,17 @@ GeoPhysVol* ReadGeoModel::buildGeoModelPrivate() std::cout << "Building nodes concurrently..." << std::endl; std::thread t2(&ReadGeoModel::buildAllElements, this); // std::thread t7(&ReadGeoModel::buildAllFunctions, this); // FIXME: implement cache for Functions - + std::thread t8(&ReadGeoModel::buildAllTransforms, this); std::thread t9(&ReadGeoModel::buildAllAlignableTransforms, this); std::thread t10(&ReadGeoModel::buildAllSerialDenominators, this); std::thread t11(&ReadGeoModel::buildAllNameTags, this); - + t8.join(); // ok, all Transforms have been built t9.join(); // ok, all AlignableTransforms have been built // needs Transforms and AlignableTransforms for Shift boolean shapes std::thread t1(&ReadGeoModel::buildAllShapes, this); - + t2.join(); // ok, all Elements have been built // needs Elements std::thread t3(&ReadGeoModel::buildAllMaterials, this); @@ -274,7 +274,7 @@ GeoPhysVol* ReadGeoModel::buildGeoModelPrivate() if (m_timing || m_debug || m_deepDebug) { std::cout << "*** Time taken to build all GeoModel nodes: " << diff << " [s]" << std::endl; } - + // *** recreate all mother-daughter relatioships between nodes *** start = std::chrono::system_clock::now(); // timing: get start time loopOverAllChildrenInBunches(); @@ -283,31 +283,31 @@ GeoPhysVol* ReadGeoModel::buildGeoModelPrivate() if (m_timing || m_debug || m_deepDebug) { std::cout << "*** Time taken to recreate all mother-daughter relationships between nodes of the GeoModel tree: " << diff << " [s]" << std::endl; } - + return getRootVolume(); } //---------------------------------------- // loop over parent-child relationship data - void ReadGeoModel::loopOverAllChildrenRecords(std::vector<std::vector<std::string>> records) + void ReadGeoModel::loopOverAllChildrenRecords(std::vector<std::vector<std::string>> records) { - + int nChildrenRecords = records.size(); - + if (m_debug || m_deepDebug) { muxCout.lock(); std::cout << "Thread " << std::this_thread::get_id() << " - processing " << nChildrenRecords << " keys..." << std::endl; muxCout.unlock(); } - + // // Get Start Time // std::chrono::system_clock::time_point start = std::chrono::system_clock::now(); - + for ( auto& record : records ) { processParentChild( record ); } - + // // Get End Time // auto end = std::chrono::system_clock::now(); // auto diff = std::chrono::duration_cast < std::chrono::seconds > (end - start).count(); @@ -349,7 +349,7 @@ void ReadGeoModel::buildAllSerialDenominators() } if (nSize>0) std::cout << "All " << nSize << " SerialDenominators have been built!\n"; } - + //! Iterate over the list of GeoSerialDenominator nodes, build them all, and store their pointers void ReadGeoModel::buildAllNameTags() { @@ -364,7 +364,7 @@ void ReadGeoModel::buildAllNameTags() } if (nSize>0) std::cout << "All " << nSize << " NameTags have been built!\n"; } - + //! Iterate over the list of nodes, build them all, and store their pointers void ReadGeoModel::buildAllElements() { @@ -377,7 +377,7 @@ void ReadGeoModel::buildAllElements() } if (nSize>0) std::cout << "All " << nSize << " Elements have been built!\n"; } - + //! Iterate over the list of nodes, build them all, and store their pointers void ReadGeoModel::buildAllMaterials() { @@ -390,7 +390,7 @@ void ReadGeoModel::buildAllMaterials() } if (nSize>0) std::cout << "All " << nSize << " Materials have been built!\n"; } - + //! Iterate over the list of nodes, build them all, and store their pointers void ReadGeoModel::buildAllLogVols() { @@ -431,7 +431,7 @@ void ReadGeoModel::buildAllPhysVols() } if (nSize>0) std::cout << "All " << nSize << " PhysVols have been built!\n"; } - + //! Iterate over the list of nodes, build them all, and store their pointers void ReadGeoModel::buildAllFullPhysVols() { @@ -447,7 +447,7 @@ void ReadGeoModel::buildAllFullPhysVols() } if (nSize>0) std::cout << "All " << nSize << " FullPhysVols have been built!\n"; } - + //! Iterate over the list of GeoAlignableTransforms nodes, build them all, and store their pointers void ReadGeoModel::buildAllAlignableTransforms() { @@ -460,7 +460,7 @@ void ReadGeoModel::buildAllAlignableTransforms() } if (nSize>0) std::cout << "All " << nSize << " AlignableTransforms have been built!\n"; } - + //! Iterate over the list of GeoTransforms nodes, build them all, and store their pointers void ReadGeoModel::buildAllTransforms() { @@ -486,7 +486,7 @@ void ReadGeoModel::buildAllSerialTransformers() } if (nSize>0) std::cout << "All " << nSize << " SerialTransformers have been built!\n"; } - + // FIXME: implement build function and cache for Functions // //! Iterate over the list of nodes, build them all, and store their pointers // void ReadGeoModel::buildAllFunctions() @@ -516,25 +516,25 @@ void ReadGeoModel::loopOverAllChildrenInBunches() { int nChildrenRecords = m_allchildren.size(); if (m_debug) std::cout << "number of children to process: " << nChildrenRecords << std::endl; - + // If we have a few children, then process them serially - std::cout << "Running concurrently? " << m_runMultithreaded << std::endl; - if (true) // !(m_runMultithreaded) || nChildrenRecords <= 500) + // std::cout << "Running concurrently? " << m_runMultithreaded << std::endl; + if (true) // !(m_runMultithreaded) || nChildrenRecords <= 500) // TODO: test if you can optimize, then revert to if()...else() { - std::cout << "Running serially...\n"; + // std::cout << "Running serially...\n"; loopOverAllChildrenRecords(m_allchildren); } // ...otherwise, let's spawn some threads to process them in bunches, parallelly! else { - - std::cout << "Running concurrently...\n"; - + + // std::cout << "Running concurrently...\n"; + std::chrono::system_clock::time_point start, end; if (m_timing || m_debug || m_deepDebug) { // Get Start Time start = std::chrono::system_clock::now(); } - + // set number of worker threads unsigned int nThreads = 0; if(m_runMultithreaded_nThreads > 0) { @@ -545,17 +545,17 @@ void ReadGeoModel::loopOverAllChildrenInBunches() nThreads = nThreadsPlatform; if (m_debug || m_deepDebug) std::cout << "INFO - You have asked for hardware native parellelism. On this platform, " << nThreadsPlatform << " concurrent threads are supported. Thus, using " << nThreads << " threads.\n"; } - + unsigned int nBunches = nChildrenRecords / nThreads; if (m_debug || m_deepDebug) std::cout << "Processing " << nThreads << " bunches, with " << nBunches << " children each, plus the remainder." << std::endl; - + // a vector to store the "futures" of async calls std::vector<std::future<void>> futures; - + for (unsigned int bb=0; bb<nThreads; ++bb ) { - + std::vector<std::vector<std::string>> bunch; - + unsigned int start = nBunches * bb; int len = nBunches; const unsigned int stop = start + len; @@ -568,23 +568,23 @@ void ReadGeoModel::loopOverAllChildrenInBunches() else { // all bunches but last one bunch = std::vector<std::vector<std::string>>(first, last); } - + if (m_debug || m_deepDebug) { muxCout.lock(); std::cout << "Thread " << bb+1 << " - Start: " << start << ", len: " << len << " ['len=-1' = all remaining items]" << std::endl; muxCout.unlock(); } - - + + if (m_debug || m_deepDebug) { muxCout.lock(); std::cout << "'bunch' size: " << bunch.size() << std::endl; muxCout.unlock(); } - + futures.push_back( std::async(std::launch::async, &ReadGeoModel::loopOverAllChildrenRecords, this, bunch) ); } - + // wait for all async calls to complete //retrieve and print the value stored in the 'std::future' if (m_debug || m_deepDebug) std::cout << "Waiting for the threads to finish...\n" << std::flush; @@ -592,7 +592,7 @@ void ReadGeoModel::loopOverAllChildrenInBunches() e.wait(); } if (m_debug || m_deepDebug) std::cout << "Done!\n"; - + if (m_timing || m_debug || m_deepDebug) { // Get End Time end = std::chrono::system_clock::now(); @@ -610,7 +610,7 @@ void ReadGeoModel::loopOverAllChildrenInBunches() std::cout << "ERROR!!! Probably you are using an old geometry file. Please, get a new one. Exiting..." << std::endl; exit(EXIT_FAILURE); } - + // get the parent's details const unsigned int parentId = std::stoi(parentchild[1]); const unsigned int parentTableId = std::stoi(parentchild[2]); @@ -618,27 +618,27 @@ void ReadGeoModel::loopOverAllChildrenInBunches() // get the child's position in the parent's children list //const unsigned int position = std::stoi(parentchild[4]); // unused - + // get the child's details const unsigned int childTableId = std::stoi(parentchild[5]); const unsigned int childId = std::stoi(parentchild[6]); const unsigned int childCopyN = std::stoi(parentchild[7]); - + // std::string childNodeType = m_tableID_toTableName[childTableId].toStdString(); std::string childNodeType = m_tableID_toTableName[childTableId]; - + if ( "" == childNodeType || 0 == childNodeType.size()) { std::cout << "ERROR!!! childNodeType is empty!!! Aborting..." << std::endl; exit(EXIT_FAILURE); } GeoVPhysVol* parentVol = nullptr; - + // build or get parent volume. // Using the parentCopyNumber here, to get a given instance of the parent volume parentVol = dynamic_cast<GeoVPhysVol*>( buildVPhysVolInstance(parentId, parentTableId, parentCopyN) ); std::string parentName = parentVol->getLogVol()->getName(); - + if (childNodeType == "GeoPhysVol") { GeoPhysVol* childNode = dynamic_cast<GeoPhysVol*>(buildVPhysVolInstance(childId, childTableId, childCopyN)); volAddHelper(parentVol, childNode); @@ -726,7 +726,7 @@ GeoVPhysVol* ReadGeoModel::buildVPhysVolInstance(const unsigned int id, const un } return dynamic_cast<GeoVPhysVol*>(getVPhysVol(id, tableId, copyN)); } - + // B - if not built already, then get the actual volume, // which should be already built by now, // get the logVol from it and build a new VPhysVol instance in the heap; @@ -751,7 +751,7 @@ GeoVPhysVol* ReadGeoModel::buildVPhysVolInstance(const unsigned int id, const un exit(EXIT_FAILURE); } storeVPhysVol(id, tableId, copyN, vol); - + return vol; } @@ -776,7 +776,7 @@ GeoVPhysVol* ReadGeoModel::buildVPhysVol(const unsigned int id, const unsigned i if (m_deepDebug) { muxCout.lock(); std::cout << "getting the actual FullPhysVol from cache...\n"; ; muxCout.unlock(); } return getBuiltFullPhysVol(id); } - + // if not built already, then get its parameters and build it now if (logVol_ID==0) { // get the volume's parameters @@ -785,7 +785,7 @@ GeoVPhysVol* ReadGeoModel::buildVPhysVol(const unsigned int id, const unsigned i values = m_physVols[id]; else if (nodeType == "GeoFullPhysVol") values = m_fullPhysVols[id]; - + logVol_ID = std::stoi(values[1]); } @@ -947,7 +947,7 @@ std::string ReadGeoModel::getShapeType(const unsigned int shapeId) return type; } - + //TODO: move shapes in different files, so code here is more managable /// Recursive function, to build GeoShape nodes @@ -974,7 +974,7 @@ GeoShape* ReadGeoModel::buildShape(const unsigned int shapeId, type_shapes_boole // Get shape's parameters from the stored string. // This will be interpreted differently according to the shape. std::vector<std::string> shapePars = splitString(parameters, ';'); - + GeoShape* shape = nullptr; if (type == "Box") { @@ -1189,7 +1189,7 @@ GeoShape* ReadGeoModel::buildShape(const unsigned int shapeId, type_shapes_boole bool error = false; GeoPgon* pgon = nullptr; - + std::string par; std::vector<std::string> vars; std::string varName; @@ -1301,7 +1301,7 @@ GeoShape* ReadGeoModel::buildShape(const unsigned int shapeId, type_shapes_boole GeoGenericTrapVertices Vertices; bool error = false; GeoGenericTrap* gTrap = nullptr; - + std::string par; std::vector<std::string> vars; std::string varName; @@ -1396,7 +1396,7 @@ GeoShape* ReadGeoModel::buildShape(const unsigned int shapeId, type_shapes_boole bool error = 0; GeoSimplePolygonBrep* sh = nullptr; - + std::string par; std::vector<std::string> vars; std::string varName; @@ -1493,7 +1493,7 @@ GeoShape* ReadGeoModel::buildShape(const unsigned int shapeId, type_shapes_boole bool error = 0; GeoTessellatedSolid* sh = nullptr; - + std::string par; std::vector<std::string> vars; std::string varName; @@ -1975,7 +1975,7 @@ GeoShape* ReadGeoModel::buildShape(const unsigned int shapeId, type_shapes_boole std::cout << "ERROR!!! shapeA or shapeB are NULL!" << std::endl; exit(EXIT_FAILURE); } - + GeoShape* shapeNew = nullptr; if ("Subtraction" == type) { shapeNew = new GeoShapeSubtraction(shapeA, shapeB); @@ -1986,7 +1986,7 @@ GeoShape* ReadGeoModel::buildShape(const unsigned int shapeId, type_shapes_boole else if ("Intersection" == type) { shapeNew = new GeoShapeIntersection(shapeA, shapeB); } - + shape = shapeNew; } // ...otherwise, build the Subtraction operator shape without operands @@ -2320,9 +2320,9 @@ std::vector<std::string> ReadGeoModel::splitString(const std::string& s, const c // } // return vec; //} - - - + + + // TODO: move this to utility class/file void ReadGeoModel::printStdVectorStrings(std::vector<std::string> vec) { @@ -2340,7 +2340,7 @@ std::pair<unsigned int, unsigned int> ReadGeoModel::getBooleanShapeOperands(cons // std::vector<std::string> paramsShape = toStdVectorStrings(m_shapes[ shapeID ]); std::vector<std::string> paramsShape = m_shapes[ shapeID-1 ];// remember: shapes' IDs start from 1 - + // unsigned int id = std::stoi(paramsShape[0]); //! the ID of the boolean/operator shape std::string type = paramsShape[1]; //! the GeoModel type of the shape std::string parameters = paramsShape[2]; //! the parameters defining the shape, coming from the DB @@ -2446,7 +2446,7 @@ GeoLogVol* ReadGeoModel::buildLogVol(const unsigned int id) std::cout << "ERROR!! While building a LogVol, Material is NULL! Exiting..." <<std::endl; exit(EXIT_FAILURE); } - + GeoLogVol* logPtr = new GeoLogVol(logVolName, shape, mat); storeBuiltLog(id, logPtr); return logPtr; @@ -2503,7 +2503,7 @@ GeoAlignableTransform* ReadGeoModel::buildAlignableTransform(const unsigned int if (isBuiltAlignableTransform(id)) { return getBuiltAlignableTransform(id); } - + std::vector<std::string> values = m_alignableTransforms[id-1]; // nodes' IDs start from 1 values.erase(values.begin()); // remove the first element, that is the 'id', leaving the other items in the list @@ -2555,27 +2555,27 @@ GeoTransform* ReadGeoModel::buildTransform(const unsigned int id) if (isBuiltTransform(id)) { return getBuiltTransform(id); } - + std::vector<std::string> values = m_transforms[id-1]; // nodes' IDs start from 1 values.erase(values.begin()); // remove the first element, that is the 'id', leaving the other items in the list - + // get the 12 matrix elements double xx = std::stod(values[0]); double xy = std::stod(values[1]); double xz = std::stod(values[2]); - + double yx = std::stod(values[3]); double yy = std::stod(values[4]); double yz = std::stod(values[5]); - + double zx = std::stod(values[6]); double zy = std::stod(values[7]); double zz = std::stod(values[8]); - + double dx = std::stod(values[9]); double dy = std::stod(values[10]); double dz = std::stod(values[11]); - + GeoTrf::Transform3D txf; // build the rotation matrix with the first 9 elements txf(0,0)=xx; @@ -2646,7 +2646,7 @@ TRANSFUNCTION ReadGeoModel::buildFunction(const unsigned int id) */ std::string expr = m_functions[id-1][1]; // nodes' IDs start from 1 - + if (0==expr.size()) { muxCout.lock(); std::cout << "FATAL ERROR!! Function expression is empty!! Aborting..." << std::endl; @@ -2657,7 +2657,7 @@ TRANSFUNCTION ReadGeoModel::buildFunction(const unsigned int id) TransFunctionInterpreter interpreter; TFPTR func=interpreter.interpret( expr ); TRANSFUNCTION tf = *(func.release()); // make func returns a pointer to the managed object and releases the ownership, then get the object dereferencing the pointer - + /* FIXME: At the moment, enabling this cache makes the app crash at the end, when calling the destructor. I suspect because the pointers are not correct and so removing them throws an error. // Get a non-const pointer to the Function object, // and store that into the cache. @@ -2666,7 +2666,7 @@ TRANSFUNCTION ReadGeoModel::buildFunction(const unsigned int id) GeoXF::Function* fPtr = const_cast <GeoXF::Function*>(fPtrConst); storeBuiltFunction(id, fPtr); */ - + return tf; } @@ -2684,7 +2684,7 @@ GeoShape* ReadGeoModel::getBuiltShape(const unsigned int id) { return m_memMapShapes[id]; // this is a map, and 'id' is the key } - + // --- methods for caching GeoLogVol nodes --- bool ReadGeoModel::isBuiltLog(const unsigned int id) { @@ -2692,13 +2692,13 @@ bool ReadGeoModel::isBuiltLog(const unsigned int id) } void ReadGeoModel::storeBuiltLog(const unsigned int id, GeoLogVol* nodePtr) { - m_memMapLogVols.push_back(nodePtr); + m_memMapLogVols.push_back(nodePtr); } GeoLogVol* ReadGeoModel::getBuiltLog(const unsigned int id) { return m_memMapLogVols[id-1]; // nodes' IDs start from 1 } - + // --- methods for caching GeoPhysVol nodes --- bool ReadGeoModel::isBuiltPhysVol(const unsigned int id) { @@ -2712,7 +2712,7 @@ GeoPhysVol* ReadGeoModel::getBuiltPhysVol(const unsigned int id) { return m_memMapPhysVols[id-1]; // nodes' IDs start from 1 } - + // --- methods for caching GeoFullPhysVol nodes --- bool ReadGeoModel::isBuiltFullPhysVol(const unsigned int id) { @@ -2728,7 +2728,7 @@ GeoFullPhysVol* ReadGeoModel::getBuiltFullPhysVol(const unsigned int id) return m_memMapFullPhysVols[id-1]; // nodes' IDs start from 1 } - + // --- methods for caching GeoMaterial nodes --- bool ReadGeoModel::isBuiltMaterial(const unsigned int id) { @@ -2742,7 +2742,7 @@ GeoMaterial* ReadGeoModel::getBuiltMaterial(const unsigned int id) { return m_memMapMaterials[id-1]; } - + // --- methods for caching GeoElement nodes --- bool ReadGeoModel::isBuiltElement(const unsigned int id) { @@ -2756,7 +2756,7 @@ GeoElement* ReadGeoModel::getBuiltElement(const unsigned int id) { return m_memMapElements[id-1]; } - + // --- methods for caching GeoTransform nodes --- bool ReadGeoModel::isBuiltTransform(const unsigned int id) { @@ -2771,7 +2771,7 @@ GeoTransform* ReadGeoModel::getBuiltTransform(const unsigned int id) { return m_memMapTransforms[id-1]; // nodes' IDs start from 1 } - + // --- methods for caching GeoAlignableTransform nodes --- bool ReadGeoModel::isBuiltAlignableTransform(const unsigned int id) { @@ -2780,14 +2780,14 @@ bool ReadGeoModel::isBuiltAlignableTransform(const unsigned int id) void ReadGeoModel::storeBuiltAlignableTransform(const unsigned int id, GeoAlignableTransform* nodePtr) { m_memMapAlignableTransforms.push_back(nodePtr); // vector, we store them in the order of IDs - + } GeoAlignableTransform* ReadGeoModel::getBuiltAlignableTransform(const unsigned int id) { return m_memMapAlignableTransforms[id-1]; // nodes' IDs start from 1 - + } - + // --- methods for caching GeoSerialDenominator nodes --- bool ReadGeoModel::isBuiltSerialDenominator(const unsigned int id) { @@ -2796,14 +2796,14 @@ bool ReadGeoModel::isBuiltSerialDenominator(const unsigned int id) void ReadGeoModel::storeBuiltSerialDenominator(const unsigned int id, GeoSerialDenominator* nodePtr) { m_memMapSerialDenominators.push_back(nodePtr); // vector, we store them in the order of IDs - + } GeoSerialDenominator* ReadGeoModel::getBuiltSerialDenominator(const unsigned int id) { return m_memMapSerialDenominators[id-1]; // nodes' IDs start from 1 - + } - + // --- methods for caching GeoNameTag nodes --- bool ReadGeoModel::isBuiltNameTag(const unsigned int id) { @@ -2812,14 +2812,14 @@ bool ReadGeoModel::isBuiltNameTag(const unsigned int id) void ReadGeoModel::storeBuiltNameTag(const unsigned int id, GeoNameTag* nodePtr) { m_memMapNameTags.push_back(nodePtr); // vector, we store them in the order of IDs - + } GeoNameTag* ReadGeoModel::getBuiltNameTag(const unsigned int id) { return m_memMapNameTags[id-1]; // vector, but nodes' IDs start from 1 - + } - + // --- methods for caching GeoSerialDenominator nodes --- bool ReadGeoModel::isBuiltSerialTransformer(const unsigned int id) { @@ -2828,14 +2828,14 @@ bool ReadGeoModel::isBuiltSerialTransformer(const unsigned int id) void ReadGeoModel::storeBuiltSerialTransformer(const unsigned int id, GeoSerialTransformer* nodePtr) { m_memMapSerialTransformers.push_back(nodePtr); // vector, we store them in the order of IDs - + } GeoSerialTransformer* ReadGeoModel::getBuiltSerialTransformer(const unsigned int id) { return m_memMapSerialTransformers[id-1]; // remember: nodes' IDs start from 1 - + } - /* FIXME: + /* FIXME: // --- methods for caching Functions nodes --- bool ReadGeoModel::isBuiltFunction(const unsigned int id) { @@ -2844,14 +2844,14 @@ GeoSerialTransformer* ReadGeoModel::getBuiltSerialTransformer(const unsigned int void ReadGeoModel::storeBuiltFunction(const unsigned int id, GeoXF::Function* nodePtr) { m_memMapFunctions.push_back(nodePtr); // vector, we store them in the order of IDs - + } GeoXF::Function* ReadGeoModel::getBuiltFunction(const unsigned int id) { return m_memMapFunctions[id-1]; // remember: nodes' IDs start from 1 } */ - + // --- methods for caching GeoPhysVol/GeoFullPhysVol nodes --- std::string getVPhysVolKey(const unsigned int id, const unsigned int tableId, const unsigned int copyNumber) { diff --git a/GeoModelIO/GeoModelWrite/CMakeLists.txt b/GeoModelIO/GeoModelWrite/CMakeLists.txt index de55ebf97..4a77b5866 100644 --- a/GeoModelIO/GeoModelWrite/CMakeLists.txt +++ b/GeoModelIO/GeoModelWrite/CMakeLists.txt @@ -7,7 +7,7 @@ file( GLOB HEADERS GeoModelWrite/*.h ) # Set up the library. add_library( GeoModelWrite SHARED ${HEADERS} ${SOURCES} ) target_link_libraries( GeoModelWrite PUBLIC - GeoModelCore::GeoModelKernel GeoModelDBManager TFPersistification ) + GeoModelKernel GeoModelDBManager TFPersistification ) target_include_directories( GeoModelWrite PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:include> ) diff --git a/GeoModelIO/TFPersistification/CMakeLists.txt b/GeoModelIO/TFPersistification/CMakeLists.txt index 2701c8268..b8828f1af 100644 --- a/GeoModelIO/TFPersistification/CMakeLists.txt +++ b/GeoModelIO/TFPersistification/CMakeLists.txt @@ -7,7 +7,7 @@ file( GLOB HEADERS TFPersistification/*.h ) # Set up the library. add_library( TFPersistification SHARED ${HEADERS} ${SOURCES} ) target_link_libraries( TFPersistification PUBLIC -GeoModelCore::GeoGenericFunctions GeoModelCore::GeoModelKernel ) +GeoGenericFunctions GeoModelKernel ) target_include_directories( TFPersistification PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:include> ) diff --git a/GeoModelTools/CMakeLists.txt b/GeoModelTools/CMakeLists.txt index 4a4bd2c6e..b54f5613a 100644 --- a/GeoModelTools/CMakeLists.txt +++ b/GeoModelTools/CMakeLists.txt @@ -20,8 +20,8 @@ list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ) # include( SetupJSON ) # # # Find the externals needed by the project. -find_package( GeoModelCore 3.2.0 REQUIRED ) -find_package( GeoModelIO 3.2.0 REQUIRED ) +# find_package( GeoModelCore 3.2.0 REQUIRED ) +# find_package( GeoModelIO 3.2.0 REQUIRED ) find_package( XercesC ) # Set up the build of the libraries of the project. diff --git a/GeoModelTools/ExpressionEvaluator/CMakeLists.txt b/GeoModelTools/ExpressionEvaluator/CMakeLists.txt index e5e882f45..6b1820db1 100644 --- a/GeoModelTools/ExpressionEvaluator/CMakeLists.txt +++ b/GeoModelTools/ExpressionEvaluator/CMakeLists.txt @@ -7,7 +7,7 @@ file( GLOB HEADERS ExpressionEvaluator/*.h ) # Create the library. add_library( ExpressionEvaluator SHARED ${HEADERS} ${SOURCES} ) target_link_libraries( ExpressionEvaluator PRIVATE - GeoModelCore::GeoModelKernel ) + GeoModelKernel ) target_include_directories( ExpressionEvaluator PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ) diff --git a/GeoModelTools/GMCAT/CMakeLists.txt b/GeoModelTools/GMCAT/CMakeLists.txt index 392472ec0..478aa1724 100644 --- a/GeoModelTools/GMCAT/CMakeLists.txt +++ b/GeoModelTools/GMCAT/CMakeLists.txt @@ -2,9 +2,9 @@ # Declare the package's executable. add_executable( gmcat src/gmcat.cxx ) -target_link_libraries( gmcat PRIVATE GeoModelCore::GeoModelKernel - GeoModelIO::GeoModelRead GeoModelIO::GeoModelWrite - GeoModelIO::GeoModelDBManager ) +target_link_libraries( gmcat PRIVATE GeoModelKernel + GeoModelRead GeoModelWrite + GeoModelDBManager ) # Tweak how debug information should be attached to the executable, in Debug # builds. diff --git a/GeoModelVisualization/CMakeLists.txt b/GeoModelVisualization/CMakeLists.txt index 5858a58bc..6ca40e25d 100644 --- a/GeoModelVisualization/CMakeLists.txt +++ b/GeoModelVisualization/CMakeLists.txt @@ -5,9 +5,10 @@ cmake_minimum_required( VERSION 3.10 ) set (CMAKE_CXX_STANDARD 14) project( "GeoModelVisualization" VERSION 3.2.0 LANGUAGES CXX ) -set ( CMAKE_BUILD_TYPE RELEASE ) +# set( CMAKE_BUILD_TYPE RELEASE ) -set (OpenGL_GL_PREFERENCE GLVND) +# Set the OpenGL flag requested by CMake +set( OpenGL_GL_PREFERENCE GLVND ) # Make the module directory visible to CMake. @@ -16,14 +17,7 @@ list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ) # Use the GNU install directory names. include( GNUInstallDirs ) -# Set up the "optional" dependencies. -# include( SetupJSON ) - - -# Project's dependencies. -find_package( GeoModelCore 3.2.0 REQUIRED ) -find_package( GeoModelIO 3.2.0 REQUIRED ) -find_package( Qt5 COMPONENTS Core Gui Widgets REQUIRED ) +# External dependencies. find_package( nlohmann_json REQUIRED ) # Set sub-packages to build. @@ -34,5 +28,4 @@ add_subdirectory(GeoModelExplorer) add_subdirectory(VP1Gui) add_subdirectory(VP1Base) add_subdirectory(VP1HEPVis) - add_subdirectory(VP1GuideLineSystems) diff --git a/GeoModelVisualization/GXClashPointSystems/CMakeLists.txt b/GeoModelVisualization/GXClashPointSystems/CMakeLists.txt index 5b75ff89a..86ed10f64 100644 --- a/GeoModelVisualization/GXClashPointSystems/CMakeLists.txt +++ b/GeoModelVisualization/GXClashPointSystems/CMakeLists.txt @@ -3,10 +3,6 @@ # Package: GXClashPointPlugin ################################################################################ - -set(CMAKE_BUILD_TYPE DEBUG) -set(CMAKE_CXX_FLAGS "-g -O0 -gdwarf-2") - set(MYLIB_VERSION_MAJOR 1) set(MYLIB_VERSION_MINOR 0) set(MYLIB_VERSION_PATCH 0) @@ -19,13 +15,8 @@ find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport Network ) find_package( Coin REQUIRED ) find_package( SoQt REQUIRED ) - - find_package(nlohmann_json QUIET) -#find_package( Qt5 COMPONENTS Core Gui Widgets Sql ) -if( APPLE ) - find_package(OpenGL REQUIRED) -endif() + # Find the header and source files. file( GLOB SOURCES src/*.cxx ) diff --git a/GeoModelVisualization/GeoModelExplorer/CMakeLists.txt b/GeoModelVisualization/GeoModelExplorer/CMakeLists.txt index d8e57d145..1a3195776 100644 --- a/GeoModelVisualization/GeoModelExplorer/CMakeLists.txt +++ b/GeoModelVisualization/GeoModelExplorer/CMakeLists.txt @@ -3,19 +3,14 @@ set(MYLIB_VERSION_MAJOR 1) set(MYLIB_VERSION_MINOR 0) set(MYLIB_VERSION_PATCH 0) -set( CMAKE_BUILD_TYPE DEBUG ) -set(CMAKE_CXX_FLAGS "-fPIC -O0 -g -gdwarf-2" ) - - - project ( "gmex" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH} LANGUAGES CXX ) find_package( Coin REQUIRED ) find_package( SoQt REQUIRED ) +find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport Network ) if ( APPLE ) find_package(OpenGL REQUIRED) endif() -find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport Network ) # Find the header and source files. @@ -23,7 +18,6 @@ file( GLOB SOURCES src/*.cxx ) file( GLOB HEADERS RunVP1Light/*.h ) - include_directories ("${PROJECT_SOURCE_DIR}") include_directories ("${PROJECT_SOURCE_DIR}/src") include_directories ("${PROJECT_SOURCE_DIR}/../VP1Gui") @@ -40,7 +34,10 @@ include_directories(${Qt5Network_INCLUDE_DIRS} ) include_directories(${Coin_INCLUDE_DIRS} ) include_directories(${SoQt_INCLUDE_DIRS} ) -add_definitions ( -DINSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}) +# Set a variable storing the CMake install prefix. +# -- It is passed to the C++ preprocessor to load the plugins from the C++ code +add_definitions ( -DGEOMODEL_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}) + add_definitions (${Qt5Core_DEFINITIONS}) add_definitions (${Qt5Gui_DEFINITIONS}) add_definitions (${Qt5OpenGL_DEFINITIONS}) diff --git a/GeoModelVisualization/GeoModelExplorer/src/main.cxx b/GeoModelVisualization/GeoModelExplorer/src/main.cxx index 735255da3..1292a2971 100644 --- a/GeoModelVisualization/GeoModelExplorer/src/main.cxx +++ b/GeoModelVisualization/GeoModelExplorer/src/main.cxx @@ -1,8 +1,9 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// Author: Joe Boudreau, repurposed from orginal work from -// Riccardo.Maria.Bianchi@cern.ch, Apr 2017 +// Author: Joe Boudreau, repurposed from orginal work from +// - Riccardo Maria Bianchi, Apr 2017 +// - Sebastian Andreas Merkt, 2018 // Update: Nov 2019 // // Qt includes @@ -18,6 +19,8 @@ // C++ includes #include <iostream> #include <cstdlib> + + #define STR_VALUE(arg) #arg #define STR_NAME(name) STR_VALUE(name) @@ -34,19 +37,20 @@ int main(int argc, char** argv) } }; // Preprocessor: we are passing the install directory to this - // class. Drivers will be loaded from this install directory. + // class, from the CMake configuration. + // Drivers will be loaded from this install directory. // However in some cases "linux" is part of the install directory // name and that may be defined in a macro to be 1. So if that is - // the case we temporarily undef it. + // the case we temporarily undef it. #ifdef linux #define waslinux linux #undef linux - const char * standardPlaces = STR_NAME( INSTALL_PREFIX ); + const char * standardPlaces = STR_NAME( GEOMODEL_INSTALL_PREFIX ); #define linux waslinux -#else - const char * standardPlaces = STR_NAME( INSTALL_PREFIX ); +#else + const char * standardPlaces = STR_NAME( GEOMODEL_INSTALL_PREFIX ); #endif - std::string gxpluginpath= std::string(standardPlaces)+"/lib/gxplugins"; + std::string gxpluginpath= std::string(standardPlaces)+"/lib/gxplugins"; pManip("GXPLUGINPATH",gxpluginpath.c_str()); QStringList arguments; for (int i = 0; i<=argc; i++){ @@ -65,7 +69,8 @@ int main(int argc, char** argv) bool helpIsSet = parser.isSet(helpOption); QStringList inputList=parser.positionalArguments(); - + + // This handles the input geometry files and the plugins int NGeomFiles=0; for (int i=0;i<inputList.size()-1;i++) { std::string input=inputList[i].toStdString(); @@ -76,14 +81,13 @@ int main(int argc, char** argv) setenv((std::string("GX_GEOMETRY_FILE")+std::to_string(NGeomFiles++)).c_str(),inputList[i].toStdString().c_str(), true); } } - - + // This handles the JSON files containing the geometry clash information int NJsonFiles=0; for (int i=0;i<inputList.size()-1;i++) { std::string input=inputList[i].toStdString(); if (input.find(".json")!=std::string::npos){ - + setenv((std::string("GX_JSON_FILE")+std::to_string(NJsonFiles++)).c_str(),inputList[i].toStdString().c_str(), true); } } @@ -100,7 +104,7 @@ int main(int argc, char** argv) } // Save settings - QSettings settings("ATLAS", "VP1Light"); + QSettings settings("ATLAS", "VP1Light"); // TODO: update labels! // Disable expert settings by default if(settings.value("ExpertSettings/notFirstStart").toString().isEmpty()){ settings.setValue("ExpertSettings/notFirstStart","1"); @@ -110,5 +114,5 @@ int main(int argc, char** argv) GXExecutionScheduler *scheduler=GXExecutionScheduler::init(); while (scheduler->interact()) GXExecutionScheduler::cleanup(scheduler); - + } diff --git a/GeoModelVisualization/VP1Base/CMakeLists.txt b/GeoModelVisualization/VP1Base/CMakeLists.txt index 4c0658e51..26ea983e2 100644 --- a/GeoModelVisualization/VP1Base/CMakeLists.txt +++ b/GeoModelVisualization/VP1Base/CMakeLists.txt @@ -7,10 +7,10 @@ project ( "GXBase" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB find_package( Coin REQUIRED ) find_package( SoQt REQUIRED ) +find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport ) if ( APPLE ) find_package(OpenGL REQUIRED) endif() -find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport ) diff --git a/GeoModelVisualization/VP1GeometryPlugin/CMakeLists.txt b/GeoModelVisualization/VP1GeometryPlugin/CMakeLists.txt index e5d2f4d8f..33e761527 100644 --- a/GeoModelVisualization/VP1GeometryPlugin/CMakeLists.txt +++ b/GeoModelVisualization/VP1GeometryPlugin/CMakeLists.txt @@ -16,9 +16,7 @@ endif() find_package( Coin REQUIRED ) find_package( SoQt REQUIRED ) find_package( Qt5 COMPONENTS Core Gui Widgets Sql ) -find_package( GeoModelCore REQUIRED ) -find_package( GeoModelIO REQUIRED ) -find_package( Eigen3 REQUIRED ) +# find_package( Eigen3 REQUIRED ) if( APPLE ) find_package(OpenGL REQUIRED) endif() @@ -58,7 +56,7 @@ include_directories(${Qt5Sql_INCLUDE_DIRS} ) include_directories(${Coin_INCLUDE_DIRS} ) include_directories(${SoQt_INCLUDE_DIRS} ) include_directories(${VP1HEPVis_INCLUDE_DIRS} ) -target_link_libraries (GXGeometryPlugin ${Qt5Core_LIBRARIES} GXGeometrySystems GXGuideLineSystems GXClashPointSystems GXGui GXBase GXHEPVis SoQt::SoQt Coin::Coin ${Qt5Gui_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} GeoModelCore::GeoModelKernel GeoModelCore::GeoGenericFunctions GeoModelIO::GeoModelRead GeoModelIO::TFPersistification GeoModelIO::GeoModelDBManager ) +target_link_libraries (GXGeometryPlugin ${Qt5Core_LIBRARIES} GXGeometrySystems GXGuideLineSystems GXClashPointSystems GXGui GXBase GXHEPVis SoQt::SoQt Coin::Coin ${Qt5Gui_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} GeoModelKernel GeoGenericFunctions GeoModelRead TFPersistification GeoModelDBManager ) add_definitions (${Qt5Core_DEFINITIONS}) install(TARGETS GXGeometryPlugin diff --git a/GeoModelVisualization/VP1GeometrySystems/CMakeLists.txt b/GeoModelVisualization/VP1GeometrySystems/CMakeLists.txt index 92abc1837..15447557b 100644 --- a/GeoModelVisualization/VP1GeometrySystems/CMakeLists.txt +++ b/GeoModelVisualization/VP1GeometrySystems/CMakeLists.txt @@ -1,34 +1,22 @@ -# $Id: CMakeLists.txt 732131 2016-03-24 11:03:29Z krasznaa $ ################################################################################ # Package: VP1GeometryPlugin ################################################################################ -set(CMAKE_BUILD_TYPE DEBUG) -set(CMAKE_CXX_FLAGS "-g -O0 -gdwarf-2") - set(MYLIB_VERSION_MAJOR 1) set(MYLIB_VERSION_MINOR 0) set(MYLIB_VERSION_PATCH 0) project ( "GXGeometrySystems" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH} LANGUAGES CXX ) -if ( APPLE ) - find_package(OpenGL REQUIRED) -endif() find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport Network ) - find_package( Coin REQUIRED ) find_package( SoQt REQUIRED ) -#find_package( Qt5 COMPONENTS Core Gui Widgets Sql ) -find_package( GeoModelCore REQUIRED ) -find_package( GeoModelIO REQUIRED ) -find_package( Eigen3 REQUIRED ) +# find_package( Eigen3 REQUIRED ) find_package(nlohmann_json QUIET) -if( APPLE ) +if ( APPLE ) find_package(OpenGL REQUIRED) endif() - # Find the header and source files. file( GLOB SOURCES src/*.cxx ) file( GLOB HEADERS VP1GeometrySystems/*.h ) @@ -78,12 +66,17 @@ endif() if ( APPLE ) target_link_directories (GXGeometrySystems PUBLIC ${Coin_LIB_DIR} ) - target_link_libraries (GXGeometrySystems SoQt::SoQt Coin::Coin GeoModelCore::GeoModelKernel ${Qt5Core_LIBRARIES} GXGui GXBase GXHEPVis GeoModelIO::GeoModelRead GeoModelIO::GeoModelWrite ${SoQt_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} ) + target_link_libraries (GXGeometrySystems SoQt::SoQt Coin::Coin GeoModelKernel ${Qt5Core_LIBRARIES} GXGui GXBase GXHEPVis GeoModelRead GeoModelWrite ${SoQt_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} ) else() - target_link_libraries (GXGeometrySystems SoQt::SoQt Coin::Coin GeoModelCore::GeoModelKernel ${Qt5Core_LIBRARIES} GXGui GXBase GXHEPVis GeoModelIO::GeoModelRead GeoModelIO::GeoModelWrite ${SoQt_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} ) + target_link_libraries (GXGeometrySystems SoQt::SoQt Coin::Coin GeoModelKernel ${Qt5Core_LIBRARIES} GXGui GXBase GXHEPVis GeoModelRead GeoModelWrite ${SoQt_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} ) endif() +# Set a variable storing the CMake install prefix. +# -- It is passed to the C++ preprocessor to load, from the C++ code, +# -- the JSON files storing the default materials and volume attributes +# -- for Coin3D. +add_definitions ( -DGEOMODEL_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}) diff --git a/GeoModelVisualization/VP1Gui/CMakeLists.txt b/GeoModelVisualization/VP1Gui/CMakeLists.txt index b1b6c0152..b13feb93e 100644 --- a/GeoModelVisualization/VP1Gui/CMakeLists.txt +++ b/GeoModelVisualization/VP1Gui/CMakeLists.txt @@ -1,17 +1,16 @@ set(MYLIB_VERSION_MAJOR 1) set(MYLIB_VERSION_MINOR 0) set(MYLIB_VERSION_PATCH 0) -set (CMAKE_BUILD_TYPE DEBUG) -set (CMAKE_CXX_FLAGS "-g -O0 -gdwarf-2") project ( "GXGui" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH} LANGUAGES CXX ) + find_package( Coin REQUIRED ) find_package( SoQt REQUIRED ) +find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport Network ) if ( APPLE ) find_package(OpenGL REQUIRED) endif() -find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport Network ) diff --git a/GeoModelVisualization/VP1GuideLineSystems/CMakeLists.txt b/GeoModelVisualization/VP1GuideLineSystems/CMakeLists.txt index fd4fc0c1a..ea22c48e5 100644 --- a/GeoModelVisualization/VP1GuideLineSystems/CMakeLists.txt +++ b/GeoModelVisualization/VP1GuideLineSystems/CMakeLists.txt @@ -1,30 +1,20 @@ -# $Id: CMakeLists.txt 732131 2016-03-24 11:03:29Z krasznaa $ ################################################################################ # Package: VP1GuideLinePlugin ################################################################################ - -set(CMAKE_BUILD_TYPE DEBUG) -set(CMAKE_CXX_FLAGS "-g -O0 -gdwarf-2") - set(MYLIB_VERSION_MAJOR 1) set(MYLIB_VERSION_MINOR 0) set(MYLIB_VERSION_PATCH 0) project ( "GXGuideLineSystems" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH} LANGUAGES CXX ) -if ( APPLE ) - find_package(OpenGL REQUIRED) -endif() find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport Network ) - find_package( Coin REQUIRED ) find_package( SoQt REQUIRED ) -#find_package( Qt5 COMPONENTS Core Gui Widgets Sql ) -find_package( GeoModelCore REQUIRED ) -if( APPLE ) +if ( APPLE ) find_package(OpenGL REQUIRED) endif() + # Find the header and source files. file( GLOB SOURCES src/*.cxx ) file( GLOB HEADERS VP1GuideLineSystems/*.h ) @@ -58,9 +48,9 @@ include_directories(${VP1HEPVis_INCLUDE_DIRS} ) if ( APPLE ) target_link_directories (GXGuideLineSystems PUBLIC ${Coin_LIB_DIR} ) - target_link_libraries (GXGuideLineSystems SoQt::SoQt Coin::Coin GeoModelCore::GeoModelKernel ${Qt5Core_LIBRARIES} GXGui GXBase GXHEPVis ${SoQt_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} ) + target_link_libraries (GXGuideLineSystems SoQt::SoQt Coin::Coin GeoModelKernel ${Qt5Core_LIBRARIES} GXGui GXBase GXHEPVis ${SoQt_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} ) else() - target_link_libraries (GXGuideLineSystems SoQt::SoQt Coin::Coin GeoModelCore::GeoModelKernel ${Qt5Core_LIBRARIES} GXGui GXBase GXHEPVis ${SoQt_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} ) + target_link_libraries (GXGuideLineSystems SoQt::SoQt Coin::Coin GeoModelKernel ${Qt5Core_LIBRARIES} GXGui GXBase GXHEPVis ${SoQt_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} ) endif() diff --git a/GeoModelVisualization/VP1HEPVis/CMakeLists.txt b/GeoModelVisualization/VP1HEPVis/CMakeLists.txt index a0ee5c5bd..924eb5142 100644 --- a/GeoModelVisualization/VP1HEPVis/CMakeLists.txt +++ b/GeoModelVisualization/VP1HEPVis/CMakeLists.txt @@ -6,10 +6,7 @@ set(MYLIB_VERSION_PATCH 0) project ( "GXHEPVis" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH} LANGUAGES CXX ) find_package( Coin REQUIRED ) -# if ( APPLE ) - find_package(OpenGL REQUIRED) -# endif() - +find_package( OpenGL REQUIRED ) # Find the header and source files. @@ -17,22 +14,22 @@ file( GLOB SOURCES src/*.cxx ) file( GLOB HEADERS VP1HEPVis/*.h ) - - include_directories ("${PROJECT_SOURCE_DIR}") + add_library ( GXHEPVis SHARED ${SOURCES} ${HEADERS} ) # External dependencies: -find_package( Qt5 COMPONENTS Core ) -include_directories(${Qt5Core__INCLUDE_DIRS} ) +# find_package( Qt5 COMPONENTS Core ) +# include_directories(${Qt5Core__INCLUDE_DIRS} ) include_directories(${Coin_INCLUDE_DIR} ) + +target_link_libraries( GXHEPVis PUBLIC +GeoModelKernel Coin::Coin ) if ( APPLE ) - target_link_libraries (GXHEPVis ${Qt5Core_LIBRARIES} ${Coin_LIBRARIES} ${OPENGL_LIBRARIES} ) + target_link_libraries (GXHEPVis PUBLIC ${OPENGL_LIBRARIES} ) target_link_directories (GXHEPVis PUBLIC ${Coin_LIB_DIR} ) -else() - target_link_libraries (GXHEPVis ${Qt5Core_LIBRARIES} ) endif() -add_definitions (${Qt5Core_DEFINITIONS}) +# add_definitions (${Qt5Core_DEFINITIONS}) install(TARGETS GXHEPVis diff --git a/README.md b/README.md index e69de29bb..1c2b6e1c2 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,118 @@ + +# GeoModel --- A user-friendly C++ Toolkit for HEP Detector Description + +GeoModel is a user-friendly C++ Toolkit and Suite for HEP Detector Description with minimal dependencies. + +## Dependencies + +The philosophy of the whole GeoModel Suite is to keep the external dependencies at the minimum. + +Currently, these are the dependencies: + +- GeoModel base classes (GeoModelCore, GeoModelIO): + - Eigen -- a math library + - + +## Build + +### Build tree + +By default, only the base classes will be built: + +- GeoModelCore + - GeoModelKernel + - GeoGenericFunctions +- GeoModelIO + - GeoModelDBManager + - GeoModelWrite + - GeoModelRead + - TFPersistification +- GeoModelTools + - ExpressionEvaluator + - GeoModelJSONParser + - GeoModelXMLParser + - GMCAT + +On request, additional packages, libraries, and tools can be built: + +- GeoModelVisualization (`gmex`) +- GeoModelExamples +- GeoModelG4 + - GeoMaterial2G4 + - GeoModel2G4 +- FullSimLight + +!!! note + Some of the optional packages bring in additional dependencies, for example libraries to handle 3D graphics and Geant4 for standalone detector simulations. + In particular, these are the additional dependencies and the packages that bring them: + + - GeoModelVisualization: Qt5, Coin3D, SoQt + - Examples about the classes handling the GeoModel->Geant4 translation: Geant4 + - GeoModelG4: Geant4 + +### Build options + +While configuring the build, you can enable the build of the optional packages. For example, if you want to build the examples, you can set the variable `GEOMODEL_BUILD_EXAMPLES` to `1` at CMake configuration time, in this way: + +``` +cmake -DGEOMODEL_BUILD_EXAMPLES=1 ../GeoModel/ +``` + + +#### Visualization + +``` +GEOMODEL_BUILD_VISUALIZATION=1 +``` + +will enable the build of the geometry visualization tool, `GeoModelExplorer`, or `gmex`. This brings in additional dependencies for the GUI and to handle 3D graphics: Qt5, Coin3D, and SoQt. + + +#### Examples + + +There are other variables to control the build. In particular: + +``` +GEOMODEL_BUILD_EXAMPLES=1 +``` + +will enable the build of all the examples, except those requiring Geant4. + +``` +GEOMODEL_BUILD_EXAMPLES_W_GEANT4=1 +``` + +will enable the build of the examples requiring Geant4 as well. + + +#### GeoModel --> Geant4 interface + +``` +GEOMODEL_BUILD_GEOMODELG4=1 +``` + +will build the interface classes which translate GeoModel nodes into Geant4 entities. +This brings in an additional dependency on Geant4. + + +#### Standalone detector simulation + +``` +GEOMODEL_BUILD_FULLSIMLIGHT=1 +``` + +will build the Geant4-based application which let users run standalone simulations on a complete detector geometry or on a piece of that. This brings in an additional dependency on Geant4. + + + +!!! note + When used during the CMake configuration step, all the variables must be prefixed by `-D`, like in the first example of this section. + + For example, + + ``` + cmake -DGEOMODEL_BUILD_VISUALIZATION=1 -DGEOMODEL_BUILD_EXAMPLES=1 ../GeoModel + ``` + + will build the base classes, the visualization tool (`gmex`), and the examples (the ones that not require Geant4). diff --git a/cmake/PrintBuildInfo.cmake b/cmake/PrintBuildInfo.cmake index fff48a16a..862a34b45 100644 --- a/cmake/PrintBuildInfo.cmake +++ b/cmake/PrintBuildInfo.cmake @@ -2,8 +2,8 @@ if( COLOR_DEFS ) message(STATUS "-----") - message(STATUS "${Blue}Building with type: ${CMAKE_BUILD_TYPE}${ColourReset}") - message(STATUS "${Blue}Using C++ standard: ${CMAKE_CXX_STANDARD}${ColourReset}") + message(STATUS "${BoldYellow}Building with type: ${CMAKE_BUILD_TYPE}${ColourReset}") + message(STATUS "${BoldYellow}Using C++ standard: ${CMAKE_CXX_STANDARD}${ColourReset}") message(STATUS "-----") else() message(STATUS "-----") diff --git a/documentation/.gitlab-ci.yml b/documentation/.gitlab-ci.yml index a8bb3e93c..0d79102fb 100755 --- a/documentation/.gitlab-ci.yml +++ b/documentation/.gitlab-ci.yml @@ -1,7 +1,23 @@ stages: + - pre-build - build - deploy +get-info-from-git: + stage: pre-build + script: + - curl "https://gitlab.cern.ch/api/v4/projects/95156/repository/contributors/" -o contributors.json # '95156' is the GeoModel's Project ID in CERN GitLab + +get-today-date: + stage: pre-build + script: + - read mon day year <<< $(date -d "2 days" "+%b %_d %Y") # on macOS, use 'gdate' (coming with 'brew install coreutils') + - testdate="$mon $day $year" + - echo -e "today date:\ ${testdate}\n" + - echo "{update:[{date:\"${testdate}\",flag:value}]}" > update.json + +#TODO: implement the method which takes the contributors and the update date into the docs + building: stage: build image: gitlab-registry.cern.ch/authoring/documentation/mkdocs:stable diff --git a/documentation/docs/dev/contribs.md b/documentation/docs/dev/contribs.md index 23ef203e5..01312abf3 100644 --- a/documentation/docs/dev/contribs.md +++ b/documentation/docs/dev/contribs.md @@ -1,7 +1,15 @@ # GeoModel Contributors - _(All contributors on this page are listed in alphabetical order)_ +## GeoModel Core Development Team + + - Marilena Bandieramonte _(University of Pittsburgh, US)_ + - Riccardo Maria Bianchi _(University of Pittsburgh, US)_ + - Joseph Francis Boudreau _(University of Pittsburgh, US)_ + - Andrea Dell'Acqua _(CERN, CH)_ + - Vakhtang Tsulaia _(LBNL, US)_ + +## All GeoModel Contributors **Coming Soon** diff --git a/documentation/docs/dev/index.md b/documentation/docs/dev/index.md index 18ac5fdd9..c623bf088 100644 --- a/documentation/docs/dev/index.md +++ b/documentation/docs/dev/index.md @@ -10,6 +10,14 @@ In the following, you will find basic strategies to effectively build the GeoMod ## System Dependencies +### Compilers + +In the GeoModel packages, we use modern C++ constructs (C++ 14 and sometimes C++17). Thus, before trying to compile the GeoModel libraries, be sure your compiler supports C++17. + +!!! note + + If you use GCC, we successfully tested the build of GeoModel packages on GCC 6.2 and beyond (GCC 7, GCC 8). + ### macOS @@ -36,7 +44,7 @@ Then, you can remove the old GeoModel packages with, for example: brew remove geomodelcore ``` -Please remove **all** the `geomodel`- packages before trying to build the packages from source. +Please remove **all** the `geomodel`-packages before trying to build the packages from source. See also the [Troubleshooting](troubleshooting.md) page for additional help. @@ -64,6 +72,11 @@ With these instructions you will build the whole the software stack for GeoModel ### Build and Install locally +#### Build the dependencies for graphics (only needed for GeoModelVisualization) + +If you are working + + ```bash # Build Coin3D wget https://bitbucket.org/Coin3D/coin/downloads/coin-4.0.0-src.zip @@ -84,6 +97,7 @@ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../install ../soqt make -j make install cd .. +``` # Build GeoModelCore git clone https://gitlab.cern.ch/GeoModelDev/GeoModelCore.git -- GitLab