10#include <ecl/calibration/eclAutocovarianceCalibrationC1Algorithm.h>
13#include <ecl/dataobjects/ECLElementNumbers.h>
14#include <ecl/dbobjects/ECLCrystalCalib.h>
29 "Determine noise threshold for waveforms to be used in computing the covariance matrix"
41 auto PPVsCrysID = getObjectPtr<TH2F>(
"PPVsCrysID");
43 std::vector<float> cellIDs;
44 std::vector<float> PPamps;
45 std::vector<float> PPampsErrorVector;
49 TH1F* hPP = (TH1F*)PPVsCrysID->ProjectionY(
"hPP", crysID + 1, crysID + 1);
51 int Total = hPP->GetEntries();
56 B2INFO(
"eclAutocovarianceCalibrationC1Algorithm: warning total entries for cell ID " << crysID + 1 <<
" is only: " << Total <<
63 subTotal += hPP->GetBinContent(counter);
64 fraction = ((float)subTotal) / ((float)Total);
69 cellIDs.push_back(crysID + 1);
70 PPamps.push_back(counter);
71 PPampsErrorVector.push_back(0);
73 B2INFO(
"eclAutocovarianceCalibrationC1Algorithm: crysID counter fraction Total " << crysID <<
" " << counter <<
" " << fraction <<
79 auto gPPVsCellID =
new TGraph(cellIDs.size(), cellIDs.data(), PPamps.data());
80 gPPVsCellID->SetName(
"gPPVsCellID");
83 TDirectory::TContext context;
84 TFile* histfile =
new TFile(fName,
"recreate");
95 saveCalibration(PPThreshold,
"ECLAutocovarianceCalibrationC1Threshold");
96 B2INFO(
"eclAutocovarianceCalibrationC1Algorithm: successfully stored ECLAutocovarianceCalibrationC1Threshold constants");
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.
float m_lowestEnergyFraction
Fraction of noise waveforms to use.
eclAutocovarianceCalibrationC1Algorithm()
..Constructor
std::string m_outputName
file name for histogram output
int m_TotalCountsThreshold
min number of counts needed to compute calibration
virtual EResult calibrate() override
..Run algorithm on events
const int c_NCrystals
Number of crystals.
Abstract base class for different kinds of events.