Skip to content

Design UI for Geometry panel for Geant4 with tree view and object details + Detector geometry #2008

Closed

Description

@kmichalikk
No description provided.

Activity

  1. self-assigned this
    on Apr 18, 2025
  2. kmichalikk commented on Apr 18, 2025

    @kmichalikk
    ContributorAuthor

    First draft of the tree structure

    Contents of the menus is still in progress

    Image

  3. grzanka commented on Apr 28, 2025

    @grzanka
    Contributor

    Think which solids would we like to support. Box+Cylinder+Sphere covers 95% of cases. There should be some "advanced" option to add more complicated solids.

    I think its also crucial to design what happens under right mouse click, as the crucial features like "Duplicate" or "Delete" will be there.

  4. grzanka commented on Apr 28, 2025

    @grzanka
    Contributor

    It would be nice (I think in general) to have an option to specify "Drawing region" like in PHIG-3D:
    https://www.youtube.com/watch?v=_RYiDC0gMws

    Image

  5. kmichalikk commented on May 11, 2025

    @kmichalikk
    ContributorAuthor

    I tried to sum up what functionalities we need

    The HIERARCHY panel shows the hierarchy of objects placed on the scene.

    • Buttons to add simple shapes: BOX, CYLINDER, SPHERE
      • For now, in the future we may add more shapes, for that we need a different UI because the joined buttons won't scale
    • Objects are presented in a tree structure which represents the hierarchy
    • They can be placed within the structure by drag'n'drop
    • Clicking on the objects shows the MATERIAL panel below HIERARCHY for selected object

    The INFORMATION panel allows to change object name, we leave it as-is

    The MATERIAL panel is shown only when an object is selected

    • For now, it allows to select from predefined Geant4 materials
    • Options: Custom density, Opacity and Color are preserved
    • Further plans:
      • Plus sign to the right of select
      • The new material appears in select for every object on the scene
      • Either select option name is editable or there exists a text field below that changes option name
      • Translates G4Material constructor by including inputs for: Z, A, density, state, temperature, pressure
      • The new material is saved inside the project file
      • Further further plan includes mixtures with n_components which translate AddMaterial()

    The DETECTOR panel is shown only when an object is selected

    • By default, it shows a checkbox 'Set as Sensitive Detector'
    • When on, object is associated with a SensitiveDetector and collects hits data to plot in simulation results
    • Additional configuration when on: threshold
    • Disabling and reenabling should preserve data, detector can be set as 'inactive' internally
  6. kmichalikk commented on May 11, 2025

    @kmichalikk
    ContributorAuthor

    Image

  7. kmichalikk commented on May 11, 2025

    @kmichalikk
    ContributorAuthor

    We could add icon and coloring support for TreeView and use them to provide more information at a glance

    For instance, show geometry primitives and indicate which object functions as a detector (from what I understand, Geant4 "detector" is a regular object with some special configuration)

    I am thinking about taking this further and represent some properties as pseudo objects in tree as in Blender

    Image

    but I also think that would be too complicated to implement and maybe not worth the effort

  8. grzanka commented on May 12, 2025

    @grzanka
    Contributor

    The detector object may completely unrelated to any of the items in the tree inside HIERARCHY panel.
    Each of the shapes in HIERARCHY has attach material.

    Detector object doesn't have any material attached.

    Check this:
    https://geant4.web.cern.ch/documentation/dev/bfad_html/ForApplicationDevelopers/Detector/commandScore.html

    Take a look on example here:
    https://github.com/ostatni5/geant4-wasm-performance/blob/main/example/B1/exampleB1.in

    In principle you can have a hierarchy of Spheres with some materials attached and then on top of that
    scoring dose in box centered around (0,0,0) with side of 10cm, divided into 10 slices along Z, as follows:

    /score/create/boxMesh boxMesh
    /score/mesh/boxSize 50. 50. 50. mm
    /score/mesh/nBin 1 1 10
    /score/quantity/energyDeposit eDep
    

    Such mesh can be translated/rotated.

    See also https://github.com/Geant4/geant4/blob/20a218bbe1d8b4a78f819e396f8be615e6a38358/source/digits_hits/utils/src/G4ScoringMessenger.cc#L76 for more options.

  9. kmichalikk commented on May 13, 2025

    @kmichalikk
    ContributorAuthor

    Okay, then the DETECTOR panel will be left as-is, but I will add Rotation inputs

    Image

  10. kmichalikk commented on Oct 2, 2025

    @kmichalikk
    ContributorAuthor

    The bulk of the task is done in #2165. Further development, if need be, will be done in new issues/PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions