CbmRoot
Loading...
Searching...
No Matches
LandauTable.cxx
Go to the documentation of this file.
1/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Felix Weiglhofer [committer] */
4#include "LandauTable.h"
5
7
8#include <fstream>
9
10using namespace cbm::algo;
11
13{
14 sts::LandauTable table;
15
16 std::vector<f32> charge;
17 std::vector<f32> prob;
18 std::ifstream file(path.string());
19
20 while (!file.eof()) {
21
22 f32 q, p;
23 file >> q >> p;
24 charge.push_back(q);
25 prob.push_back(p);
26
27 L_(trace) << "Reading Landau table " << path << " q=" << q << " p=" << p;
28 }
29
30 // TODO: check if charge is monotonically increasing, also more than 2 entries
31
32 table.stepSize = charge[1] - charge[0];
33 table.values = std::move(prob);
34
35 return table;
36}
#define L_(level)
float f32
Definition Definitions.h:24
static LandauTable FromFile(fs::path path)
std::vector< f32 > values
Definition LandauTable.h:19