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

Filtering on simulation status is not yet working as intended. #30

Closed
tmadlener opened this issue Jun 4, 2024 · 4 comments · Fixed by #27
Closed

Filtering on simulation status is not yet working as intended. #30

tmadlener opened this issue Jun 4, 2024 · 4 comments · Fixed by #27

Comments

@tmadlener
Copy link
Contributor

In order to not blow up #27 too much, I have pulled this into a separate issue that can then also be fixed by a separate PR.

The sim status filtering is not currently working as intended. If I look here (which I hope is the right place):

https://github.com/key4hep/dmx/blob/23a1eb2cc4ed4fb3200a4d38ee70e464a180a21f/js/menu/filter/parameters.js#L114-L118

This checks whether the sim status is exactly the value of the check boxes that appear on the page:
image

However, these are the bits in the sim status that are set if a condition is met:
https://github.com/key4hep/EDM4hep/blob/0784e02caf09ee89a728b4dd17ed74ef082e4d66/edm4hep.yaml#L297-L304

So there are two things that would need to be improved / fixed

  1. The current display should not display the bit numbers, but rather their meaning. E.g. 23 -> Overlay
  2. The actual filtering should be checking the bits of the simulator status, not the actual value
@brauliorivas
Copy link
Member

  1. The current display should not display the bit numbers, but rather their meaning. E.g. 23 -> Overlay

This seems easy to implement. However, there are cases when the bit is completely different from the specification (like 0 or some other number). In that case, what should be displayed?

2. The actual filtering should be checking the bits of the simulator status, not the actual value

Sorry, I don't quite understand what you mean by "not the actual value"? I mean, the condition checks if simStatus is the same as the simStatus of the particle.

@tmadlener
Copy link
Contributor Author

To clarify what I mean by not the value, the check that is currently there is effectively

return particle.simStatus === filterSimStatus;

Where filterSimStatus is taken from the input (i.e. something between 23 and 30 inclusive). However, what we would actually want to have is a check like this

return (particle.simStatus & (1 << filterSimStatus)) !== 0;

This way the filter would check whether a certain bit is set in simStatus. I suppose you would have to introduce a new class inheriting from FilterParameter that works similar to the Checkbox does now, but has a different implementation for buildCondition. Alternatively, subclass the Checkbox and make a ValueCheckbox (that keeps the current behavior) and a BitfieldCheckbox that implements the proposed behavior here.

@brauliorivas
Copy link
Member

brauliorivas commented Jun 5, 2024

Ohh so it's not a direct comparison. Instead, some math to check the status. I've implemented these changes in this commit. The new check works as intended, by making the bit operations, and shows the simulation status name (overlay, stopped, etc) if the simStatus of the particle is defined here. However, It shows the number instead if the simStatus is not found.

@tmadlener tmadlener linked a pull request Jun 5, 2024 that will close this issue
@brauliorivas
Copy link
Member

I just noticed that I confused simStatus with genStatus. genStatus was using the simStatus implementation and vice versa. But now is fixed.

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 a pull request may close this issue.

2 participants