13#include "fairlogger/Logger.h"
16#include <nlohmann/json.hpp>
23 Double_t nominalZ = detectorStep;
25 for (Int_t j =
iX; j <=
iZ; j++) {
31 fNominalZ[
i] = nominalZ;
32 nominalZ += detectorStep;
42 LOG(info) <<
" Saving test detectors planes to " << path;
43 std::ofstream ofs(path);
45 LOG(error) <<
" <!> failed to open JSON file " << path;
50 j[
"nominal_z"] = fNominalZ;
51 j[
"misalignments"] = nlohmann::json::array();
53 j[
"misalignments"].
push_back({fMisalignments[
i](
iX), fMisalignments[
i](
iY), fMisalignments[
i](
iZ)});
62 LOG(info) <<
" > Loading test detectors planes from " << path;
63 std::ifstream ifs(path);
65 LOG(error) <<
" <!> failed to open JSON file " << path;
71 const auto& jz = j[
"nominal_z"];
72 const auto& jm = j[
"misalignments"];
74 if (jz.size() != jm.size()) {
75 LOG(error) <<
" <!> inconsistent number of detector planes in JSON file " << path;
80 fNominalZ[
i] = jz[
i].get<
double>();
82 SVectGL(jm[
i][
static_cast<Int_t
>(
iX)].get<double>(), jm[
i][
static_cast<Int_t
>(
iY)].get<double>(),
83 jm[
i][
static_cast<Int_t
>(
iZ)].get<double>());
90void BmnATestDetector::RebuildDetectors()
#define BMN_ALIGN_PARAM_TOLERENCE
#define BMN_TEST_MODULE_COUNT
ROOT::Math::SVector< Double_t, BMN_GLOBAL_PARAMS_PD > SVectGL
BmnATestDetector(Double_t detectorStep, const char *dumpPath=nullptr)
Bool_t Save(const char *path) const
Bool_t Load(const char *path)
a class to store JSON values
string_t dump(const int indent=-1, const char indent_char=' ', const bool ensure_ascii=false, const error_handler_t error_handler=error_handler_t::strict) const
serialization
void push_back(basic_json &&val)
add an object to an array