5 #include <FairLogger.h>
16 openFileAndReadContents();
23 auto intercept = fIntercept.find(padNum);
25 if (intercept == fIntercept.end()) {
27 LOG(debug) <<
"Missing calibration for pad: " << padNum;
29 for (
int tb = 0; tb < 512; tb++)
30 pad->
SetADC(tb, fIntercept[padNum] + adc[tb] * fSlope[padNum]);
33 void AtFilterCalibrate::openFileAndReadContents()
35 auto file = openFile();
37 LOG(info) <<
"Loaded calibration parameters for: " << fIntercept.size() <<
" pads.";
40 filePtr AtFilterCalibrate::openFile()
42 filePtr file = std::make_unique<std::ifstream>(fCalibrationFile.Data());
44 LOG(fatal) <<
"Failed to open calibration file: " << fCalibrationFile;
46 LOG(info) <<
"Opened calibration file: " << fCalibrationFile;
50 void AtFilterCalibrate::readContents(std::ifstream &file)
53 float intercept, slope;
55 file >> padNumber >> intercept >> slope;
56 fIntercept.emplace(padNumber, intercept);
57 fSlope.emplace(padNumber, slope);