Adding 'volume filters' to GMEX
Intro:
This MR adds to GMEX new tools to filter volumes based on regular expressions.
Screenshots:
A screenshot of the new functionality, here below, where we visualize all EOL
and BIS
ATLAS Muon chambers, by using a regular expression with two patterns and an OR
operator:
Another example, where we visualize the ATLAS FlexibleChain
volumes, by using, again, two patterns and an OR
operator:
Description:
In particular, regular expressions are used to pick PhysVols, by matching the name of the associated LogVol.
Regular expressions can be used to build complex filters, by combining different patterns with boolean operators.
The result of the search is reflected in the GMEX geometry Browser
tool, which users can use to quickly visualize the result of their search. The number of total matching volumes is also printed in the GMEX message box at the bottom of the main window, under the 3D view.
Users can choose to show:
- only the first match; e.g., to quickly check a particular volume/shape
- all matching volumes; e.g., to show all volumes of the same type
Users can also choose to:
- Do not visit children of a matching volume [default mode]: only the matching volume is shown, regardless of its children
- Visit the children of a matching volume: also the children of a matching volume are visited, to see if they match with the search pattern.
The second option is used to visualize nested mother and daughters volumes together. In that case, the transparency of the volumes is automatically adjusted to 50%, and the transparency type of the 3D view is set to the OpenGL type SORTED_OBJECT_BLEND
, to ease the visualization of the nested volumes. Users can choose to lock the transparency, to not let the tool automatically change it.
To speed up the search process (important, in particular, with geometries featuring a large number of volumes), the 'depth' is limited to a given value and can be set by the users. 'Depth' is the number of layers of children volumes to be visited, starting from the top root volume. The default value is 1
: only the first layer of children of the root volume will be visited. Users can set the value of the 'depth' to another value, and that will be used during the search. Setting 'depth' to 0
lets the filter tool searching only through the root volumes. Setting it to -1
means all layers
. It is the responsibility of the user to not set a high value of 'depth' if not necessary: when filtering over very complex geometries with a very high number of volumes (as the ATLAS Muon Spectrometer), using a high value of 'depth' lets the filter tool search through a very high number of volumes, which slows down the process, causing a potentially very slow search.
Users can use the Browser
tool in GMEX to visualize the geometry tree structure and estimate the needed depth
.
Finally, there is a 'Reset filters' button, which resets everything and reverts the geometry system to its original state, showing the top root volume.
Notes:
-
Ether
volumes are weakly handled. They are not always visited or visualized (expanded) correctly. More work is needed to handle that correctly. This will be the focus of a later merge request. -
When the geometry is complex, with a large number of volumes (e.g., when filtering on the volumes belonging to the ATLAS Muon system), filtering can be very slow. A suggestion was to use
GeoModelAction
instances to visit the GeoModel tree. This will be explored and implemented in a later merge request.