10#include <ecl/calibration/eclWaveformTemplateCalibrationC1Algorithm.h>
13#include <ecl/dataobjects/ECLElementNumbers.h>
14#include <ecl/dbobjects/ECLCrystalCalib.h>
30 "Used to determine the baseline noise level of crystals in e+e- --> gamma gamma"
42 auto maxResvsCrysID = getObjectPtr<TH2F>(
"maxResvsCrysID");
44 std::vector<float> cellIDs;
45 std::vector<float> maxResiduals;
46 std::vector<float> Counts;
51 TH1F* hMaxResx = (TH1F*)maxResvsCrysID->ProjectionY(
"hMaxResx",
id + 1,
id + 1);
53 int Total = hMaxResx->GetEntries();
56 B2INFO(
"eclWaveformTemplateCalibrationC1Algorithm: warning total entries for cell ID " <<
id + 1 <<
" is only: " << Total <<
73 while (fraction < fractionLimit) {
74 subTotal += hMaxResx->GetBinContent(counter);
75 fraction = ((float)subTotal) / ((float)Total);
79 cellIDs.push_back(
id + 1);
80 maxResiduals.push_back(hMaxResx->GetBinLowEdge(counter + 1));
81 Counts.push_back(Total);
83 B2INFO(
"eclWaveformTemplateCalibrationC1Algorithm: id counter fraction Total maxResiduals[id]" <<
id <<
" " << counter <<
" " <<
85 " " << Total <<
" " << maxResiduals[
id]);
93 saveCalibration(PPThreshold,
"eclWaveformTemplateCalibrationC1MaxResLimit");
94 B2INFO(
"eclWaveformTemplateCalibrationC1Algorithm: successfully stored ECLAutocovarianceCalibrationC1Threshold constants");
97 auto gmaxResvsCellID =
new TGraph(cellIDs.size(), cellIDs.data(), maxResiduals.data());
98 gmaxResvsCellID->SetName(
"gmaxResvsCellID");
99 auto gTotalvsCellID =
new TGraph(cellIDs.size(), cellIDs.data(), Counts.data());
100 gTotalvsCellID->SetName(
"gTotalvsCellID");
103 TFile* histfile =
new TFile(fName,
"recreate");
105 gmaxResvsCellID->Write();
106 gTotalvsCellID->Write();
Base class for calibration algorithms.
void saveCalibration(TClonesArray *data, const std::string &name)
Store DBArray payload with given name with default IOV.
void setDescription(const std::string &description)
Set algorithm description (in constructor)
EResult
The result of calibration.
@ c_OK
Finished successfully =0 in Python.
@ c_NotEnoughData
Needs more data =2 in Python.
General DB object to store one calibration number per ECL crystal.
void setCalibVector(const std::vector< float > &CalibConst, const std::vector< float > &CalibConstUnc)
Set vector of constants with uncertainties.
const int c_NCrystals
Number of crystals.
Abstract base class for different kinds of events.