17#ifndef GPUCA_STANDALONE
29void CalibdEdxCorrection::clear()
31 for (
auto&
row : mParams) {
36 for (
auto&
x : mChi2) {
42#ifndef GPUCA_STANDALONE
46 std::unique_ptr<TFile> file(TFile::Open(fileName.data(),
"recreate"));
48 LOGP(error,
"Failed to open file {} for writing", fileName.data());
52 file->WriteObject(
this, objName.data());
57 std::unique_ptr<TFile> file(TFile::Open(fileName.data()));
58 if (!file || file->IsZombie()) {
59 LOGP(error,
"Failed to open file {}", fileName.data());
67 LOGP(error,
"Failed to load object with name {} from file {}", objName.data(), fileName.data());
82 std::vector<float> qMaxCorrOut;
83 std::vector<float> qTotCorrOut;
84 std::vector<float> tglOut;
85 std::vector<float> snpOut;
87 for (
float tgl = 0;
tgl < 2;
tgl += 0.01) {
88 for (
float snp = 0;
snp < 1;
snp += 0.1) {
91 tglOut.emplace_back(
tgl);
92 snpOut.emplace_back(
snp);
97 <<
"qMaxCorr=" << qMaxCorrOut
98 <<
"qTotCorr=" << qTotCorrOut
102 <<
"sector=" << sector
110 std::array<float, ParamSize>
params{};
115 std::for_each(
params.begin(),
params.end(), [](
auto&
val) { val /= (0.5f * FitSize); });
121 std::array<float, ParamSize>
params{};
126 std::for_each(
params.begin(),
params.end(), [](
auto&
val) { val /= (SECTORSPERSIDE * SIDES); });
140 return mean / (0.5f *
FitSize);
163 return mean / (0.5f *
FitSize);
void dumpToTree(const char *outFileName="calib_dedx.root") const
static constexpr int ParamSize
Number of params per fit.
const std::array< float, ParamSize > getMeanParams(ChargeType charge) const
Parameters averaged over all stacks.
void writeToFile(std::string_view fileName, std::string_view objName="ccdb_object") const
void loadFromFile(std::string_view fileName, std::string_view objName="ccdb_object")
float getMeanParam(ChargeType charge, uint32_t param) const
Single fit parameters averaged over all sectors for a stack type.
void setUnity()
set all corrections to 1, used for default initialization and to reset corrections
ChargeType float float snp
float getMeanEntries(ChargeType charge) const
Single fit parameters averaged over all sectors for a stack type.
static constexpr int FitSize
Number of fitted corrections.
GLenum const GLfloat * params
Global TPC definitions and constants.
GEMstack
TPC GEM stack types.
constexpr unsigned char SECTORSPERSIDE
constexpr unsigned char SIDES
constexpr unsigned short GEMSTACKSPERSECTOR
GEM stack identification.