mirror of
https://github.com/OpenCMT/uLib.git
synced 2025-12-06 07:21:31 +01:00
Compare commits
6 Commits
v.0.2.1
...
beam_trace
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4d1e6af63 | ||
|
|
3cea59bc67 | ||
|
|
a2bd38fc2c | ||
|
|
843a2d69cf | ||
|
|
a60a21bfe4 | ||
|
|
9d899928b8 |
@@ -1,116 +0,0 @@
|
|||||||
Summary: Cosmic Muon Tomography core libraries
|
|
||||||
Name: cmt-ulib
|
|
||||||
Version: @PKGVERSION@
|
|
||||||
Release: @PKGRELEASE@%{?dist}
|
|
||||||
License: EUROPEAN UNION PUBLIC LICENCE v. 1.2
|
|
||||||
Vendor: INFN
|
|
||||||
URL: https://github.com/OpenCMT/uLib
|
|
||||||
Group: Development/Libraries
|
|
||||||
BuildArch: %{_arch}
|
|
||||||
%if %{?rhel}%{!?rhel:0} >= 8
|
|
||||||
BuildRequires: cmake
|
|
||||||
%else
|
|
||||||
BuildRequires: cmake3
|
|
||||||
%endif
|
|
||||||
BuildRequires: doxygen
|
|
||||||
BuildRequires: boost-devel
|
|
||||||
BuildRequires: eigen3-devel
|
|
||||||
BuildRequires: vtk-devel
|
|
||||||
BuildRequires: readline-devel
|
|
||||||
BuildRequires: pcl-devel
|
|
||||||
BuildRequires: root-geom
|
|
||||||
BuildRequires: root-genvector
|
|
||||||
BuildRequires: root-smatrix
|
|
||||||
BuildRequires: root-montecarlo-eg
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
|
||||||
AutoReqProv: yes
|
|
||||||
Source: %{name}-%{version}.tar.gz
|
|
||||||
|
|
||||||
%description
|
|
||||||
This package contains the base toolkit library for Cosmic Muon Tomography reconstruction,
|
|
||||||
analysis and imaging software Developed by University of Padova and INFN Sezione di Padova Italy
|
|
||||||
|
|
||||||
%global _ulibpkgname mutom
|
|
||||||
%global _ulibcmakedir %{_libdir}/cmake/%{_ulibpkgname}
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -c
|
|
||||||
rm -rf %{buildroot}
|
|
||||||
mkdir -p %{buildroot}
|
|
||||||
|
|
||||||
%build
|
|
||||||
mkdir %{_builddir}/%{name}-%{version}/build
|
|
||||||
cd %{_builddir}/%{name}-%{version}/build
|
|
||||||
%cmake -DCMAKE_INSTALL_PREFIX=%{buildroot}%{_prefix} \
|
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
||||||
-DPACKAGE_NAME=%{_ulibpkgname} \
|
|
||||||
-DPACKAGE_INSTALL_LIB_DIR=%{buildroot}%{_libdir} \
|
|
||||||
-DPACKAGE_INSTALL_INC_DIR=%{buildroot}%{_includedir}/%{_ulibpkgname} \
|
|
||||||
-DPACKAGE_INSTALL_CMAKE_DIR=%{buildroot}%{_ulibcmakedir} \
|
|
||||||
-DNODOXYGEN=ON \
|
|
||||||
%{_builddir}/%{name}-%{version}
|
|
||||||
make %{?_smp_mflags}
|
|
||||||
|
|
||||||
%install
|
|
||||||
cd %{_builddir}/%{name}-%{version}/build
|
|
||||||
make install
|
|
||||||
sed -i 's|%{buildroot}/usr|%{_prefix}|g' %{buildroot}%{_ulibcmakedir}/uLibTargets.cmake
|
|
||||||
sed -i 's|%{buildroot}/usr|%{_prefix}|g' %{buildroot}%{_ulibcmakedir}/uLibTargets-relwithdebinfo.cmake
|
|
||||||
|
|
||||||
%clean
|
|
||||||
rm -rf %{buildroot}
|
|
||||||
|
|
||||||
%files
|
|
||||||
%defattr(-,root,root)
|
|
||||||
%{_libdir}/libmutom*.so.0.2
|
|
||||||
%{_libdir}/uLibRootDict_rdict.pcm
|
|
||||||
|
|
||||||
%package devel
|
|
||||||
Summary: Cosmic Muon Tomography core libraries, development files
|
|
||||||
Requires: %{name}
|
|
||||||
Requires: boost-devel
|
|
||||||
Requires: eigen3-devel
|
|
||||||
Requires: vtk-devel
|
|
||||||
Requires: readline-devel
|
|
||||||
Requires: pcl-devel
|
|
||||||
Requires: root-geom
|
|
||||||
Requires: root-genvector
|
|
||||||
Requires: root-smatrix
|
|
||||||
Requires: root-montecarlo-eg
|
|
||||||
|
|
||||||
|
|
||||||
%description devel
|
|
||||||
This package contains the base toolkit library for Cosmic Muon Tomography reconstruction,
|
|
||||||
analysis and imaging software Developed by University of Padova and INFN Sezione di Padova Italy
|
|
||||||
|
|
||||||
%files devel
|
|
||||||
%defattr(-,root,root)
|
|
||||||
%dir %{_ulibcmakedir}
|
|
||||||
/usr/bin/uLib_config
|
|
||||||
%{_libdir}/libmutom*.so
|
|
||||||
%{_ulibcmakedir}/*.cmake
|
|
||||||
%dir %{_includedir}/%{_ulibpkgname}
|
|
||||||
%dir %{_includedir}/%{_ulibpkgname}/Core
|
|
||||||
%dir %{_includedir}/%{_ulibpkgname}/Math
|
|
||||||
%dir %{_includedir}/%{_ulibpkgname}/Root
|
|
||||||
%dir %{_includedir}/%{_ulibpkgname}/Detectors
|
|
||||||
%dir %{_includedir}/%{_ulibpkgname}/Vtk
|
|
||||||
%{_includedir}/%{_ulibpkgname}/*.h
|
|
||||||
%{_includedir}/%{_ulibpkgname}/Core/*.h
|
|
||||||
%{_includedir}/%{_ulibpkgname}/Math/*.h
|
|
||||||
%{_includedir}/%{_ulibpkgname}/Math/*.hpp
|
|
||||||
%{_includedir}/%{_ulibpkgname}/Root/*.h
|
|
||||||
%{_includedir}/%{_ulibpkgname}/Detectors/*.h
|
|
||||||
%{_includedir}/%{_ulibpkgname}/Vtk/*.h
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
|
||||||
* Tue Dec 04 2018 Paolo Andreetto <paolo.andreetto@pd.infn.it> - 0.2.1-1
|
|
||||||
- Repackaging for CentOS 7
|
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ set(Boost_USE_STATIC_LIBS OFF)
|
|||||||
set(Boost_USE_MULTITHREADED ON)
|
set(Boost_USE_MULTITHREADED ON)
|
||||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||||
|
|
||||||
find_package(Boost 1.45.0 COMPONENTS serialization signals program_options REQUIRED)
|
find_package(Boost 1.45.0 COMPONENTS program_options REQUIRED)
|
||||||
if(Boost_FOUND)
|
if(Boost_FOUND)
|
||||||
set(HAVE_BOOST true)
|
set(HAVE_BOOST true)
|
||||||
endif(Boost_FOUND)
|
endif(Boost_FOUND)
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
# Target for RPMs creation
|
|
||||||
|
|
||||||
set(PKGREL 1 CACHE STRING "Package build number")
|
|
||||||
set(ITEMS_FOR_SOURCE AUTHORS
|
|
||||||
CMakeConfig.in.h
|
|
||||||
CMakePkgConfig.pc.in
|
|
||||||
test.cpp
|
|
||||||
uLibConfig.cmake.in
|
|
||||||
uLib.creator
|
|
||||||
ulib.h
|
|
||||||
vtk_test.cpp
|
|
||||||
CMake
|
|
||||||
CMakeLists.txt
|
|
||||||
Jenkinsfile
|
|
||||||
src
|
|
||||||
uLib.config
|
|
||||||
uLibConfigVersion.cmake.in
|
|
||||||
uLib.files
|
|
||||||
uLib.includes)
|
|
||||||
|
|
||||||
add_custom_target(rpm
|
|
||||||
COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/rpmbuild/BUILD
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rpmbuild/RPMS
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rpmbuild/SOURCES
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rpmbuild/SPECS
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rpmbuild/SRPMS
|
|
||||||
COMMAND tar -zcf ${CMAKE_CURRENT_BINARY_DIR}/rpmbuild/SOURCES/cmt-ulib-${PACKAGE_VERSION}.tar.gz ${ITEMS_FOR_SOURCE}
|
|
||||||
COMMAND sed -e 's|@PKGVERSION@|${PACKAGE_VERSION}|g'
|
|
||||||
-e 's|@PKGRELEASE@|${PKGREL}|g'
|
|
||||||
CMake/cmt-ulib.spec.in > ${CMAKE_CURRENT_BINARY_DIR}/rpmbuild/SPECS/cmt-ulib.spec
|
|
||||||
COMMAND QA_SKIP_BUILD_ROOT=1 rpmbuild -ba --define '_topdir ${CMAKE_CURRENT_BINARY_DIR}/rpmbuild'
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rpmbuild/SPECS/cmt-ulib.spec
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
|
|
||||||
201
CMakeLists.txt
201
CMakeLists.txt
@@ -11,7 +11,7 @@ project(uLib)
|
|||||||
|
|
||||||
# The version number.
|
# The version number.
|
||||||
set(PROJECT_VERSION_MAJOR 0)
|
set(PROJECT_VERSION_MAJOR 0)
|
||||||
set(PROJECT_VERSION_MINOR 2)
|
set(PROJECT_VERSION_MINOR 4)
|
||||||
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
|
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
|
||||||
set(PROJECT_SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
|
set(PROJECT_SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
|
||||||
|
|
||||||
@@ -26,130 +26,169 @@ set(PACKAGE_AUTHOR "Andrea Rigoni Garola <andrea.rigoni@pd.infn.it>")
|
|||||||
|
|
||||||
set(ULIB_CMAKE_DIR "${PROJECT_SOURCE_DIR}/CMake")
|
set(ULIB_CMAKE_DIR "${PROJECT_SOURCE_DIR}/CMake")
|
||||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
|
||||||
message(STATUS "Module path: ${CMAKE_MODULE_PATH}")
|
message(STATUS "Project name = ${PROJECT_NAME}")
|
||||||
|
message(STATUS "Package name = ${PACKAGE_NAME}")
|
||||||
include(uLibMacros)
|
message(STATUS "Package version = ${PACKAGE_VERSION}")
|
||||||
include(uLibDebugMacro)
|
message(STATUS "Module path = ${CMAKE_MODULE_PATH}")
|
||||||
include(uLibTargetMacros)
|
|
||||||
#include(uLibGenerateRMake)
|
|
||||||
|
|
||||||
|
|
||||||
## GLOBALS ------------------------------------------------------------------ ##
|
## GLOBALS ------------------------------------------------------------------ ##
|
||||||
|
|
||||||
include(uLibCommon)
|
set(PACKAGE_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/bin
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ") ## Add flags here ##
|
CACHE PATH "Installation directory for executables")
|
||||||
|
set(PACKAGE_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib/
|
||||||
|
CACHE PATH "Installation directory for libraries")
|
||||||
|
set(PACKAGE_INSTALL_INC_DIR ${CMAKE_INSTALL_PREFIX}/include/${PACKAGE_NAME}
|
||||||
|
CACHE PATH "Installation directory for headers")
|
||||||
|
set(PACKAGE_INSTALL_DATA_DIR ${CMAKE_INSTALL_PREFIX}/share/${PACKAGE_NAME}
|
||||||
|
CACHE PATH "Installation directory for data files")
|
||||||
|
set(PACKAGE_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_PREFIX}/lib/cmake/${PACKAGE_NAME}
|
||||||
|
CACHE PATH "Installation directory for CMake files")
|
||||||
|
|
||||||
enable_testing()
|
set(SRC_DIR ${PROJECT_SOURCE_DIR}/src)
|
||||||
|
|
||||||
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
message(STATUS "Setting build type to 'Release' as none was specified.")
|
||||||
|
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed")
|
||||||
|
# Set the possible values of build type for cmake-gui
|
||||||
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
|
||||||
|
STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_CXX_WARNING_OPTION ""
|
||||||
|
CACHE STRING "Warning level -WAll to verbose all warnings")
|
||||||
|
set(CMAKE_VERBOSE_MAKEFILE FALSE
|
||||||
|
CACHE STRING "Verbose compile output switch")
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x ${CMAKE_CXX_WARNING_OPTION}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -UULIB_SERIALIZATION_ON")
|
||||||
|
|
||||||
|
#enable_testing()
|
||||||
|
|
||||||
## FIND PACKAGES ------------------------------------------------------------ ##
|
## FIND PACKAGES ------------------------------------------------------------ ##
|
||||||
|
|
||||||
include(uLibFindDependencies)
|
set(Boost_USE_STATIC_LIBS OFF)
|
||||||
|
set(Boost_USE_MULTITHREADED ON)
|
||||||
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||||
|
find_package(Boost 1.45.0 COMPONENTS program_options REQUIRED)
|
||||||
|
include_directories(${Boost_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
find_package(Eigen3 CONFIG REQUIRED)
|
||||||
|
include(${EIGEN3_USE_FILE})
|
||||||
|
|
||||||
|
find_package(ROOT CONFIG REQUIRED)
|
||||||
|
include(${ROOT_USE_FILE})
|
||||||
|
|
||||||
|
find_package(VTK CONFIG REQUIRED)
|
||||||
|
include(${VTK_USE_FILE})
|
||||||
|
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_INCLUDES math.h)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES CMAKE_REQUIRED_LIBRARIES m)
|
||||||
|
|
||||||
## CONFIG ------------------------------------------------------------------- ##
|
## CONFIG ------------------------------------------------------------------- ##
|
||||||
|
|
||||||
include(uLibConfigHeader)
|
set(BOOST_PP_VARIADICS ON)
|
||||||
|
|
||||||
|
include(CheckIncludeFiles)
|
||||||
|
include(CheckFunctionExists)
|
||||||
|
include(CheckSymbolExists)
|
||||||
|
|
||||||
|
CHECK_INCLUDE_FILES(inittypes.h HAVE_INITTYPES_H)
|
||||||
|
CHECK_INCLUDE_FILES(stdbool.h HAVE_STDBOOL_H)
|
||||||
|
CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)
|
||||||
|
CHECK_INCLUDE_FILES(stdlib.h HAVE_STDLIB_H)
|
||||||
|
CHECK_INCLUDE_FILES(dlfcn.h HAVE_DLFCN_H)
|
||||||
|
CHECK_INCLUDE_FILES(malloc.h HAVE_MALLOC_H)
|
||||||
|
CHECK_FUNCTION_EXISTS(malloc HAVE_MALLOC)
|
||||||
|
CHECK_INCLUDE_FILES(memory.h HAVE_MEMORY_H)
|
||||||
|
CHECK_INCLUDE_FILES(math.h HAVE_MATH_H)
|
||||||
|
CHECK_FUNCTION_EXISTS(fsetround HAVE_FSETROUND)
|
||||||
|
CHECK_FUNCTION_EXISTS(floor HAVE_FLOOR)
|
||||||
|
CHECK_FUNCTION_EXISTS(pow HAVE_POW)
|
||||||
|
CHECK_FUNCTION_EXISTS(sqrt HAVE_SQRT)
|
||||||
|
CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP)
|
||||||
|
CHECK_FUNCTION_EXISTS(strstr HAVE_STRSTR)
|
||||||
|
CHECK_INCLUDE_FILES(strings.h HAVE_STRINGS_H)
|
||||||
|
CHECK_INCLUDE_FILES(string.h HAVE_STRING_H)
|
||||||
|
CHECK_INCLUDE_FILES(sys/stat.h HAVE_SYS_STAT_H)
|
||||||
|
CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)
|
||||||
|
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
|
||||||
|
CHECK_INCLUDE_FILES(assert.h HAVE_ASSERT_H)
|
||||||
|
|
||||||
|
configure_file("${PROJECT_SOURCE_DIR}/CMakeConfig.in.h"
|
||||||
|
"${PROJECT_BINARY_DIR}/config.h")
|
||||||
|
|
||||||
|
install(FILES "${PROJECT_BINARY_DIR}/config.h"
|
||||||
|
DESTINATION ${PACKAGE_INSTALL_INC_DIR})
|
||||||
|
|
||||||
## ADD LIBRARIES SUBDIRECTORIES --------------------------------------------- ##
|
## ADD LIBRARIES SUBDIRECTORIES --------------------------------------------- ##
|
||||||
|
|
||||||
## select modules ##
|
include_directories(${PROJECT_BINARY_DIR})
|
||||||
set(ULIB_SELECTED_MODULES
|
include_directories(${SRC_DIR})
|
||||||
Core
|
|
||||||
Math
|
|
||||||
Detectors
|
|
||||||
Root
|
|
||||||
)
|
|
||||||
|
|
||||||
## uLib_add_shared_library puts names there
|
## uLib_add_shared_library puts names there
|
||||||
set(ULIB_SHARED_LIBRARIES)
|
set(ULIB_SHARED_LIBRARIES)
|
||||||
|
## select modules ##
|
||||||
|
set(ULIB_SELECTED_MODULES)
|
||||||
|
|
||||||
if(ULIB_USE_VTK)
|
include_directories(${SRC_DIR}/Core)
|
||||||
LIST(APPEND ULIB_SELECTED_MODULES Vtk)
|
add_subdirectory(${SRC_DIR}/Core)
|
||||||
endif(ULIB_USE_VTK)
|
|
||||||
|
include_directories(${SRC_DIR}/Math)
|
||||||
|
add_subdirectory(${SRC_DIR}/Math)
|
||||||
|
|
||||||
|
include_directories(${SRC_DIR}/Detectors)
|
||||||
|
add_subdirectory(${SRC_DIR}/Detectors)
|
||||||
|
|
||||||
|
include_directories(${SRC_DIR}/Root)
|
||||||
|
add_subdirectory(${SRC_DIR}/Root)
|
||||||
|
|
||||||
|
include_directories(${SRC_DIR}/Vtk)
|
||||||
|
add_subdirectory(${SRC_DIR}/Vtk)
|
||||||
|
|
||||||
|
#add_subdirectory("${SRC_DIR}/utils/make_recipe")
|
||||||
|
|
||||||
## Documentation and packages
|
## Documentation and packages
|
||||||
|
|
||||||
include(uLibGenerateRPMS)
|
#include(uLibGenerateDoc)
|
||||||
include(uLibGenerateDoc)
|
|
||||||
|
|
||||||
## this gets ulib modules into a variable ##
|
|
||||||
function(uLib_modules result)
|
|
||||||
set(out)
|
|
||||||
foreach(module ${ULIB_SELECTED_MODULES})
|
|
||||||
list(APPEND out ${PACKAGE_LIBPREFIX}${module})
|
|
||||||
endforeach(module)
|
|
||||||
set(${result} "${out}" PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
|
|
||||||
## ENTERING MODULES SUBDIRECTORIES ##
|
|
||||||
message("/////////// SELECTED MODULES //////////////")
|
|
||||||
foreach(module ${ULIB_SELECTED_MODULES})
|
|
||||||
message(STATUS "adding module: ${module}")
|
|
||||||
set( uLib-module ${module})
|
|
||||||
include_directories(${SRC_DIR}/${module})
|
|
||||||
add_subdirectory(${SRC_DIR}/${module})
|
|
||||||
endforeach(module)
|
|
||||||
|
|
||||||
## UTILITIES ##
|
## UTILITIES ##
|
||||||
add_subdirectory("${SRC_DIR}/utils/make_recipe")
|
#add_subdirectory("${SRC_DIR}/utils/make_recipe")
|
||||||
|
|
||||||
|
|
||||||
## INSTALLS AND EXPORTS ----------------------------------------------------- ##
|
## INSTALLS AND EXPORTS ----------------------------------------------------- ##
|
||||||
|
|
||||||
#export(PACKAGE uLib)
|
#export(PACKAGE ULIB)
|
||||||
export(PACKAGE ULIB)
|
#export(TARGETS ${ULIB_SHARED_LIBRARIES} ${ULIB_EXPORTED_TARGETS}
|
||||||
export(TARGETS ${ULIB_SHARED_LIBRARIES} ${ULIB_EXPORTED_TARGETS}
|
# FILE "${PROJECT_BINARY_DIR}/uLibTargets.cmake" )
|
||||||
FILE "${PROJECT_BINARY_DIR}/uLibTargets.cmake" )
|
|
||||||
#export(TARGETS ${ULIB_EXPORTED_TARGETS}
|
|
||||||
# FILE "${PROJECT_BINARY_DIR}/uLibExeTargets.cmake" )
|
|
||||||
|
|
||||||
|
|
||||||
# Create the FooBarConfig.cmake and FooBarConfigVersion files
|
# Create the FooBarConfig.cmake and FooBarConfigVersion files
|
||||||
file(RELATIVE_PATH REL_INCLUDE_DIR "${PACKAGE_INSTALL_CMAKE_DIR}"
|
file(RELATIVE_PATH REL_INCLUDE_DIR "${PACKAGE_INSTALL_CMAKE_DIR}"
|
||||||
"${PACKAGE_INSTALL_INC_DIR}")
|
"${PACKAGE_INSTALL_INC_DIR}")
|
||||||
|
|
||||||
# ... for the build tree
|
# ... for the build tree
|
||||||
set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}")
|
#set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}")
|
||||||
configure_file(uLibConfig.cmake.in
|
#configure_file(uLibConfig.cmake.in
|
||||||
"${PROJECT_BINARY_DIR}/uLibConfig.cmake" @ONLY)
|
# "${PROJECT_BINARY_DIR}/uLibConfig.cmake" @ONLY)
|
||||||
|
|
||||||
# ... for the install tree
|
# ... for the install tree
|
||||||
set(CONF_INCLUDE_DIRS "\${ULIB_CMAKE_DIR}/${REL_INCLUDE_DIR}")
|
set(CONF_INCLUDE_DIRS "\${ULIB_CMAKE_DIR}/${REL_INCLUDE_DIR}")
|
||||||
configure_file(uLibConfig.cmake.in
|
configure_file(uLibConfig.cmake.in
|
||||||
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/uLibConfig.cmake" @ONLY)
|
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/uLibConfig.cmake"
|
||||||
|
@ONLY)
|
||||||
|
|
||||||
# ... for both
|
# ... for both
|
||||||
configure_file(uLibConfigVersion.cmake.in
|
configure_file(uLibConfigVersion.cmake.in
|
||||||
"${PROJECT_BINARY_DIR}/uLibConfigVersion.cmake" @ONLY)
|
"${PROJECT_BINARY_DIR}/uLibConfigVersion.cmake" @ONLY)
|
||||||
|
|
||||||
install(FILES "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/uLibConfig.cmake"
|
install(FILES "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/uLibConfig.cmake"
|
||||||
"${PROJECT_BINARY_DIR}/uLibConfigVersion.cmake"
|
"${PROJECT_BINARY_DIR}/uLibConfigVersion.cmake"
|
||||||
"${PROJECT_SOURCE_DIR}/CMake/FindReadLine.cmake"
|
|
||||||
"${PROJECT_SOURCE_DIR}/CMake/FindROOT.cmake"
|
|
||||||
"${PROJECT_SOURCE_DIR}/CMake/FindROOTv6.cmake"
|
|
||||||
"${PROJECT_SOURCE_DIR}/CMake/uLibCommon.cmake"
|
|
||||||
"${PROJECT_SOURCE_DIR}/CMake/uLibConfigHeader.cmake"
|
|
||||||
"${PROJECT_SOURCE_DIR}/CMake/uLibDebugMacro.cmake"
|
|
||||||
"${PROJECT_SOURCE_DIR}/CMake/uLibFindDependencies.cmake"
|
|
||||||
"${PROJECT_SOURCE_DIR}/CMake/uLibGenerateDoc.cmake"
|
|
||||||
"${PROJECT_SOURCE_DIR}/CMake/uLibGenerateRMake.cmake"
|
|
||||||
"${PROJECT_SOURCE_DIR}/CMake/uLibGenerateRPMS.cmake"
|
|
||||||
"${PROJECT_SOURCE_DIR}/CMake/uLibMacros.cmake"
|
|
||||||
"${PROJECT_SOURCE_DIR}/CMake/uLibTargetMacros.cmake"
|
|
||||||
DESTINATION "${PACKAGE_INSTALL_CMAKE_DIR}"
|
DESTINATION "${PACKAGE_INSTALL_CMAKE_DIR}"
|
||||||
COMPONENT dev)
|
COMPONENT dev)
|
||||||
|
|
||||||
# Install the export set for use with the install-tree
|
# Install the export set for use with the install-tree
|
||||||
install(EXPORT "${PROJECT_NAME}Targets" DESTINATION
|
install(EXPORT "${PROJECT_NAME}Targets"
|
||||||
"${PACKAGE_INSTALL_CMAKE_DIR}" COMPONENT dev)
|
DESTINATION "${PACKAGE_INSTALL_CMAKE_DIR}"
|
||||||
|
COMPONENT dev)
|
||||||
install(FILES ${PROJECT_SOURCE_DIR}/ulib.h DESTINATION ${PACKAGE_INSTALL_INC_DIR})
|
|
||||||
|
|
||||||
|
|
||||||
# TODO clean also subdirectories
|
|
||||||
add_custom_target(clean-cmake-files
|
|
||||||
COMMAND ${CMAKE_COMMAND} -P ${ULIB_CMAKE_DIR}/clean-all.cmake
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +1,27 @@
|
|||||||
|
|
||||||
set(HEADERS
|
set(HEADERS Options.h
|
||||||
Archives.h
|
StaticInterface.h)
|
||||||
Array.h
|
|
||||||
Debug.h
|
set(SOURCES Options.cpp)
|
||||||
Export.h
|
|
||||||
Function.h
|
set(LIBRARIES ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||||
Macros.h
|
|
||||||
Mpl.h
|
set(libname ${PACKAGE_LIBPREFIX}Core)
|
||||||
Object.h
|
set(ULIB_SHARED_LIBRARIES ${ULIB_SHARED_LIBRARIES} ${libname} PARENT_SCOPE)
|
||||||
ObjectProps.h
|
set(ULIB_SELECTED_MODULES ${ULIB_SELECTED_MODULES} Core PARENT_SCOPE)
|
||||||
Options.h
|
|
||||||
Serializable.h
|
add_library(${libname} SHARED ${SOURCES})
|
||||||
Signal.h
|
set_target_properties(${libname} PROPERTIES
|
||||||
Singleton.h
|
VERSION ${PROJECT_VERSION}
|
||||||
SmartPointer.h
|
SOVERSION ${PROJECT_SOVERSION})
|
||||||
StaticInterface.h
|
target_link_libraries(${libname} ${LIBRARIES})
|
||||||
StringReader.h
|
|
||||||
Types.h
|
install(TARGETS ${libname}
|
||||||
Uuid.h
|
EXPORT "${PROJECT_NAME}Targets"
|
||||||
Timer.h
|
RUNTIME DESTINATION ${PACKAGE_INSTALL_BIN_DIR} COMPONENT bin
|
||||||
)
|
LIBRARY DESTINATION ${PACKAGE_INSTALL_LIB_DIR} COMPONENT lib)
|
||||||
|
|
||||||
|
install(FILES ${HEADERS} DESTINATION ${PACKAGE_INSTALL_INC_DIR}/Core)
|
||||||
|
|
||||||
SET(SOURCES
|
|
||||||
Archives.cpp
|
|
||||||
Object.cpp
|
|
||||||
Options.cpp
|
|
||||||
Serializable.cpp
|
|
||||||
Signal.cpp
|
|
||||||
Uuid.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
set(LIBRARIES
|
|
||||||
${Boost_SERIALIZATION_LIBRARY}
|
|
||||||
${Boost_SIGNALS_LIBRARY}
|
|
||||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
|
||||||
${ROOT_LIBRARIES}
|
|
||||||
)
|
|
||||||
|
|
||||||
uLib_add_shared_library(${uLib-module})
|
|
||||||
add_subdirectory(testing)
|
|
||||||
|
|||||||
@@ -1,37 +1,6 @@
|
|||||||
#set(HEADERS
|
|
||||||
# DetectorChamber.h
|
|
||||||
# ExperimentFitEvent.h
|
|
||||||
# GeantEvent.h
|
|
||||||
# HitMC.h
|
|
||||||
# MuonScatter.h
|
|
||||||
# MuonEvent.h
|
|
||||||
# MuonError.h
|
|
||||||
# ChamberHitEvent.h
|
|
||||||
# Hit.h
|
|
||||||
# LinearFit.h
|
|
||||||
# Solid.h
|
|
||||||
# Matter.h
|
|
||||||
# Scene.h
|
|
||||||
#)
|
|
||||||
|
|
||||||
|
|
||||||
#set(SOURCES
|
|
||||||
# Solid.cpp
|
|
||||||
# Scene.cpp
|
|
||||||
#)
|
|
||||||
|
|
||||||
#set(LIBRARIES
|
|
||||||
# ${Boost_SERIALIZATION_LIBRARY}
|
|
||||||
# ${Boost_SIGNALS_LIBRARY}
|
|
||||||
# ${Boost_PROGRAM_OPTIONS_LIBRARY}
|
|
||||||
# ${Eigen_LIBRARY}
|
|
||||||
# ${Geant4_LIBRARIES}
|
|
||||||
# ${ROOT_LIBRARIES}
|
|
||||||
# ${PACKAGE_LIBPREFIX}Core
|
|
||||||
# ${PACKAGE_LIBPREFIX}Math
|
|
||||||
#)
|
|
||||||
|
|
||||||
set(HEADERS MuonScatter.h MuonError.h MuonEvent.h)
|
set(HEADERS MuonScatter.h MuonError.h MuonEvent.h)
|
||||||
|
|
||||||
uLib_add_shared_library(${uLib-module})
|
set(ULIB_SELECTED_MODULES ${ULIB_SELECTED_MODULES} Detectors PARENT_SCOPE)
|
||||||
add_subdirectory(testing)
|
|
||||||
|
install(FILES ${HEADERS}
|
||||||
|
DESTINATION ${PACKAGE_INSTALL_INC_DIR}/Detectors)
|
||||||
|
|||||||
@@ -1,53 +1,53 @@
|
|||||||
|
set(HEADERS ContainerBox.h
|
||||||
|
Dense.h
|
||||||
|
Geometry.h
|
||||||
|
Transform.h
|
||||||
|
StructuredData.h
|
||||||
|
StructuredGrid.h
|
||||||
|
VoxImage.h
|
||||||
|
VoxRaytracer.h
|
||||||
|
Utils.h
|
||||||
|
VoxImageFilter.h
|
||||||
|
VoxImageFilter.hpp
|
||||||
|
VoxImageFilterLinear.hpp
|
||||||
|
VoxImageFilterMedian.hpp
|
||||||
|
VoxImageFilterABTrim.hpp
|
||||||
|
VoxImageFilterBilateral.hpp
|
||||||
|
VoxImageFilterThreshold.hpp
|
||||||
|
VoxImageFilter2ndStat.hpp
|
||||||
|
VoxImageFilterCustom.hpp
|
||||||
|
Accumulator.h
|
||||||
|
TriangleMesh.h
|
||||||
|
BitCode.h
|
||||||
|
Structured2DGrid.h
|
||||||
|
Structured4DGrid.h)
|
||||||
|
|
||||||
# HEADERS
|
set(SOURCES VoxRaytracer.cpp
|
||||||
set(HEADERS
|
StructuredData.cpp
|
||||||
ContainerBox.h
|
StructuredGrid.cpp
|
||||||
Dense.h
|
VoxImage.cpp
|
||||||
Geometry.h
|
TriangleMesh.cpp
|
||||||
Transform.h
|
Dense.cpp
|
||||||
StructuredData.h
|
Structured2DGrid.cpp
|
||||||
StructuredGrid.h
|
Structured4DGrid.cpp)
|
||||||
VoxImage.h
|
|
||||||
VoxRaytracer.h
|
|
||||||
Utils.h
|
|
||||||
VoxImageFilter.h
|
|
||||||
VoxImageFilter.hpp
|
|
||||||
VoxImageFilterLinear.hpp
|
|
||||||
VoxImageFilterMedian.hpp
|
|
||||||
VoxImageFilterABTrim.hpp
|
|
||||||
VoxImageFilterBilateral.hpp
|
|
||||||
VoxImageFilterThreshold.hpp
|
|
||||||
VoxImageFilter2ndStat.hpp
|
|
||||||
VoxImageFilterCustom.hpp
|
|
||||||
Accumulator.h
|
|
||||||
TriangleMesh.h
|
|
||||||
BitCode.h
|
|
||||||
Structured2DGrid.h
|
|
||||||
Structured4DGrid.h
|
|
||||||
)
|
|
||||||
|
|
||||||
|
set(LIBRARIES ${Eigen_LIBRARY}
|
||||||
|
${ROOT_LIBRARIES})
|
||||||
|
|
||||||
# SOURCES
|
set(libname ${PACKAGE_LIBPREFIX}Math)
|
||||||
set(SOURCES
|
set(ULIB_SHARED_LIBRARIES ${ULIB_SHARED_LIBRARIES} ${libname} PARENT_SCOPE)
|
||||||
VoxRaytracer.cpp
|
set(ULIB_SELECTED_MODULES ${ULIB_SELECTED_MODULES} Math PARENT_SCOPE)
|
||||||
StructuredData.cpp
|
|
||||||
StructuredGrid.cpp
|
|
||||||
VoxImage.cpp
|
|
||||||
TriangleMesh.cpp
|
|
||||||
Dense.cpp
|
|
||||||
Structured2DGrid.cpp
|
|
||||||
Structured4DGrid.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
set(LIBRARIES
|
add_library(${libname} SHARED ${SOURCES})
|
||||||
${Boost_SERIALIZATION_LIBRARY}
|
set_target_properties(${libname} PROPERTIES
|
||||||
${Boost_SIGNALS_LIBRARY}
|
VERSION ${PROJECT_VERSION}
|
||||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
SOVERSION ${PROJECT_SOVERSION})
|
||||||
${Eigen_LIBRARY}
|
target_link_libraries(${libname} ${LIBRARIES})
|
||||||
${ROOT_LIBRARIES}
|
|
||||||
${PACKAGE_LIBPREFIX}Core
|
|
||||||
)
|
|
||||||
|
|
||||||
|
install(TARGETS ${libname}
|
||||||
|
EXPORT "${PROJECT_NAME}Targets"
|
||||||
|
RUNTIME DESTINATION ${PACKAGE_INSTALL_BIN_DIR} COMPONENT bin
|
||||||
|
LIBRARY DESTINATION ${PACKAGE_INSTALL_LIB_DIR} COMPONENT lib)
|
||||||
|
|
||||||
|
install(FILES ${HEADERS} DESTINATION ${PACKAGE_INSTALL_INC_DIR}/Math)
|
||||||
|
|
||||||
uLib_add_shared_library(${uLib-module})
|
|
||||||
add_subdirectory(testing)
|
|
||||||
|
|||||||
@@ -28,11 +28,12 @@
|
|||||||
#ifndef VOXIMAGEFILTERCUSTOM_HPP
|
#ifndef VOXIMAGEFILTERCUSTOM_HPP
|
||||||
#define VOXIMAGEFILTERCUSTOM_HPP
|
#define VOXIMAGEFILTERCUSTOM_HPP
|
||||||
|
|
||||||
#include "Core/Macros.h"
|
|
||||||
#include <Math/Dense.h>
|
#include <Math/Dense.h>
|
||||||
#include "Math/VoxImage.h"
|
#include "Math/VoxImage.h"
|
||||||
#include "VoxImageFilter.h"
|
#include "VoxImageFilter.h"
|
||||||
|
|
||||||
|
#define likely(expr) __builtin_expect(!!(expr), 1)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
///// VOXIMAGE FILTER CUSTOM /////////////////////////////////////////////////
|
///// VOXIMAGE FILTER CUSTOM /////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -24,13 +24,12 @@
|
|||||||
//////////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "VoxRaytracer.h"
|
#include "VoxRaytracer.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
#include "Core/Macros.h"
|
|
||||||
|
|
||||||
inline float fast_sign(float f) { return 1 - 2 * (f < 0); }
|
inline float fast_sign(float f) { return 1 - 2 * (f < 0); }
|
||||||
|
|
||||||
namespace uLib {
|
namespace uLib {
|
||||||
@@ -49,16 +48,17 @@ void VoxRaytracer::RayData::AddElement(Id_t id, float L)
|
|||||||
|
|
||||||
void VoxRaytracer::RayData::AppendRay(const VoxRaytracer::RayData &in)
|
void VoxRaytracer::RayData::AppendRay(const VoxRaytracer::RayData &in)
|
||||||
{
|
{
|
||||||
if (unlikely(!in.m_Data.size())) {
|
if (!in.m_Data.size())
|
||||||
|
{
|
||||||
std::cout << "Warinig: PoCA on exit border!\n";
|
std::cout << "Warinig: PoCA on exit border!\n";
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else if (unlikely(!m_Data.size())) {
|
else if (!m_Data.size())
|
||||||
|
{
|
||||||
m_Data = in.m_Data;
|
m_Data = in.m_Data;
|
||||||
std::cout << "Warinig: PoCA on entrance border!\n";
|
std::cout << "Warinig: PoCA on entrance border!\n";
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
// Opzione 1) un voxel in piu' //
|
// Opzione 1) un voxel in piu' //
|
||||||
m_Data.reserve(m_Data.size() + in.m_Data.size());
|
m_Data.reserve(m_Data.size() + in.m_Data.size());
|
||||||
m_Data.insert(m_Data.end(), in.m_Data.begin(), in.m_Data.end());
|
m_Data.insert(m_Data.end(), in.m_Data.begin(), in.m_Data.end());
|
||||||
@@ -82,16 +82,22 @@ void VoxRaytracer::RayData::AppendRay(const VoxRaytracer::RayData &in)
|
|||||||
void VoxRaytracer::RayData::PrintSelf(std::ostream &o)
|
void VoxRaytracer::RayData::PrintSelf(std::ostream &o)
|
||||||
{
|
{
|
||||||
o << "Ray: total lenght " << m_TotalLength << "\n";
|
o << "Ray: total lenght " << m_TotalLength << "\n";
|
||||||
std::vector<Element>::iterator it;
|
for(std::vector<Element>::iterator it = m_Data.begin(); it < m_Data.end(); ++it)
|
||||||
for(it = m_Data.begin(); it < m_Data.end(); ++it)
|
{
|
||||||
o << "[ " << (*it).vox_id << ", " << (*it).L << "] \n";
|
o << "[ " << (*it).vox_id << ", " << (*it).L << "] \n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//// RAY TRACER ////////////////////////////////////////////////////////////////
|
//// RAY TRACER ////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
VoxRaytracer::VoxRaytracer(StructuredGrid &image) : m_Image(&image)
|
||||||
|
{
|
||||||
|
m_scale << (m_Image->GetWorldMatrix() * Vector4f(1,0,0,0)).norm(),
|
||||||
|
(m_Image->GetWorldMatrix() * Vector4f(0,1,0,0)).norm(),
|
||||||
|
(m_Image->GetWorldMatrix() * Vector4f(0,0,1,0)).norm();
|
||||||
|
}
|
||||||
|
|
||||||
bool VoxRaytracer::GetEntryPoint(const HLine3f &line, HPoint3f &pt)
|
bool VoxRaytracer::GetEntryPoint(const HLine3f &line, HPoint3f &pt)
|
||||||
{
|
{
|
||||||
@@ -150,9 +156,7 @@ bool VoxRaytracer::GetExitPoint(const HLine3f &line, HPoint3f &pt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VoxRaytracer::RayData VoxRaytracer::TraceBetweenPoints(const HPoint3f &in,
|
VoxRaytracer::RayData VoxRaytracer::TraceBetweenPoints(const HPoint3f &in, const HPoint3f &out) const
|
||||||
const HPoint3f &out)
|
|
||||||
const
|
|
||||||
{
|
{
|
||||||
RayData ray;
|
RayData ray;
|
||||||
Vector4f pt1 = m_Image->GetLocalPoint(in);
|
Vector4f pt1 = m_Image->GetLocalPoint(in);
|
||||||
@@ -162,53 +166,138 @@ const
|
|||||||
float l = s.head(3).norm();
|
float l = s.head(3).norm();
|
||||||
Vector3f L(l/s(0), l/s(1), l/s(2));
|
Vector3f L(l/s(0), l/s(1), l/s(2));
|
||||||
|
|
||||||
// Vector3f scale; // FIXXX
|
|
||||||
// scale << (m_Image->GetWorldMatrix() * Vector4f(1,0,0,0)).norm(),
|
|
||||||
// (m_Image->GetWorldMatrix() * Vector4f(0,1,0,0)).norm(),
|
|
||||||
// (m_Image->GetWorldMatrix() * Vector4f(0,0,1,0)).norm();
|
|
||||||
|
|
||||||
Vector3f offset;
|
Vector3f offset;
|
||||||
for(int i=0;i<3;++i) offset(i) = (s(i)>=0) - (pt1(i)-floor(pt1(i))) ;
|
for(int i=0;i<3;++i)
|
||||||
|
{
|
||||||
|
offset(i) = (s(i)>=0) - (pt1(i)-floor(pt1(i)));
|
||||||
|
}
|
||||||
offset = offset.cwiseProduct(L).cwiseAbs();
|
offset = offset.cwiseProduct(L).cwiseAbs();
|
||||||
L = L.cwiseAbs();
|
L = L.cwiseAbs();
|
||||||
|
|
||||||
//---- Check if the ray only crosses one voxel
|
//---- Check if the ray only crosses one voxel
|
||||||
Vector3i vid = m_Image->Find(in);
|
Vector3i vid = m_Image->Find(in);
|
||||||
if(vid == m_Image->Find(out)){
|
if (vid == m_Image->Find(out))
|
||||||
ray.AddElement(m_Image->Map(vid),s.norm());
|
{
|
||||||
return ray;
|
ray.AddElement(m_Image->Map(vid),s.norm());
|
||||||
|
return ray;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---- Otherwise, loop until ray is finished
|
//---- Otherwise, loop until ray is finished
|
||||||
int id; float d;
|
int id; float d;
|
||||||
while(l>0){
|
while (l>0)
|
||||||
|
{
|
||||||
|
d = offset.minCoeff(&id);
|
||||||
|
|
||||||
d = offset.minCoeff(&id);
|
if (m_Image->IsInsideGrid(vid))
|
||||||
|
{
|
||||||
|
ray.AddElement(m_Image->Map(vid), d * m_scale(id));
|
||||||
|
}
|
||||||
|
|
||||||
if(m_Image->IsInsideGrid(vid)){
|
vid(id) += (int)fast_sign(s(id));
|
||||||
ray.AddElement(m_Image->Map(vid), d * m_scale(id) );
|
|
||||||
}
|
|
||||||
|
|
||||||
// nan check //
|
l -= d;
|
||||||
// if(unlikely(!isFinite(d * scale(id)))) {
|
offset.array() -= d;
|
||||||
// std:: cout << "NAN in raytracer\n";
|
offset(id) = fmin(L(id),l);
|
||||||
// exit(1);
|
|
||||||
// }
|
|
||||||
|
|
||||||
vid(id) += (int)fast_sign(s(id));
|
|
||||||
|
|
||||||
l -= d;
|
|
||||||
offset.array() -= d;
|
|
||||||
offset(id) = fmin(L(id),l);
|
|
||||||
}
|
}
|
||||||
return ray;
|
return ray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int encode_v(Vector3i in)
|
||||||
|
{
|
||||||
|
return ((in[0] + 1) << 4) + ((in[1] + 1) << 2) + in[2] + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Vector3i decode_v(int in)
|
||||||
|
{
|
||||||
|
Vector3i result {
|
||||||
|
((in & 48) >> 4) - 1,
|
||||||
|
((in & 12) >> 2) - 1,
|
||||||
|
(in & 3) - 1
|
||||||
|
};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
VoxRaytracer::RayData VoxRaytracer::BeamBetweenPoints(const HPoint3f &in, const HPoint3f &out, Vector3i thickness) const
|
||||||
|
{
|
||||||
|
if (thickness[0] < 0) thickness[0] = 0;
|
||||||
|
if (thickness[1] < 0) thickness[1] = 0;
|
||||||
|
if (thickness[2] < 0) thickness[2] = 0;
|
||||||
|
|
||||||
|
Vector3i zero_v { 0, 0, 0 };
|
||||||
|
|
||||||
|
RayData ray = TraceBetweenPoints(in, out);
|
||||||
|
if (thickness == zero_v || ray.Data().size() == 0) return ray;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Calculate the forbidden relocations
|
||||||
|
*/
|
||||||
|
|
||||||
|
std::unordered_map<int, int> ban_points(26);
|
||||||
|
|
||||||
|
Vector3i prevPos = m_Image->UnMap(ray.Data()[0].vox_id);
|
||||||
|
Vector3i currDir = zero_v;
|
||||||
|
int currLen = 1;
|
||||||
|
|
||||||
|
for (int k = 1; k < ray.Data().size(); k++)
|
||||||
|
{
|
||||||
|
Vector3i currPos = m_Image->UnMap(ray.Data()[k].vox_id);
|
||||||
|
Vector3i offset = currPos - prevPos;
|
||||||
|
prevPos = currPos;
|
||||||
|
|
||||||
|
if (k == 1) currDir = offset;
|
||||||
|
|
||||||
|
if (offset == currDir)
|
||||||
|
{
|
||||||
|
currLen++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int enc_v = encode_v(currDir);
|
||||||
|
if (ban_points.find(enc_v) == ban_points.end())
|
||||||
|
{
|
||||||
|
ban_points.emplace(enc_v, currLen);
|
||||||
|
}
|
||||||
|
else if (currLen > ban_points[enc_v])
|
||||||
|
{
|
||||||
|
ban_points[enc_v] = currLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
currDir = offset;
|
||||||
|
currLen = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Calculate the beam section
|
||||||
|
*/
|
||||||
|
std::vector<Vector3i> relocs;
|
||||||
|
relocs.push_back(zero_v);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compose the beam
|
||||||
|
*/
|
||||||
|
RayData beam;
|
||||||
|
for (auto iter : ray.Data())
|
||||||
|
{
|
||||||
|
Vector3i rPos = m_Image->UnMap(iter.vox_id);
|
||||||
|
|
||||||
|
for (Vector3i reloc : relocs)
|
||||||
|
{
|
||||||
|
Vector3i cPos = rPos + reloc;
|
||||||
|
if (!m_Image->IsInsideGrid(cPos)) continue;
|
||||||
|
|
||||||
|
beam.AddElement(m_Image->Map(cPos), iter.L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return beam;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 20150528 SV for absorbed muons
|
// 20150528 SV for absorbed muons
|
||||||
VoxRaytracer::RayData VoxRaytracer::TraceLine(const HLine3f &line) const
|
VoxRaytracer::RayData VoxRaytracer::TraceLine(const HLine3f &line) const
|
||||||
{
|
{
|
||||||
RayData ray;
|
RayData ray;
|
||||||
|
|
||||||
Vector4f pt = m_Image->GetLocalPoint(line.origin);
|
Vector4f pt = m_Image->GetLocalPoint(line.origin);
|
||||||
Vector4f s = m_Image->GetLocalPoint(line.direction);
|
Vector4f s = m_Image->GetLocalPoint(line.direction);
|
||||||
|
|
||||||
@@ -250,4 +339,4 @@ VoxRaytracer::RayData VoxRaytracer::TraceLine(const HLine3f &line) const
|
|||||||
return ray;
|
return ray;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} //end of namespace uLib
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ namespace uLib {
|
|||||||
class VoxRaytracer {
|
class VoxRaytracer {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class RayData {
|
class RayData
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
RayData() : m_TotalLength(0) {}
|
RayData() : m_TotalLength(0) {}
|
||||||
|
|
||||||
@@ -62,14 +63,8 @@ public:
|
|||||||
Scalarf m_TotalLength;
|
Scalarf m_TotalLength;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
public:
|
VoxRaytracer(StructuredGrid &image);
|
||||||
VoxRaytracer(StructuredGrid &image) : m_Image(&image) {
|
|
||||||
m_scale <<
|
|
||||||
(m_Image->GetWorldMatrix() * Vector4f(1,0,0,0)).norm(),
|
|
||||||
(m_Image->GetWorldMatrix() * Vector4f(0,1,0,0)).norm(),
|
|
||||||
(m_Image->GetWorldMatrix() * Vector4f(0,0,1,0)).norm();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetEntryPoint(const HLine3f &line, HPoint3f &pt);
|
bool GetEntryPoint(const HLine3f &line, HPoint3f &pt);
|
||||||
|
|
||||||
@@ -77,6 +72,8 @@ public:
|
|||||||
|
|
||||||
RayData TraceBetweenPoints(const HPoint3f &in, const HPoint3f &out) const;
|
RayData TraceBetweenPoints(const HPoint3f &in, const HPoint3f &out) const;
|
||||||
|
|
||||||
|
RayData BeamBetweenPoints(const HPoint3f &in, const HPoint3f &out, Vector3i thickness) const;
|
||||||
|
|
||||||
RayData TraceLine(const HLine3f &line) const;
|
RayData TraceLine(const HLine3f &line) const;
|
||||||
|
|
||||||
inline StructuredGrid* GetImage() const { return this->m_Image; }
|
inline StructuredGrid* GetImage() const { return this->m_Image; }
|
||||||
|
|||||||
@@ -1,55 +1,27 @@
|
|||||||
set(HEADERS
|
set(HEADERS RootMathDense.h
|
||||||
TestTObject.h
|
RootMuonScatter.h
|
||||||
RootMathDense.h
|
RootHitRaw.h)
|
||||||
RootMuonScatter.h
|
|
||||||
RootHitRaw.h
|
|
||||||
muBlastHit.h
|
|
||||||
muBlastMCTrack.h
|
|
||||||
muCastorMCTrack.h
|
|
||||||
muCastorHit.h
|
|
||||||
muCastorInfo.h
|
|
||||||
)
|
|
||||||
|
|
||||||
set(DICTIONARY_HEADERS
|
set(SOURCES ${HEADERS} RootMuonScatter.cpp)
|
||||||
TestTObject.h
|
|
||||||
RootMathDense.h
|
|
||||||
RootMuonScatter.h
|
|
||||||
RootHitRaw.h
|
|
||||||
muBlastHit.h
|
|
||||||
muBlastMCTrack.h
|
|
||||||
muCastorMCTrack.h
|
|
||||||
muCastorHit.h
|
|
||||||
muCastorInfo.h
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(SOURCES
|
set(LIBRARIES ${ROOT_LIBRARIES}
|
||||||
TestTObject.cpp
|
${PACKAGE_LIBPREFIX}Math)
|
||||||
RootMuonScatter.cpp
|
|
||||||
muBlastHit.cpp
|
|
||||||
muBlastMCTrack.cpp
|
|
||||||
muCastorMCTrack.cpp
|
|
||||||
muCastorHit.cpp
|
|
||||||
muCastorInfo.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
set(LIBRARIES
|
set(libname ${PACKAGE_LIBPREFIX}Root)
|
||||||
# ${Boost_SERIALIZATION_LIBRARY}
|
set(ULIB_SHARED_LIBRARIES ${ULIB_SHARED_LIBRARIES} ${libname} PARENT_SCOPE)
|
||||||
# ${Boost_SIGNALS_LIBRARY}
|
set(ULIB_SELECTED_MODULES ${ULIB_SELECTED_MODULES} Root PARENT_SCOPE)
|
||||||
# ${Boost_PROGRAM_OPTIONS_LIBRARY}
|
|
||||||
${ROOT_LIBRARIES}
|
|
||||||
${PACKAGE_LIBPREFIX}Core
|
|
||||||
${PACKAGE_LIBPREFIX}Math
|
|
||||||
)
|
|
||||||
|
|
||||||
include(FindROOTv6)
|
add_library(${libname} SHARED ${SOURCES})
|
||||||
root_generate_dictionary(uLibRootDict ${DICTIONARY_HEADERS} LINKDEF Linkdef.h)
|
set_target_properties(${libname} PROPERTIES
|
||||||
set_source_files_properties(uLibRootDict.cxx PROPERTIES GENERATED TRUE)
|
VERSION ${PROJECT_VERSION}
|
||||||
set_source_files_properties(uLibRootDict.h PROPERTIES GENERATED TRUE)
|
SOVERSION ${PROJECT_SOVERSION})
|
||||||
list(APPEND SOURCES uLibRootDict.cxx)
|
target_link_libraries(${libname} ${LIBRARIES})
|
||||||
|
|
||||||
|
install(TARGETS ${libname}
|
||||||
|
EXPORT "${PROJECT_NAME}Targets"
|
||||||
|
RUNTIME DESTINATION ${PACKAGE_INSTALL_BIN_DIR} COMPONENT bin
|
||||||
|
LIBRARY DESTINATION ${PACKAGE_INSTALL_LIB_DIR} COMPONENT lib)
|
||||||
|
|
||||||
|
install(FILES ${HEADERS} DESTINATION ${PACKAGE_INSTALL_INC_DIR}/Root)
|
||||||
|
|
||||||
# TODO use a custom target linked to root_generate_dictionary
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uLibRootDict_rdict.pcm
|
|
||||||
DESTINATION ${PACKAGE_INSTALL_LIB_DIR})
|
|
||||||
|
|
||||||
uLib_add_shared_library(${uLib-module})
|
|
||||||
add_subdirectory(testing)
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
// Martin Subieta martin.subieta@ing.unibs.it
|
// Martin Subieta martin.subieta@ing.unibs.it
|
||||||
//########################################
|
//########################################
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "TObject.h"
|
#include "TObject.h"
|
||||||
#include "TParticle.h"
|
#include "TParticle.h"
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
// Martin Subieta martin.subieta@ing.unibs.it
|
// Martin Subieta martin.subieta@ing.unibs.it
|
||||||
//########################################
|
//########################################
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include "vector"
|
#include "vector"
|
||||||
#include "TObject.h"
|
#include "TObject.h"
|
||||||
#include "TParticle.h"
|
#include "TParticle.h"
|
||||||
|
|||||||
@@ -1,37 +1,38 @@
|
|||||||
set(HEADERS
|
set(HEADERS uLibVtkInterface.h
|
||||||
uLibVtkInterface.h
|
uLibVtkViewer.h
|
||||||
uLibVtkViewer.h
|
vtkContainerBox.h
|
||||||
vtkContainerBox.h
|
vtkMuonScatter.h
|
||||||
vtkMuonScatter.h
|
vtkStructuredGrid.h
|
||||||
vtkStructuredGrid.h
|
vtkVoxRaytracerRepresentation.h
|
||||||
vtkVoxRaytracerRepresentation.h
|
vtkVoxImage.h)
|
||||||
vtkVoxImage.h
|
|
||||||
# vtkHLineRepresentation.h
|
|
||||||
# vtkTriangleMesh.h
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(SOURCES
|
set(SOURCES uLibVtkInterface.cxx
|
||||||
uLibVtkInterface.cxx
|
uLibVtkViewer.cpp
|
||||||
uLibVtkViewer.cpp
|
vtkContainerBox.cpp
|
||||||
vtkContainerBox.cpp
|
vtkMuonScatter.cxx
|
||||||
vtkMuonScatter.cxx
|
vtkStructuredGrid.cpp
|
||||||
vtkStructuredGrid.cpp
|
vtkVoxRaytracerRepresentation.cpp
|
||||||
vtkVoxRaytracerRepresentation.cpp
|
vtkVoxImage.cpp)
|
||||||
vtkVoxImage.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
set(LIBRARIES
|
set(LIBRARIES ${Eigen_LIBRARY}
|
||||||
${Boost_SERIALIZATION_LIBRARY}
|
${ROOT_LIBRARIES}
|
||||||
${Boost_SIGNALS_LIBRARY}
|
${VTK_LIBRARIES}
|
||||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
${PACKAGE_LIBPREFIX}Math)
|
||||||
${Eigen_LIBRARY}
|
|
||||||
${ROOT_LIBRARIES}
|
|
||||||
${Geant4_LIBRARIES}
|
|
||||||
${VTK_LIBRARIES}
|
|
||||||
${PACKAGE_LIBPREFIX}Core
|
|
||||||
${PACKAGE_LIBPREFIX}Math
|
|
||||||
)
|
|
||||||
|
|
||||||
uLib_add_shared_library(${uLib-module})
|
set(libname ${PACKAGE_LIBPREFIX}Vtk)
|
||||||
|
set(ULIB_SHARED_LIBRARIES ${ULIB_SHARED_LIBRARIES} ${libname} PARENT_SCOPE)
|
||||||
|
set(ULIB_SELECTED_MODULES ${ULIB_SELECTED_MODULES} Vtk PARENT_SCOPE)
|
||||||
|
|
||||||
|
add_library(${libname} SHARED ${SOURCES})
|
||||||
|
set_target_properties(${libname} PROPERTIES
|
||||||
|
VERSION ${PROJECT_VERSION}
|
||||||
|
SOVERSION ${PROJECT_SOVERSION})
|
||||||
|
target_link_libraries(${libname} ${LIBRARIES})
|
||||||
|
|
||||||
|
install(TARGETS ${libname}
|
||||||
|
EXPORT "${PROJECT_NAME}Targets"
|
||||||
|
RUNTIME DESTINATION ${PACKAGE_INSTALL_BIN_DIR} COMPONENT bin
|
||||||
|
LIBRARY DESTINATION ${PACKAGE_INSTALL_LIB_DIR} COMPONENT lib)
|
||||||
|
|
||||||
|
install(FILES ${HEADERS} DESTINATION ${PACKAGE_INSTALL_INC_DIR}/Vtk)
|
||||||
|
|
||||||
add_subdirectory(testing)
|
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
/*//////////////////////////////////////////////////////////////////////////////
|
|
||||||
// CMT Cosmic Muon Tomography project //////////////////////////////////////////
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
|
|
||||||
All rights reserved
|
|
||||||
|
|
||||||
Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
|
|
||||||
|
|
||||||
------------------------------------------------------------------
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 3.0 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library.
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "Object.h"
|
|
||||||
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -9,11 +9,7 @@ get_filename_component(ULIB_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
|||||||
set(ULIB_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
|
set(ULIB_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
|
||||||
|
|
||||||
# Our library dependencies (contains definitions for IMPORTED targets)
|
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||||
# if(NOT TARGET foo AND NOT FooBar_BINARY_DIR)
|
include("${ULIB_CMAKE_DIR}/uLibTargets.cmake")
|
||||||
include("${ULIB_CMAKE_DIR}/uLibTargets.cmake")
|
|
||||||
# endif()
|
|
||||||
|
|
||||||
# These are IMPORTED targets created by FooBarTargets.cmake
|
# These are IMPORTED targets created by FooBarTargets.cmake
|
||||||
# set(FOOBAR_LIBRARIES foo)
|
|
||||||
# set(FOOBAR_EXECUTABLE bar)
|
|
||||||
set(ULIB_LIBRARIES @ULIB_SHARED_LIBRARIES@)
|
set(ULIB_LIBRARIES @ULIB_SHARED_LIBRARIES@)
|
||||||
|
|||||||
Reference in New Issue
Block a user