Skip to content

Commit

Permalink
For ACTS CI (no new flags)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredevb committed Jul 26, 2024
1 parent f7d9df8 commit c5ae4e5
Show file tree
Hide file tree
Showing 21 changed files with 122 additions and 113 deletions.
4 changes: 2 additions & 2 deletions core/include/traccc/definitions/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ template <typename scalar_t>
using unit = detray::unit<scalar_t>;

// epsilon for float variables
constexpr scalar float_epsilon = 1e-5;
constexpr scalar float_epsilon = 1e-5f;

// pion mass for track parameter estimation
constexpr scalar PION_MASS_MEV = 139.57018 * unit<scalar>::MeV;
constexpr scalar PION_MASS_MEV = 139.57018f * unit<scalar>::MeV;

} // namespace traccc
46 changes: 23 additions & 23 deletions core/include/traccc/seeding/detail/seeding_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ struct seedfinder_config {
// limiting location of collision region in z
scalar collisionRegionMin = -250 * unit<scalar>::mm;
scalar collisionRegionMax = +250 * unit<scalar>::mm;
scalar phiMin = -M_PI;
scalar phiMax = M_PI;
scalar phiMin = static_cast<scalar>(-M_PI);
scalar phiMax = static_cast<scalar>(M_PI);

// Seed Cuts
// lower cutoff for seeds in MeV
scalar minPt = 500. * unit<scalar>::MeV;
scalar minPt = 500.f * unit<scalar>::MeV;
// cot of maximum theta angle
// equivalent to 2.7 eta (pseudorapidity)
scalar cotThetaMax = 7.40627;
scalar cotThetaMax = 7.40627f;
// minimum distance in mm in r between two measurements within one seed
scalar deltaRMin = 1 * unit<scalar>::mm;
// maximum distance in mm in r between two measurements within one seed
Expand All @@ -68,7 +68,7 @@ struct seedfinder_config {
// for how many seeds can one SpacePoint be the middle SpacePoint?
int maxSeedsPerSpM = 20;

scalar bFieldInZ = 1.99724 * unit<scalar>::T;
scalar bFieldInZ = 1.99724f * unit<scalar>::T;
// location of beam in x,y plane.
// used as offset for Space Points
vector2 beamPos{-.0 * unit<scalar>::mm, -.0 * unit<scalar>::mm};
Expand All @@ -77,7 +77,7 @@ struct seedfinder_config {
// scattering.
// default is 5%
// TODO: necessary to make amount of material dependent on detector region?
scalar radLengthPerSeed = 0.05;
scalar radLengthPerSeed = 0.05f;
// alignment uncertainties, used for uncertainties in the
// non-measurement-plane of the modules
// which otherwise would be 0
Expand Down Expand Up @@ -121,19 +121,19 @@ struct seedfinder_config {
// Configure unset parameters
TRACCC_HOST_DEVICE
void setup() {
highland = 13.6 * traccc::unit<traccc::scalar>::MeV *
highland = 13.6f * traccc::unit<traccc::scalar>::MeV *
std::sqrt(radLengthPerSeed) *
(1 + 0.038 * std::log(radLengthPerSeed));
(1.f + 0.038f * std::log(radLengthPerSeed));

float maxScatteringAngle = highland / minPt;
maxScatteringAngle2 = maxScatteringAngle * maxScatteringAngle;

pTPerHelixRadius = bFieldInZ;
minHelixDiameter2 = std::pow(minPt * 2 / pTPerHelixRadius, 2);
minHelixDiameter2 = std::pow(minPt * 2.f / pTPerHelixRadius, 2.f);

// @TODO: This is definitely a bug because highland / pTPerHelixRadius
// is in length unit
pT2perRadius = std::pow(highland / pTPerHelixRadius, 2);
pT2perRadius = std::pow(highland / pTPerHelixRadius, 2.f);
}
};

Expand Down Expand Up @@ -175,9 +175,9 @@ struct spacepoint_grid_config {
// impact parameter in mm
scalar impactMax;
// minimum phi value for phiAxis construction
scalar phiMin = -M_PI;
scalar phiMin = static_cast<scalar>(-M_PI);
// maximum phi value for phiAxis construction
scalar phiMax = M_PI;
scalar phiMax = static_cast<scalar>(M_PI);
// Multiplicator for the number of phi-bins. The minimum number of phi-bins
// depends on min_pt, magnetic field: 2*M_PI/(minPT particle
// phi-deflection). phiBinDeflectionCoverage is a multiplier for this
Expand All @@ -190,15 +190,15 @@ struct spacepoint_grid_config {
struct seedfilter_config {
// the allowed delta between two inverted seed radii for them to be
// considered compatible.
scalar deltaInvHelixDiameter = 0.00003 / unit<scalar>::mm;
scalar deltaInvHelixDiameter = 0.00003f / unit<scalar>::mm;
// the impact parameters (d0) is multiplied by this factor and subtracted
// from weight
scalar impactWeightFactor = 1.;
scalar impactWeightFactor = 1.f;
// seed weight increased by this value if a compatible seed has been found.
scalar compatSeedWeight = 200.;
scalar compatSeedWeight = 200.f;
// minimum distance between compatible seeds to be considered for weight
// boost
scalar deltaRMin = 5. * unit<scalar>::mm;
scalar deltaRMin = 5.f * unit<scalar>::mm;
// in dense environments many seeds may be found per middle space point.
// only seeds with the highest weight will be kept if this limit is reached.
unsigned int maxSeedsPerSpM = 20;
Expand All @@ -210,17 +210,17 @@ struct seedfilter_config {
size_t max_triplets_per_spM = 5;

// seed weight increase
scalar good_spB_min_radius = 150. * unit<scalar>::mm;
scalar good_spB_weight_increase = 400.;
scalar good_spT_max_radius = 150. * unit<scalar>::mm;
scalar good_spT_weight_increase = 200.;
scalar good_spB_min_radius = 150.f * unit<scalar>::mm;
scalar good_spB_weight_increase = 400.f;
scalar good_spT_max_radius = 150.f * unit<scalar>::mm;
scalar good_spT_weight_increase = 200.f;

// bottom sp cut
scalar good_spB_min_weight = 380;
scalar good_spB_min_weight = 380.f;

// seed cut
scalar seed_min_weight = 200;
scalar spB_min_radius = 43. * unit<scalar>::mm;
scalar seed_min_weight = 200.f;
scalar spB_min_radius = 43.f * unit<scalar>::mm;
};

} // namespace traccc
6 changes: 3 additions & 3 deletions core/include/traccc/seeding/spacepoint_binning_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ inline std::pair<detray::axis2::circular<>, detray::axis2::regular<>> get_axes(

// divide 2pi by angle delta to get number of phi-bins
// size is always 2pi even for regions of interest
phiBins = std::ceil(2 * M_PI / deltaPhi);
phiBins = std::llround(2 * M_PI / deltaPhi + 0.5);
// need to scale the number of phi bins accordingly to the number of
// consecutive phi bins in the seed making step.
// Each individual bin should be approximately a fraction (depending on
Expand Down Expand Up @@ -116,8 +116,8 @@ inline TRACCC_HOST_DEVICE size_t is_valid_sp(const seedfinder_config& config,
if (spPhi > config.phiMax || spPhi < config.phiMin) {
return detray::detail::invalid_value<size_t>();
}
size_t r_index = getter::perp(
vector2{sp.x() - config.beamPos[0], sp.y() - config.beamPos[1]});
size_t r_index = static_cast<size_t>(getter::perp(
vector2{sp.x() - config.beamPos[0], sp.y() - config.beamPos[1]}));

if (r_index < config.get_num_rbins()) {
return r_index;
Expand Down
12 changes: 6 additions & 6 deletions core/include/traccc/seeding/track_params_estimation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ class track_params_estimation
const spacepoint_collection_types::host& spacepoints,
const seed_collection_types::host& seeds, const vector3& bfield,
const std::array<traccc::scalar, traccc::e_bound_size>& stddev = {
0.02 * detray::unit<traccc::scalar>::mm,
0.03 * detray::unit<traccc::scalar>::mm,
1. * detray::unit<traccc::scalar>::degree,
1. * detray::unit<traccc::scalar>::degree,
0.01 / detray::unit<traccc::scalar>::GeV,
1 * detray::unit<traccc::scalar>::ns}) const override;
0.02f * detray::unit<traccc::scalar>::mm,
0.03f * detray::unit<traccc::scalar>::mm,
1.f * detray::unit<traccc::scalar>::degree,
1.f * detray::unit<traccc::scalar>::degree,
0.01f / detray::unit<traccc::scalar>::GeV,
1.f * detray::unit<traccc::scalar>::ns}) const override;

private:
/// The memory resource to use in the algorithm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// System include
#include <algorithm>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
Expand Down Expand Up @@ -245,11 +246,12 @@ void greedy_ambiguity_resolution_algorithm::compute_initial_state(
double ratio = static_cast<float>(mcount_idzero) /
static_cast<float>(mcount_all);
if (ratio > warning_threshold) {
std::size_t percent = ratio * 100;
LOG_WARN(std::to_string(percent) +
"% of input measurements have an ID equal to 0 "
"(measurement.measurement_id == 0). This may be "
"suspicious.");
std::stringstream stream;
stream << std::fixed << std::setprecision(2) << (ratio * 100.)
<< "% of input measurements have an ID equal to 0 "
"(measurement.measurement_id == 0). This may be "
"suspicious.";
LOG_WARN(stream.str());
}
}
}
Expand Down
45 changes: 25 additions & 20 deletions core/src/seeding/seed_filtering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,31 @@ void seed_filtering::operator()(
}

// sort seeds based on their weights
std::sort(seeds_per_spM.begin(), seeds_per_spM.end(),
[&](seed& seed1, seed& seed2) {
if (seed1.weight != seed2.weight) {
return seed1.weight > seed2.weight;
} else {
scalar seed1_sum = 0;
scalar seed2_sum = 0;
auto& spB1 = sp_collection.at(seed1.spB_link);
auto& spT1 = sp_collection.at(seed1.spT_link);
auto& spB2 = sp_collection.at(seed2.spB_link);
auto& spT2 = sp_collection.at(seed2.spT_link);

seed1_sum += pow(spB1.y(), 2) + pow(spB1.z(), 2);
seed1_sum += pow(spT1.y(), 2) + pow(spT1.z(), 2);
seed2_sum += pow(spB2.y(), 2) + pow(spB2.z(), 2);
seed2_sum += pow(spT2.y(), 2) + pow(spT2.z(), 2);

return seed1_sum > seed2_sum;
}
});
std::sort(
seeds_per_spM.begin(), seeds_per_spM.end(),
[&](seed& seed1, seed& seed2) {
if (seed1.weight != seed2.weight) {
return seed1.weight > seed2.weight;
} else {
scalar seed1_sum = 0;
scalar seed2_sum = 0;
auto& spB1 = sp_collection.at(seed1.spB_link);
auto& spT1 = sp_collection.at(seed1.spT_link);
auto& spB2 = sp_collection.at(seed2.spB_link);
auto& spT2 = sp_collection.at(seed2.spT_link);

seed1_sum +=
static_cast<scalar>(pow(spB1.y(), 2) + pow(spB1.z(), 2));
seed1_sum +=
static_cast<scalar>(pow(spT1.y(), 2) + pow(spT1.z(), 2));
seed2_sum +=
static_cast<scalar>(pow(spB2.y(), 2) + pow(spB2.z(), 2));
seed2_sum +=
static_cast<scalar>(pow(spT2.y(), 2) + pow(spT2.z(), 2));

return seed1_sum > seed2_sum;
}
});

seed_collection_types::host new_seeds;
if (seeds_per_spM.size() > 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ struct track_params_estimation
const seed_collection_types::const_view& seeds_view,
const vector3& bfield,
const std::array<traccc::scalar, traccc::e_bound_size>& = {
0.02 * detray::unit<traccc::scalar>::mm,
0.03 * detray::unit<traccc::scalar>::mm,
1. * detray::unit<traccc::scalar>::degree,
1. * detray::unit<traccc::scalar>::degree,
0.01 / detray::unit<traccc::scalar>::GeV,
1 * detray::unit<traccc::scalar>::ns}) const override;
0.02f * detray::unit<traccc::scalar>::mm,
0.03f * detray::unit<traccc::scalar>::mm,
1.f * detray::unit<traccc::scalar>::degree,
1.f * detray::unit<traccc::scalar>::degree,
0.01f / detray::unit<traccc::scalar>::GeV,
1.f * detray::unit<traccc::scalar>::ns}) const override;

private:
/// Memory resource used by the algorithm
Expand Down
2 changes: 1 addition & 1 deletion extern/covfie/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ message( STATUS "Fetching covfie as part of the traccc project" )

# Declare where to get covfie from.
set( TRACCC_COVFIE_SOURCE
"URL;https://github.com/acts-project/covfie/archive/refs/tags/v0.8.1.tar.gz;URL_MD5;0b4dc9624533d1ed4ea7a763da47f07e"
"URL;https://github.com/acts-project/covfie/archive/refs/tags/v0.10.0.tar.gz;URL_MD5;af59c6e2a1eebfa765b29f0af9fc70f7"
CACHE STRING "Source for covfie, when built as part of this project" )
mark_as_advanced( TRACCC_COVFIE_SOURCE )
FetchContent_Declare( covfie ${TRACCC_COVFIE_SOURCE} )
Expand Down
2 changes: 1 addition & 1 deletion extern/detray/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ message( STATUS "Building Detray as part of the TRACCC project" )

# Declare where to get Detray from.
set( TRACCC_DETRAY_SOURCE
"URL;https://github.com/acts-project/detray/archive/refs/tags/v0.69.1.tar.gz;URL_MD5;38a0f8e786ac6a61fabcd3a28d7bb2d6"
"URL;https://github.com/acts-project/detray/archive/refs/tags/v0.71.0.tar.gz;URL_MD5;3d68d6d97acd0b584c98ca8998aa24d3"
CACHE STRING "Source for Detray, when built as part of this project" )

mark_as_advanced( TRACCC_DETRAY_SOURCE )
Expand Down
2 changes: 1 addition & 1 deletion io/src/read_digitization_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void from_json(const nlohmann::json& json, module_digitization_config& cfg) {
if (json.find(geometric) != json.end()) {
const auto& json_geom = json[geometric];
if (json_geom.find(segmentation) != json_geom.end()) {
from_json(json_geom[segmentation], cfg.segmentation);
Acts::from_json(json_geom[segmentation], cfg.segmentation);
}
if (json_geom.find(variances) != json_geom.end()) {
for (const auto& jdata : json_geom[variances]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class finding_performance_writer {

/// Plot tool configurations.
std::map<std::string, plot_helpers::binning> var_binning = {
{"Eta", plot_helpers::binning("#eta", 40, -4, 4)},
{"Phi", plot_helpers::binning("#phi", 100, -3.15, 3.15)},
{"Pt", plot_helpers::binning("p_{T} [GeV/c]", 40, 0, 100)},
{"Num", plot_helpers::binning("N", 30, -0.5, 29.5)}};
{"Eta", plot_helpers::binning("#eta", 40, -4.f, 4.f)},
{"Phi", plot_helpers::binning("#phi", 100, -3.15f, 3.15f)},
{"Pt", plot_helpers::binning("p_{T} [GeV/c]", 40, 0.f, 100.f)},
{"Num", plot_helpers::binning("N", 30, -0.5f, 29.5f)}};

/// Cut values
scalar pT_cut = 0.1f * traccc::unit<scalar>::GeV;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class nseed_performance_writer {
std::optional<std::size_t>);

void write_track_header();
void write_track_row(std::size_t, std::size_t, bool, int, scalar, scalar,
void write_track_row(std::size_t, std::size_t, bool, scalar, scalar, scalar,
scalar);

std::string _prefix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ class seeding_performance_writer {

/// Plot tool configurations.
std::map<std::string, plot_helpers::binning> var_binning = {
{"Eta", plot_helpers::binning("#eta", 40, -4, 4)},
{"Phi", plot_helpers::binning("#phi", 100, -3.15, 3.15)},
{"Pt", plot_helpers::binning("p_{T} [GeV/c]", 40, 0, 100)},
{"Num", plot_helpers::binning("N", 30, -0.5, 29.5)}};
{"Eta", plot_helpers::binning("#eta", 40, -4.f, 4.f)},
{"Phi", plot_helpers::binning("#phi", 100, -3.15f, 3.15f)},
{"Pt", plot_helpers::binning("p_{T} [GeV/c]", 40, 0.f, 100.f)},
{"Num", plot_helpers::binning("N", 30, -0.5f, 29.5f)}};

/// Cut values
scalar pT_cut = 1.f * traccc::unit<scalar>::GeV;
Expand Down
38 changes: 20 additions & 18 deletions performance/include/traccc/resolution/res_plot_tool_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,38 @@ struct res_plot_tool_config {
/// Binning setups
std::map<std::string, plot_helpers::binning> var_binning = {
{"pull", plot_helpers::binning("pull", 100, -5, 5)},
{"residual_d0", plot_helpers::binning("r_{d0} [mm]", 100, -0.5, 0.5)},
{"residual_z0", plot_helpers::binning("r_{z0} [mm]", 100, -0.5, 0.5)},
{"residual_d0", plot_helpers::binning("r_{d0} [mm]", 100, -0.5f, 0.5f)},
{"residual_z0", plot_helpers::binning("r_{z0} [mm]", 100, -0.5f, 0.5f)},
{"residual_phi",
plot_helpers::binning("r_{#phi} [rad]", 100, -0.01, 0.01)},
plot_helpers::binning("r_{#phi} [rad]", 100, -0.01f, 0.01f)},
{"residual_theta",
plot_helpers::binning("r_{#theta} [rad]", 100, -0.01, 0.01)},
{"residual_qop", plot_helpers::binning("r_{q/p} [c/GeV]", 100, -1, 1)},
{"residual_t", plot_helpers::binning("r_{t} [s]", 100, -1000, 1000)},
plot_helpers::binning("r_{#theta} [rad]", 100, -0.01f, 0.01f)},
{"residual_qop",
plot_helpers::binning("r_{q/p} [c/GeV]", 100, -1.f, 1.f)},
{"residual_t",
plot_helpers::binning("r_{t} [s]", 100, -1000.f, 1000.f)},
{"residual_qopT",
plot_helpers::binning("r_{q/p_{T}} [c/GeV]", 100, -1, 1)},
plot_helpers::binning("r_{q/p_{T}} [c/GeV]", 100, -1.f, 1.f)},
{"residual_qopz",
plot_helpers::binning("r_{q/p_{z}} [c/GeV]", 100, -1, 1)},
plot_helpers::binning("r_{q/p_{z}} [c/GeV]", 100, -1.f, 1.f)},
{"resolution_d0",
plot_helpers::binning("#sigma_{d0} [mm]", 100, 0, 0.5)},
plot_helpers::binning("#sigma_{d0} [mm]", 100, 0.f, 0.5f)},
{"resolution_z0",
plot_helpers::binning("#sigma_{z0} [mm]", 100, 0, 0.5)},
plot_helpers::binning("#sigma_{z0} [mm]", 100, 0.f, 0.5f)},
{"resolution_phi",
plot_helpers::binning("#sigma_{#phi} [rad]", 100, 0, 0.01)},
plot_helpers::binning("#sigma_{#phi} [rad]", 100, 0.f, 0.01f)},
{"resolution_theta",
plot_helpers::binning("#sigma_{#theta} [rad]", 100, 0, 0.01)},
plot_helpers::binning("#sigma_{#theta} [rad]", 100, 0.f, 0.01f)},
{"resolution_qop",
plot_helpers::binning("#sigma_{q/p} [c/GeV]", 100, 0, 0.1)},
plot_helpers::binning("#sigma_{q/p} [c/GeV]", 100, 0.f, 0.1f)},
{"resolution_t",
plot_helpers::binning("#sigma_{t} [s]", 100, -1000, 1000)},
plot_helpers::binning("#sigma_{t} [s]", 100, -1000.f, 1000.f)},
{"resolution_qopT",
plot_helpers::binning("#sigma_{q/p_{T}} [c/GeV]", 100, 0, 0.1)},
plot_helpers::binning("#sigma_{q/p_{T}} [c/GeV]", 100, 0.f, 0.1f)},
{"resolution_qopz",
plot_helpers::binning("#sigma_{q/p_{z}} [c/GeV]", 100, 0, 0.1)},
{"Eta", plot_helpers::binning("#eta", 40, -4, 4)},
{"Pt", plot_helpers::binning("p_{T} [GeV/c]", 40, 0, 100)},
plot_helpers::binning("#sigma_{q/p_{z}} [c/GeV]", 100, 0.f, 0.1f)},
{"Eta", plot_helpers::binning("#eta", 40, -4.f, 4.f)},
{"Pt", plot_helpers::binning("p_{T} [GeV/c]", 40, 0.f, 100.f)},
};
};

Expand Down
Loading

0 comments on commit c5ae4e5

Please sign in to comment.