-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Timed Clusterization
- Loading branch information
cvarni
committed
Oct 2, 2024
1 parent
661ab12
commit 0b3beeb
Showing
6 changed files
with
402 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// This file is part of the ACTS project. | ||
// | ||
// Copyright (C) 2016 CERN for the benefit of the ACTS project | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include "Acts/Clusterization/Clusterization.hpp" | ||
#include "Acts/Definitions/Algebra.hpp" | ||
|
||
#include <limits> | ||
|
||
namespace Acts::Ccl { | ||
|
||
template <typename Cell> | ||
concept HasRetrievableTimeInfo = requires(Cell cell) { | ||
{ getCellTime(cell) } -> std::same_as<Acts::ActsScalar>; | ||
}; | ||
|
||
template <Acts::Ccl::HasRetrievableTimeInfo Cell, std::size_t N> | ||
struct TimedConnect : public Acts::Ccl::DefaultConnect<Cell, N> { | ||
Acts::ActsScalar timeTollerance{std::numeric_limits<Acts::ActsScalar>::max()}; | ||
|
||
TimedConnect() = default; | ||
TimedConnect(Acts::ActsScalar time); | ||
TimedConnect(Acts::ActsScalar time, bool conn) | ||
requires(N == 2); | ||
virtual ~TimedConnect() = default; | ||
|
||
virtual ConnectResult operator()(const Cell& ref, | ||
const Cell& iter) const override; | ||
}; | ||
|
||
} // namespace Acts::Ccl | ||
|
||
#include "Acts/Clusterization/TimedClusterization.ipp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// This file is part of the ACTS project. | ||
// | ||
// Copyright (C) 2016 CERN for the benefit of the ACTS project | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
namespace Acts::Ccl { | ||
|
||
template <Acts::Ccl::HasRetrievableTimeInfo Cell, std::size_t N> | ||
TimedConnect<Cell, N>::TimedConnect(Acts::ActsScalar time) | ||
: timeTollerance(time) {} | ||
|
||
template <Acts::Ccl::HasRetrievableTimeInfo Cell, std::size_t N> | ||
TimedConnect<Cell, N>::TimedConnect(Acts::ActsScalar time, bool conn) | ||
requires(N == 2) | ||
: Acts::Ccl::DefaultConnect<Cell, N>(conn), timeTollerance(time) {} | ||
|
||
template <Acts::Ccl::HasRetrievableTimeInfo Cell, std::size_t N> | ||
Acts::Ccl::ConnectResult TimedConnect<Cell, N>::operator()( | ||
const Cell& ref, const Cell& iter) const { | ||
Acts::Ccl::ConnectResult spaceCompatibility = | ||
Acts::Ccl::DefaultConnect<Cell, N>::operator()(ref, iter); | ||
if (spaceCompatibility != Acts::Ccl::ConnectResult::eConn) { | ||
return spaceCompatibility; | ||
} | ||
|
||
if (std::abs(getCellTime(ref) - getCellTime(iter)) < timeTollerance) { | ||
return Acts::Ccl::ConnectResult::eConn; | ||
} | ||
|
||
return Acts::Ccl::ConnectResult::eNoConn; | ||
} | ||
|
||
} // namespace Acts::Ccl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
add_unittest(Clusterization1D ClusterizationTests1D.cpp) | ||
add_unittest(Clusterization2D ClusterizationTests2D.cpp) | ||
add_unittest(TimedClusterization TimedClusterizationTests.cpp) |
Oops, something went wrong.