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

Merge/alexwenym #29

Merged
merged 45 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
efef21f
ATALS, QOL changes, and Column Depth fixes (#27)
austinschneider Jun 24, 2023
296ddb0
Add Placement pybindings
austinschneider Jun 24, 2023
45355ba
Add Quaternion python bindings
austinschneider Jun 24, 2023
eacd64b
EarthModel pybindings
austinschneider Jun 25, 2023
07725e5
Default constructor for EarthSector. Fix name collision for static an…
austinschneider Jun 25, 2023
1d59b21
Move detector pybindings into separate files. Add DensityDistribution…
austinschneider Jun 25, 2023
3f886b1
pybindings for Axis1D and Distribution1D
austinschneider Jun 26, 2023
f9a6d31
pybindings for CartesianAxis1D
austinschneider Jun 26, 2023
e7d5b6f
Axis1D has pure virtual functions
austinschneider Jun 27, 2023
4325129
Add Axis1D and Distribution1D subclasses
austinschneider Jun 27, 2023
5ed3d9e
Polynomial and Exponential cartesian axis distributions
austinschneider Jun 28, 2023
31f30b5
Remove non-existent comparison operators
austinschneider Jun 29, 2023
48ed293
Add pybindings for ConstantDensityDistribution
austinschneider Jun 29, 2023
199549b
Fix pybindings name for ConstantDistribution1D
Jun 30, 2023
9d648ae
Add EarthSector python printout
austinschneider Jun 30, 2023
7fc8919
MaterialModel bindings. Remove unnecessary LeptonDepthFunction method
austinschneider Jun 30, 2023
01286b5
MaterialModel pybindings
austinschneider Jul 1, 2023
060e65e
DummyCrossSection
austinschneider Jul 1, 2023
60b3d2e
Sketch helper class for CrossSection pybindings
austinschneider Jul 1, 2023
75b2278
Reindent
austinschneider Jul 1, 2023
e84ba32
CrossSection pybindings
austinschneider Jul 1, 2023
2964333
Re-organize crosssections pybindings
austinschneider Jul 1, 2023
dce1eed
pybindings for DummyCrossSection
austinschneider Jul 2, 2023
1fa38c8
More realistic total cross section for DummyCrossSection
austinschneider Jul 2, 2023
da64274
Add interaction probability to pybindings
austinschneider Jul 3, 2023
956246a
Fixed == and != operators to play well with pybind11's execute_cast
nickkamp1 Sep 8, 2023
4113174
Update build_wheels.yml
austinschneider Sep 8, 2023
c75f9a7
Merge branch 'merge/alexwenym' of github.com:Harvard-Neutrino/LeptonI…
nickkamp1 Sep 8, 2023
e02e098
starting to add HNL classes
nickkamp1 Sep 13, 2023
71782f0
Use a specific python version if specified
austinschneider Sep 15, 2023
2f1fc9b
Remove parts of interface that depend on rk
austinschneider Sep 16, 2023
2cda60e
Explicitly label rk static lib. Export cmake project for rk
austinschneider Sep 16, 2023
58aed0f
Use rk_static in testing. Use photosplines internal install directive…
austinschneider Sep 16, 2023
e076689
Incude cassert (previously included via rk)
austinschneider Sep 16, 2023
854037d
Export cmake project. Specify public asnd private link libs. Remove u…
austinschneider Sep 16, 2023
a4aca90
Install cereal so other libraries can use it
austinschneider Sep 16, 2023
5281bdc
Install delabella so other libraries can use it
austinschneider Sep 16, 2023
ee71758
Use a single export name for rk
austinschneider Sep 16, 2023
d05f2fc
Use a single export name for delabella
austinschneider Sep 16, 2023
7290d77
Move around includes
austinschneider Sep 17, 2023
9614f0b
Rearranging includes to enforce "include what you use"
austinschneider Sep 20, 2023
596943c
Move around includes to comply with IWYU
austinschneider Sep 20, 2023
0a0336d
Delete resources/DipoleInjection/inject_HNLs_CCM.ipynb
austinschneider Sep 20, 2023
f910404
Delete resources/DipoleInjection/Makefile
austinschneider Sep 20, 2023
740dbb5
Rename Makefile_original to Makefile
austinschneider Sep 20, 2023
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
1 change: 1 addition & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
matrix:
#os: [ubuntu-20.04, windows-2019, macos-11]
os: [ubuntu-20.04, macos-11]
arch: [x86_64, auto32, auto64, aarch64, ppc64le, s390x, arm64]

steps:
- name: Checkout LeptonInjector
Expand Down
126 changes: 82 additions & 44 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,8 @@ else()
endif()

# load python and pybind11
include(Python)
include(pybind11)
if(CMAKE_VERSION VERSION_LESS 3.12.0)
if(Python_ROOT_DIR)
MESSAGE(WARNING "Python_ROOT_DIR is set but will be ignored by this version of CMake; set PYTHON_EXECUTABLE instead")
endif()
find_package(PythonInterp)
find_package(PythonLibs)
set(PYTHON_FOUND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND)
else()
if(PYTHON_EXECUTABLE)
MESSAGE(WARNING "PYTHON_EXECUTABLE is set but will be ignored by this version of CMake; set Python_ROOT_DIR instead")
endif()
find_package(Python COMPONENTS Interpreter Development)
set(PYTHON_FOUND Python_Interpreter_FOUND AND Python_Development_FOUND)
set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}")
set(PYTHON_INCLUDE_DIRS "${Python_INCLUDE_DIRS}")
set(PYTHON_LIBRARIES "${Python_LIBRARIES}")
set(PYTHON_VERSION_MAJOR "${Python_VERSION_MAJOR}")
set(PYTHON_VERSION_MINOR "${Python_VERSION_MINOR}")
endif()

# load project dependencies
include(rk)
Expand Down Expand Up @@ -105,33 +87,35 @@ add_library(LeptonInjector SHARED)
set_property(TARGET LeptonInjector PROPERTY POSITION_INDEPENDENT_CODE ON)
if(${MACOSX})
target_link_libraries(LeptonInjector
LI_utilities
LI_serialization
LI_math
LI_dataclasses
LI_geometry
LI_detector
LI_crosssections
LI_distributions
LI_injection
rk
delabella
PRIVATE
PUBLIC
delabella_shared
photospline
LI_utilities
LI_serialization
LI_math
LI_dataclasses
LI_geometry
LI_detector
LI_crosssections
LI_distributions
LI_injection
)
else()
target_link_libraries(LeptonInjector
LI_utilities
LI_serialization
LI_math
LI_dataclasses
LI_geometry
LI_detector
LI_crosssections
LI_distributions
LI_injection
-Wl,--whole-archive
rk
delabella
-Wl,--no-whole-archive
PRIVATE
PUBLIC
photospline
delabella_shared
LI_utilities
LI_serialization
LI_math
LI_dataclasses
LI_geometry
LI_detector
LI_crosssections
LI_distributions
LI_injection
)
endif()

Expand All @@ -144,15 +128,48 @@ if(DEFINED SKBUILD)
message(STATUS "Setting LeptonInjector install lib dir to: ${CI_INSTALL_PREFIX}/lib")
message(STATUS "Setting LeptonInjector install include dir to: ${CI_INSTALL_PREFIX}/include")
install(TARGETS LeptonInjector
delabella_shared
LI_utilities
LI_serialization
LI_math
LI_dataclasses
LI_geometry
LI_detector
LI_crosssections
LI_distributions
LI_injection
EXPORT ${PROJECT_NAME}Config
LIBRARY DESTINATION "${CI_INSTALL_PREFIX}/lib"
PUBLIC_HEADER DESTINATION "${CI_INSTALL_PREFIX}/include")
else()
install(TARGETS LeptonInjector
delabella_shared
LI_utilities
LI_serialization
LI_math
LI_dataclasses
LI_geometry
LI_detector
LI_crosssections
LI_distributions
LI_injection
EXPORT ${PROJECT_NAME}Config
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector.libs
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
else()
install(TARGETS LeptonInjector
delabella_shared
LI_utilities
LI_serialization
LI_math
LI_dataclasses
LI_geometry
LI_detector
LI_crosssections
LI_distributions
LI_injection
EXPORT ${PROJECT_NAME}Config
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
Expand Down Expand Up @@ -201,9 +218,30 @@ if(DEFINED SKBUILD)
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector)
install(TARGETS injection
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector)
install(FILES ${PROJECT_SOURCE_DIR}/python/__init__.py DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector)
install(FILES ${PROJECT_SOURCE_DIR}/python/__init__.py
DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector)
endif()

# Export targets for use in downstream CMake projects
# -----------------------------------------------------------------------------
include(CMakePackageConfigHelpers)
# Make importable from build directory
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
export(EXPORT ${PROJECT_NAME}Config FILE ${PROJECT_NAME}Config.cmake)

# Make importable from install location
set(_config_dir share/${PROJECT_NAME}/cmake)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${_config_dir}
)
install(EXPORT ${PROJECT_NAME}Config
DESTINATION ${_config_dir}
)

MESSAGE("")
MESSAGE("Done!")
MESSAGE("Run `make` then `make install`")
15 changes: 12 additions & 3 deletions cmake/Packages/Python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@ IF(CMAKE_VERSION VERSION_LESS 3.12.0)
IF(Python_ROOT_DIR)
MESSAGE(WARNING "Python_ROOT_DIR is set but will be ignored by this version of CMake; set PYTHON_EXECUTABLE instead")
ENDIF(Python_ROOT_DIR)
find_package(PythonInterp)
find_package(PythonLibs)
IF(PYTHON_VERSION)
find_package(PythonInterp ${PYTHON_VERSION})
find_package(PythonLibs ${PYTHON_VERSION})
ELSE(PYTHON_VERSION)
find_package(PythonInterp)
find_package(PythonLibs)
ENDIF(PYTHON_VERSION)
set(PYTHON_FOUND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND)
ELSE()
IF(PYTHON_EXECUTABLE)
MESSAGE(WARNING "PYTHON_EXECUTABLE is set but will be ignored by this version of CMake; set Python_ROOT_DIR instead")
ENDIF(PYTHON_EXECUTABLE)
FIND_PACKAGE(Python COMPONENTS Interpreter Development)
IF(PYTHON_VERSION)
FIND_PACKAGE(Python ${PYTHON_VERSION} COMPONENTS Interpreter Development)
ELSE(PYTHON_VERSION)
FIND_PACKAGE(Python COMPONENTS Interpreter Development)
ENDIF(PYTHON_VERSION)
SET(PYTHON_FOUND "${Python_FOUND}")
SET(PYTHON_EXECUTABLE "${Python_EXECUTABLE}")
SET(PYTHON_INCLUDE_DIRS "${Python_INCLUDE_DIRS}")
Expand Down
2 changes: 1 addition & 1 deletion cmake/Packages/cereal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ endif()
set(JUST_INSTALL_CEREAL ON CACHE INTERNAL "Cereal just install library.")
set(SKIP_PORTABILITY_TEST ON CACHE INTERNAL "Skip cereal portability tests.")
set(SKIP_PERFORMANCE_COMPARISON ON CACHE INTERNAL "Skip cereal performance comparison.")
add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/cereal" "extern/cereal" EXCLUDE_FROM_ALL)
add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/cereal" "extern/cereal")
include_directories("${PROJECT_SOURCE_DIR}/vendor/cereal/include")
12 changes: 11 additions & 1 deletion cmake/Packages/delabella.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,14 @@ if(NOT EXISTS "${PROJECT_SOURCE_DIR}/vendor/delabella/CMakeLists.txt")
message(FATAL_ERROR "The delabella submodule was not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
endif()

add_subdirectory(${PROJECT_SOURCE_DIR}/vendor/delabella EXCLUDE_FROM_ALL)
add_subdirectory(${PROJECT_SOURCE_DIR}/vendor/delabella)
#add_subdirectory(${PROJECT_SOURCE_DIR}/vendor/delabella)
#install(TARGETS delabella_shared
# ARCHIVE DESTINATION lib)
#set(_config_dir share/delabella/cmake)
#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/delabellaConfigVersion.cmake"
# DESTINATION ${_config_dir}
#)
#install(EXPORT delabellaConfig
# DESTINATION ${_config_dir}
#)
5 changes: 3 additions & 2 deletions cmake/Packages/photospline.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ if(NOT EXISTS "${PROJECT_SOURCE_DIR}/vendor/photospline/CMakeLists.txt")
message(FATAL_ERROR "The photospline submodule was not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
endif()

add_subdirectory(${PROJECT_SOURCE_DIR}/vendor/photospline EXCLUDE_FROM_ALL)
#add_subdirectory(${PROJECT_SOURCE_DIR}/vendor/photospline EXCLUDE_FROM_ALL)
add_subdirectory(${PROJECT_SOURCE_DIR}/vendor/photospline)
if(DEFINED SKBUILD)
if(${CIBUILDWHEEL})
message(STATUS "Setting photospline install lib dir to: ${CI_INSTALL_PREFIX}/lib")
Expand All @@ -42,6 +43,6 @@ if(DEFINED SKBUILD)
# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector.libs
# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
else()
install(TARGETS photospline DESTINATION ${CMAKE_INSTALL_LIBDIR})
#install(TARGETS photospline DESTINATION ${CMAKE_INSTALL_LIBDIR})
#install(TARGETS spglam DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
2 changes: 1 addition & 1 deletion cmake/testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set_target_properties(gmock_main PROPERTIES FOLDER extern)
macro(package_add_test TESTNAME)
add_executable(${TESTNAME} ${ARGN})
target_link_libraries(${TESTNAME} gtest gmock gtest_main LeptonInjector)
add_dependencies(${TESTNAME} rk)
add_dependencies(${TESTNAME} rk_static)
add_test(NAME ${TESTNAME} COMMAND ${TESTNAME} WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
set_target_properties(${TESTNAME} PROPERTIES FOLDER tests)
endmacro()
Expand Down
32 changes: 16 additions & 16 deletions projects/crosssections/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ LIST (APPEND crosssections_SOURCES
${PROJECT_SOURCE_DIR}/projects/crosssections/private/DipoleFromTable.cxx
${PROJECT_SOURCE_DIR}/projects/crosssections/private/NeutrissimoDecay.cxx
${PROJECT_SOURCE_DIR}/projects/crosssections/private/DISFromSpline.cxx
${PROJECT_SOURCE_DIR}/projects/crosssections/private/HNLFromSpline.cxx
${PROJECT_SOURCE_DIR}/projects/crosssections/private/ElasticScattering.cxx
${PROJECT_SOURCE_DIR}/projects/crosssections/private/DummyCrossSection.cxx
)
add_library(LI_crosssections OBJECT ${crosssections_SOURCES})
set_property(TARGET LI_crosssections PROPERTY POSITION_INDEPENDENT_CODE ON)
target_include_directories(LI_crosssections PUBLIC
${PROJECT_SOURCE_DIR}/projects/crosssections/public/
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/projects/crosssections/public/>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/LeptonInjector/crosssections/>
)
add_dependencies(LI_crosssections rk)
add_dependencies(LI_crosssections LI_serialization LI_utilities LI_math LI_dataclasses LI_detector)

target_link_libraries(LI_crosssections photospline)
target_link_libraries(LI_crosssections rk)

target_include_directories(LI_crosssections PUBLIC ${PROJECT_SOURCE_DIR}/vendor/rk/include)
target_include_directories(LI_crosssections PUBLIC ${PROJECT_SOURCE_DIR}/projects/serialization/public/)
target_include_directories(LI_crosssections PUBLIC ${PROJECT_SOURCE_DIR}/projects/utilities/public/)
target_include_directories(LI_crosssections PUBLIC ${PROJECT_SOURCE_DIR}/projects/math/public/)
target_include_directories(LI_crosssections PUBLIC ${PROJECT_SOURCE_DIR}/projects/detector/public/)
target_include_directories(LI_crosssections PUBLIC ${PROJECT_SOURCE_DIR}/projects/dataclasses/public/)

install(TARGETS LI_crosssections
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
target_link_libraries(LI_crosssections
PRIVATE
$<BUILD_INTERFACE:rk_static>
PUBLIC
photospline
LI_serialization
LI_utilities
LI_math
LI_dataclasses
LI_detector
)

install(DIRECTORY "${PROJECT_SOURCE_DIR}/projects/crosssections/public/"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
Expand All @@ -42,7 +42,7 @@ package_add_test(UnitTest_DipoleFromTable ${PROJECT_SOURCE_DIR}/projects/crossse
#package_add_test(UnitTest_ElasticScattering ${PROJECT_SOURCE_DIR}/projects/crosssections/private/test/ElasticScattering_TEST.cxx)

pybind11_add_module(crosssections ${PROJECT_SOURCE_DIR}/projects/crosssections/private/pybindings/crosssections.cxx)
target_link_libraries(crosssections PRIVATE LeptonInjector photospline rk)
target_link_libraries(crosssections PRIVATE LeptonInjector photospline rk_static)
if(DEFINED SKBUILD)
set_target_properties(crosssections PROPERTIES
BUILD_WITH_INSTALL_RPATH FALSE
Expand Down
22 changes: 13 additions & 9 deletions projects/crosssections/private/CrossSectionCollection.cxx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#include <map>
#include <set>
#include <vector>
#include <string>
#include <memory>

#include "LeptonInjector/dataclasses/Particle.h"

#include "LeptonInjector/crosssections/CrossSection.h"
#include "LeptonInjector/crosssections/CrossSectionCollection.h"

#include <map> // for map
#include <set> // for operator==
#include <tuple> // for tie
#include <limits> // for numeric...
#include <vector> // for vector
#include <utility> // for pair

#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSe...
#include "LeptonInjector/crosssections/Decay.h" // for Decay
#include "LeptonInjector/dataclasses/InteractionRecord.h" // for Interac...
#include "LeptonInjector/dataclasses/InteractionSignature.h" // for Interac...
#include "LeptonInjector/dataclasses/Particle.h" // for Particle

namespace LI {
namespace crosssections {

Expand Down
39 changes: 22 additions & 17 deletions projects/crosssections/private/DISFromSpline.cxx
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
#include <map>
#include <set>
#include <vector>
#include <string>
#include <memory>

#include <rk/rk.hh>
#include <rk/geom3.hh>

#include <photospline/splinetable.h>
#include <photospline/cinter/splinetable.h>

#include "LeptonInjector/dataclasses/Particle.h"

#include "LeptonInjector/utilities/Random.h"

#include "LeptonInjector/crosssections/CrossSection.h"
#include "LeptonInjector/crosssections/DISFromSpline.h"

#include <map> // for map, opera...
#include <set> // for set, opera...
#include <array> // for array
#include <cmath> // for pow, log10
#include <tuple> // for tie, opera...
#include <memory> // for allocator
#include <string> // for basic_string
#include <vector> // for vector
#include <assert.h> // for assert
#include <stddef.h> // for size_t

#include <rk/rk.hh> // for P4, Boost
#include <rk/geom3.hh> // for Vector3

#include <photospline/splinetable.h> // for splinetable
//#include <photospline/cinter/splinetable.h>

#include "LeptonInjector/crosssections/CrossSection.h" // for CrossSection
#include "LeptonInjector/dataclasses/InteractionRecord.h" // for Interactio...
#include "LeptonInjector/dataclasses/Particle.h" // for Particle
#include "LeptonInjector/utilities/Random.h" // for LI_random

namespace LI {
namespace crosssections {

Expand Down
9 changes: 7 additions & 2 deletions projects/crosssections/private/Decay.cxx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#include "LeptonInjector/crosssections/Decay.h"
#include "LeptonInjector/utilities/Constants.h"

#include <rk/rk.hh>
#include <array> // for array

#include <rk/rk.hh> // for P4
#include <rk/geom3.hh> // for Vector3

#include "LeptonInjector/dataclasses/InteractionRecord.h"
#include "LeptonInjector/utilities/Constants.h"

namespace LI {
namespace crosssections {
Expand Down
Loading