FRIBDAQ / DDASToys

Parallel trace-fitting software for DDAS
0 stars 0 forks source link

DDASToys documentation

Introduction

This page contains source code documentation for DDASToys. This code is used to build shared plugin libraries which can be used by the NSCLDAQ EventEditor program to fit recorded trace data. DDASToys is supported as part of NSCLDAQ releases 11.3 and later. The implemented classes and functions in DDASToys are documented with an eye toward guiding users looking to incorporate the fitting subroutines into their own code.

Two companion programs for analyzing DDAS data with fits are provided as part of the DDASToys package. Since many users perform their final analysis using CERN ROOT, a conversion tool called eeconverter is provided to convert DDAS data with fits to ROOT format. This is conceptually similar to the NSCLDAQ ddasdumper program many users are familiar with. A shared library for I/O in ROOT is provided. Trace data and their associated fits can be examined using the traceview program. Please note that traceview is a lightweight debugging and diagnostic tool, not an analysis tool; analysis of fitted trace data is left to the user.

Building DDASToys

Clone the DDASToys repository using git clone https://github.com/NSCLDAQ/DDASToys.git. The main branch should be checked out by default. You can verify this using git branch. In general it is not advisable to build and install DDASToys from the main branch, you should instead pull down a tag corresponding to a released version. Some tags of note:

Build Instructions for DDASToys 5.1 and later

Once the environment is correctly configured, navigate to the repository directory and build DDASToys using UFMT=/path/to/ufmt PREFIX=/where/to/install/ddastoys make. If no PREFIX is specified, it will default to /user/\<yourname>/ddastoys. This will:

Build Instructions for DDASToys 5.0

Once the environment is correctly configured, navigate into the cloned repository directory and build DDASToys using PREFIX=/where/to/install/ddastoys make. If no PREFIX is specified, it will default to /user/\<yourname>/ddastoys. This will:

Build Instructions for DDASToys 4.0 and Earlier

Once the environment is correctly configured, navigate into the cloned repository directory and build DDASToys using make. This will create the following:

DDASToys Overview

The FitEditor shared libraries are plugin extensions for the EventEditor program allowing fits to be parallelized using either ZMQ threading or MPI. $DAQBIN/EventEditor --help will provide some guidance on how to run this code. The libDDASFitHitUnpacker.so library defines an unpacker for DDAS hits with fit extensions. Event fragments are unpacked into the DDASFitHit class. The libDDASRootFitFormat.so library (libDDASRootFit.so in pre-6.0 releases) contains the dictionary needed by ROOT for I/O of custom classes and defines the data structure in the output ROOT file.

For more information refer to the DDASToys Manual installed in $(PREFIX)/share/manual/manual.pdf or point a web browser at $(PREFIX)/share/manual/manual.html.

Running DDASToys Codes

For more information about how to run the EventEditor codes please refer to the DDASToys manual.

Fitting Traces Using the Plugin Libraries

For an explanation of how to run the EventEditor trace fitting framework, please refer to the DDASToys Manual or the output of the command $DAQBIN/EventEditor --help run from a terminal. We will assume that you have installed the latest version of the DDASToys package. In that case, the DAQBIN variable must point to an NSCLDAQ version 12.1 or later where the EventEditor software is installed. The manual also describes how to run the fitting software at NERSC and configure an analysis pipeline for trace fitting. Notably, the structure of the fit extension appended to each event is defined in the fit_extensions.h header.

Converting Event Files Containing Fits to ROOT Format

The eeconverter program converts EventEditor output into a ROOT file format suitable for further analysis. Running eeconverter --help from the command line will show how to use the program and how to pass it arguments; running without any command line parameters will show you the minimum number of required arguments.

The eeconverter program reads ring items from a data source -- in this case built NSCLDAQ event data possibly containing fit information -- and hands them off to a ring item processor. The processor performs type-independent processing of each ring item, converting each NSCLDAQ PHYSICS_EVENT to a ROOT-ized data format and writing it to a ROOT file sink.

Viewing Traces and Fits Using Traceview

The traceview program can be used to display trace data and their respective fits (if present). Currently, traceview reads the fit and template configuration information from the files pointed to by the environment variables FIT_CONFIGFILE and TEMPLATE_CONFIGFILE. For analytic or machine-learning inference fitting, only the former must be defined; to correctly display template fitting results, both must be defined and point to valid files. Refer to the DDASToys Manual for more information about the format of these configuration files.

The traceview top menu is used to load data files and to exit the program. Successfully loading a file enables the GUI elements which allow you to parse the file and view its contents.

Crate/slot/channel identifying information for traces you wish to inspect are configured through the Channel Selection box. A * character is interpreted as a wildcard i.e. crate/slot/channel = 1/2/* will show traces for all channels located in crate 1, slot 2 for a given event. The Event Selection box allows you to skip events or select a particular event. Both features read the value in the event selection text box. The Main Control box buttons are used to view the next event containing trace data, update the list of viewable events based on the channel selection box values, and exit the program, respectively. Once a file has been loaded, you must hit the \a Next button to view the first physics event containing trace data or otherwise advance the file using the \a Skip or \a Select buttons.

The Hit Data and Classifier Data boxes display basic event information and classifier output. Both classification probabilities may be displayed as N/A in the case that no fit is associated with the channel or zero in the case where a fit is present without classification data. The Fit Data box allows you to configure the fitting method and print fit results for traces with fit data. A warning is issued if the program believes the wrong fitting method has been selected.

Once a physics event containing trace data has been found, a list of channels with traces matching the current channel selection box data is populated. Clicking on one of the list members will draw the trace and its fits (if present) on the embedded ROOT canvas. The ROOT canvas can be interacted with in the normal way (i.e. clicking and dragging along an axis will zoom).

Some traceview options--the loaded data file and the fitting method--can be configured from the command line as well as from the GUI. To see a list of commands, run traceview --help or traceview -h.