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