CbmRoot
Loading...
Searching...
No Matches
RecoGeneralQa.cxx
Go to the documentation of this file.
1/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: P.-A. Loizeau [committer] */
4
5#include "RecoGeneralQa.h"
6
7#include <cmath>
8
11
12namespace cbm::algo::qa
13{
14 RecoGeneralQa::RecoGeneralQa(const uint64_t& runStartTimeNs, std::shared_ptr<HistogramSender> pSender)
15 : fRunStartTimeNs(runStartTimeNs)
16 , fpSender(pSender)
17 {
18 }
19
20 // --- Execution --------------------------------------------------------
21 void RecoGeneralQa::operator()(const fles::Timeslice& ts)
22 {
23 if (!fpSender.get()) {
24 return;
25 }
26
27 if (fInitNotDone) {
28 double_t dBegAxisX = 0.0;
29 double_t dSizeTsSec = 0.128;
30 if (ts.num_components() != 0 && ts.num_microslices(0) > 1) {
31 dSizeTsSec = ((ts.descriptor(0, 1).idx - ts.descriptor(0, 0).idx) * ts.num_core_microslices()) * 1.0e-9;
32 }
33 auto cName = "processed_ts";
34 auto cTitl = "Statistics of TS processed online";
35 auto canv = CanvasConfig(cName, cTitl, 2, 1);
36 {
37 auto pad = PadConfig();
38 auto name = "timeslices_count_evo";
39 auto titl = "Number of processed TS vs time in run; time in run [s]; Nb TS []";
40 int32_t nbBins = std::ceil(7200.0 / (dSizeTsSec * kNbTsPerBinCount)); // a bit more than 2h range
41 double_t dEndAxisX = nbBins * dSizeTsSec * kNbTsPerBinCount;
42 fphTimeslicesCountEvo = fQaData.MakeObj<H1D>(name, titl, nbBins, dBegAxisX, dEndAxisX);
43 pad.RegisterHistogram(fphTimeslicesCountEvo, "hist");
44 canv.AddPadConfig(pad);
45 }
46 {
47 auto pad = PadConfig();
48 auto name = "timeslices_fraction_evo";
49 auto titl = "Fraction of TS processed vs time in run; time in run [s]; Processed TS []";
50 int32_t nbBins = std::ceil(7200.0 / (dSizeTsSec * kNbTsPerBinFrac)); // a bit more than 2h range
51 double_t dEndAxisX = nbBins * dSizeTsSec * kNbTsPerBinFrac;
52 fphTimeslicesFractionEco = fQaData.MakeObj<H1D>(name, titl, nbBins, dBegAxisX, dEndAxisX);
53 pad.RegisterHistogram(fphTimeslicesFractionEco, "hist");
54 canv.AddPadConfig(pad);
55 }
57
59 fInitNotDone = false;
60 }
61
62 fphTimeslicesCountEvo->Fill((ts.start_time() - fRunStartTimeNs) * 1e-9);
63 fphTimeslicesFractionEco->Fill((ts.start_time() - fRunStartTimeNs) * 1e-9, 1.0 / kNbTsPerBinFrac);
64
65 fQaData.Send(fpSender); // Send and reset!
66 }
67
68} // namespace cbm::algo::qa
A canvas configuration for the histogram server.
Class to handle QA-objects in the online reconstruction.
Definition QaData.h:28
void AddCanvasConfig(const CanvasConfig &canvas)
Adds a canvas to the canvas config list.
Definition QaData.h:51
void Send(std::shared_ptr< HistogramSender > histoSender)
Sends QA data to the HistogramSender.
Definition QaData.cxx:72
void Init(std::shared_ptr< HistogramSender > histoSender)
Sends QA initialization information to the HistogramSender.
Definition QaData.cxx:18
Obj * MakeObj(Args... args)
Creates a QA-object and returns the pointer to it.
Definition QaData.h:85
1D-histogram
int Fill(double x, double w=1.)
Fills histogram.
Definition Histogram.h:473
A pad configuration for the histogram server.
Definition PadConfig.h:26
RecoGeneralQa()=delete
Default constructor.
void operator()(const fles::Timeslice &ts)
Execution: fill histograms and emit them (FIXME: control emission frequency)
std::shared_ptr< HistogramSender > fpSender
Histogram sender.
qa::H1D * fphTimeslicesCountEvo
hist: timeslices vs time in run in s, binned for 100 TS
static const int32_t kNbTsPerBinFrac
qa::Data fQaData
QA data, with folder named Reco as hist destination.
qa::H1D * fphTimeslicesFractionEco
hist: fraction of al ts vs time in run in s, binned for 1000 TS
static const int32_t kNbTsPerBinCount