Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New CMake ROOT usage / Minor feature in libraries / Pipeline image change #145

Merged
merged 3 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 47 additions & 47 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
#image: lobis/root-geant4-garfieldpp:cxx14_ROOTv6-25-01_Geant4v10.4.3
image: nkx1231/root6-geant4-garfield:0.6
image: ghcr.io/lobis/root-geant4-garfield:cpp17_ROOT-v6-26-00_Geant4-v10.4.3_Garfield-af4a1451
#image: nkx1231/root6-geant4-garfield:0.6

variables:
# GIT_SUBMODULE_STRATEGY: recursive

stages:
# Basic checks to verify correctness of code
# Basic checks to verify correctness of code
- pre-build

# Project compilation validation
# Project compilation validation
- build

# REST libraries installed as sub-modules
# REST libraries installed as sub-modules
- libraries

# Basic validation tests of installation
# Basic validation tests of installation
- install

# Basic core validation tests
# Basic core validation tests
- core

# Stage dedicated to validate metadata classes. gas, readout, g4Metadata, etc
# Stage dedicated to validate metadata classes. gas, readout, g4Metadata, etc
- metadata

# Stage to validate restG4 package examples
# Stage to validate restG4 package examples
- restG4

# Stage to validate data chain processing constructions (TREX-DM data, PandaX-III topology, etc).
# Stage to validate data chain processing constructions (TREX-DM data, PandaX-III topology, etc).
- restManager_process

# Stage to validate tasks or executions over preprocessed data filesx
# Stage to validate tasks or executions over preprocessed data filesx
- postProcessing

# Stage to validate other restManager tasks (metadata generation, script loading, etc).
# Stage to validate other restManager tasks (metadata generation, script loading, etc).
- restManager_generate

# Scripts to launch more complete tests. TRestGas file generation, Geant4 physics validation, etc.
# Scripts to launch more complete tests. TRestGas file generation, Geant4 physics validation, etc.
- deploy

before_script:
- pwd
- export USER="test"
# - export GIT_SSL_NO_VERIFY=1
# - export GIT_SSL_NO_VERIFY=1
- echo $CI_SERVER_HOST
- echo $CRONJOB
# We redefine the HOME
# We redefine the HOME
- export HOME=${CI_PROJECT_DIR}/install_latest/
- if [ -d $HOME/.rest ]; then rm -Rf $HOME/.rest; fi
- if [ -f "/opt/root/install/bin/thisroot.sh" ]; then source /opt/root/install/bin/thisroot.sh; fi
Expand Down Expand Up @@ -73,11 +73,11 @@ clang-format:
- $CRONJOB == "YES"

validateCode:
stage: pre-build
script:
- cd ${CI_PROJECT_DIR}/
- python3 pull-submodules.py --force --dontask
- python3 pipeline/validateProcesses.py source/libraries/
stage: pre-build
script:
- cd ${CI_PROJECT_DIR}/
- python3 pull-submodules.py --force --dontask
- python3 pipeline/validateProcesses.py source/libraries/

#axionLib:
# stage: libraries
Expand Down Expand Up @@ -124,27 +124,27 @@ build_latest:
- if [ -d ${CI_PROJECT_DIR}/install_latest ]; then rm -Rf ${CI_PROJECT_DIR}/install_latest; fi
- cmake ${CI_PROJECT_DIR} -DREST_WELCOME=OFF -DREST_GARFIELD=ON -DREST_G4=ON -DRESTLIB_DETECTOR=ON -DRESTLIB_RAW=ON -DRESTLIB_TRACK=ON -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/install_latest
- make install -j2
# - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
# - . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
artifacts:
paths:
- ${CI_PROJECT_DIR}/install_latest
expire_in: 1 day

#build_latest_root622_geant4v1042:
# image: lobis/root-geant4-garfieldpp:cxx14_ROOTv6-22-08_Geant4v10.4.2
# type: build
# script:
# - cd ${CI_PROJECT_DIR}/
# - python3 pull-submodules.py --force --dontask --latest
# - if [ -d ${CI_PROJECT_DIR}/build_latest2 ]; then rm -Rf ${CI_PROJECT_DIR}/build_latest2; fi
#build_latest_root622_geant4v1042:
# image: lobis/root-geant4-garfieldpp:cxx14_ROOTv6-22-08_Geant4v10.4.2
# type: build
# script:
# - cd ${CI_PROJECT_DIR}/
# - python3 pull-submodules.py --force --dontask --latest
# - if [ -d ${CI_PROJECT_DIR}/build_latest2 ]; then rm -Rf ${CI_PROJECT_DIR}/build_latest2; fi
# - mkdir ${CI_PROJECT_DIR}/build_latest2 && cd ${CI_PROJECT_DIR}/build_latest2/
# - if [ -d ${CI_PROJECT_DIR}/install_latest2 ]; then rm -Rf ${CI_PROJECT_DIR}/install_latest2; fi
# - cmake ${CI_PROJECT_DIR} -DREST_WELCOME=OFF -DREST_GARFIELD=ON -DREST_G4=ON -DRESTLIB_DETECTOR=ON -DRESTLIB_RAW=ON -DRESTLIB_TRACK=ON -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/install_latest2
# - make install -j2
# - . ${CI_PROJECT_DIR}/install_latest2/thisREST.sh
# except:
# variables:
# - $CRONJOB == "YES"
# variables:
# - $CRONJOB == "YES"

#build_nkx:
# image: nkx1231/root6-geant4-garfield:0.6
Expand Down Expand Up @@ -202,24 +202,24 @@ listRESTMacros:
expire_in: 1 day

LoadGas:
type: metadata
type: metadata
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/metadata/gas/
- restRoot -b -q LoadGasFromServerAndValidate.C
only:
variables:
- $CI_SERVER_HOST == "lfna.unizar.es"
variables:
- $CI_SERVER_HOST == "lfna.unizar.es"

GenerateGas:
type: metadata
type: metadata
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/metadata/gas/
- restRoot -b -q GenerateDummyGas.C
only:
variables:
- $CI_SERVER_HOST == "lfna.unizar.es"
variables:
- $CI_SERVER_HOST == "lfna.unizar.es"

AnalysisTree:
type: core
Expand All @@ -229,17 +229,17 @@ AnalysisTree:
- restRoot -b -q simpleTree.cpp

GenerateReadout:
type: metadata
type: metadata
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/metadata/readout/
- restManager --c generateReadout.rml --o readout.root
- restRoot -b -q PrintReadout.C'("readout.root")' > /dev/null
# We need to introduce basic validation here
# - diff validation.txt print.txt
# We need to introduce basic validation here
# - diff validation.txt print.txt

BasicReadout:
type: metadata
type: metadata
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- cd ${CI_PROJECT_DIR}/projects/basic-readouts/
Expand All @@ -260,7 +260,7 @@ testMeta:
- ${CI_PROJECT_DIR}/install_latest/examples/meta.root
expire_in: 1 day

trexDM_data_latest:
trexDM_data_latest:
type: restManager_process
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
Expand All @@ -279,7 +279,7 @@ trexDM_data_latest:
- ${CI_PROJECT_DIR}/pipeline/trex/Hits_01928.root
expire_in: 1 day

pandaXIII_Topological:
pandaXIII_Topological:
type: restManager_process
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
Expand All @@ -293,7 +293,7 @@ pandaXIII_Topological:
- ${CI_PROJECT_DIR}/pipeline/pandaxiii_MC/trackParameter.png
expire_in: 1 week

pandaXIII_Topological_fromG4:
pandaXIII_Topological_fromG4:
type: restManager_process
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
Expand All @@ -307,7 +307,7 @@ pandaXIII_Topological_fromG4:
- ${CI_PROJECT_DIR}/pipeline/pandaxiii_MC/testOutput.root
expire_in: 1 week

pandaXIII_data:
pandaXIII_data:
type: restManager_process
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
Expand All @@ -319,16 +319,16 @@ pandaXIII_data:
paths:
- ${CI_PROJECT_DIR}/pipeline/pandaxiii_data/TriggerRate.png
expire_in: 1 week
EventSelection:

EventSelection:
type: restManager_process
script:
- . ${CI_PROJECT_DIR}/install_latest/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/selection
- restManager --c g4Analysis.rml --f "${CI_PROJECT_DIR}/install_latest/examples/restG4/01.NLDBD/Run00001_NLDBD_Test.root"
- restManager --c g4OnSelection.rml --f Run00001_NLDBD_Test_g4Analysis.root
- restRoot -b -q Validate.C'("Run00001_NLDBD_Test_EvSelection.root")'

artifacts:
paths:
- ${CI_PROJECT_DIR}/pipeline/selection/IDs.txt
Expand Down
34 changes: 21 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,27 @@ set(CMAKE_MACOSX_RPATH 1)

find_package(ROOT REQUIRED)

set(ROOT_REQUIRED_LIBRARIES Core RIO Geom Gdml Minuit Spectrum XMLIO)
# Switch to enable ROOT Eve functionality.
if (NOT DEFINED REST_EVE)
set(REST_EVE ON)
endif ()
if (${REST_EVE} MATCHES "ON")
add_definitions(-DUSE_Eve)
list(APPEND rest_features "Eve")
set(ROOT_REQUIRED_LIBRARIES ${ROOT_REQUIRED_LIBRARIES} Eve RGL)
else ()
set(excludes ${excludes} TRestEveEventViewer)
endif (${REST_EVE} MATCHES "ON")

find_package(ROOT REQUIRED COMPONENTS ${ROOT_REQUIRED_LIBRARIES})

message(STATUS "ROOT LIBRARIES: ${ROOT_LIBRARIES}")

set(external_libs "${external_libs};${ROOT_LIBRARIES}")

set(ROOTCINT_EXECUTABLE ${ROOT_rootcint_CMD})

execute_process(COMMAND root-config --has-cxx20 OUTPUT_VARIABLE HASCXX20)
execute_process(COMMAND root-config --has-cxx17 OUTPUT_VARIABLE HASCXX17)
execute_process(COMMAND root-config --has-cxx14 OUTPUT_VARIABLE HASCXX14)
Expand All @@ -76,19 +97,6 @@ elseif (${HASCXX11} MATCHES "yes")
endif ()

set(external_include_dirs ${external_include_dirs} ${ROOT_INCLUDE_DIRS})
set(external_libs ${external_libs} "${ROOT_LIBRARIES} -lGui -lGeom -lGdml -lMinuit -lSpectrum")

# Switch to enable ROOT Eve functionality.
if (NOT DEFINED REST_EVE)
set(REST_EVE ON)
endif ()
if (${REST_EVE} MATCHES "ON")
add_definitions(-DUSE_Eve)
list(APPEND rest_features "Eve")
set(external_libs "${external_libs} -lEve -lRGL")
else ()
set(excludes ${excludes} TRestEveEventViewer)
endif (${REST_EVE} MATCHES "ON")

# This is to enable linking of SQL libraries. I.e. for process TRestSQLToAnalysisProccess.
if (NOT DEFINED SQL)
Expand Down
74 changes: 37 additions & 37 deletions cmake/CollectGitInfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,82 +6,82 @@ set(GIT_BRANCH)
set(GIT_CLEANSTATE)
set(REST_OFFICIAL_RELEASE "No")

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
return()
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
return()
endif ()

execute_process(COMMAND git status --porcelain
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE GIT_CLEANSTATE ERROR_VARIABLE gitstatuserr)
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE GIT_CLEANSTATE ERROR_VARIABLE gitstatuserr)

if( GIT_CLEANSTATE STREQUAL "" )
set( GIT_CLEANSTATE "Yes" )
else()
set( GIT_CLEANSTATE "No" )
endif()
if (GIT_CLEANSTATE STREQUAL "")
set(GIT_CLEANSTATE "Yes")
else ()
set(GIT_CLEANSTATE "No")
endif ()

execute_process(COMMAND git describe --tags
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE gitdiscribe ERROR_VARIABLE err)
execute_process(COMMAND git describe --tags
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE gitdiscribe ERROR_VARIABLE err)

if(err MATCHES ".*fatal.*")
message("Warning! not a git repository")
return()
endif()
if (err MATCHES ".*fatal.*")
message("Warning! not a git repository")
return()
endif ()

set(GIT_VALID TRUE)

#get git tag
string(REGEX REPLACE "v(.*)-(.*)-(.*)"
"v\\1" version
${gitdiscribe})
"v\\1" version
${gitdiscribe})
string(REPLACE "\n" "" version ${version})
set(GIT_TAG ${version})

execute_process(COMMAND git rev-list -n 1 ${GIT_TAG}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE GIT_LASTTAG_COMMIT)
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE GIT_LASTTAG_COMMIT)

string(SUBSTRING ${GIT_LASTTAG_COMMIT} 0 8 GIT_LASTTAG_COMMIT)
#message( STATUS "Git LatestTag commit: ${GIT_LASTTAG_COMMIT}" )

#get git commit date
execute_process(COMMAND git log -1 --format=%ai
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE git_date)
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE git_date)
string(REPLACE "\n" "" git_date ${git_date})
set(GIT_DATE ${git_date})

#get git number
execute_process(COMMAND git rev-parse --verify HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE git_ver)
string(SUBSTRING ${git_ver} 0 8 git_commit )
execute_process(COMMAND git rev-parse --verify HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE git_ver)
string(SUBSTRING ${git_ver} 0 8 git_commit)
set(GIT_COMMIT ${git_commit})

#get git branch
execute_process(COMMAND git branch
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_FILE /tmp/temp.txt)
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_FILE /tmp/temp.txt)
execute_process(COMMAND grep -e "^*"
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
INPUT_FILE /tmp/temp.txt
OUTPUT_VARIABLE git_branch)
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
INPUT_FILE /tmp/temp.txt
OUTPUT_VARIABLE git_branch)
execute_process(COMMAND rm /tmp/temp.txt)
string(REPLACE "\n" "" git_branch ${git_branch})
string(SUBSTRING ${git_branch} 2 -1 git_branch)
set(GIT_BRANCH ${git_branch})

if( GIT_COMMIT STREQUAL GIT_LASTTAG_COMMIT )
set( REST_OFFICIAL_RELEASE "Yes" )
endif()
if (GIT_COMMIT STREQUAL GIT_LASTTAG_COMMIT)
set(REST_OFFICIAL_RELEASE "Yes")
endif ()

message("")
message(STATUS "REST release : ${GIT_TAG}")
message(STATUS "REST date : ${GIT_DATE}")
message(STATUS "REST commit : ${GIT_COMMIT}")
message(STATUS "REST branch : ${GIT_BRANCH}")
message("")
message( STATUS "Clean state: ${GIT_CLEANSTATE}" )
message( STATUS "REST Official release: ${REST_OFFICIAL_RELEASE}" )
message(STATUS "Clean state: ${GIT_CLEANSTATE}")
message(STATUS "REST Official release: ${REST_OFFICIAL_RELEASE}")
message("")
Loading