39 lines
1.2 KiB
C++
39 lines
1.2 KiB
C++
// Copyright (2019-2023) Paul Scherrer Institute
|
|
|
|
#ifndef JUNGFRAUJOCH_JFMODULEGAINCALIBRATION_H
|
|
#define JUNGFRAUJOCH_JFMODULEGAINCALIBRATION_H
|
|
|
|
#include <vector>
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <array>
|
|
|
|
#include "../common/Definitions.h"
|
|
|
|
class JFModuleGainCalibration {
|
|
constexpr const static size_t offset_g0 = 0;
|
|
constexpr const static size_t offset_g1 = RAW_MODULE_SIZE;
|
|
constexpr const static size_t offset_g2 = 2 * RAW_MODULE_SIZE;
|
|
std::vector<double> gain;
|
|
static double GetMean(const double *ptr) ;
|
|
public:
|
|
JFModuleGainCalibration();
|
|
explicit JFModuleGainCalibration(const std::string &filename);
|
|
explicit JFModuleGainCalibration(const std::vector<double>& vec);
|
|
[[nodiscard]] const std::vector<double> &GetGainCalibration() const;
|
|
void ExportG0(uint16_t *output) const;
|
|
void ExportG1(uint16_t* output) const;
|
|
void ExportG2(uint16_t* output) const;
|
|
|
|
double GetG0Mean() const;
|
|
double GetG1Mean() const;
|
|
double GetG2Mean() const;
|
|
};
|
|
|
|
// Only to use in automated tests run from the default directory
|
|
inline JFModuleGainCalibration GainCalibrationFromTestFile() {
|
|
return JFModuleGainCalibration("../../tests/test_data/gainMaps_M049.bin");
|
|
}
|
|
|
|
#endif //JUNGFRAUJOCH_JFMODULEGAINCALIBRATION_H
|