R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandParSet.cxx
Go to the documentation of this file.
1
#include "
R3BNeulandParSet.h
"
2
#include "
R3BDetParRootFileIo.h
"
3
#include <FairDetParIo.h>
4
#include <FairParIo.h>
5
#include <
R3BException.h
>
6
#include <Rtypes.h>
7
#include <fairlogger/Logger.h>
8
#include <fmt/core.h>
9
#include <gsl/span>
10
#include <range/v3/algorithm/fill.hpp>
11
#include <string_view>
12
13
using
gsl::span;
14
15
namespace
R3B::Neuland
16
{
17
ParSet::ParSet
(std::string_view name, std::string_view title, std::string_view context,
bool
own)
18
: FairParSet(name.data(), title.data(), context.data(), own)
19
{
20
// TODO: versions should be initialized in FairParSet!
21
ranges::fill(span(versions), -1);
22
}
23
24
auto
ParSet::init
(FairParIo* inputFile) ->
bool
25
{
26
LOGP(debug,
"Try to init parameter {}"
, GetName());
27
if
(
auto
* detParIo = inputFile->getDetParIo(
DetParRootFileIo::DEFAULT_NAME
.data()); detParIo !=
nullptr
)
28
{
29
LOGP(debug,
"Found DetParIo {}. Try to init with this."
, detParIo->GetName());
30
auto
res = detParIo->init(
this
);
31
if
(not res)
32
{
33
LOGP(error,
"Parameter {} init failed."
, detParIo->GetName());
34
}
35
return
res;
36
}
37
38
LOGP(error,
"Failed to init parameter {} because no FairDetParIo object is found!"
, GetName());
39
return
false
;
40
}
41
42
auto
ParSet::write
(FairParIo* outputFile) ->
int
43
{
44
// writes the container to an output
45
if
(
auto
* detParIo = outputFile->getDetParIo(
"FairGenericParIo"
); detParIo !=
nullptr
)
46
{
47
LOGP(info,
"writing parameter {} to root file."
, GetName());
48
return
detParIo->write(
this
);
49
}
50
throw
R3B::runtime_error
(
51
fmt::format(
"Failed to write parameter {} because no FairDetParIo object is found!"
, GetName()));
52
}
53
}
// namespace R3B::Neuland
54
55
ClassImp
(
R3B::Neuland::ParSet
);
R3BDetParRootFileIo.h
R3BException.h
ClassImp
ClassImp(R3B::Neuland::Cal2HitPar)
R3BNeulandParSet.h
R3B::DetParRootFileIo::DEFAULT_NAME
static constexpr auto DEFAULT_NAME
Definition
R3BDetParRootFileIo.h:12
R3B::Neuland::ParSet
Definition
R3BNeulandParSet.h:25
R3B::Neuland::ParSet::write
auto write(FairParIo *outputFile) -> int override
Definition
R3BNeulandParSet.cxx:42
R3B::Neuland::ParSet::init
auto init(FairParIo *inputFile) -> bool override
Definition
R3BNeulandParSet.cxx:24
R3B::Neuland::ParSet::ParSet
ParSet(std::string_view name="parSet", std::string_view title="Neuland parameter", std::string_view context="TestDefaultContext", bool own=true)
Definition
R3BNeulandParSet.cxx:17
R3B::runtime_error
Definition
R3BException.h:13
R3B::Neuland
Simulation of NeuLAND Bar/Paddle.
Definition
GeneratorFactoryJson.h:12
neuland
calibration
share
R3BNeulandParSet.cxx
Generated by
1.14.0