Summary of executable

nptool is shipped with four basic executable design to perform different kind of data manipulation and data production:

npconversionAny nptool::VDataInput containing raw dataAny nptool::VDataOutput containing Data classesN/A
npanalysisAny nptool::VDataInput containing Data classesAny nptool::VDataOutput containing Physics classesN/A
nponlineAny nptool::VDataInput containing Data and/or Physics classesN/Aany nptool::VUserInterface
npsimulationN/AAny nptool::VDataOutput containing Data classesN/A
list of nptool executable and the type of data input and output as well as the type of interfaces.

In addition to those base application, any plugin can come with nptool based specific purpose application. A typical example are event builders for specific detector system.

We use different type of data in nptool to store information at various stage of treatment. Raw data is used to refer to data in native DAQ format. Those format are usually unstructured and unfit for easy data processing. The first stage is therefore to order Raw data into detector specific classes referred to as Data classes. At this stage the data is organised but left untouched. No data is rejected, and no calibration is applied. In a subsequent step, the calibration and threshold are applied, as well as reconstruction algorithm, leading to the creation of Physics classes that allow the extraction of physical quantity such as position and energy.

I/O data plugin

In nptool v4 the data I/O are handled by plugin specifically design for each type of file format. This allow the framework to work with a variety of file format without modification. Plugin implement I/O classes that derived from Virtual classes. Each plugin will have its specifics number of argument, but the first one will always be the plugin name, allowing the framework to load the relevant library, and the last one the file name.

Input data

Input data plugin derived from the nptool::VDataInput class. For the case of the root plugin, the RootInput class is used. the flag argument looks like :

--input root,<TreeName>,<FileName> # file case
--input root,DataTree,path/to/file.root # file case
--input root,<TreeName>,<ServerName>:<Port Number> # stream case
--input root,localhost:8080 # stream case

Output data

Input data plugin derived from the nptool::VDataOutput class. For the case of the root plugin, the RootOutput class is used. the flag argument looks like :

--output root,<TreeName>,<FileName> # file case
--output root,PhysicsTree,path/to/file.root # file case
--output root,<Port Number> # stream case
--output root,8081 # stream case


npconversion is used to convert data file from DAQ native format (e.g. .fast, .ridf, .dat…) to an organised format compatible with Data classes from nptool plugin. A typlical conversion command will look like:

npconversion --detector detector.yaml --input faster,, --output root,DataTree,data.root

Here the detector file will allow the framework to load the plugin associated with the detector used in the setup. The input flag allow the conversion from faster and the output flag will create a root tree containing one branch per detector.


npanalysis is used to produce a Physics object based on a Data object. A typical analysis command will be called after a conversion with:

npanalsyis --detector detector.yaml --input root,DataTree,data.root --output root,PhysicsTree,physics.root

It can however also be called directly on a Raw file:

npanalsyis --detector detector.yaml --input faster,, --output root,PhysicsTree,physics.root

If your project is using a user analysis library you load it using:

npanalsyis --detector detector.yaml --input faster,, --output root,PhysicsTree,physics.root --user-analysis analysis

For advance users: npanalysis support the use of multiple analysis library at once. –user-analysis therefore accept a comma separated list of analysis plugin. The list of plugins could be edited in the local_plugin.list file where the three columns are name, token and library name. To add new libraries edit analysis/CMakeLists.txt.


nponline is used to produce non persistant histogram and serve them on a given interface (e.g. curse, web pages, gui…). Here is an example of Online topology based of the root plugin that could be deploy during an experiment:

The model work around the concept of event server. npconversion capture data buffer via a given protocole (here faster DAQ provide the last buffer through the UDP protocole). By loading the faster plugin, npconversion can access and treat the data. npconversion is launch with a circular buffer output (e.g. root circular tree) available via TCP-IP protocol on a given port. npanalysis can capture those event and treat them, producing Physics object available through another circular tree. nponline then capture both data and physics events and build the detector specific spectrum produced in the spectra classes. nponline can load different type of spectra interface (e.g. root html) to serve spectra to the user.

In addition, on demand spectra can be produced by users via simple root macro. Here is a simple example of such online macro:

void online(){
  // create the root tree client connecting to the circular tree
  // produced by npconversion on port 8080
  nptool::root::RootTreeClient client("localhost",8080);

  // declare histograms
  auto hUp = new TH2F("hUp","hUp",200,0,200,500,0,1e6);
  auto hDw = new TH2F("hDw","hDw",200,0,200,500,0,1e6);
  // prepare canvas for display
  auto c = new TCanvas();
  // infinite loop
    // wait for the process to return new events
    auto tree = client.GetCurrentTree();
    // Draw the histogram in add mod (>>+) 
    // keeping previously accumulated stat
    c->cd(1); gPad->Update();
    c->cd(2); gPad->Update();

For testing purposed, nponline can be launch using a file-based VDataInput as well. In that case execution stops at the end of the file.

A typical line to run nponline is the following, reading raw and physics event from port 8080 and 8081 and serving spectra on port 8082 :

nponline --detector detector.yaml --input-raw root,localhost:8080 --input-phy root,localhost:8081 --interface root,8082

nponline also support the –user-analysis flags and online specific library could loaded e.g. to produce online spectra of user calculated values.


npsimulation is still in devellopment.