Skip to content

[FYI] Introducing a python based online for ucesb #1211

@klenze

Description

@klenze

For your information, the following is a copy of a mail I just sent to the analysis WG.

Dear colleagues,
One of the time-honored traditions of R3B is that at some point, DAQ persons write their own analysis framework as an alternative to FairRoot/R3BRoot, and try unsuccessfully to get the collaboration to adopt it.

This here is then me trying exactly that.

Behold pyjsroot [0] (better name pending), a proof of concept online monitor based on my pyh101 ucesb client [1].

A short anecdote: few weeks ago, I wanted to integrate a new detector prototype (FastTof, which is currently read out with VTFX modules) into an online analysis so that I can check coarse and fine time correlations between it and LOS with a pulser.

In R3BRoot that would have taken 14 new files in the main git (plus two in R3BParams) and edits in five more to add the new detector and histogram time differences between specific detectors. [2]

With pyjsroot, it took me about an hour to create a class for displaying the calibrated time differences of arbitrary TDC channels around the fine- and coarse range, and then five minutes more to specify which detectors and channels should be considered in this case. Imagine my surprise when I noticed I was having fun building an online analysis!

Why Python? See [3] for why I think that C++ is not a suitable analysis language for our collaboration.

At the moment, pyh101 can unpack arbitrary ucesb data encountered in R3B unpackers into nice python structures, assemble white rabbit timestamps, apply a fine time calibration for GSI TDC systems (Tamex, VFTX) on the fly (but optionally with caching of the calibration), calculate ToT values for Tamex data and identify which detector channels correspond to which trigger channels. This can be expanded upon either from Python or in the CPython module.

pyjsroot can read unpacker data from file or stream and show a few basic los and rolu spectra, a basic time-of-flight spectrum between LOS and FastTof, histogram the tdc differences of pulsed channels to make sure our 200MHz are in sync and analyze White Rabbit timestamps.

Given the complexity of our present beam monitoring solution
(r4l -[UDP]-> udp_repeater -> udp_reader -[zmq]-> websocket server
-[ws]-> browser), I think a pyh101 based solution could greatly reduce complexity at the cost of a somewhat higher delay, likely a few seconds.

Again, the idea of my proof of concept is not that I realistically aim to replace R3BRoot, but simply to challenge the prevailing opinion on what is a normal and healthy amount of boilerplate code. One can build a ucesb reader and jsroot server in a couple of thousand lines of code (i.e. ~1% of the FR+R3BRoot codebase) easily, and you can completely define a histogram in a single statement just fine instead of having to add code in four different places.

If you want to give it a try, use the links below and drop me a mail if you run into trouble.

Cheers,
Philipp

[0] https://github.com/klenze/pyjsroot/
[1] https://github.com/klenze/pyh101/
[2] https://github.com/klenze/pyjsroot/blob/master/docs/intro.md
[3] https://github.com/klenze/pyjsroot/blob/master/docs/soapbox.md

Metadata

Metadata

Assignees

No one assigned

    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