HSF / phoenix

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

Enhancement: Interested in contributing EDM4hepLoader #478

Open wdconinc opened 2 years ago

wdconinc commented 2 years ago

I don't have any TypeScript experience :-) but I'm interested in contributing an event loader for the EDM4hep data model used by the key4HEP project. The data model contains both simulated and reconstructed quantities which would be useful to implement, but an initial goal is these simulated quantities:

My approach would be to use the ScriptLoader to use JSROOT to read edm4hep.root files.

The EDM4hep data model does not contain geometry information beyond position (and in some cases momentum). Connection to geometry is done through the cellID fields which connect to DD4hep geometry objects. This will not be possible to replicate here unless there is some way of connecting the cellID back to the geometry in Phoenix. That's out of scope here (and likely not necessary until we need to show entire calorimeter blocks instead of simple hit positions).

The files in the EDM4hep data model do not use prescribed names for the collections of event-level information. A SimTrackerHits collection can be stored under any name, which will need to be defined in the event loader configuration (MCParticles are typically stored under that name, though, so it presents a convenient target for initial implementation).

Cc'ing @vvolkl since of interest.

wdconinc commented 2 years ago

Current thoughts are to extend the jsroot-event-loader.ts into edm4hep-jsroot-event-load.ts (the EDM4hep data model does not prescribe the ROOT IO layer, so it seems reasonable to specify it as part of the class name). Extension would have to be .edm4hep.root to avoid ambiguity with existing .root files with TLists of tracks and hits.

wdconinc commented 2 years ago

Possibly useful info: I'm at ICHEP if any of the devs is and we can chat about this.

vvolkl commented 2 years ago

Indeed, this would be great to have! For completeness, I also link to a relevant section of the docs: https://github.com/HSF/phoenix/blob/master/guides/developers/event-data-loader.md

9inpachi commented 2 years ago

Thanks for the interest @wdconinc.

TypeScript boils down to JavaScript, so if you know JavaScript, I don't think there would be major problems.

I am not too sure about the similarities between the root event data and the EDM4HEP data that's stored in root files. But keeping the architectural aspects in mind, if it's too different or doesn't have any overlap, I will recommend creating a separate loader that can scale independently of the jsroot event loader.

@vvolkl already pointed you to the docs we have for creating a custom event loader. That should already be plenty helpful.

What I recommend is going through the following steps:

  1. Understanding the Phoenix JSON format. https://github.com/HSF/phoenix/blob/master/guides/users.md#event-data
  2. Understanding some basic functions of PhoenixLoader that are referenced/used in the event data loader guide.
  3. Creating custom objects from parameters. (Included in the event data loader guide)
  4. Creating a loader that extends from PhoenixLoader and creates custom objects based on object parameters from event data. (Also included in the event data loader guide)

CMSLoader and JSRootEventLoader are really good examples of how to create new event data loaders from a custom format.

If you need any help, please feel free to reach out. We can have a call or pairing session if needed as well. :)