Skip to content

Commit

Permalink
Merge pull request #155 from sfegan/main
Browse files Browse the repository at this point in the history
Move to ADH APIs
  • Loading branch information
sfegan authored Sep 17, 2024
2 parents 352fd20 + 36a2cc5 commit d1261a2
Show file tree
Hide file tree
Showing 418 changed files with 76,019 additions and 42,755 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/native-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,16 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
compiler: [ [gcc-11, g++-11, 'gcc-11 g++-11', broadwell ],
os: [ubuntu-22.04]
geant: [11.2.2]
compiler: [ [gcc-12, g++-12, 'gcc-12 g++-12', broadwell ],
[gcc-11, g++-11, 'gcc-11 g++-11', broadwell ],
[gcc-10, g++-10, 'gcc-10 g++-10', broadwell ],
[gcc-9, g++-9, 'gcc-9 g++-9', broadwell ],
[gcc-8, g++-8, 'gcc-8 g++-8', broadwell ],
[gcc-7, g++-7, 'gcc-7 g++-7', broadwell ],
[clang-12, clang++-12, 'clang-12', broadwell ],
[clang-11, clang++-11, 'clang-11', broadwell ],
[clang-10, clang++-10, 'clang-10', broadwell ] ]
[clang-15, clang++-15, 'clang-15', broadwell ],
[clang-14, clang++-14, 'clang-14', broadwell ],
[clang-13, clang++-13, 'clang-13', broadwell ],
[clang-12, clang++-12, 'clang-12', broadwell ] ]

runs-on: ${{ matrix.os }}

Expand All @@ -64,13 +65,13 @@ jobs:
shell: bash
run: |
sudo apt-get update -y
sudo apt-get install -y gsl-bin libgsl0-dev libfftw3-dev python-numpy \
sudo apt-get install -y gsl-bin libgsl0-dev libfftw3-dev \
libzmq3-dev python3 python3-dev python3-numpy libxerces-c-dev \
libpcap-dev libz-dev libprotobuf-c-dev protobuf-c-compiler \
libprotobuf-dev protobuf-compiler libprotoc-dev libzstd-dev \
${{ matrix.compiler[2] }}
curl -L https://github.com/llr-cta/CamerasToACTLRelease/releases/download/latest/CamerasToACTL.tgz | sudo tar -zxf - -C /
curl -L https://github.com/llr-cta/Geant4Build/releases/download/ubuntu-20.04-10.7.2/Geant4-ubuntu-20.04-10.7.2.tbz2 | sudo tar -jxf - -C /
curl -L https://github.com/llr-cta/CTA_ADH_APIS_Build/releases/download/${{matrix.os}}/cta_adh_apis_installed.tgz | sudo tar -zxf - -C /
curl -L https://github.com/llr-cta/Geant4Build/releases/download/${{matrix.os}}-${{matrix.geant}}-OFF/Geant4-${{matrix.os}}-${{matrix.geant}}-OFF.tbz2 | sudo tar -jxf - -C /
- name: Print version information
shell: bash
run: |
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/singularity-build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
geant: [11.2.2]
arch: [ 'generic', 'ivybridge', 'broadwell', 'cascadelake' ]

runs-on: ubuntu-20.04
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
Expand All @@ -44,14 +46,14 @@ jobs:
shell: bash
run: |
sudo apt-get update -y
sudo apt-get install -y gsl-bin libgsl0-dev libfftw3-dev python-numpy \
sudo apt-get install -y gsl-bin libgsl0-dev libfftw3-dev \
libzmq3-dev python3 python3-dev python3-numpy libxerces-c-dev \
libpcap-dev libz-dev libprotobuf-c-dev protobuf-c-compiler \
libprotobuf-dev protobuf-compiler libprotoc-dev libzstd-dev \
build-essential libssl-dev uuid-dev libgpgme11-dev squashfs-tools \
libseccomp-dev pkg-config
curl -L https://github.com/llr-cta/CamerasToACTLRelease/releases/download/latest/CamerasToACTL.tgz | sudo tar -zxf - -C /
curl -L https://github.com/llr-cta/Geant4Build/releases/download/ubuntu-20.04-10.7.2/Geant4-ubuntu-20.04-10.7.2.tbz2 | sudo tar -jxf - -C /
curl -L https://github.com/llr-cta/CTA_ADH_APIS_Build/releases/download/${{matrix.os}}/cta_adh_apis_installed.tgz | sudo tar -zxf - -C /
curl -L https://github.com/llr-cta/Geant4Build/releases/download/${{matrix.os}}-${{matrix.geant}}-OFF/Geant4-${{matrix.os}}-${{matrix.geant}}-OFF.tbz2 | sudo tar -jxf - -C /
- name: Configure calin
shell: bash
Expand All @@ -61,7 +63,7 @@ jobs:
cmake -DCALIN_BUILD_ARCH=${{ matrix.arch }} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCALIN_PYTHON_SUB_DIR=lib/python3.8 \
-DCALIN_PYTHON_SUB_DIR=lib/python3.10 \
-DNO_GEANT4_TEST:BOOLEAN=TRUE \
..
Expand All @@ -87,9 +89,10 @@ jobs:
ls -l /tmp/calin_installed.tgz
- name: Set up Go 1.13
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.13
cache: false
id: go

- name: Install Singularity
Expand Down
22 changes: 7 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.

cmake_minimum_required(VERSION 3.3)
cmake_minimum_required(VERSION 3.15)
project(calin)
enable_testing()

Expand Down Expand Up @@ -97,18 +97,14 @@ include_directories(${SQLITE3_INCLUDE_DIR})
set(EXTRA_LIBS ${EXTRA_LIBS} ${SQLITE3_LIBRARY} )

## Find Python interpreter and libraries
find_package(PythonInterp 3 REQUIRED)
find_package(PythonLibs 3 REQUIRED)
include_directories(${PYTHON_INCLUDE_PATH})

## Find Numpy since we use numpy arrays here
find_package(Numpy)
include_directories(${PYTHON_NUMPY_INCLUDE_DIR})
find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
include_directories(${Python3_INCLUDE_DIRS} ${Python3_NumPy_INCLUDE_DIRS})
message(STATUS "Python3_LIBRARIES:" ${Python3_LIBRARIES})

## Find SWIG and set SWIG include paths to "swig", "include" and "proto"
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
set(CMAKE_SWIG_FLAGS -py3 -I${CMAKE_SOURCE_DIR}/swig -I${CMAKE_BINARY_DIR}/swig -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_BINARY_DIR}/include -I${CMAKE_BINARY_DIR}/proto)
set(CMAKE_SWIG_FLAGS -I${CMAKE_SOURCE_DIR}/swig -I${CMAKE_BINARY_DIR}/swig -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_BINARY_DIR}/include -I${CMAKE_BINARY_DIR}/proto)

## Find ZeroMQ
find_package(ZMQ REQUIRED)
Expand All @@ -123,12 +119,8 @@ if(XercesC_FOUND)
set(CALIN_HAVE_XERCESC TRUE)
endif()

## Find the CTA CamerasToACTL package
set(CALIN_HAVE_CTA_CAMERASTOACTL FALSE)
find_package(CTA_CAMERASTOACTL)
if(CTA_CAMERASTOACTL_FOUND)
set(CALIN_HAVE_CTA_CAMERASTOACTL TRUE)
endif()
## Find the CTA ADH_APIS package
find_package(CTA_ADH_APIS)

## Find Geant4 if requested
SET(CALIN_HAVE_GEANT4 FALSE)
Expand Down
20 changes: 20 additions & 0 deletions CMakeModules/FindCTA_ADH_APIS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# - Try to find CTA ADH_APIS
# Once done this will define
# CTA_ADH_APIS_FOUND - System has CTA ADH_APIS
# CTA_ADH_APIS_INCLUDE_DIRS - The CTA ADH_APIS include directories
# CTA_ADH_APIS_LIBRARIES - The libraries needed to use CTA ADH_APIS

FIND_PATH ( CTA_ADH_APIS_INCLUDE_DIRS R1v1.pb.h HINTS ${CTA_ADH_APIS_DIR})
FIND_LIBRARY ( CTA_ADH_APIS_LIBRARY_ZFITSIO NAMES ZFitsIO HINTS ${CTA_ADH_APIS_DIR})
FIND_LIBRARY ( CTA_ADH_APIS_LIBRARY_ADHCORE NAMES ADHCore HINTS ${CTA_ADH_APIS_DIR})

SET ( CTA_ADH_APIS_LIBRARIES ${CTA_ADH_APIS_LIBRARY_ZFITSIO}
${CTA_ADH_APIS_LIBRARY_ADHCORE})
SET ( CTA_ADH_APIS_INCLUDE_DIRS ${CTA_ADH_APIS_INCLUDE_DIRS} )

INCLUDE ( FindPackageHandleStandardArgs )
# handle the QUIETLY and REQUIRED arguments and set CTA_ADH_APIS_FOUND to TRUE
# if all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS( CTA_ADH_APIS DEFAULT_MSG
CTA_ADH_APIS_LIBRARY_ZFITSIO CTA_ADH_APIS_LIBRARY_ADHCORE
CTA_ADH_APIS_INCLUDE_DIRS )
23 changes: 0 additions & 23 deletions CMakeModules/FindCTA_CAMERASTOACTL.cmake

This file was deleted.

4 changes: 2 additions & 2 deletions CMakeModules/FindGeant4.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ get_filename_component(GEANT4_LIBRARY_DIR ${GEANT4_G4RUN_LIB} DIRECTORY)
# set(GEANT4_INCLUDE_DIR ${GEANT4_PREFIX}/include/Geant4)
# set(GEANT4_LIBRARY_DIR ${GEANT4_PREFIX}/${CMAKE_INSTALL_LIBDIR})
# set(GEANT4_LIBRARY_DIR ${GEANT4_PREFIX}/lib)
set(GEANT4_LIBRARIES G4interfaces G4persistency G4analysis
set(GEANT4_LIBRARIES G4interfaces G4analysis
G4error_propagation G4readout G4physicslists
G4run G4event G4tracking G4parmodels G4processes
G4digits_hits G4track G4particles G4geometry
Expand All @@ -96,7 +96,7 @@ get_filename_component(GEANT4_LIBRARY_DIR ${GEANT4_G4RUN_LIB} DIRECTORY)
set(GEANT4_LIBRARIES_WITH_VIS
G4OpenGL G4gl2ps G4Tree G4FR G4GMocren G4visHepRep
G4RayTracer G4VRML G4vis_management G4modeling
G4interfaces G4persistency G4analysis
G4interfaces G4analysis
G4error_propagation G4readout G4physicslists
G4run G4event G4tracking G4parmodels G4processes
G4digits_hits G4track G4particles G4geometry
Expand Down
48 changes: 0 additions & 48 deletions CMakeModules/FindNumpy.cmake

This file was deleted.

8 changes: 0 additions & 8 deletions configure_centos7_llrcta.sh

This file was deleted.

7 changes: 0 additions & 7 deletions configure_macports.sh

This file was deleted.

7 changes: 0 additions & 7 deletions configure_macports_debug.sh

This file was deleted.

6 changes: 2 additions & 4 deletions configure_macports_py310.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
cmake \
-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \
-DPYTHON_EXECUTABLE=/opt/local/bin/python3.10 \
-DPYTHON_INCLUDE_DIR=/opt/local/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 \
-DPYTHON_LIBRARY=/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/config-3.10-darwin/libpython3.10.dylib \
-DPython3_EXECUTABLE=/opt/local/bin/python3.10 \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCTA_CAMERASTOACT_DIR=$HOME/local \
-DCTA_ADH_APIS_DIR=$HOME/local \
-DCMAKE_INSTALL_PREFIX=$HOME/local ..
7 changes: 0 additions & 7 deletions configure_macports_py36.sh

This file was deleted.

8 changes: 0 additions & 8 deletions configure_macports_py37.sh

This file was deleted.

5 changes: 0 additions & 5 deletions include/calin_global_config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@
// Flags conditional compilation of GEANT4-specific code
#cmakedefine CALIN_HAVE_GEANT4 1

// CALIN_HAVE_CTA_CAMERASTOACTL
// Flags conditional compilation of code depending on (proprietary)
// CTA CamerasToACTL package
#cmakedefine CALIN_HAVE_CTA_CAMERASTOACTL 1

// Capture various CMake variables to pass to build system provenance class
#define CALIN_BUILD_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}"
#define CALIN_PROTO_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CALIN_PROTO_INSTALL_DIR}"
Expand Down
29 changes: 25 additions & 4 deletions include/calin_global_definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,30 +78,51 @@ inline Eigen::VectorXi std_to_eigenvec_unsigned(const std::vector<unsigned> &x)
return Eigen::Map<const Eigen::VectorXi>(reinterpret_cast<const int*>(&x.front()), x.size());
}

template<typename T>
template<typename T> inline
std::vector<T> protobuf_to_stdvec(const google::protobuf::RepeatedField<T>& x)
{
return std::vector<T>(x.begin(), x.end());
}

template<typename T>
template<typename T> inline
std::vector<T> protobuf_to_stdvec(const google::protobuf::RepeatedField<T>* x)
{
return std::vector<T>(x->begin(), x->end());
}

template<typename T> void stdvec_to_existing_protobuf(
template<typename T> inline void stdvec_to_existing_protobuf(
google::protobuf::RepeatedField<T>& y, const std::vector<int> &x)
{
y.Resize(x.size());
std::copy(x.begin(), x.end(), y.begin());
}

template<typename T> void stdvec_to_existing_protobuf(
template<typename T> inline void stdvec_to_existing_protobuf(
google::protobuf::RepeatedField<T>* y, const std::vector<int> &x)
{
y->Resize(x.size());
std::copy(x.begin(), x.end(), y->begin());
}

template<typename T, typename V> inline void vec_to_xyz(T* xyz, const V& v)
{
xyz->set_x(v[0]);
xyz->set_y(v[1]);
xyz->set_z(v[2]);
}

template<typename T, typename V> inline T vec_to_xyz(const V& v)
{
T xyz;
xyz.set_x(v[0]);
xyz.set_y(v[1]);
xyz.set_z(v[2]);
return xyz;
}

template<typename T> inline Eigen::Vector3d xyz_to_eigenvec(const T& xyz)
{
return { xyz.x(), xyz.y(), xyz.z() };
}

}; // namespace calin
Loading

0 comments on commit d1261a2

Please sign in to comment.