8 #include <nlohmann/json.hpp>
25 int ipcb = (strip_id.
istrip-1)/1024 + 1;
36 auto strip =
it->second.getStrip(iclass, strip_id.
istrip);
43 int ipcb = (strip_id.
istrip-1)/1024 + 1;
63 for (
const json& jmodule : jroot.at(
"elementarray")) {
67 throw std::runtime_error(
e.what());
77 std::unique_ptr<ElementModel> deformation_model;
79 if (
model ==
"nodefo") {
80 deformation_model = std::make_unique<ElementModelRigid>();
81 }
else if (
model ==
"scalesag") {
84 const auto& jc = j.
json.at(
"model_constant_pars");
85 jc.at(
"len_x").get_to(lenX);
86 jc.at(
"len_y").get_to(lenY);
87 jc.at(
"defo0_x").get_to(defo0[0]);
88 jc.at(
"defo0_y").get_to(defo0[1]);
89 jc.at(
"defo0_z").get_to(defo0[2]);
90 deformation_model = std::make_unique<ElementModelScaleSag>(lenX, lenY, defo0);
92 throw std::runtime_error(
"Unknown model: "+
model);
96 std::unique_ptr<Element>
el = std::make_unique<Element>(std::move(deformation_model));
97 el->setAsapId(j.
json.at(
"id_asap"));
100 std::map<std::string, double> correctionPars, nominalPars;
101 j.
json.at(
"pars_correction").get_to(correctionPars);
102 j.
json.at(
"pars_nominal").get_to(nominalPars);
120 throw std::runtime_error(
"StripCalculator: stationName not implemented: "+
stationName);
134 j.
json.at(
"iboard").get_to(ret.
ipcb);
142 double xpos, ypos, xpitch, ypitch;
143 j.at(
"pos").at(
"x").get_to(xpos);
144 j.at(
"pos").at(
"y").get_to(ypos);
145 j.at(
"pitchvec").at(
"x").get_to(xpitch);
146 j.at(
"pitchvec").at(
"y").get_to(ypitch);
160 if (j.
json.contains(
"strip_configuration") && j.
json.contains(
"identifier")) {
172 json::const_iterator
it;
173 json::const_iterator
end;
176 if (!j.
json.contains(
"identifier")) {
184 const std::string KEY =
"zdaughters";
187 std::list<tree_t> jtree;
188 jtree.push_back({j.
json.at(KEY).
begin(), j.
json.at(KEY).end()});
189 while (!jtree.empty()) {
190 auto&
it = jtree.back().it;
191 if (
it != jtree.back().end) {
194 Element* daugref =
mom->addDaughter(std::move(daughter));
195 if (
it->contains(KEY)) {
196 jtree.push_back({
it->at(KEY).
begin(),
it->at(KEY).end()});