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

Resolution plot updates with truth fitting examples #480

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

beomki-yeo
Copy link
Contributor

@beomki-yeo beomki-yeo commented Oct 30, 2023

This PR adds some useful plots in fitting_performance and truth fitting examples. The PR is expected to be a milestone of new tag for ACTS workshop

1. Measurement-level resolution (Figure: the p values of smoothed track parameters)

2. Residuals (Figure: residuals of q/p and q/p_T w.r.t eta)

3. Track-level resolution (Figure: sigma of q/p and q/p_T, gaussian fitting of residuals)

List of changes that are not implied by the title:

  • Update detray to v0.47.0 (had to change detail::get_event_filename() to traccc::io::get_event_filename
  • Fix a bug in smoother where we don't record the chi2 of smoothed state.
  • Add propagator option in telescope simulator
  • Comparator for KF result (fitter_info)
  • Update on REDAME.md
  • Add telescope build option in simulation example
  • default align axis of telescope x -> z axis

@beomki-yeo beomki-yeo marked this pull request as draft October 31, 2023 17:44
@beomki-yeo beomki-yeo force-pushed the res-plots branch 3 times, most recently from c35194b to 6fb42dd Compare November 1, 2023 13:30
@beomki-yeo beomki-yeo marked this pull request as ready for review November 1, 2023 13:32
@@ -16,6 +16,10 @@ traccc_add_executable( truth_finding_example "truth_finding_example.cpp"
LINK_LIBRARIES vecmem::core detray::utils traccc::core traccc::io
traccc::performance traccc::options)

traccc_add_executable( truth_fitting_example "truth_fitting_example.cpp"
LINK_LIBRARIES vecmem::core detray::utils traccc::core traccc::io
Copy link
Contributor

@niermann999 niermann999 Nov 1, 2023

Choose a reason for hiding this comment

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

Maybe also link against detray::io explicitly (I guess it is part of traccc::io?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added now

traccc::fitting_performance_writer::config{});

// Output Stats
uint64_t n_fitted_tracks = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it have to 64bits? Why not std::size_t?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it to std::size_t

#include <TGraphErrors.h>
#endif // TRACCC_HAVE_ROOT

#include <iostream>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a leftover?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. removed

performance/src/resolution/res_plot_tool.cpp Show resolved Hide resolved

// Find index of eta and pT for resolution histogram
const scalar eta = getter::eta(ptc.mom);
const scalar pT = getter::perp(vector2{ptc.mom[0], ptc.mom[1]});
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const scalar pT = getter::perp(vector2{ptc.mom[0], ptc.mom[1]});
const scalar pT = std::hypot(ptc.mom[0], ptc.mom[1]);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

cache.ndf_hist = plot_helpers::book_histo("ndf", "NDF", b_ndf);
cache.chi2_hist = plot_helpers::book_histo("chi2", "Chi2", b_chi2);
cache.reduced_chi2_hist =
plot_helpers::book_histo("reduced_chi2", "Chi2/NDF", b_reduced_chi2);
cache.pval_hist = plot_helpers::book_histo("pval", "p value", b_pval);
for (unsigned int D = 1; D <= 2; D++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for (unsigned int D = 1; D <= 2; D++) {
for (unsigned int D = 1u; D <= 2u; D++) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

performance/src/resolution/stat_plot_tool.cpp Show resolved Hide resolved
Comment on lines +70 to +75
detray::material<scalar> mat;
if (!telescope_opts.empty_material) {
mat = detray::silicon<scalar>();
} else {
mat = detray::vacuum<scalar>();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
detray::material<scalar> mat;
if (!telescope_opts.empty_material) {
mat = detray::silicon<scalar>();
} else {
mat = detray::vacuum<scalar>();
}
auto mat = telescope_opts.empty_material ? detray::vacuum<scalar>() : detray::silicon<scalar>();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems the compiler is not smart enough

/home/beomki/projects/traccc/traccc/examples/simulation/simulate_telescope.cpp:71:40: error: operands to ‘?:’ have different types ‘detray::vacuum<float>’ and ‘detray::silicon<float>’
   70 |     detray::material<scalar> mat = telescope_opts.empty_material
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   71 |                                        ? detray::vacuum<scalar>()
      |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
   72 |                                        : detray::silicon<scalar>();

@beomki-yeo beomki-yeo merged commit 4a49aad into acts-project:main Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants