Skip to content

Commit

Permalink
Merge/alexwenym (#29)
Browse files Browse the repository at this point in the history
* ATALS, QOL changes, and Column Depth fixes (#27)

* atlas notebook, added some pybindings

* updates to SNe Ranged injection

* incremental changes for atlas injection, columndepth debug ongoing

* added some pybindings to help debug classes Path and ColumnDepthPositionDistribution

* Fix column depth unit conversions. Fix unsigned integer overflow in bounds clipping. Fix spacing.

* Special case for constructing 180deg rotation Quaternion for a rotation between opposing directions.

* Include what you use

* Convert from detector coordinates to earth coordinates before checking bounds

* Removed extra files, some may need to be added to resources later

* TreeWeighter constructor w/o secondary processes

* Delete Doxyfile

Removing unnecessary file

---------

Co-authored-by: Alex Wen <[email protected]>
Co-authored-by: Alex Wen <[email protected]>
Co-authored-by: Alex Wen <[email protected]>
Co-authored-by: Alex Wen <[email protected]>
Co-authored-by: Philip Weigel <[email protected]>

* Add Placement pybindings

* Add Quaternion python bindings

* EarthModel pybindings

* Default constructor for EarthSector. Fix name collision for static and non-static methods in EarthModel

* Move detector pybindings into separate files. Add DensityDistribution pybindings

* pybindings for Axis1D and Distribution1D

* pybindings for CartesianAxis1D

* Axis1D has pure virtual functions

* Add Axis1D and Distribution1D subclasses

* Polynomial and Exponential cartesian axis distributions

* Remove non-existent comparison operators

* Add pybindings for ConstantDensityDistribution

* Fix pybindings name for ConstantDistribution1D

* Add EarthSector python printout

* MaterialModel bindings. Remove unnecessary LeptonDepthFunction method

* MaterialModel pybindings

* DummyCrossSection

* Sketch helper class for CrossSection pybindings

* Reindent

* CrossSection pybindings

* Re-organize crosssections pybindings

* pybindings for DummyCrossSection

* More realistic total cross section for DummyCrossSection

* Add interaction probability to pybindings

* Fixed == and != operators to play well with pybind11's execute_cast

* Update build_wheels.yml

* starting to add HNL classes

* Use a specific python version if specified

* Remove parts of interface that depend on rk

* Explicitly label rk static lib. Export cmake project for rk

* Use rk_static in testing. Use photosplines internal install directives so we can export it as a cmake project.

* Incude cassert (previously included via rk)

* Export cmake project. Specify public asnd private link libs. Remove unneeded dependencies. Guard include dirs at install

* Install cereal so other libraries can use it

* Install delabella so other libraries can use it

* Use a single export name for rk

* Use a single export name for delabella

* Move around includes

* Rearranging includes to enforce "include what you use"

* Move around includes to comply with IWYU

* Delete resources/DipoleInjection/inject_HNLs_CCM.ipynb

* Delete resources/DipoleInjection/Makefile

* Rename Makefile_original to Makefile

---------

Co-authored-by: Alex Wen <[email protected]>
Co-authored-by: Alex Wen <[email protected]>
Co-authored-by: Alex Wen <[email protected]>
Co-authored-by: Alex Wen <[email protected]>
Co-authored-by: Philip Weigel <[email protected]>
Co-authored-by: Austin William Schneider <[email protected]>
Co-authored-by: Nicholas Kamp <[email protected]>
  • Loading branch information
8 people authored Sep 21, 2023
1 parent 69529c0 commit 4c35379
Show file tree
Hide file tree
Showing 215 changed files with 6,319 additions and 2,162 deletions.
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

0 comments on commit 4c35379

Please sign in to comment.