Skip to content

Commit

Permalink
Merge pull request acts-project#499 from beomki-yeo/rework-options
Browse files Browse the repository at this point in the history
Rework configs and options
  • Loading branch information
beomki-yeo authored Nov 29, 2023
2 parents de62e50 + 58f82d5 commit 47492a9
Show file tree
Hide file tree
Showing 38 changed files with 162 additions and 167 deletions.
46 changes: 15 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,45 +234,29 @@ cmake --build <build_directory> <options>
### CPU reconstruction chain

```sh
<build_directory>/bin/traccc_seq_example --detector_file=tml_detector/trackml-detector.csv --digitization_config_file=tml_detector/default-geometric-config-generic.json --input_directory=tml_pixels/ --events=10
<build_directory>/bin/traccc_seq_example --detector-file=tml_detector/trackml-detector.csv --digitization-config-file=tml_detector/default-geometric-config-generic.json --input-directory=tml_pixels/ --events=10

<build_directory>/bin/traccc_throughput_mt --detector_file=tml_detector/trackml-detector.csv --digitization_config_file=tml_detector/default-geometric-config-generic.json --input_directory=tml_pixels/ --cold_run_events=100 --processed_events=1000 --threads=1
<build_directory>/bin/traccc_throughput_mt --detector-file=tml_detector/trackml-detector.csv --digitization-config-file=tml_detector/default-geometric-config-generic.json --input-directory=tml_pixels/ --cold-run-events=100 --processed-events=1000 --threads=1
```

### CUDA reconstruction chain

- Users can generate CUDA examples by adding `-DTRACCC_BUILD_CUDA=ON` to cmake options

```sh
<build_directory>/bin/traccc_seq_example_cuda --detector_file=tml_detector/trackml-detector.csv --digitization_config_file=tml_detector/default-geometric-config-generic.json --input_directory=tml_pixels/ --events=10 --run_cpu=1
<build_directory>/bin/traccc_seq_example_cuda --detector-file=tml_detector/trackml-detector.csv --digitization-config-file=tml_detector/default-geometric-config-generic.json --input-directory=tml_pixels/ --events=10 --run-cpu=1

<build_directory>/bin/traccc_throughput_mt_cuda --detector_file=tml_detector/trackml-detector.csv --digitization_config_file=tml_detector/default-geometric-config-generic.json --input_directory=tml_pixels/ --cold_run_events=100 --processed_events=1000 --threads=1
```

```sh
# Toy geometry examples
<build_directory>/bin/traccc_simulate_toy_detector --gen-vertex-xyz-mm=0:0:0 --gen-vertex-xyz-std-mm=0:0:0 --gen-mom-gev=100:100 --gen-phi-degree=0:360 --events=10 --gen-nparticles=2000 --output_directory=detray_simulation/toy_detector/n_particles_2000/ --gen-eta=-3:3 --constraint-step-size-mm=1

<build_directory>/bin/traccc_seeding_example_cuda --input_directory=detray_simulation/toy_detector/n_particles_2000/ --check_performance=true --detector_file=<detector_directory>/toy_detector_geometry.json --material_file=<detector_directory>/toy_detector_homogeneous_material.json --grid_file=<detector_directory>/toy_detector_surface_grids.json --event=1 --track_candidates_range=3:30 --constraint-step-size-mm=1000 --run_cpu=1

<build_directory>/bin/traccc_truth_finding_example_cuda --input_directory=detray_simulation/toy_detector/n_particles_2000/ --check_performance=true --detector_file=<detector_directory>/toy_detector_geometry.json --material_file=<detector_directory>/toy_detector_homogeneous_material.json --grid_file=<detector_directory>/toy_detector_surface_grids.json --event=1 --track_candidates_range=3:30 --constraint-step-size-mm=1 --run_cpu=1
```

```sh
# Wire chamber examples
<build_directory>/bin/traccc_simulate_wire_chamber --gen-vertex-xyz-mm=0:0:0 --gen-vertex-xyz-std-mm=0:0:0 --gen-mom-gev=2:2 --gen-phi-degree=0:360 --events=10 --gen-nparticles=1000 --output_directory=detray_simulation/wire_chamber/n_particles_1000/ --gen-eta=-1:1 --constraint-step-size-mm=1

<build_directory>/bin/traccc_truth_finding_example_cuda --input_directory=detray_simulation/wire_chamber/n_particles_1000/ --check_performance=true --detector_file=<detector_directory>/wire_chamber_geometry.json --material_file=<detector_directory>/wire_chamber_homogeneous_material.json --grid_file=<detector_directory>/wire_chamber_surface_grids.json --event=10 --track_candidates_range=6:30 --constraint-step-size-mm=1
<build_directory>/bin/traccc_throughput_mt_cuda --detector-file=tml_detector/trackml-detector.csv --digitization-config-file=tml_detector/default-geometric-config-generic.json --input-directory=tml_pixels/ --cold-run-events=100 --processed-events=1000 --threads=1
```

### SYCL reconstruction chain

- Users can generate SYCL examples by adding `-DTRACCC_BUILD_SYCL=ON` to cmake options

```sh
<build_directory>/bin/traccc_seq_example_sycl --detector_file=tml_detector/trackml-detector.csv --digitization_config_file=tml_detector/default-geometric-config-generic.json --input_directory=tml_pixels/ --events=10 --run_cpu=1
<build_directory>/bin/traccc_seq_example_sycl --detector-file=tml_detector/trackml-detector.csv --digitization-config-file=tml_detector/default-geometric-config-generic.json --input-directory=tml_pixels/ --events=10 --run-cpu=1

<build_directory>/bin/traccc_throughput_mt_sycl --detector_file=tml_detector/trackml-detector.csv --digitization_config_file=tml_detector/default-geometric-config-generic.json --input_directory=tml_pixels/ --cold_run_events=100 --processed_events=1000 --threads=1
<build_directory>/bin/traccc_throughput_mt_sycl --detector-file=tml_detector/trackml-detector.csv --digitization-config-file=tml_detector/default-geometric-config-generic.json --input-directory=tml_pixels/ --cold-run-events=100 --processed-events=1000 --threads=1
```

### Running a partial chain with simplified simulation data
Expand All @@ -281,13 +265,13 @@ Users can generate muon-like particle simulation data with the pre-built detray

```sh
# Generate telescope geometry data
<build_directory>/bin/traccc_simulate_telescope --gen-vertex-xyz-mm=0:0:0 --gen-vertex-xyz-std-mm=0:0:0 --gen-mom-gev=100:100 --gen-phi-degree=0:0 --events=10 --gen-nparticles=2000 --output_directory=detray_simulation/telescope_detector/n_particles_2000/ --gen-eta=1:3
<build_directory>/bin/traccc_simulate_telescope --gen-vertex-xyz-mm=0:0:0 --gen-vertex-xyz-std-mm=0:0:0 --gen-mom-gev=100:100 --gen-phi-degree=0:0 --events=10 --gen-nparticles=2000 --output-directory=detray_simulation/telescope_detector/n_particles_2000/ --gen-eta=1:3

# Generate toy geometry data
<build_directory>/bin/traccc_simulate_toy_detector --gen-vertex-xyz-mm=0:0:0 --gen-vertex-xyz-std-mm=0:0:0 --gen-mom-gev=100:100 --gen-phi-degree=0:360 --events=10 --gen-nparticles=2000 --output_directory=detray_simulation/toy_detector/n_particles_2000/ --gen-eta=-3:3 --constraint-step-size-mm=1
<build_directory>/bin/traccc_simulate_toy_detector --gen-vertex-xyz-mm=0:0:0 --gen-vertex-xyz-std-mm=0:0:0 --gen-mom-gev=100:100 --gen-phi-degree=0:360 --events=10 --gen-nparticles=2000 --output-directory=detray_simulation/toy_detector/n_particles_2000/ --gen-eta=-3:3 --constraint-step-size-mm=1

# Generate drift chamber data
<build_directory>/bin/traccc_simulate_wire_chamber --gen-vertex-xyz-mm=0:0:0 --gen-vertex-xyz-std-mm=0:0:0 --gen-mom-gev=2:2 --gen-phi-degree=0:360 --events=10 --gen-nparticles=100 --output_directory=detray_simulation/wire_chamber/n_particles_100/ --gen-eta=-1:1 --constraint-step-size-mm=1
<build_directory>/bin/traccc_simulate_wire_chamber --gen-vertex-xyz-mm=0:0:0 --gen-vertex-xyz-std-mm=0:0:0 --gen-mom-gev=2:2 --gen-phi-degree=0:360 --events=10 --gen-nparticles=100 --output-directory=detray_simulation/wire_chamber/n_particles_100/ --gen-eta=-1:1 --constraint-step-size-mm=1
```

The simulation will also generate the detector json files (geometry, material and surface_grid) in the current directory. It is user's responsibility to move them to an appropriate place (e.g. `<detector_directory>`) and match them to the input file arguments of reconstruction chains.
Expand All @@ -296,7 +280,7 @@ If users have a geometry json file already, it is also possible to run simulatio

```sh
# Given that users have a geometry json file
<build_directory>/bin/traccc_simulate --output_directory=<output_directory> --detector_file=<geometry_file> --material_file=<material_file> --grid_file=<grid_file> --event=10 --constraint-step-size-mm=1
<build_directory>/bin/traccc_simulate --output-directory=<output-directory> --detector-file=<geometry_file> --material-file=<material-file> --grid-file=<grid-file> --event=10 --constraint-step-size-mm=1
```

There are three types of partial reconstruction chain users can operate: `seeding_example`, `truth_finding_example`, and `truth_fitting_example` where their algorithm coverages are shown in the table below. Each of them starts from truth measurements, truth seeds, and truth tracks, respectively.
Expand All @@ -311,25 +295,25 @@ The dirft chamber will not produce meaningful results with `seeding_example` as

```sh
# Run cuda seeding example for toy geometry
<build_directory>/bin/traccc_seeding_example_cuda --input_directory=detray_simulation/toy_detector/n_particles_2000/ --check_performance=true --detector_file=<detector_directory>/toy_detector_geometry.json --material_file=<detector_directory>/toy_detector_homogeneous_material.json --grid_file=<detector_directory>/toy_detector_surface_grids.json --event=1 --track_candidates_range=3:30 --constraint-step-size-mm=1000 --run_cpu=1
<build_directory>/bin/traccc_seeding_example_cuda --input-directory=detray_simulation/toy_detector/n_particles_2000/ --check-performance=true --detector-file=<detector_directory>/toy_detector_geometry.json --material-file=<detector_directory>/toy_detector_homogeneous_material.json --grid-file=<detector_directory>/toy_detector_surface_grids.json --event=1 --track-candidates-range=3:30 --constraint-step-size-mm=1000 --run-cpu=1
```

```sh
# Run cuda truth finding example for toy geometry
<build_directory>/bin/traccc_truth_finding_example_cuda --input_directory=detray_simulation/toy_detector/n_particles_2000/ --check_performance=true --detector_file=<detector_directory>/toy_detector_geometry.json --material_file=<detector_directory>/toy_detector_homogeneous_material.json --grid_file=<detector_directory>/toy_detector_surface_grids.json --event=1 --track_candidates_range=3:30 --constraint-step-size-mm=1000 --run_cpu=1
<build_directory>/bin/traccc_truth_finding_example_cuda --input-directory=detray_simulation/toy_detector/n_particles_2000/ --check-performance=true --detector-file=<detector_directory>/toy_detector_geometry.json --material-file=<detector_directory>/toy_detector_homogeneous_material.json --grid-file=<detector_directory>/toy_detector_surface_grids.json --event=1 --track-candidates-range=3:30 --constraint-step-size-mm=1000 --run-cpu=1
```

```sh
# Run cuda truth finding example for drift chamber
<build_directory>/bin/traccc_truth_finding_example_cuda --input_directory=detray_simulation/wire_chamber/n_particles_100/ --check_performance=true --detector_file=<detector_directory>/wire_chamber_geometry.json --material_file=<detector_directory>/wire_chamber_homogeneous_material.json --grid_file=<detector_directory>/wire_chamber_surface_grids.json --event=10 --track_candidates_range=6:30 --constraint-step-size-mm=1 --run_cpu=1
<build_directory>/bin/traccc_truth_finding_example_cuda --input-directory=detray_simulation/wire_chamber/n_particles_100/ --check-performance=true --detector-file=<detector_directory>/wire_chamber_geometry.json --material-file=<detector_directory>/wire_chamber_homogeneous_material.json --grid-file=<detector_directory>/wire_chamber_surface_grids.json --event=10 --track-candidates-range=6:30 --constraint-step-size-mm=1 --run-cpu=1
```

```sh
# Run cpu truth fitting example for drift chamber
<build_directory>/bin/traccc_truth_fitting_example --input_directory=detray_simulation/wire_chamber/n_particles_2000_100GeV/ --check_performance=true --detector_file=<detector_directory>/wire_chamber_geometry.json --material_file=<detector_directory>/wire_chamber_homogeneous_material.json --grid_file=<detector_directory>/wire_chamber_surface_grids.json --event=10 --constraint-step-size-mm=1
<build_directory>/bin/traccc_truth_fitting_example --input-directory=detray_simulation/wire_chamber/n_particles_2000_100GeV/ --check-performance=true --detector-file=<detector_directory>/wire_chamber_geometry.json --material-file=<detector_directory>/wire_chamber_homogeneous_material.json --grid-file=<detector_directory>/wire_chamber_surface_grids.json --event=10 --constraint-step-size-mm=1
```

Users can open the performance root files (with `--check_performance=true`) and draw the histograms.
Users can open the performance root files (with `--check-performance=true`) and draw the histograms.

```sh
$ root -l performance_track_finding.root
Expand Down
3 changes: 3 additions & 0 deletions core/include/traccc/finding/finding_algorithm.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,12 @@ finding_algorithm<stepper_t, navigator_t>::operator()(
// Create propagator state
typename propagator_type::state propagation(
trk_state.filtered(), field, det);
propagation._stepping().set_overstep_tolerance(
m_cfg.overstep_tolerance);
propagation._stepping.template set_constraint<
detray::step::constraint::e_accuracy>(
m_cfg.constrained_step_size);
propagation.set_mask_tolerance(m_cfg.mask_tolerance);

typename detray::pathlimit_aborter::state s0;
typename detray::parameter_transporter<
Expand Down
7 changes: 5 additions & 2 deletions core/include/traccc/finding/finding_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,23 @@ struct finding_config {

/// Min/Max number of track candidates per track
unsigned int min_track_candidates_per_track = 3;
unsigned int max_track_candidates_per_track = 30;
unsigned int max_track_candidates_per_track = 10000;

/// Minimum step length that track should make to reach the next surface. It
/// should be set higher than the overstep tolerance not to make it stay on
/// the same surface
scalar_t min_step_length_for_surface_aborter =
0.1f * detray::unit<scalar_t>::mm;
/// Maximum Chi-square that is allowed for branching
scalar_t chi2_max = 15.f;
scalar_t chi2_max = 30.f;

/// Constrained step size for propagation
/// @TODO: Make a separate file for propagation config?
scalar_t constrained_step_size = std::numeric_limits<scalar_t>::max();

scalar_t overstep_tolerance = -100 * detray::unit<scalar_t>::um;
scalar_t mask_tolerance = 15.f * detray::unit<scalar_t>::um;

/// GPU-specific parameter for the number of measurements to be
/// iterated per thread
unsigned int n_measurements_per_thread = 8;
Expand Down
2 changes: 1 addition & 1 deletion core/include/traccc/fitting/fitting_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct fitting_config {

std::size_t n_iterations = 1;
scalar_t pathlimit = std::numeric_limits<scalar_t>::max();
scalar_t overstep_tolerance = -10 * detray::unit<scalar_t>::um;
scalar_t overstep_tolerance = -100 * detray::unit<scalar_t>::um;
scalar_t step_constraint = std::numeric_limits<scalar_t>::max();
scalar_t mask_tolerance = 15.f * detray::unit<scalar_t>::um;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ TRACCC_DEVICE inline void propagate_to_next_surface(
// Create propagator state
typename propagator_t::state propagation(
in_par, field_data, det, std::move(nav_candidates.at(globalIndex)));
propagation._stepping().set_overstep_tolerance(cfg.overstep_tolerance);
propagation._stepping
.template set_constraint<detray::step::constraint::e_accuracy>(
cfg.constrained_step_size);
propagation.set_mask_tolerance(cfg.mask_tolerance);

// Actor state
// @TODO: simplify the syntax here
Expand Down
1 change: 0 additions & 1 deletion examples/options/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ traccc_add_library( traccc_options options TYPE SHARED
"src/options/handle_argument_errors.cpp"
"src/options/mt_options.cpp"
"src/options/seeding_input_options.cpp"
"src/options/finding_input_options.cpp"
"src/options/full_tracking_input_options.cpp"
"src/options/throughput_options.cpp"
)
Expand Down
22 changes: 20 additions & 2 deletions examples/options/include/traccc/options/finding_input_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,29 @@ 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;

finding_input_config(po::options_description& desc);
void read(const po::variables_map& vm);
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, 10000}),
"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");
}
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>();
}
};

} // namespace traccc
10 changes: 8 additions & 2 deletions examples/options/include/traccc/options/propagation_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,29 @@ namespace po = boost::program_options;
template <typename scalar_t>
struct propagation_options {
scalar_t step_constraint{std::numeric_limits<scalar_t>::max()};
scalar_t overstep_tolerance{-10.f * detray::unit<scalar_t>::um};
scalar_t overstep_tolerance{-100.f * detray::unit<scalar_t>::um};
scalar_t mask_tolerance{15.f * detray::unit<scalar_t>::um};

propagation_options(po::options_description& desc) {
desc.add_options()("constraint-step-size-mm",
po::value<scalar_t>()->default_value(
std::numeric_limits<scalar>::max()),
"The constrained step size [mm]");
desc.add_options()("overstep-tolerance-um",
po::value<scalar_t>()->default_value(-10.f),
po::value<scalar_t>()->default_value(-100.f),
"The overstep tolerance [um]");
desc.add_options()("mask-tolerance-um",
po::value<scalar_t>()->default_value(15.f),
"The mask tolerance [um]");
}

void read(const po::variables_map& vm) {
step_constraint = vm["constraint-step-size-mm"].as<scalar_t>() *
detray::unit<scalar_t>::mm;
overstep_tolerance = vm["overstep-tolerance-um"].as<scalar_t>() *
detray::unit<scalar_t>::um;
mask_tolerance =
vm["mask-tolerance-um"].as<scalar_t>() * detray::unit<scalar_t>::um;
}
};

Expand Down
Loading

0 comments on commit 47492a9

Please sign in to comment.