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