Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command Line Options Cleanup, main branch (2024.03.05.) #525

Merged
merged 2 commits into from
Mar 5, 2024
Merged
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
17 changes: 11 additions & 6 deletions examples/options/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TRACCC library, part of the ACTS project (R&D line)
#
# (c) 2022-2023 CERN for the benefit of the ACTS project
# (c) 2022-2024 CERN for the benefit of the ACTS project
#
# Mozilla Public License Version 2.0

Expand All @@ -9,23 +9,28 @@ traccc_add_library( traccc_options options TYPE SHARED
# header files
"include/traccc/options/common_options.hpp"
"include/traccc/options/detector_input_options.hpp"
"include/traccc/options/finding_input_options.hpp"
"include/traccc/options/full_tracking_input_options.hpp"
"include/traccc/options/handle_argument_errors.hpp"
"include/traccc/options/mt_options.hpp"
"include/traccc/options/options.hpp"
"include/traccc/options/particle_gen_options.hpp"
"include/traccc/options/propagation_options.hpp"
"include/traccc/options/finding_input_options.hpp"
"include/traccc/options/seeding_input_options.hpp"
"include/traccc/options/full_tracking_input_options.hpp"
"include/traccc/options/telescope_detector_options.hpp"
"include/traccc/options/throughput_options.hpp"
# source files
"src/options/common_options.cpp"
"src/options/detector_input_options.cpp"
"src/options/finding_input_options.cpp"
"src/options/full_tracking_input_options.cpp"
"src/options/handle_argument_errors.cpp"
"src/options/mt_options.cpp"
"src/options/particle_gen_options.cpp"
"src/options/propagation_options.cpp"
"src/options/seeding_input_options.cpp"
"src/options/full_tracking_input_options.cpp"
"src/options/telescope_detector_options.cpp"
"src/options/throughput_options.cpp"
)
target_link_libraries( traccc_options PUBLIC traccc::io
traccc::performance Boost::program_options)
target_link_libraries( traccc_options PUBLIC traccc::io
traccc::performance Boost::program_options)
54 changes: 39 additions & 15 deletions examples/options/include/traccc/options/common_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,48 @@
// Project include(s)
#include "traccc/io/data_format.hpp"

// Boost
// Boost include(s).
#include <boost/program_options.hpp>

namespace traccc {
// System include(s).
#include <iosfwd>
#include <string>

namespace po = boost::program_options;
namespace traccc {

/// Common options for the example applications
struct common_options {

/// The input data format
traccc::data_format input_data_format = traccc::data_format::csv;
std::string input_directory;
unsigned int events;
int skip;
unsigned short target_cells_per_partition;
bool check_performance;
bool perform_ambiguity_resolution;

common_options(po::options_description& desc);
void read(const po::variables_map& vm);
};

} // namespace traccc
/// The data input directory
std::string input_directory = "tml_full/ttbar_mu20/";
/// The number of events to process
unsigned int events = 1;
/// The number of events to skip
unsigned int skip = 0;
/// The number of cells to merge in a partition
unsigned short target_cells_per_partition = 1024;
/// Whether to check the reconstructions performance
bool check_performance = false;
/// Whether to perform ambiguity resolution
bool perform_ambiguity_resolution = true;

/// Constructor on top of a common @c program_options object
///
/// @param desc The program options to add to
///
common_options(boost::program_options::options_description& desc);

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

}; // struct common_options

/// Printout helper for @c traccc::common_options
std::ostream& operator<<(std::ostream& out, const common_options& opt);

} // namespace traccc
40 changes: 31 additions & 9 deletions examples/options/include/traccc/options/detector_input_options.hpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2023 CERN for the benefit of the ACTS project
* (c) 2023-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

// Boost
#pragma once

// Boost include(s).
#include <boost/program_options.hpp>

namespace traccc {
// System include(s).
#include <iosfwd>
#include <string>

namespace po = boost::program_options;
namespace traccc {

/// Options for the detector description
struct detector_input_options {
std::string detector_file;

/// The file containing the detector description
std::string detector_file = "tml_detector/trackml-detector.csv";
/// The file containing the material description
std::string material_file;
/// The file containing the surface grid description
std::string grid_file;

detector_input_options(po::options_description& desc);
void read(const po::variables_map& vm);
};
/// Constructor on top of a common @c program_options object
///
/// @param desc The program options to add to
///
detector_input_options(boost::program_options::options_description& desc);

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

}; // struct detector_input_options

/// Printout helper for @c traccc::detector_input_options
std::ostream& operator<<(std::ostream& out, const detector_input_options& opt);

} // namespace traccc
} // namespace traccc
71 changes: 34 additions & 37 deletions examples/options/include/traccc/options/finding_input_options.hpp
Original file line number Diff line number Diff line change
@@ -1,52 +1,49 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2023 CERN for the benefit of the ACTS project
* (c) 2023-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Project include(s).
#include "traccc/options/options.hpp"

// Boost
// Boost include(s).
#include <boost/program_options.hpp>

// System include(s).
#include <iosfwd>
#include <limits>

namespace traccc {

namespace po = boost::program_options;

template <typename scalar_t>
struct finding_input_config {
Reals<unsigned int, 2> track_candidates_range;
scalar_t chi2_max;
unsigned int nmax_per_seed;

finding_input_config(po::options_description& desc) {

desc.add_options()("track-candidates-range",
po::value<Reals<unsigned int, 2>>()
->value_name("MIN:MAX")
->default_value({3, 100}),
"Range of track candidates number");
desc.add_options()(
"chi2-max",
po::value<scalar_t>()->value_name("chi2-max")->default_value(30.f),
"Maximum Chi suqare that measurements can be included in the "
"track");
desc.add_options()(
"nmax_per_seed",
po::value<unsigned int>()
->value_name("nmax_per_seed")
->default_value(std::numeric_limits<unsigned int>::max()),
"Maximum number of branches which each initial seed can have at a "
"step.");
}
void read(const po::variables_map& vm) {
track_candidates_range =
vm["track-candidates-range"].as<Reals<unsigned int, 2>>();
chi2_max = vm["chi2-max"].as<scalar_t>();
nmax_per_seed = vm["nmax_per_seed"].as<unsigned int>();
}
};
/// Configuration for track finding
struct finding_input_options {

/// Number of track candidates per seed
Reals<unsigned int, 2> track_candidates_range{3, 100};
/// Maximum chi2 for a measurement to be included in the track
float chi2_max = 30.f;
/// Maximum number of branches which each initial seed can have at a step
unsigned int nmax_per_seed = std::numeric_limits<unsigned int>::max();

/// Constructor on top of a common @c program_options object
///
/// @param desc The program options to add to
///
finding_input_options(boost::program_options::options_description& desc);

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

}; // struct finding_input_options

/// Printout helper for @c traccc::finding_input_options
std::ostream& operator<<(std::ostream& out, const finding_input_options& opt);

} // namespace traccc
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2022 CERN for the benefit of the ACTS project
* (c) 2022-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

// Boost
#pragma once

// Boost include(s).
#include <boost/program_options.hpp>

// System include(s).
#include <iosfwd>
#include <string>

namespace traccc {

namespace po = boost::program_options;
/// Configuration for a full tracking chain
struct full_tracking_input_options {

/// The digitization configuration file
std::string digitization_config_file =
"tml_detector/default-geometric-config-generic.json";

/// Constructor on top of a common @c program_options object
///
/// @param desc The program options to add to
///
full_tracking_input_options(
boost::program_options::options_description& desc);

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

struct full_tracking_input_config {
std::string detector_file;
std::string digitization_config_file;
}; // struct full_tracking_input_config

full_tracking_input_config(po::options_description& desc);
void read(const po::variables_map& vm);
};
/// Printout helper for @c traccc::full_tracking_input_options
std::ostream& operator<<(std::ostream& out,
const full_tracking_input_options& opt);

} // namespace traccc
} // namespace traccc
4 changes: 2 additions & 2 deletions examples/options/include/traccc/options/mt_options.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2022 CERN for the benefit of the ACTS project
* (c) 2022-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand Down Expand Up @@ -28,7 +28,7 @@ struct mt_options {
///
mt_options(boost::program_options::options_description& desc);

/// Read the command line options
/// Read/process the command line options
///
/// @param vm The command line options to interpret/read
///
Expand Down
Loading
Loading