8 #include <nlohmann/json.hpp>
31 auto strip =
it->second.getStgcStrip(iclass, strip_id.
istrip);
50 for (
const json& jmodule : jroot.at(
"elementarray")) {
54 throw std::runtime_error(
e.what());
63 std::unique_ptr<ElementModel> deformation_model;
65 if (
model ==
"nodefo") {
66 deformation_model = std::make_unique<ElementModelRigid>();
68 else if (
model ==
"stgc") {
71 const auto& jc = j.
json.at(
"model_constant_pars");
72 jc.at(
"len_x").get_to(lenX);
73 jc.at(
"len_y").get_to(lenY);
74 jc.at(
"defo0_x").get_to(defo0[0]);
75 jc.at(
"defo0_y").get_to(defo0[1]);
76 jc.at(
"defo0_z").get_to(defo0[2]);
77 deformation_model = std::make_unique<ElementModelSTGC>(lenX, lenY, defo0);
80 throw std::runtime_error(
"Unknown model: "+
model);
84 std::unique_ptr<Element>
el = std::make_unique<Element>(std::move(deformation_model));
87 std::map<std::string, double> correctionPars, nominalPars;
88 j.
json.at(
"pars_corrected").get_to(correctionPars);
89 j.
json.at(
"pars_nominal").get_to(nominalPars);
105 throw std::runtime_error(
"StgcStripCalculator: stationName not implemented: "+
stationName);
107 j.
json.at(
"station_eta").get_to(
ret.stationEta);
108 j.
json.at(
"station_phi").get_to(
ret.stationPhi);
109 j.
json.at(
"multilayer").get_to(
ret.multilayer);
114 ret.quadruplet = quad_id;
115 j.
json.at(
"ilayer").get_to(
ret.ilayer);
116 j.
json.at(
"ipcb").get_to(
ret.ipcb);
121 double xpos, ypos, xpitch, ypitch;
122 j.at(
"pos").at(
"x").get_to(xpos);
123 j.at(
"pos").at(
"y").get_to(ypos);
124 j.at(
"pitch").at(
"x").get_to(xpitch);
125 j.at(
"pitch").at(
"y").get_to(ypitch);
129 j.
json.at(
"nstrip").get_to(
ret.lastStripNumber);
130 ret.fCenterPoint = getPoint(j.
json.at(
"first_strip_center"));
131 ret.fLeftPoint = getPoint(j.
json.at(
"first_strip_left"));
132 ret.fRightPoint = getPoint(j.
json.at(
"first_strip_right"));
133 ret.sCenterPoint = getPoint(j.
json.at(
"second_strip_center"));
134 ret.sLeftPoint = getPoint(j.
json.at(
"second_strip_left"));
135 ret.sRightPoint = getPoint(j.
json.at(
"second_strip_right"));
136 ret.lCenterPoint = getPoint(j.
json.at(
"last_strip_center"));
137 ret.lLeftPoint = getPoint(j.
json.at(
"last_strip_left"));
138 ret.lRightPoint = getPoint(j.
json.at(
"last_strip_right"));
143 if (j.
json.contains(
"strip_configuration") && j.
json.contains(
"identifier")) {
153 json::const_iterator
it;
154 json::const_iterator
end;
157 if (!j.
json.contains(
"identifier")) {
165 const std::string KEY =
"zdaughters";
168 std::list<tree_t> jtree;
169 jtree.push_back({j.
json.at(KEY).
begin(), j.
json.at(KEY).end()});
170 while (!jtree.empty()) {
171 auto&
it = jtree.back().it;
172 if (
it != jtree.back().end) {
175 Element* daugref =
mom->addDaughter(std::move(daughter));
176 if (
it->contains(KEY)) {
177 jtree.push_back({
it->at(KEY).
begin(),
it->at(KEY).end()});