HSF / phoenix

"Phoenix", an experiment independent web-based event display for High Energy Physics.
https://hepsoftwarefoundation.org/phoenix/
Apache License 2.0
54 stars 54 forks source link

[feature] Support of DD4hep geometry input #639

Open bartosik-hep opened 8 months ago

bartosik-hep commented 8 months ago

From the code it doesn't seem like geometry input in DD4hep format is supported. Is it something being worked on or considered for the near future?

Many future experiments are using it to describe their geometries and the present ones are also migrating to DD4hep, so it would have been great for the experiment-agnostic event visualization tool to support it.

EdwardMoyse commented 8 months ago

Hi, I'm going from memory here, so take this with a pinch of salt, but my understanding of supporting DD4HEP was that this wasn't really feasible, since DD4HEP in use in a real detector is typically going to be a mixture of xml and C++ i.e. you cannot just open an XML file, you need the code in order to parse it.

That said, we do have instructions about how to turn ROOT TGeo into something Phoenix understands: https://github.com/HSF/phoenix/blob/main/guides/developers/convert-gdml-to-gltf.md#concert-root-to-gltf

bartosik-hep commented 8 months ago

Thank you for the hint, @EdwardMoyse I know that this workflow of conversion to .gltf causes the loss of sensitive-element identifiers that makes association of hits with their corresponding detector elements impossible. Yet in the manual it is written that among others Phoenix supports loading .root files containing 3D objects. So does it mean that a TGeo geometry stored in a root file can be loaded directly, without conversion to .gltf?

EdwardMoyse commented 8 months ago

Kind of - I think it's probably a bit rudimentary.

But for example, I went to the Playground (https://hepsoftwarefoundation.org/phoenix/#/playground) and tried to import the root geometry shipped with Phoenix, and when the popup appeared asking for "Enter object name in ROOT file", I typed "simple1"

This gives the following: image

So something works, but I don't know if anyone uses this in "production"

DraTeots commented 7 months ago

EIC ePIC detector uses DD4Hep and we export root and gdml geometry in CI. Experimenting, I tried to open those files directly

this.eventDisplay.loadRootGeometry('assets/epic_dirc_only.root', "default", "default", "", 10);

Note scale 10, it is important to convert from cm. Here is our DIRC detector as an example

image
EdwardMoyse commented 7 months ago

Very nice!

DraTeots commented 7 months ago

I need to say, that converting to gltf and working with gltf provides much nicer experience and results. Especially using Blender for GLTF and other tools. But I don't think it is a problem of Phoenix but rather how how one sets up a pipeline to convert from dd4hep to geometry and import to phoenix. Currently just working with format designed for 3d in WebGL to render in WebGL and professional tools designed to work with 3D just work better than Cern ROOT geometry ported to javascript (with all my respect to Sergey Linev and all developers, they do amazing job).

I will write the full steps and ways to work with DD4HEP data in the end of my experiments

image
DraTeots commented 7 months ago

DD4Hep plugin with custom stepping action exporting track steps to phoenix format.

image

And here are optical photons

2024-03-26 02_17_31-Firebird - Vivaldi

It is fun!

bartosik-hep commented 7 months ago

@DraTeots this is really interesting... Is this plugin available as part of some public repository to see the code? It would be very useful.

DraTeots commented 7 months ago

Yes, I am making them public. Give me a day or two as I have to separate my pile of experiments to more sane projects and communicate with EIC software and computing where to better put them (presumably github.com/eic). I'll let you know here as it is alive.

bartosik-hep commented 7 months ago

Thank you! Very much looking forward to it...

DraTeots commented 7 months ago

Sorry for a long absence. Unfortunately didn't have time before the APS and vacation. Now I am back and will update on this soon.

EdwardMoyse commented 1 month ago

Just a quick ping to ask on progress on this?