Falaise
4.0.1
SuperNEMO Software Toolkit
|
If you have just started using Falaise or the FLReconstruct application, we strongly recommend that you familiarize yourself with the basic usage of FLReconstruct covered in The FLReconstruct Application. You should also be familiar with composing and using pipeline modules, as covered in Writing FLReconstruct Modules.
In FLReconstruct, modules are the basic "unit" for processing events. Each event stores data relevant to that event, but creation, use, and interpretation of this data may require other data which common to a set of events (e.g. a detector run). These data are supplied through Services.
Your module can access any services it needs via the datatools::service_manager reference supplied to its constructor by the flreconstruct application. From this, you can get a smart pointer to a current service.
In this tutorial, we will see how to implement a module requiring the snemo::geometry_svc service.
This tutorial builds on the basic module implemented in Writing FLReconstruct Modules. You should therefore have a workspace and module sources arranged as
The CMakeLists.txt
build script and .conf
pipeline scripts are identical to the earlier tutorial. We begin by modifying the module's implementation as follows:
The changes are pretty simple:
snemo::service_handle<snemo::geometry_svc>
MyModule
's constructor from the supplied datatools::service_manager instance.process
member function, here for illustration only by calling the tree_dump
member function of the held snemo::geometry_svc instance.You do not need to worry about checking that the service is correctly constructed and valid. snemo::service_handle will throw exceptions if:
geosvc->tree_dump(std::cout)
) and is not validThe flreconstruct
pipeline with handle these errors and report them on the command line.
No special steps are needed to build or run a service-aware module, so you can follow the build instructions from the original example and run the module in the same way.