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 "
algo/data/sts/LandauTable.h
"
5
6
#include "
AlgoFairloggerCompat.h
"
7
8
#include <fstream>
9
#include <sstream>
10
11
using namespace
cbm::algo
;
12
13
sts::LandauTable
sts::LandauTable::FromFile
(fs::path path)
14
{
15
sts::LandauTable
table;
16
17
if
(!fs::exists(path)) {
18
std::stringstream msg;
19
msg <<
"sts::LandauTable: file "
<< path.string() <<
" does not exist"
;
20
throw
std::runtime_error(msg.str());
21
}
22
23
std::vector<f32> charge;
24
std::vector<f32> prob;
25
std::ifstream file(path.string());
26
27
while
(!file.eof()) {
28
29
f32
q, p;
30
file >> q >> p;
31
charge.push_back(q);
32
prob.push_back(p);
33
34
L_
(trace) <<
"Reading Landau table "
<< path <<
" q="
<< q <<
" p="
<< p;
35
}
36
37
// TODO: check if charge is monotonically increasing, also more than 2 entries
38
39
table.
stepSize
= charge[1] - charge[0];
40
table.
values
= std::move(prob);
41
42
return
table;
43
}
AlgoFairloggerCompat.h
L_
#define L_(level)
Definition
AlgoFairloggerCompat.h:18
LandauTable.h
cbm::algo
Definition
AlgoTraits.h:16
cbm::algo::f32
float f32
Definition
Definitions.h:24
cbm::algo::sts::LandauTable
Definition
LandauTable.h:15
cbm::algo::sts::LandauTable::FromFile
static LandauTable FromFile(fs::path path)
Definition
LandauTable.cxx:13
cbm::algo::sts::LandauTable::values
std::vector< f32 > values
Definition
LandauTable.h:19
cbm::algo::sts::LandauTable::stepSize
f32 stepSize
Definition
LandauTable.h:20
algo
data
sts
LandauTable.cxx
Generated on Fri Jan 30 2026 23:05:17 for CbmRoot by
1.13.2