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

Implement utility to benchmark navigation performance #49

Open
gipert opened this issue Jul 4, 2023 · 10 comments
Open

Implement utility to benchmark navigation performance #49

gipert opened this issue Jul 4, 2023 · 10 comments
Labels
discussion Further information is requested

Comments

@gipert
Copy link
Member

gipert commented Jul 4, 2023

It would be nice to have a tool that lets the user know whether the implementation of a certain solid is efficient or not. Example: comparing tessellated vs CSG solids.

  • Does it make sense to loop over all volumes in the physical store?
  • Does it make sense to shoot geantinos? Starting from where and with which direction?
  • How to "isolate" the solid of interest from the rest?
@gipert gipert added the discussion Further information is requested label Dec 6, 2024
@tdixon97
Copy link
Collaborator

tdixon97 commented Jan 7, 2025

I think we should increase the priority for this item since its important to have in place before developing geometry. What would we like to do? I can try to have a look.

It would be nice to have a tool that lets the user know whether the implementation of a certain solid is efficient or not. Example: comparing tessellated vs CSG solids.

* Does it make sense to loop over all volumes in the physical store?

I am not sure what you mean here ? We can maybe just use a single volume at a time to make this faster, rather than checks on the full array.

* Does it make sense to shoot geantinos? Starting from where and with which direction?

Geantinos or a real simulation, eg. some gammas or betas?

* How to "isolate" the solid of interest from the rest?

What about just starting with a basic geometry with just the "complicated" volume we are concerned about?

@EricMEsch
Copy link
Collaborator

Does it make sense to loop over all volumes in the physical store?

I just had an idea, but then realized the issue with tesselated solids. How are tesselated solids treated? Because at that point iterating through each single triangle is not really useful. I tried looking at the GDML, i am not entirely sure i correctly understand, but i think the entire tesselated volume is treated as one physical volume? Then i think looping over all volumes makes sense.

@EricMEsch
Copy link
Collaborator

Something that i remembered from the call last wednesday, Jason mentioned that his sampler was very good at spotting overlapps in geometry. He said it could even spot overlapps that geant4 was not able to find. I did not get the time to look in depth at what you introduced with #226, @tdixon97 but do you think something like that could then also be used to benchmark the navigation performance? As overlapps are tightly connected to navigation issues.

@tdixon97
Copy link
Collaborator

I am not sure, what I wrote treats one G4VSolid at a time so there cannot be overlaps. @jasondet what did you have in mind?

@ManuelHu
Copy link
Collaborator

Finding overlaps is certainly important, but here we are more interested in comparing the overhead of different implementations. Example: to find the best option to implement a single part; either as a lot of (nested) boolean solids, or as tesselated solids, ...

This already assumes that the geometry is well-defined (i.e. all meshes are closed, no overlaps). I do not think that toby's code helps a lot to benchmark this (i.e. it could be used to benchmark DistanceToIn/DistanceToOut, but not so much more)...

Otherwise benchmarking also does not really make sense, as the simulation being slow is probably the least problem when having overlaps...

@ManuelHu
Copy link
Collaborator

a very simple thing I did a while ago with different PEN plate meshes:

Notes_Optical_Mesh_performance.pdf

@tdixon97
Copy link
Collaborator

Yeah I was thinking of something similar, but do we also need to compare the results of the simulation?

@EricMEsch
Copy link
Collaborator

"Geantino runtime tomography" sounds like a great approach (and name 😄). Although i am not 100% sure why you need the gridded CSG source? Couldnt you just specify a planar square with the GPS? (or in order to also get all directions specify a sphere?) I think the GPS planar source sampling should be time uniform, as it is just randomly specifying x and y with a given z.

@gipert
Copy link
Member Author

gipert commented Jan 14, 2025

@nikolay327 also worked on this in the past, did you document it anywhere Niko?

@jasondet
Copy link

the geantino check is simple: a geantino must exit every volume it enters, so the number of surface intersections must be even. That one check found many problems in the early MJD geometries (usually people nesting and putting surfaces within kCarTolerance of each other) that were not found by other methods.

I think one can also implement a check that a geantino must exit a daughter volume before it exits a parent. I can't remember if that crosscheck is already in G4, if not then it should be. But it should be easy to add to the geantino checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants