Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
DraTeots committed Nov 20, 2024
2 parents 4dea66c + aee1808 commit 7846b12
Show file tree
Hide file tree
Showing 27 changed files with 1,935 additions and 665 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

- name: configure
run: cmake -Stest -Bbuild -DENABLE_TEST_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug
run: cmake -Bbuild -DCMAKE_BUILD_TYPE=Debug

- name: build
run: cmake --build build -j4
Expand Down
32 changes: 5 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,16 @@ tdis
/mnt/data/g4sbsout_EPCEvents_200000.txt
```

##

# Geometry IDs
## Geometry IDs

The geometry description is gives us that each pad is identified by `plane`, `ring`, `pad`:

- `plane` The mTPC will consist of 10 separate TPC volumes. Numbered 0 - 9 from upstream to downstream.
- `ring` The pads are arranged into 21 concentric rings, The rings are numbered from 0 to 20 sequentially, with 0 being the innermost ring.
- `pad` Each ring has 122 pads, 0 is at or closest to phi=0 and numbering is clockwise

This is convenient to encode in a singe uint32_t ID. We assign 8 bits each to plane and ring, and 16 bits to pad.
The encodePadID function packs these three values into a single uint32_t using bitwise shifts and OR operations.

```python
import numpy as np

def encode_pad_id(plane, ring, pad):
"""Encode plane, ring, pad into an uint32_t id.
Works with both scalar values and numpy arrays."""
plane = np.asarray(plane, dtype=np.uint32)
ring = np.asarray(ring, dtype=np.uint32)
pad = np.asarray(pad, dtype=np.uint32)

pad_id = (plane << 24) | (ring << 16) | pad
return pad_id

def decode_pad_id(pad_id):
"""Decode pad_id into plane, ring, pad.
Works with both scalar values and numpy arrays."""

pad_id = np.asarray(pad_id, dtype=np.uint32)
plane = (pad_id >> 24) & 0xFF # Upper 8 bits
ring = (pad_id >> 16) & 0xFF # Next 8 bits
pad = pad_id & 0xFFFF # Lower 16 bits
return plane, ring, pad
```
This is convenient to encode in a singe uint32_t ID.

`1 000 000 * plane + 1 000 * ring + pad`
4 changes: 2 additions & 2 deletions docker/tdis-pre/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ARG BUILD_THREADS=8
# Software versions

ARG VERSION_CERN_ROOT=v6-32-06
ARG VERSION_ACTS=v37.2.0
ARG VERSION_ACTS=v37.4.0
ARG VERSION_PODIO=v01-01
ARG VERSION_JANA2=v2.3.2

Expand Down Expand Up @@ -93,7 +93,7 @@ RUN edpm config root branch=${VERSION_CERN_ROOT} &&\


RUN edpm config acts branch=${VERSION_ACTS} &&\
edpm config acts cmake_flags='-DACTS_BUILD_PLUGIN_TGEO=ON -DACTS_BUILD_PLUGIN_DD4HEP=OFF -DACTS_BUILD_PLUGIN_JSON=ON -DACTS_BUILD_PLUGIN_ACTSVG=OFF' &&\
edpm config acts cmake_flags='-DACTS_BUILD_EXAMPLES_PYTHON_BINDINGS=ON -DACTS_BUILD_PLUGIN_TGEO=ON -DACTS_BUILD_PLUGIN_DD4HEP=OFF -DACTS_BUILD_PLUGIN_JSON=ON -DACTS_BUILD_PLUGIN_ACTSVG=OFF' &&\
edpm install acts

RUN edpm config podio branch=${VERSION_PODIO} &&\
Expand Down
8 changes: 1 addition & 7 deletions source/tdis/CKFTracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@ namespace eicrecon {

class CKFTracking: public WithPodConfig<eicrecon::CKFTrackingConfig> {
public:
/// Track finder function that takes input measurements, initial trackstate
/// and track finder options and returns some track-finder-specific result.
using TrackFinderOptions =
Acts::CombinatorialKalmanFilterOptions<ActsExamples::IndexSourceLinkAccessor::Iterator,
Acts::VectorMultiTrajectory>;
using TrackFinderResult =
Acts::Result<std::vector<ActsExamples::TrackContainer::TrackProxy>>;


/// Find function that takes the above parameters
/// @note This is separated into a virtual interface to keep compilation units
Expand Down
90 changes: 0 additions & 90 deletions source/tdis/CKFTrackingFunction.cc

This file was deleted.

119 changes: 53 additions & 66 deletions source/tdis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
cmake_policy(SET CMP0144 NEW)


# --------- FETCH DEPENDENCIES --------------
# Fetch CLI11
include(FetchContent)
FetchContent_Declare(
Expand All @@ -23,13 +24,11 @@ FetchContent_Declare(
FetchContent_MakeAvailable(CLI11)



# --------- GENERATE PODIO --------------
find_package(podio REQUIRED)
PODIO_GENERATE_DATAMODEL(podio_model "layout.yaml" DATAMODEL_HEADERS DATAMODEL_SOURCES OUTPUT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/podio_model")
PODIO_ADD_DATAMODEL_CORE_LIB(podio_model_lib "${DATAMODEL_HEADERS}" "${DATAMODEL_SOURCES}")
PODIO_ADD_ROOT_IO_DICT(podio_model_dict podio_model_lib "${DATAMODEL_HEADERS}" "podio_model/src/selection.xml")
message(STATUS "PODIO MODEL DICT: ${podio_model_dict}")

target_include_directories(podio_model_lib PRIVATE "podio_model")
target_include_directories(podio_model_dict PRIVATE "podio_model")
Expand All @@ -41,31 +40,77 @@ add_executable(tdis
PadGeometryHelper.hpp
io/DigitizedDataEventSource.hpp
io/PodioWriteProcessor.hpp
tracking/ActsGeometryProvider.cc
tracking/ActsGeometryProvider.h
tracking/ActsGeometryService.cc
tracking/ActsGeometryService.h
tracking/ReconstructedHitFactory.h
# tracking/DD4hepBField.h
# /tracking/DD4hepBField.cc
tracking/BuildMtpcDetector.cpp
tracking/BuildMtpcDetector.hpp
tracking/MtpcDetectorElement.cpp
tracking/MtpcDetectorElement.hpp
# tracking/Measurement2DFactory.h
tracking/TruthTrackParameterFactory.h
tracking/KalmanFittingFactory.h
tracking/CKFTracking.h
tracking/CKFTracking.cc
)

# ---------- FIND REQUIRED PACKAGES -------------
find_package(JANA REQUIRED)
find_package(fmt REQUIRED)
find_package(spdlog REQUIRED)
find_package(Boost REQUIRED)

find_package(ROOT COMPONENTS Core RIO Hist Graf Gpad Tree Postscript Matrix Physics MathCore)
find_package(Acts REQUIRED COMPONENTS Core PluginTGeo PluginJson)

target_include_directories(tdis PUBLIC ${CMAKE_CURRENT_LIST_DIR} "${CMAKE_CURRENT_LIST_DIR}/..")
target_link_libraries(tdis ${JANA_LIB} podio::podio podio::podioRootIO podio_model_lib podio_model_dict spdlog::spdlog fmt::fmt CLI11::CLI11 Boost::boost ActsCore ActsPluginTGeo ActsPluginJson)
target_link_libraries(tdis
${JANA_LIB}
ROOT::RIO ROOT::Core
podio::podio podio::podioRootIO podio_model_lib podio_model_dict
spdlog::spdlog
fmt::fmt
CLI11::CLI11
Boost::boost
ActsCore ActsPluginTGeo ActsPluginJson
)

set_target_properties(tdis PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
target_include_directories(tdis PRIVATE "podio_model")
target_include_directories(tdis SYSTEM PUBLIC ${JANA_INCLUDE_DIR} ${ROOT_INCLUDE_DIRS})

# ----------- Configure ACTS ExamplesLibrary --------
# ExamplesLibrary actually creates ACTS event model
# Get ActsExamples base
get_target_property(ActsCore_LOCATION ActsCore LOCATION)
get_filename_component(ActsCore_PATH ${ActsCore_LOCATION} DIRECTORY)
set(ActsExamples_LIB ${ActsCore_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}ActsExamplesFramework${CMAKE_SHARED_LIBRARY_SUFFIX})

# If acts is installed to / we are good but if acts is installed in some directory with structure /bin /include /lib
# we need to get this directory and try to include include
get_filename_component(Acts_HOME "${ActsCore_PATH}" DIRECTORY)
set(Acts_HOME_INCLUDE "${Acts_HOME}/include")

# List all ACTS variables
message(STATUS "ACTS List all variables : ${ActsExample_LIB}")
get_cmake_property(_variableNames VARIABLES)
foreach (_variableName ${_variableNames})
if (_variableName MATCHES "^Acts")
message(STATUS " ${_variableName} = ${${_variableName}}")
endif()
endforeach()

# Add examples library and includes

# Check if the directory exists and is accessible on the disk
if(EXISTS "${Acts_HOME_INCLUDE}")
# Add the directory to the target's include directories only if it exists
target_include_directories(tdis PUBLIC SYSTEM "${Acts_HOME_INCLUDE}")
message(STATUS "Added include directory: ${Acts_HOME_INCLUDE}")
else()
message(STATUS "Directory does not exist or is not accessible: ${Acts_HOME_INCLUDE}. It is OK if ACTS is installed in /")
endif()

target_include_directories(tdis PUBLIC ${CMAKE_CURRENT_LIST_DIR} "${CMAKE_CURRENT_LIST_DIR}/..")

# ----------- install destination -------------------
install(TARGETS tdis DESTINATION bin)
Expand Down Expand Up @@ -103,61 +148,3 @@ if(WITH_TESTS)
message(WARNING "Catch2 not found, unit tests will not be built.")
endif()
endif()

#
#
## Function creates ${PLUGIN_NAME}_plugin and ${PLUGIN_NAME}_library targets
## Setting default includes, libraries and installation paths
#plugin_add(${PLUGIN_NAME})
#
## The macro grabs sources as *.cc *.cpp *.c and headers as *.h *.hh *.hpp Then
## correctly sets sources for ${_name}_plugin and ${_name}_library targets Adds
## headers to the correct installation directory
#plugin_glob_all(${PLUGIN_NAME})
#
## Find dependencies
#
#plugin_add_acts(${PLUGIN_NAME})
#plugin_add_cern_root(${PLUGIN_NAME})
#plugin_add_event_model(${PLUGIN_NAME})
#
#
#
#plugin_sources(${PLUGIN_NAME} ${DATAMODEL_HEADERS} ${DATAMODEL_SOURCES})


#set(PodioExample_SOURCES
# PodioExample.cc
# PodioExampleProcessor.cc
# PodioExampleSource.cc
# ExampleClusterFactory.cc
# ExampleMultifactory.cc
# )
#
#foreach( _conf ${CMAKE_CONFIGURATION_TYPES} )
# string(TOUPPER ${_conf} _conf )
# set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${_conf} ${CMAKE_CURRENT_BINARY_DIR} )
# set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${_conf} ${CMAKE_CURRENT_BINARY_DIR} )
# set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${_conf} ${CMAKE_CURRENT_BINARY_DIR} )
#endforeach()
#
#PODIO_GENERATE_DATAMODEL(datamodel layout.yaml DATAMODEL_HEADERS DATAMODEL_SOURCES IO_BACKEND_HANDLERS ROOT)
#
#PODIO_ADD_DATAMODEL_CORE_LIB(PodioExampleDatamodel "${DATAMODEL_HEADERS}" "${DATAMODEL_SOURCES}")
#
#PODIO_ADD_ROOT_IO_DICT(PodioExampleDatamodelDict PodioExampleDatamodel "${DATAMODEL_HEADERS}" src/selection.xml)
#
#
#
#add_executable(PodioExample ${PodioExample_SOURCES})
#target_include_directories(PodioExample PUBLIC .)
#target_link_libraries(PodioExample jana2 podio::podio PodioExampleDatamodel PodioExampleDatamodelDict podio::podioRootIO)
#set_target_properties(PodioExample PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
#
#install(TARGETS PodioExample DESTINATION bin)
#install(TARGETS PodioExampleDatamodel DESTINATION lib)
#install(TARGETS PodioExampleDatamodelDict DESTINATION lib)




Loading

0 comments on commit 7846b12

Please sign in to comment.