R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandParSet.cxx
Go to the documentation of this file.
1#include "R3BNeulandParSet.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
13using gsl::span;
14
15namespace 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 }
51 fmt::format("Failed to write parameter {} because no FairDetParIo object is found!", GetName()));
52 }
53} // namespace R3B::Neuland
54
ClassImp(R3B::Neuland::Cal2HitPar)
static constexpr auto DEFAULT_NAME
auto write(FairParIo *outputFile) -> int override
auto init(FairParIo *inputFile) -> bool override
ParSet(std::string_view name="parSet", std::string_view title="Neuland parameter", std::string_view context="TestDefaultContext", bool own=true)
Simulation of NeuLAND Bar/Paddle.