Skip to content

Projection Tree Debugging tool

tprocter46 requested to merge projtreeplotter_integration into main

As analyses are added, and projections declared, the rivet projection handler stores the unique projections and links them to all their children/parents. This in effect constructs a tree. This is a tool to enable better visualisation of those trees - before, you had to manually follow memory addresses of pointer through cloning declarations in hundreds of lines of -l TRACE output.

This was originally written to help verify Merge Request !410 (merged) ("Proper Thread Safety"), but this MR is independent of that MR, and should be useful beyond it: if there is a need to debug which projections are/aren't being used/cached, if two projections are/aren't being found as identical (especially if mkNamedPcmp returns not equal due to children or grandchildren being not equal). As an example, it was used extensively to help with MR !414 (merged) .

The basic usage is rivet -a ANALYSES --debug-proj-tree(-only) --proj-tree-name="ProjectionTree.gv" file.hepmc. The --debug-proj-tree-only variation only produces the tree, but does not run rivet (indeed, no hepmc file is even required in this case), whereas --debug-proj-tree extracts the tree from the AnalysisHandler after its been initialised, and then continues the run.

The output is a graphviz .gv file containing a digraph. This is a human-readable format and can also be useful. To produce an image file, the user can use graphviz's dot or similar. Rivet will give the user an example command, but will not execute it - this means we do NOT need to add a dependency on graphviz.

A simple python API also exists, based on the ProjectionTreeGenerator class. This allows users to output the edges and node names into python code if they wish to do something more complex with the information.

This MR will probably be briefly mentioned during the planned discussion of !410 (merged) during the rivet developers meeting on Feb 9th 2022, including how it helped fix some issues we had on that branch.

There is still some work (mainly tidying, consistency) to do here, and I'd be grateful for any feedback on how it could be more useful, things that could/should be renamed, etc.

Example plots are attached.13TeVProjectionTree_new.svgATLAS_2018_I1707015_LMODE_DILEPTON.svg

Edited by tprocter46

Merge request reports