-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-fpeovf-root-particle-writer
- Loading branch information
Showing
10 changed files
with
108 additions
and
3 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
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 @@ | ||
add_subdirectory(Digitization) |
3 changes: 3 additions & 0 deletions
3
Tests/UnitTests/Examples/Algorithms/Digitization/CMakeLists.txt
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,3 @@ | ||
set(unittest_extra_libraries ActsExamplesDigitization) | ||
|
||
add_unittest(ModuleClusters ModuleClustersTests.cpp) |
92 changes: 92 additions & 0 deletions
92
Tests/UnitTests/Examples/Algorithms/Digitization/ModuleClustersTests.cpp
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,92 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2023 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 http://mozilla.org/MPL/2.0/. | ||
|
||
#include <boost/test/unit_test.hpp> | ||
|
||
#include "Acts/Utilities/BinningData.hpp" | ||
#include "ActsExamples/Digitization/ModuleClusters.hpp" | ||
#include "ActsFatras/Digitization/Channelizer.hpp" | ||
|
||
using namespace Acts; | ||
using namespace ActsFatras; | ||
using namespace ActsExamples; | ||
|
||
namespace { | ||
|
||
DigitizedParameters makeDigitizationParameters(const Vector2 &position, | ||
const Vector2 &variance, | ||
const BinUtility &binUtility) { | ||
auto [binX, binY, _] = | ||
binUtility.binTriple((Vector3() << position, 0).finished()); | ||
Channelizer::Bin2D bin = {(Channelizer::Bin2D::value_type)binX, | ||
(Channelizer::Bin2D::value_type)binY}; | ||
Channelizer::Segment2D segment = {position, position}; | ||
double activation = 1; | ||
Cluster::Cell cell = {bin, segment, activation}; | ||
|
||
Cluster cluster; | ||
cluster.sizeLoc0 = 1; | ||
cluster.sizeLoc1 = 1; | ||
cluster.channels = {cell}; | ||
|
||
DigitizedParameters params; | ||
params.indices = {eBoundLoc0, eBoundLoc1}; | ||
params.values = {position.x(), position.y()}; | ||
params.variances = {variance.x(), variance.y()}; | ||
params.cluster = {cluster}; | ||
|
||
return params; | ||
} | ||
|
||
auto testDigitizedParametersWithTwoClusters(bool merge, const Vector2 &firstHit, | ||
const Vector2 &secondHit) { | ||
BinUtility binUtility; | ||
binUtility += | ||
BinningData(BinningOption::open, BinningValue::binX, 20, -10.0f, 10.0f); | ||
binUtility += | ||
BinningData(BinningOption::open, BinningValue::binY, 20, -10.0f, 10.0f); | ||
std::vector<Acts::BoundIndices> boundIndices = {eBoundLoc0, eBoundLoc1}; | ||
double nsigma = 1; | ||
bool commonCorner = true; | ||
|
||
ModuleClusters moduleClusters(binUtility, boundIndices, merge, nsigma, | ||
commonCorner); | ||
|
||
moduleClusters.add(makeDigitizationParameters(firstHit, {1, 1}, binUtility), | ||
0); | ||
moduleClusters.add(makeDigitizationParameters(secondHit, {1, 1}, binUtility), | ||
1); | ||
|
||
return moduleClusters.digitizedParameters(); | ||
} | ||
|
||
} // namespace | ||
|
||
BOOST_AUTO_TEST_SUITE(DigitizationModuleClustersTests) | ||
|
||
BOOST_AUTO_TEST_CASE(digitizedParameters_merging) { | ||
// overlapping hits are expected to be merged if turned on | ||
{ | ||
auto result = testDigitizedParametersWithTwoClusters(true, {0, 0}, {0, 0}); | ||
BOOST_CHECK_EQUAL(result.size(), 1); | ||
|
||
result = testDigitizedParametersWithTwoClusters(false, {0, 0}, {0, 0}); | ||
BOOST_CHECK_EQUAL(result.size(), 2); | ||
} | ||
|
||
// non overlapping hits are not expected to be merged | ||
{ | ||
auto result = testDigitizedParametersWithTwoClusters(true, {0, 0}, {5, 0}); | ||
BOOST_CHECK_EQUAL(result.size(), 2); | ||
|
||
result = testDigitizedParametersWithTwoClusters(false, {0, 0}, {5, 0}); | ||
BOOST_CHECK_EQUAL(result.size(), 2); | ||
} | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
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 +1,2 @@ | ||
add_subdirectory_if(Json ACTS_BUILD_PLUGIN_JSON) | ||
add_subdirectory(Algorithms) | ||
add_subdirectory(Io) |
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 @@ | ||
add_subdirectory_if(Json ACTS_BUILD_PLUGIN_JSON) |
File renamed without changes.
File renamed without changes.