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

feat: introduce digitization #663

Merged

Conversation

asalzburger
Copy link
Contributor

@asalzburger asalzburger commented Jan 21, 2021

This PR superseded #652 and introduces the geometric digitization + the possibility to configure it with json.

In detail:

  • This PR introduces a new configuration based on Json for digitization
  • It adds a new unit test Examples/JsonDigitizationConfigTests.cpp
  • It introduces the new DigitizationAlgorithm capable of smearing and geometric digitization
  • It allows to use the same RootDigitizationWriter for SmearingAlgorithm and DigitizationAlgorithm

When deployed, the HitSmearing and PlanarSteppingAlgorithm can become osbolete, and finally the Plugins/Digitization and Plugins/Identification can vanish.

Here are two example files snippes for the Pixel detector of the TrackML detector

  1. analog digitization (blue)
{
  "acts-geometry-hierarchy-map": {
    "format-version": 0,
    "value-identifier": "digitization-configuration"
  },
  "entries": [
    {
      "layer": 2,
      "value": {
        "geometric": {
          "digital": false,
          "indices": [
            0,
            1
          ],
          "segmentation": {
            "binningdata": [
              {
                "bins": 336,
                "max": 8.399999618530273,
                "min": -8.399999618530273,
                "option": "open",
                "type": "equidistant",
                "value": "binX"
              },
              {
                "bins": 1280,
                "max": 36.0,
                "min": -36.0,
                "option": "open",
                "type": "equidistant",
                "value": "binY"
              }
            ]
          },
          "thickness": 0.15,
          "threshold": 0.01
        }
      },
      "volume": 8
    }]
}
  1. digital digitization (red)

(only showing the change)

          "digital": false,

The results can be seen in the following plot:
Screen Shot 2021-01-29 at 12 44 00

@asalzburger asalzburger self-assigned this Jan 21, 2021
@asalzburger asalzburger added Component - Examples Affects the Examples module Feature Development to integrate a new feature labels Jan 21, 2021
@asalzburger asalzburger added this to the next milestone Jan 21, 2021
@asalzburger asalzburger added the 🚧 WIP Work-in-progress label Jan 21, 2021
@codecov
Copy link

codecov bot commented Jan 21, 2021

Codecov Report

Merging #663 (f630875) into master (f61a219) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #663   +/-   ##
=======================================
  Coverage   49.07%   49.07%           
=======================================
  Files         331      331           
  Lines       16568    16568           
  Branches     7722     7722           
=======================================
  Hits         8130     8130           
  Misses       3006     3006           
  Partials     5432     5432           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f61a219...c57f696. Read the comment docs.

@asalzburger asalzburger removed the 🚧 WIP Work-in-progress label Jan 29, 2021
@asalzburger
Copy link
Contributor Author

Hi @XiaocongAi - sorry for the bit lengthy Pr, but it should be quite clear. There will be a bit more code to come for the covariance assignment and the smearing generation of charge and lorentz vector, but this can be done as an addon.

@asalzburger
Copy link
Contributor Author

@paulgessinger - I tried three times now with the macos build on this PR but it constantly fails :-(

@asalzburger
Copy link
Contributor Author

Ok, CI finally runs through - @xai - this one is ready for review

Copy link
Contributor

@XiaocongAi XiaocongAi left a comment

Choose a reason for hiding this comment

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

Hi @asalzburger, I have not looked into the Json part in great detail, but in general, the PR looks very nice to me. I have only a few minor comments.

struct DigitizedParameters {
std::vector<Acts::BoundIndices> indices = {};
std::vector<Acts::ActsScalar> values = {};
std::vector<Acts::ActsScalar> covariances = {};
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this vector is for just the errors of the parameters (not their correlation), right? Personally, I would expect a matrix from the name covariance. Is it better to rename it to e.g. errors or uncertainties?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Measurement directions are by all means independent for our purpose.
We could write 'variances' ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good!

@asalzburger
Copy link
Contributor Author

@XiaocongAi - I think I have addressed everything & simplified the code by removing the 'Void...Generators' by just having void functions.

Copy link
Contributor

@XiaocongAi XiaocongAi left a comment

Choose a reason for hiding this comment

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

HI @asalzburger , thank you for the changes. I will approve.
One thing to confirm though, it looks to me we don't need the SmearingAlgorithm since it's basically contained in this DigitizationAlgorithm when we use the smearing instead of geometric in the Json input. But you mentioned the HitSmearing. Which one are we going to remove, the SmearingAlgorithm or the HitSmearing?

/// @return a charge to which the threshold can be applied
using ChargeGenerator = std::function<Acts::ActsScalar(
Acts::ActsScalar, Acts::ActsScalar, RandomEngine&)>;
/// Takes as an argument the clsuter size and an random engine
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
/// Takes as an argument the clsuter size and an random engine
/// Takes as an argument the cluster size and an random engine

BOOST_AUTO_TEST_CASE(DigitizationConfigRoundTrip) {
std::ofstream out;

// As all SurfaceBounds have the same streaming API only a one is
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
// As all SurfaceBounds have the same streaming API only a one is
// As all SurfaceBounds have the same streaming API only one is

@asalzburger
Copy link
Contributor Author

Ideally, both, 'HitSmearing' and 'SmearingAlgorithm' could go, but I would like to keep the latter as we can configure it through command options.

@asalzburger asalzburger merged commit bb07ac1 into acts-project:master Feb 2, 2021
@asalzburger asalzburger deleted the feat-digitization-example branch February 2, 2021 20:07
paulgessinger pushed a commit to paulgessinger/acts that referenced this pull request Feb 9, 2021
@paulgessinger paulgessinger modified the milestones: next, v6.0.0 Mar 2, 2021
kodiakhq bot pushed a commit that referenced this pull request Nov 2, 2023
@asalzburger I think this was a small copy paste error in #663 otherwise the branch would be unreachable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Examples Affects the Examples module Feature Development to integrate a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants