Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class gbts_seeding_algorithm
/// @param str The CUDA stream to perform the operations in
///
gbts_seeding_algorithm(
const gbts_seedfinder_config& cfg, traccc::memory_resource& mr,
const gbts_seedfinder_config& cfg, const traccc::memory_resource& mr,
vecmem::copy& copy, stream& str,
std::unique_ptr<const Logger> logger = getDummyLogger().clone());

Expand Down
2 changes: 1 addition & 1 deletion device/cuda/src/gbts_seeding/gbts_seeding_algorithm.cu
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ struct gbts_ctx {
};

gbts_seeding_algorithm::gbts_seeding_algorithm(
const gbts_seedfinder_config& cfg, traccc::memory_resource& mr,
const gbts_seedfinder_config& cfg, const traccc::memory_resource& mr,
vecmem::copy& copy, stream& str, std::unique_ptr<const Logger> logger)
: messaging(logger->clone()),
m_config(cfg),
Expand Down
2 changes: 2 additions & 0 deletions examples/options/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ traccc_add_library( traccc_options options TYPE SHARED
"include/traccc/options/track_propagation.hpp"
"include/traccc/options/track_resolution.hpp"
"include/traccc/options/track_seeding.hpp"
"include/traccc/options/track_gbts_seeding.hpp"
# source files
"src/details/interface.cpp"
"src/accelerator.cpp"
Expand All @@ -49,6 +50,7 @@ traccc_add_library( traccc_options options TYPE SHARED
"src/track_propagation.cpp"
"src/track_resolution.cpp"
"src/track_seeding.cpp"
"src/track_gbts_seeding.cpp"
"src/truth_finding.cpp"
)
target_link_libraries( traccc_options
Expand Down
47 changes: 47 additions & 0 deletions examples/options/include/traccc/options/track_gbts_seeding.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2022-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Project include(s).
#include "traccc/gbts_seeding/gbts_seeding_config.hpp"
#include "traccc/options/details/interface.hpp"

// System include(s).
#include <cstddef>

namespace traccc::opts {

/// Option(s) for multi-threaded code execution
class track_gbts_seeding : public interface {

public:
/// @name Options
/// @{

bool m_use_gbts = false;
std::string m_config_dir = "DEFAULT";

/// @}
// config info from file
std::vector<std::pair<uint64_t, short>> barcodeBinning;
std::vector<std::pair<int, std::vector<int>>> binTables;
traccc::device::gbts_layerInfo layerInfo;
Comment on lines +30 to +33
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not be better to just have a

Suggested change
// config info from file
std::vector<std::pair<uint64_t, short>> barcodeBinning;
std::vector<std::pair<int, std::vector<int>>> binTables;
traccc::device::gbts_layerInfo layerInfo;
/// Configuration object
gbts_seedfinder_config config;

object in there? Then we could easily add more command line options later on, as needed. In case we'd want to override even more options from the command line. 🤔

Though I don't claim to properly understand the code organization at this point.


/// Constructor
track_gbts_seeding();

/// Read/process the command line options
///
/// @param vm The command line options to interpret/read
///
void read(const boost::program_options::variables_map& vm) override;

std::unique_ptr<configuration_printable> as_printable() const override;
};

} // namespace traccc::opts
95 changes: 95 additions & 0 deletions examples/options/src/track_gbts_seeding.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2022-2025 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

// Local include(s).
#include "traccc/options/track_gbts_seeding.hpp"

#include "traccc/examples/utils/printable.hpp"

// System include(s).
#include <filesystem>
#include <fstream>
#include <stdexcept>

namespace traccc::opts {

track_gbts_seeding::track_gbts_seeding() : interface("GBTS Options") {
m_desc.add_options()("use-gbts",
boost::program_options::bool_switch(&m_use_gbts),
"Use gbts algorithm");

m_desc.add_options()("gbts-config-dir",
boost::program_options::value(&m_config_dir)
->default_value(m_config_dir),
"Directory for GBTS config files");
}

void track_gbts_seeding::read(const boost::program_options::variables_map &) {
// fill config
if (!m_use_gbts) {
return;
}
std::ifstream barcodeBinningFile(
std::filesystem::path(m_config_dir + "/barcodeBinning.txt"));

unsigned int nBarcodes = 0;
barcodeBinningFile >> nBarcodes;
barcodeBinning.reserve(nBarcodes);

std::pair<uint64_t, short> barcodeLayerPair;
for (; nBarcodes > 0u; --nBarcodes) {
barcodeBinningFile >> barcodeLayerPair.first;
barcodeBinningFile >> barcodeLayerPair.second;

barcodeBinning.push_back(barcodeLayerPair);
}

std::ifstream binTablesFile(
std::filesystem::path(m_config_dir + "/binTables.txt"));

unsigned int nBinPairs = 0;
binTablesFile >> nBinPairs;
binTables.reserve(nBinPairs);
int bin1 = 0;
std::vector<int> bin2 = {0};
for (; nBinPairs > 0; --nBinPairs) {
binTablesFile >> bin1;
binTablesFile >> bin2[0];
binTables.emplace_back(bin1, bin2);
}

std::ifstream layerInfoFile(
std::filesystem::path(m_config_dir + "/layerInfo.txt"));

unsigned int nLayers = 0;
layerInfoFile >> nLayers;
layerInfo.reserve(nLayers);
int type = 0;
std::array<int, 2> info = {0, 0};
std::array<float, 2> geo = {0, 0};
for (; nLayers > 0u; --nLayers) {
layerInfoFile >> type;
layerInfoFile >> info[0] >> info[1];
layerInfoFile >> geo[0] >> geo[1];
layerInfo.addLayer(static_cast<char>(type), info[0], info[1], geo[0],
geo[1]);
}
}

std::unique_ptr<configuration_printable> track_gbts_seeding::as_printable()
const {
auto cat = std::make_unique<configuration_category>(m_description);

cat->add_child(std::make_unique<configuration_kv_pair>(
"Using GBTS algorithm", std::to_string(m_use_gbts)));
cat->add_child(std::make_unique<configuration_kv_pair>(
"GBTS config directory ", m_config_dir));

return cat;
}

} // namespace traccc::opts
Loading