Skip to content

Commit

Permalink
Merge branch 'main' into fix-fpeovf-root-particle-writer
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] committed Jun 28, 2023
2 parents 93ed153 + 4bbbbaf commit 950f575
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
- cmake/**
'Component - Core':
- Core/**
- Tests/UnitTests/Core/**
'Component - Examples':
- Examples/**
- Tests/UnitTests/Examples/**
'Component - Fatras':
- Fatras/**
- Tests/UnitTests/Fatras/**
'Component - Plugins':
- Plugins/**
- Tests/UnitTests/Plugins/**
'Component - Documentation':
- docs/**
'Changes Performance':
Expand Down
6 changes: 4 additions & 2 deletions Core/include/Acts/Seeding/SpacePointGrid.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Acts::SpacePointGridCreator::createGrid(
"SpacePointGridCreator::createGrid");
}
using AxisScalar = Acts::Vector3::Scalar;
using namespace Acts::UnitLiterals;

int phiBins = 0;
// for no magnetic field, create 100 phi-bins
Expand All @@ -35,8 +36,9 @@ Acts::SpacePointGridCreator::createGrid(
// calculate circle intersections of helix and max detector radius
float minHelixRadius =
config.minPt /
(300. * options.bFieldInZ); // in mm -> R[mm] =pT[GeV] / (3·10−4×B[T])
// = pT[MeV] / (300 *Bz[kT])
(1_T * 1e6 *
options.bFieldInZ); // in mm -> R[mm] =pT[GeV] / (3·10−4×B[T])
// = pT[MeV] / (300 *Bz[kT])

// sanity check: if yOuter takes the square root of a negative number
if (minHelixRadius < config.rMax / 2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "Acts/Utilities/Helpers.hpp"

#include <array>
#include <atomic>
#include <csignal>
#include <cstddef>
Expand Down
1 change: 1 addition & 0 deletions Tests/UnitTests/Examples/Algorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(Digitization)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(unittest_extra_libraries ActsExamplesDigitization)

add_unittest(ModuleClusters ModuleClustersTests.cpp)
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()
3 changes: 2 additions & 1 deletion Tests/UnitTests/Examples/CMakeLists.txt
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)
1 change: 1 addition & 0 deletions Tests/UnitTests/Examples/Io/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory_if(Json ACTS_BUILD_PLUGIN_JSON)

0 comments on commit 950f575

Please sign in to comment.