8#include <svd/calibration/SVDTimeValidationAlgorithm.h>
10#include <svd/dbobjects/SVDCoGCalibrationFunction.h>
11#include <svd/calibration/SVDCoGTimeCalibrations.h>
18#include <framework/logging/Logger.h>
21#include <TFitResult.h>
34 gROOT->SetBatch(
true);
36 auto hEventT0 = getObjectPtr<TH1F>(
"hEventT0");
37 float eventT0_mean = 0;
38 float eventT0_rms = 0;
40 eventT0_mean = hEventT0->GetMean();
41 eventT0_rms = hEventT0->GetRMS();
43 B2ERROR(
"Histogram with Event T0 not found");
45 B2DEBUG(27,
"Histogram: " << hEventT0->GetName() <<
46 " Entries (n. clusters): " << hEventT0->GetEntries() <<
47 " Mean: " << eventT0_mean);
49 auto __hClsTimeOnTracks__ = getObjectPtr<TH2F>(
"__hClsTimeOnTracks__");
52 auto __hBinToSensorMap__ = getObjectPtr<TH1F>(
"__hBinToSensorMap__");
54 for (
int ij = 0; ij < (__hBinToSensorMap__->GetNbinsX()); ij++) {
59 auto binLabel = __hBinToSensorMap__->GetXaxis()->GetBinLabel(ij + 1);
61 int layer_num, ladder_num, sensor_num;
62 std::sscanf(binLabel,
"L%dL%dS%d%c", &layer_num, &ladder_num, &sensor_num, &side);
64 B2INFO(
"Projecting for Sensor: " << binLabel <<
" with Bin Number: " << ij + 1);
66 auto hClsTimeOnTracks = (TH1D*)__hClsTimeOnTracks__->ProjectionX(
"hClsTimeOnTracks_tmp", ij + 1, ij + 1);
67 if (!hClsTimeOnTracks)
68 B2ERROR(
"Histogram " << Form(
"clsTimeOnTracks__L%dL%dS%d%c", layer_num, ladder_num, sensor_num, side) <<
" not found");
70 hClsTimeOnTracks->SetName(Form(
"clsTimeOnTracks__L%dL%dS%d%c", layer_num, ladder_num, sensor_num, side));
71 char sidePN = (side ==
'U' ?
'P' :
'N');
72 hClsTimeOnTracks->SetTitle(Form(
"clsTimeOnTracks in %d.%d.%d %c/%c", layer_num, ladder_num, sensor_num, side, sidePN));
73 hClsTimeOnTracks->SetDirectory(0);
75 float clsTimeOnTracks_mean = hClsTimeOnTracks->GetMean();
76 auto deviation = (clsTimeOnTracks_mean - eventT0_mean) / eventT0_rms;
78 B2DEBUG(27,
"Histogram: " << hClsTimeOnTracks->GetName() <<
79 " Entries (n. clusters): " << hClsTimeOnTracks->GetEntries() <<
80 " Mean: " << clsTimeOnTracks_mean <<
81 " Deviation: " << deviation <<
" EventT0 RMS");
83 B2ERROR(
"Histogram: " << hClsTimeOnTracks->GetName() <<
" deviates from EventT0 by" << deviation <<
" times the EventT0 RMS");
85 delete hClsTimeOnTracks;
Base class for calibration algorithms.
void setDescription(const std::string &description)
Set algorithm description (in constructor)
EResult
The result of calibration.
@ c_OK
Finished successfully =0 in Python.
float m_allowedDeviationMean
Allowed deviation of clsOnTracks histo wrt EventT0 histo in number of EventT0 RMS.
SVDTimeValidationAlgorithm()
Constructor set the prefix to SVDTimeCalibrationCollector.
virtual EResult calibrate() override
Run algo on data.
Abstract base class for different kinds of events.