13 LOG_ERROR(
"ParamBlockWriter",
"dest is null");
17 LOG_ERROR(
"ParamBlockWriter",
"src is null");
21 for (
const auto& bk : src->get_block_names()) {
23 if (!src->contains(bk)) {
24 LOG_WARN(
"ParamBlockWriter",
"Block not found in accessor:", bk);
28 auto blk = src->at(bk);
30 LOG_WARN(
"ParamBlockWriter",
"Null block pointer for:", bk);
34 std::map<BlockName, DBNode::Value> groupData;
36 if (blk->has_scale()) {
37 groupData[
BlockName(
"scale")] = blk->get_scale();
40 for (
const auto& [
id, p] : blk->getItems()) {
43 auto node = std::make_shared<DBNode>();
46 node->set(value.real(),
"central_value");
47 if (value.imag() != 0.0) {
48 node->set(value.imag(),
"imaginary_value");
52 auto [stat, syst] = p->get_std();
53 node->set(
static_cast<double>(stat),
"stat_error");
54 node->set(
static_cast<double>(syst),
"syst_error");
58 double sc = p->get_scale();
60 node->set(sc,
"scale");
65 auto bin = p->get_bin();
66 if (!(bin.first == -1.0 && bin.second == -1.0)) {
67 node->set(bin.first,
"bin_low");
68 node->set(bin.second,
"bin_high");
72 groupData[lhaid_to_key(
id)] = node;
75 dest->setGroup({bk}, groupData);