-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unified the setup of the command line option reading code.
Made all structs behave the same way, and introduced print operators for all of them.
- Loading branch information
Showing
21 changed files
with
727 additions
and
348 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
38 changes: 30 additions & 8 deletions
38
examples/options/include/traccc/options/detector_input_options.hpp
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,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 { | ||
|
||
/// The file containing the detector description | ||
std::string detector_file; | ||
/// 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
71
examples/options/include/traccc/options/finding_input_options.hpp
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,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 |
39 changes: 30 additions & 9 deletions
39
examples/options/include/traccc/options/full_tracking_input_options.hpp
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,23 +1,44 @@ | ||
/** 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 { | ||
|
||
struct full_tracking_input_config { | ||
std::string detector_file; | ||
/// The digitization configuration file | ||
std::string digitization_config_file; | ||
|
||
full_tracking_input_config(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 | ||
/// | ||
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 | ||
|
||
/// 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 |
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
Oops, something went wrong.