Skip to content

Commit

Permalink
Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
beomki-yeo committed Oct 23, 2023
2 parents 461a6b6 + 929479e commit 5bcda3f
Show file tree
Hide file tree
Showing 200 changed files with 3,718 additions and 1,552 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,14 @@ if( TRACCC_BUILD_ALPAKA )
add_subdirectory( device/alpaka )
endif()
add_subdirectory( io )
add_subdirectory( performance )
add_subdirectory( plugins )
add_subdirectory( simulation )

if ( TRACCC_BUILD_EXAMPLES )
# Find Boost.
find_package( Boost REQUIRED COMPONENTS program_options filesystem)

add_subdirectory( performance )
add_subdirectory( examples )
endif()

Expand Down
3 changes: 2 additions & 1 deletion cmake/traccc-compiler-options-cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ endif()

# Turn on a number of warnings for the "known compilers".
if( ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" ) OR
( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) )
( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) OR
( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM" ) )

# Basic flags for all build modes.
traccc_add_flag( CMAKE_CXX_FLAGS "-Wall" )
Expand Down
6 changes: 6 additions & 0 deletions cmake/traccc-compiler-options-sycl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
# Include the helper function(s).
include( traccc-functions )

# Only tweak the flags for the Intel compiler.
if( NOT ( ( "${CMAKE_SYCL_COMPILER_ID}" STREQUAL "IntelLLVM" ) OR
( "${CMAKE_SYCL_COMPILER_ID}" MATCHES "Clang" ) ) )
return()
endif()

# Basic flags for all build modes.
foreach( mode RELEASE RELWITHDEBINFO MINSIZEREL DEBUG )
traccc_add_flag( CMAKE_SYCL_FLAGS_${mode} "-Wall" )
Expand Down
9 changes: 7 additions & 2 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#
# Mozilla Public License Version 2.0

# Project include(s).
include( traccc-compiler-options-cpp )

# Set up the "build" of the traccc::core library.
traccc_add_library( traccc_core core TYPE SHARED
# Common definitions.
Expand All @@ -19,7 +22,6 @@ traccc_add_library( traccc_core core TYPE SHARED
"include/traccc/edm/cluster.hpp"
"include/traccc/edm/spacepoint.hpp"
"include/traccc/edm/measurement.hpp"
"include/traccc/edm/alt_measurement.hpp"
"include/traccc/edm/track_parameters.hpp"
"include/traccc/edm/container.hpp"
"include/traccc/edm/internal_spacepoint.hpp"
Expand All @@ -37,6 +39,7 @@ traccc_add_library( traccc_core core TYPE SHARED
"include/traccc/utils/type_traits.hpp"
"include/traccc/utils/memory_resource.hpp"
"include/traccc/utils/seed_generator.hpp"
"include/traccc/utils/subspace.hpp"
# Clusterization algorithmic code.
"include/traccc/clusterization/detail/measurement_creation_helper.hpp"
"include/traccc/clusterization/detail/sparse_ccl.hpp"
Expand Down Expand Up @@ -67,6 +70,8 @@ traccc_add_library( traccc_core core TYPE SHARED
"include/traccc/seeding/detail/singlet.hpp"
"include/traccc/seeding/detail/seeding_config.hpp"
"include/traccc/seeding/detail/spacepoint_grid.hpp"
"include/traccc/seeding/experimental/spacepoint_formation.hpp"
"include/traccc/seeding/experimental/spacepoint_formation.ipp"
"include/traccc/seeding/seed_selecting_helper.hpp"
"include/traccc/seeding/seed_filtering.hpp"
"src/seeding/seed_filtering.cpp"
Expand All @@ -85,7 +90,7 @@ traccc_add_library( traccc_core core TYPE SHARED
"include/traccc/seeding/spacepoint_binning.hpp"
"src/seeding/spacepoint_binning.cpp" )
target_link_libraries( traccc_core
PUBLIC Eigen3::Eigen vecmem::core detray::core traccc::Thrust
PUBLIC Eigen3::Eigen vecmem::core detray::core traccc::Thrust
traccc::algebra )

# Prevent Eigen from getting confused when building code for a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
// Library include(s).
#include "traccc/clusterization/component_connection.hpp"
#include "traccc/clusterization/measurement_creation.hpp"
#include "traccc/edm/alt_measurement.hpp"
#include "traccc/edm/cell.hpp"
#include "traccc/edm/measurement.hpp"
#include "traccc/utils/algorithm.hpp"

// VecMem include(s).
Expand All @@ -28,7 +28,7 @@ namespace traccc {
/// module from the cells of the modules.
///
class clusterization_algorithm
: public algorithm<alt_measurement_collection_types::host(
: public algorithm<measurement_collection_types::host(
const cell_collection_types::host&,
const cell_module_collection_types::host&)> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
// Project include(s).
#include "traccc/definitions/primitives.hpp"
#include "traccc/definitions/qualifiers.hpp"
#include "traccc/edm/alt_measurement.hpp"
#include "traccc/edm/cell.hpp"
#include "traccc/edm/cluster.hpp"
#include "traccc/edm/measurement.hpp"

namespace traccc::detail {

Expand Down Expand Up @@ -79,8 +79,8 @@ TRACCC_HOST inline void calc_cluster_properties(
/// @param[in] module is the cell module where the cluster belongs to
/// @param[in] module_link is the module index
///
TRACCC_HOST void fill_measurement(
alt_measurement_collection_types::host& measurements,
TRACCC_HOST inline void fill_measurement(
measurement_collection_types::host& measurements,
const cell_collection_types::host& cluster, const cell_module& module,
const unsigned int module_link) {

Expand All @@ -100,8 +100,9 @@ TRACCC_HOST void fill_measurement(
detail::calc_cluster_properties(cluster, module, mean, var, totalWeight);

if (totalWeight > 0.) {
alt_measurement m;
measurement m;
m.module_link = module_link;
m.surface_link = module.surface_link;
// normalize the cell position
m.local = mean;
// normalize the variance
Expand Down
4 changes: 2 additions & 2 deletions core/include/traccc/clusterization/measurement_creation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#pragma once

// Library include(s).
#include "traccc/edm/alt_measurement.hpp"
#include "traccc/edm/cell.hpp"
#include "traccc/edm/cluster.hpp"
#include "traccc/edm/measurement.hpp"
#include "traccc/utils/algorithm.hpp"

// VecMem include(s).
Expand All @@ -28,7 +28,7 @@ namespace traccc {
/// module.
///
class measurement_creation
: public algorithm<alt_measurement_collection_types::host(
: public algorithm<measurement_collection_types::host(
const cluster_container_types::host &,
const cell_module_collection_types::host &)> {

Expand Down
6 changes: 3 additions & 3 deletions core/include/traccc/clusterization/spacepoint_formation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#pragma once

// Library include(s).
#include "traccc/edm/alt_measurement.hpp"
#include "traccc/edm/measurement.hpp"
#include "traccc/edm/spacepoint.hpp"
#include "traccc/utils/algorithm.hpp"

Expand All @@ -26,7 +26,7 @@ namespace traccc {
/// measurements made on every detector module, into 3D spacepoint coordinates.
///
class spacepoint_formation : public algorithm<spacepoint_collection_types::host(
const alt_measurement_collection_types::host&,
const measurement_collection_types::host&,
const cell_module_collection_types::host&)> {

public:
Expand All @@ -45,7 +45,7 @@ class spacepoint_formation : public algorithm<spacepoint_collection_types::host(
/// measurement
///
output_type operator()(
const alt_measurement_collection_types::host& measurements,
const measurement_collection_types::host& measurements,
const cell_module_collection_types::host& modules) const override;

private:
Expand Down
1 change: 0 additions & 1 deletion core/include/traccc/definitions/primitives.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
namespace traccc {

using geometry_id = uint64_t;
using event_id = uint64_t;
using channel_id = unsigned int;

using vector2 = __plugin::point2<traccc::scalar>;
Expand Down
60 changes: 0 additions & 60 deletions core/include/traccc/edm/alt_measurement.hpp

This file was deleted.

7 changes: 5 additions & 2 deletions core/include/traccc/edm/cell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#include "traccc/edm/container.hpp"
#include "traccc/geometry/pixel_data.hpp"

// Detray include(s).
#include "detray/geometry/barcode.hpp"

namespace traccc {

/// Definition of a detector module
Expand All @@ -23,7 +26,7 @@ namespace traccc {
///
struct cell_module {

geometry_id module = 0;
detray::geometry::barcode surface_link{0u};
transform3 placement = transform3{};
scalar threshold = 0;

Expand All @@ -37,7 +40,7 @@ using cell_module_collection_types = collection_types<cell_module>;
/// Equality operator for cell module
TRACCC_HOST_DEVICE
inline bool operator==(const cell_module& lhs, const cell_module& rhs) {
return lhs.module == rhs.module;
return lhs.surface_link == rhs.surface_link;
}

/// Definition for one detector cell
Expand Down
67 changes: 49 additions & 18 deletions core/include/traccc/edm/measurement.hpp
Original file line number Diff line number Diff line change
@@ -1,50 +1,65 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2021-2022 CERN for the benefit of the ACTS project
* (c) 2022 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Project include(s).
#include "traccc/definitions/common.hpp"
#include "traccc/definitions/primitives.hpp"
#include "traccc/definitions/qualifiers.hpp"
#include "traccc/definitions/track_parametrization.hpp"
#include "traccc/edm/cell.hpp"
#include "traccc/edm/container.hpp"
#include "traccc/utils/subspace.hpp"

// Detray include(s).
#include "detray/geometry/barcode.hpp"

// System include(s).
#include <climits>
#include <cmath>
#include <limits>

namespace traccc {

/// Measurement expressed in local coordinates
///
/// It describes the 2D position and the uncertainty of that position
/// of a measurement on a detector element.
/// Measurement structure which contains both the measurement and
/// a link to its module (held in a separate collection).
///
/// This can be used for storing all information in a single collection, whose
/// objects need to have both the header and item information from the
/// measurement container types.
struct measurement {

/// Local 2D coordinates for a measurement on a detector module
point2 local{0., 0.};
/// Variance on the 2D coordinates of the measurement
variance2 variance{0., 0.};

/// Geometry ID
detray::geometry::barcode surface_link;

/// Link to Module vector index
using link_type = cell_module_collection_types::view::size_type;
link_type module_link = 0;

/// Cluster link
std::size_t cluster_link = std::numeric_limits<std::size_t>::infinity();
};
std::size_t cluster_link = std::numeric_limits<std::size_t>::max();

/// Measurement dimension
unsigned int meas_dim = 2u;

/// Measurement with surface link
struct measurement_link {
geometry_id surface_link;
measurement meas;
/// subspace
subspace<transform3, e_bound_size, 2u> subs{{0u, 1u}};
};

/// Comparison / ordering operator for measurements
TRACCC_HOST_DEVICE
inline bool operator<(const measurement& lhs, const measurement& rhs) {
TRACCC_HOST_DEVICE inline bool operator<(const measurement& lhs,
const measurement& rhs) {

if (std::abs(lhs.local[0] - rhs.local[0]) > float_epsilon) {
if (lhs.surface_link != rhs.surface_link) {
return lhs.surface_link < rhs.surface_link;
} else if (std::abs(lhs.local[0] - rhs.local[0]) > float_epsilon) {
return (lhs.local[0] < rhs.local[0]);
} else {
return (lhs.local[1] < rhs.local[1]);
Expand All @@ -55,12 +70,28 @@ inline bool operator<(const measurement& lhs, const measurement& rhs) {
TRACCC_HOST_DEVICE
inline bool operator==(const measurement& lhs, const measurement& rhs) {

return ((std::abs(lhs.local[0] - rhs.local[0]) < float_epsilon) &&
return ((lhs.surface_link == rhs.surface_link) &&
(std::abs(lhs.local[0] - rhs.local[0]) < float_epsilon) &&
(std::abs(lhs.local[1] - rhs.local[1]) < float_epsilon) &&
(std::abs(lhs.variance[0] - rhs.variance[0]) < float_epsilon) &&
(std::abs(lhs.variance[1] - rhs.variance[1]) < float_epsilon));
}

/// Comparator based on detray barcode value
struct measurement_sort_comp {
TRACCC_HOST_DEVICE
bool operator()(const measurement& lhs, const measurement& rhs) {
return lhs.surface_link < rhs.surface_link;
}
};

struct measurement_equal_comp {
TRACCC_HOST_DEVICE
bool operator()(const measurement& lhs, const measurement& rhs) {
return lhs.surface_link == rhs.surface_link;
}
};

/// Declare all measurement collection types
using measurement_collection_types = collection_types<measurement>;
/// Declare all measurement container types
Expand Down
Loading

0 comments on commit 5bcda3f

Please sign in to comment.