Draft: Online-ready version of CbmTofEventClusterizer.
This MR introduces two new classes, which implement an online-ready version of CbmTofEventClusterizer
. They are for now called CbmTaskTofClusterizer
and algo::tof::Clusterizer
to distinguish them from the existing classes CbmTaskTofHitFinder
and algo::tof::HitFinder
, which were based on CbmTofSimpClusterizer
. Ultimately, we might decide to only keep the new version and rename it to HitFinder
.
The class CbmTofEventClusterizer
handles framework access. The class algo::tof::Clusterizer
class is ROOT-free and is instantiated once per RPC in the task.
The present implementation runs and has been verified on 2391 data (it is able to produce the output of the original class). It was only tested in time-based mode. It is not clear that we will keep the event-based mode.
All of the monitoring and QA functionality of the original class was removed. The class CbmTaskTofClusterizer
is however still able to read calibration data from ROOT histograms.
The MR is marked as draft, as there are a number of issues to discuss. Of these, possibly the most important is whether we can manage to get rid of the std::vector::erase()
calls that operate on the temporary storage vectors. These possibly slow down the code quite a bit. In the previous port of CbmTofSimpClusterizer
(i.e. in algo::tof::HitFinder
) we were able to switch to using iterators instead, to simply keep track of positions in the input vectors instead of manipulating / resizing them. This seems to be more complicated here, as vector-elements can in general be deleted from random places, not just from the beginning of the vector. Maybe we can solve this through some reformulations. @p.-a.loizeau might be able to provide some insight.
The iterator-based code from algo::tof::HitFinder
is included at the end of algo::tof::Clusterizer
as a commented-out block, for reference. It can simply be deleted once we are done.
The other big issue is how to go about calibration of the input digis. In the original class, there was the function CbmTofEventClusterizer::CalibRawData()
. This was was carried over to CbmTaskTofClusterizer
. It operates on the entire set of input digis, i.e. on all RPCs and channels, before the bucket-sort step that occurs prior to algorithm execution.
It is in principle possible to do this RPC-wise, and the class algo::tof::Clusterizer
does in fact provide such a function (i.e. a RPC-separated calibration). The problem here, is that a rejection of duplicated digis (based on a dead-time check) is carried out alongside the calibration, and the global indices of the calibrated digis are stored in the output tree. These indices are modified whenever a digi is discarded. If we do this RPC-wise, wo no longer have access to the global index, and hence cannot exactly reproduce the original version.
The cleanest solution probably be to move all of this to the unpacker. This was suggested by @n.herrmann.
There are some more minor technical points I wanted to discuss. There are comments regarding these in the code. I will, however, also mark them here with issue threads. Mostly these concern the fact that the present hitfinder includes some code blocks which deal with non-time-sorted input. If the input data already arrives in a time-ordered fashion, then we can drop these.
Also: The original CbmTofEventClusterizer
seems to suggest a workflow in which calibration constants can be tuned using the CbmTofCalibrator
class. This seems to be done by calling CbmTofEventClusterizer
(perhaps repeatedly) and then adjusting the calibration constants based on the output. To aid in this step, there seemed to be several ROOT histograms. All of this has been dropped. What the present class does, is produce output data based on a supplied set of calibration constants. The tuning of these constants will need to be implemented separately.
Feedback requested from: @p.-a.loizeau @v.friese @n.herrmann @f.uhlig