31 jItem[
"name"] =
item.name();
32 jItem[
"ctpid"] =
item.ctpId();
33 jItem[
"definition"] =
item.definition();
34 jItem[
"monitor"] =
item.monitor();
35 jItem[
"partition"] =
item.partition();
36 jItem[
"triggerType"] =
item.triggerType();
37 jItem[
"bunchgroups"] =
json(
item.bunchgroups());
43 json thresholds = json::object_t{};
44 for(
const std::string & thrType :
l1menu.thresholdTypes()) {
45 json jThresholsByType({});
47 for(
auto & thr :
l1menu.thresholds(thrType)) {
49 jThr[
"mapping"] = thr->mapping();
51 if(thr->hasChild(
"sectors")) {
52 std::vector<std::string> sectors;
53 for(
auto &
s : thr->getList(
"sectors")) {
54 sectors.push_back(
s.getValue());
56 jThr[
"sectors"] = sectors;
58 if(thr->hasAttribute(
"voltage")) {
59 jThr[
"voltage"] = thr->getAttribute<
float>(
"voltage");
64 if(thr->hasAttribute(
"value")) {
66 jThr[
"value"] =
int(caloThr.thrValue());
68 }
catch(std::bad_cast&) {};
74 jThr[
"ecThr"] = muThr.ptEndcap();
75 jThr[
"fwThr"] = muThr.ptForward();
76 jThr[
"baIdx"] = muThr.idxBarrel();
77 jThr[
"ecIdx"] = muThr.idxEndcap();
78 jThr[
"fwIdx"] = muThr.idxForward();
79 jThr[
"region"] = muThr.region();
80 jThr[
"tgcFlags"] = muThr.tgcFlags();
81 jThr[
"rpcFlags"] = muThr.rpcFlags();
82 if(
const std::string & roiExcl = muThr.rpcExclROIList(); !roiExcl.empty()) {
83 jThr[
"rpcExclROIList"] = roiExcl;
85 }
catch(std::bad_cast&) {};
90 std::string isobits =
"00000";
92 for(
size_t b=0;
b<5; ++
b) {
93 if(isomask & (1<<
b)) { isobits[4-
b] =
'1'; }
95 jThr[
"isobits"] = isobits;
96 jThr[
"thrValues"] = json::array_t({});
97 for(
auto &
rv : tauThr.thrValues()) {
99 jRV[
"value"] =
static_cast<unsigned int>(
rv.value());
100 jRV[
"etamin"] =
rv.etaMin();
101 jRV[
"etamax"] =
rv.etaMax();
104 jRV[
"priority"] =
rv.priority();
105 jThr[
"thrValues"] += jRV;
107 }
catch(std::bad_cast&) {};
112 jThr[
"thrValues"] = json::array_t({});
113 for(
auto &
rv : EMThr.thrValues()) {
115 jRV[
"value"] =
static_cast<unsigned int>(
rv.value());
116 jRV[
"etamin"] =
rv.etaMin();
117 jRV[
"etamax"] =
rv.etaMax();
120 std::string isobits =
"00000";
121 auto isomask = EMThr.isolationMask(
rv.etaMin());
122 for(
size_t b=0;
b<5; ++
b) {
123 if(isomask & (1<<
b)) { isobits[4-
b] =
'1'; }
125 jRV[
"isobits"] = isobits;
126 jRV[
"priority"] =
rv.priority();
127 jThr[
"thrValues"] += jRV;
129 }
catch(std::bad_cast&) {};
134 jThr[
"thrValues"] = json::array_t({});
135 for(
auto &
rv : JThr.thrValues()) {
137 jRV[
"value"] =
static_cast<unsigned int>(
rv.value());
138 jRV[
"etamin"] =
rv.etaMin();
139 jRV[
"etamax"] =
rv.etaMax();
142 jRV[
"window"] = JThr.window(0);
143 jRV[
"priority"] =
rv.priority();
144 jThr[
"thrValues"] += jRV;
146 }
catch(std::bad_cast&) {};
152 for(
auto &
rv : teThr.thrValues()) {
154 jRV[
"value"] =
static_cast<unsigned int>(
rv.value());
155 jRV[
"etamin"] =
rv.etaMin();
156 jRV[
"etamax"] =
rv.etaMax();
157 jRV[
"priority"] =
rv.priority();
158 jThr[
"thrValues"] += jRV;
160 }
catch(std::bad_cast&) {};
165 jThr[
"seed"] = zbThr.
seed();
166 jThr[
"seedBcdelay"] = zbThr.seedBcdelay();
167 jThr[
"seedMultiplicity"] = zbThr.seedMultiplicity();
168 }
catch(std::bad_cast&) {};
173 jThr[
"mask0"] = zbTopoThr.
mask0();
174 jThr[
"mask0"] = zbTopoThr.mask0();
175 jThr[
"mask0"] = zbTopoThr.mask0();
176 jThr[
"mask0"] = zbTopoThr.mask0();
177 jThr[
"mask0"] = zbTopoThr.mask0();
178 jThr[
"mask0"] = zbTopoThr.mask0();
179 jThr[
"seedBcdelay"] = zbTopoThr.seedBcdelay();
181 }
catch(std::bad_cast&) {};
190 for(
auto &
rv : eEMThr.thrValues()) {
192 jRV[
"value"] =
static_cast<unsigned int>(
rv.value());
193 jRV[
"etamin"] =
rv.etaMin();
194 jRV[
"etamax"] =
rv.etaMax();
195 jRV[
"priority"] =
rv.priority();
196 jThr[
"thrValues"] += jRV;
198 }
catch(std::bad_cast&) {};
207 for(
auto &
rv : jEMThr.thrValues()) {
209 jRV[
"value"] =
static_cast<unsigned int>(
rv.value());
210 jRV[
"etamin"] =
rv.etaMin();
211 jRV[
"etamax"] =
rv.etaMax();
212 jRV[
"priority"] =
rv.priority();
213 jThr[
"thrValues"] += jRV;
215 }
catch(std::bad_cast&) {};
222 jThr[
"thrValues"] = json::array_t({});
223 for(
auto &
rv : eTAUThr.thrValues()) {
225 jRV[
"value"] =
static_cast<unsigned int>(
rv.value());
226 jRV[
"etamin"] =
rv.etaMin();
227 jRV[
"etamax"] =
rv.etaMax();
230 jRV[
"priority"] =
rv.priority();
231 jThr[
"thrValues"] += jRV;
233 }
catch(std::bad_cast&) {};
239 jThr[
"thrValues"] = json::array_t({});
240 for(
auto &
rv : jTAUThr.thrValues()) {
242 jRV[
"value"] =
static_cast<unsigned int>(
rv.value());
243 jRV[
"etamin"] =
rv.etaMin();
244 jRV[
"etamax"] =
rv.etaMax();
247 jRV[
"priority"] =
rv.priority();
248 jThr[
"thrValues"] += jRV;
250 }
catch(std::bad_cast&) {};
256 jThr[
"thrValues"] = json::array_t({});
257 for(
auto &
rv : cTAUThr.thrValues()) {
259 jRV[
"value"] =
static_cast<unsigned int>(
rv.value());
260 jRV[
"etamin"] =
rv.etaMin();
261 jRV[
"etamax"] =
rv.etaMax();
264 jRV[
"priority"] =
rv.priority();
265 jThr[
"thrValues"] += jRV;
267 }
catch(std::bad_cast&) {};
272 jThr[
"thrValues"] = json::array_t({});
273 for(
auto &
rv : jJThr.thrValues()) {
275 jRV[
"value"] =
static_cast<unsigned int>(
rv.value());
276 jRV[
"etamin"] =
rv.etaMin();
277 jRV[
"etamax"] =
rv.etaMax();
278 jRV[
"priority"] =
rv.priority();
279 jThr[
"thrValues"] += jRV;
281 }
catch(std::bad_cast&) {};
286 jThr[
"thrValues"] = json::array_t({});
287 for(
auto &
rv : jLJThr.thrValues()) {
289 jRV[
"value"] =
static_cast<unsigned int>(
rv.value());
290 jRV[
"etamin"] =
rv.etaMin();
291 jRV[
"etamax"] =
rv.etaMax();
292 jRV[
"priority"] =
rv.priority();
293 jThr[
"thrValues"] += jRV;
295 }
catch(std::bad_cast&) {};
300 jThr[
"value"] =
int(gJThr.thrValue());
301 }
catch(std::bad_cast&) {};
306 jThr[
"value"] =
int(gLJThr.thrValue());
307 }
catch(std::bad_cast&) {};
312 jThr[
"value"] =
int(jXEThr.thrValue());
313 }
catch(std::bad_cast&) {};
318 jThr[
"value"] =
int(jTEThr.thrValue());
319 }
catch(std::bad_cast&) {};
324 jThr[
"value"] =
int(gXEThr.thrValue());
325 }
catch(std::bad_cast&) {};
330 jThr[
"value"] =
int(gTEThr.thrValue());
331 }
catch(std::bad_cast&) {};
333 jThresholsByType[thr->name()] = std::move(jThr);
336 if(thrType !=
"internal") {
337 jThrType[
"thresholds"] = std::move(jThresholsByType);
339 jThrType[
"type"] = thrType;
342 auto & extraInfo =
l1menu.thrExtraInfo().thrExtraInfo(thrType);
343 if(extraInfo.hasAttribute(
"ptMinToTopo")) {
344 jThrType[
"ptMinToTopo"] = extraInfo.getAttribute<
unsigned int>(
"ptMinToTopo");
346 if(extraInfo.hasAttribute(
"resolutionMeV")) {
347 jThrType[
"resolutionMeV"] = extraInfo.getAttribute<
unsigned int>(
"resolutionMeV");
351 if(thrType ==
"internal") {
352 jThrType[
"names"] = json::array_t({});
353 for(
auto & thr :
l1menu.thresholds(thrType)) {
354 jThrType[
"names"] += thr->name();
356 auto & extInfo =
l1menu.thrExtraInfo().thrExtraInfo(
"internal");
357 if(
auto randoms = extInfo.getExtraInfo(
"randoms")) {
358 for(
size_t rc=0;
rc<4; ++
rc) {
360 randoms->get().getAttribute<
unsigned int>(
"RNDM" +
std::to_string(rc)+
".cut");
365 if(thrType ==
"MU") {
366 auto & muinfo =
l1menu.thrExtraInfo().MU();
368 for(
auto & listName : muinfo.exclusionListNames()) {
369 jThrType[
"exclusionLists"][listName] = json::array_t({});
370 for(
auto &
x : muinfo.exclusionList(listName)) {
371 jThrType[
"exclusionLists"][listName] +=
json({ {
"sectorName",
x.first}, {
"rois",
x.second}});
374 for(
auto & rpcPt : muinfo.knownRpcPtValues()) {
375 jThrType[
"roads"][
"rpc"][
std::to_string(rpcPt)] = muinfo.rpcIdxForPt(rpcPt);
377 for(
auto &
tgcPt : muinfo.knownTgcPtValues()) {
382 if(thrType ==
"EM" &&
l1menu.run()>1) {
383 auto & eminfo =
l1menu.thrExtraInfo().EM();
384 for(
const std::string isoSet : {
"EMIsoForEMthr",
"HAIsoForEMthr" }) {
385 jThrType[
"isolation"][isoSet][
"thrtype"] = isoSet;
386 jThrType[
"isolation"][isoSet][
"Parametrization"] = json::array_t({});
387 for(
size_t bit = 1; bit<=5; ++bit) {
388 auto & iso = eminfo.isolation(isoSet,bit);
390 jIso[
"etamax"] = iso.etamax();
391 jIso[
"etamin"] = iso.etamin();
392 jIso[
"isobit"] = iso.isobit();
393 jIso[
"mincut"] = iso.mincut();
394 jIso[
"offset"] = iso.offset();
395 jIso[
"priority"] = iso.priority();
396 jIso[
"slope"] = iso.slope();
397 jIso[
"upperlimit"] = iso.upperlimit();
398 jThrType[
"isolation"][isoSet][
"Parametrization"] += jIso;
403 if(thrType ==
"TAU" &&
l1menu.run()>1) {
404 auto & tauinfo =
l1menu.thrExtraInfo().TAU();
405 const std::string isoSet{
"EMIsoForTAUthr" };
406 jThrType[
"isolation"][isoSet][
"thrtype"] = isoSet;
407 jThrType[
"isolation"][isoSet][
"Parametrization"] = json::array_t({});
408 for(
size_t bit = 1; bit<=5; ++bit) {
409 auto & iso = tauinfo.isolation(isoSet,bit);
411 jIso[
"etamax"] = iso.etamax();
412 jIso[
"etamin"] = iso.etamin();
413 jIso[
"isobit"] = iso.isobit();
414 jIso[
"mincut"] = iso.mincut();
415 jIso[
"offset"] = iso.offset();
416 jIso[
"priority"] = iso.priority();
417 jIso[
"slope"] = iso.slope();
418 jIso[
"upperlimit"] = iso.upperlimit();
419 jThrType[
"isolation"][isoSet][
"Parametrization"] += jIso;
423 if(thrType ==
"JET") {
424 auto & jetinfo =
l1menu.thrExtraInfo().JET();
425 jThrType[
"ptMinToTopoSmallWindow"] = (
int)jetinfo.ptMinToTopoSmallWindow();
426 jThrType[
"ptMinToTopoLargeWindow"] = (
int)jetinfo.ptMinToTopoLargeWindow();
429 if(thrType ==
"XS") {
430 auto & xsinfo =
l1menu.thrExtraInfo().XS();
431 jThrType[
"significance"][
"xeMin"] = xsinfo.xeMin();
432 jThrType[
"significance"][
"xeMax"] = xsinfo.xeMax();
433 jThrType[
"significance"][
"teSqrtMin"] = xsinfo.teSqrtMin();
434 jThrType[
"significance"][
"teSqrtMax"] = xsinfo.teSqrtMax();
435 jThrType[
"significance"][
"xsSigmaScale"] = xsinfo.xsSigmaScale();
436 jThrType[
"significance"][
"xsSigmaOffset"] = xsinfo.xsSigmaOffset();
439 if(thrType ==
"eEM") {
440 auto & eeminfo =
l1menu.thrExtraInfo().eEM();
441 jThrType[
"maxEt"] = (
int)eeminfo.maxEt();
444 jThrType[
"workingPoints"][wpstr] = json::array_t({});
445 for(
auto & iso : eeminfo.isolation(
wp)) {
448 stream << std::fixed << std::setprecision(3) << iso.value().reta_d();
449 jWPIso[
"reta"] = std::stod(
stream.str());
450 jWPIso[
"reta_fw"] = iso.value().reta_fw();
453 stream << std::fixed << std::setprecision(3) << iso.value().rhad_d();
454 jWPIso[
"rhad"] = std::stod(
stream.str());
455 jWPIso[
"rhad_fw"] = iso.value().rhad_fw();
458 stream << std::fixed << std::setprecision(3) << iso.value().wstot_d();
459 jWPIso[
"wstot"] = std::stod(
stream.str());
460 jWPIso[
"wstot_fw"] = iso.value().wstot_fw();
461 jWPIso[
"etamin"] = iso.etaMin();
462 jWPIso[
"etamax"] = iso.etaMax();
463 jWPIso[
"priority"] = iso.priority();
464 jThrType[
"workingPoints"][wpstr] += jWPIso;
469 if(thrType ==
"jEM") {
470 auto & jeminfo =
l1menu.thrExtraInfo().jEM();
471 jThrType[
"maxEt"] = (
int)jeminfo.maxEt();
472 jThrType[
"ptMinToTopo1"] = (
int)jeminfo.ptMinToTopo(
"1A");
473 jThrType[
"ptMinToTopo2"] = (
int)jeminfo.ptMinToTopo(
"2A");
474 jThrType[
"ptMinToTopo3"] = (
int)jeminfo.ptMinToTopo(
"3A");
475 jThrType[
"ptMinxTOB1"] = (
int)jeminfo.ptMinxTOB(
"1A");
476 jThrType[
"ptMinxTOB2"] = (
int)jeminfo.ptMinxTOB(
"2A");
477 jThrType[
"ptMinxTOB3"] = (
int)jeminfo.ptMinxTOB(
"3A");
480 jThrType[
"workingPoints"][wpstr] = json::array_t({});
481 for(
auto & iso : jeminfo.isolation(
wp)) {
484 stream << std::fixed << std::setprecision(3) << iso.value().iso_d();
485 jWPIso[
"iso"] = std::stod(
stream.str());
486 jWPIso[
"iso_fw"] = iso.value().iso_fw();
489 stream << std::fixed << std::setprecision(3) << iso.value().frac_d();
490 jWPIso[
"frac"] = std::stod(
stream.str());
491 jWPIso[
"frac_fw"] = iso.value().frac_fw();
494 stream << std::fixed << std::setprecision(3) << iso.value().frac2_d();
495 jWPIso[
"frac2"] = std::stod(
stream.str());
496 jWPIso[
"frac2_fw"] = iso.value().frac2_fw();
497 jWPIso[
"etamin"] = iso.etaMin();
498 jWPIso[
"etamax"] = iso.etaMax();
499 jWPIso[
"priority"] = iso.priority();
500 jThrType[
"workingPoints"][wpstr] += jWPIso;
505 if(thrType ==
"eTAU") {
506 auto & eeminfo =
l1menu.thrExtraInfo().eTAU();
507 jThrType[
"minIsoEt"] = (
int)eeminfo.minIsoEt();
508 jThrType[
"maxEt"] = (
int)eeminfo.maxEt();
509 jThrType[
"algoVersion"] = (
int)eeminfo.algoVersion();
513 jThrType[
"workingPoints"][wpstr] = json::array_t({});
514 for(
auto & iso : eeminfo.isolation(
wp)) {
517 stream << std::fixed << std::setprecision(3) << iso.value().rCore_d();
518 jWPIso[
"rCore"] = std::stod(
stream.str());
519 jWPIso[
"rCore_fw"] = iso.value().rCore_fw();
522 stream << std::fixed << std::setprecision(3) << iso.value().rHad_d();
523 jWPIso[
"rHad"] = std::stod(
stream.str());
524 jWPIso[
"rHad_fw"] = iso.value().rHad_fw();
525 jThrType[
"workingPoints"][wpstr] += jWPIso;
530 if(thrType ==
"jTAU") {
531 auto & jtauinfo =
l1menu.thrExtraInfo().jTAU();
532 jThrType[
"maxEt"] = (
int)jtauinfo.maxEt();
533 jThrType[
"ptMinToTopo1"] = (
int)jtauinfo.ptMinToTopo(
"1A");
534 jThrType[
"ptMinToTopo2"] = (
int)jtauinfo.ptMinToTopo(
"2A");
535 jThrType[
"ptMinToTopo3"] = (
int)jtauinfo.ptMinToTopo(
"3A");
536 jThrType[
"ptMinxTOB1"] = (
int)jtauinfo.ptMinxTOB(
"1A");
537 jThrType[
"ptMinxTOB2"] = (
int)jtauinfo.ptMinxTOB(
"2A");
538 jThrType[
"ptMinxTOB3"] = (
int)jtauinfo.ptMinxTOB(
"3A");
541 jThrType[
"workingPoints"][wpstr] = json::array_t({});
542 for(
auto & iso : jtauinfo.isolation(
wp)) {
545 stream << std::fixed << std::setprecision(3) << iso.value().isolation_d();
546 jWPIso[
"isolation"] = std::stod(
stream.str());
547 jWPIso[
"isolation_fw"] = iso.value().isolation_fw();
548 jThrType[
"workingPoints"][wpstr] += jWPIso;
553 if(thrType ==
"cTAU") {
554 auto & eeminfo =
l1menu.thrExtraInfo().cTAU();
557 jThrType[
"workingPoints"][wpstr] = json::array_t({});
558 for(
auto & iso : eeminfo.isolation(
wp)) {
561 stream << std::fixed << std::setprecision(3) << iso.value().isolation_d();
562 jWPIso[
"isolation"] = std::stod(
stream.str());
563 jWPIso[
"isolation_fw"] = iso.value().isolation_fw();
565 stream << std::fixed << std::setprecision(3) << iso.value().isolation_jTAUCoreScale_d();
566 jWPIso[
"isolation_jTAUCoreScale"] = std::stod(
stream.str());
567 jWPIso[
"isolation_jTAUCoreScale_fw"] = iso.value().isolation_jTAUCoreScale_fw();
569 stream << std::fixed << std::setprecision(3) << iso.value().eTAU_rCoreMin_WP_d();
570 jWPIso[
"eTAU_rCoreMin"] = std::stod(
stream.str());
571 jWPIso[
"eTAU_rCoreMin_WP_fw"] = iso.value().eTAU_rCoreMin_WP_fw();
573 stream << std::fixed << std::setprecision(3) << iso.value().eTAU_rHadMin_WP_d();
574 jWPIso[
"eTAU_rHadMin"] = std::stod(
stream.str());
575 jWPIso[
"eTAU_rHadMin_WP_fw"] = iso.value().eTAU_rHadMin_WP_fw();
576 jThrType[
"workingPoints"][wpstr] += jWPIso;
581 if(thrType ==
"jJ") {
582 auto & jjinfo =
l1menu.thrExtraInfo().jJ();
583 jThrType[
"ptMinToTopo1"] = (
int)jjinfo.ptMinToTopo(
"1A");
584 jThrType[
"ptMinToTopo2"] = (
int)jjinfo.ptMinToTopo(
"2A");
585 jThrType[
"ptMinToTopo3"] = (
int)jjinfo.ptMinToTopo(
"3A");
586 jThrType[
"ptMinxTOB1"] = (
int)jjinfo.ptMinxTOB(
"1A");
587 jThrType[
"ptMinxTOB2"] = (
int)jjinfo.ptMinxTOB(
"2A");
588 jThrType[
"ptMinxTOB3"] = (
int)jjinfo.ptMinxTOB(
"3A");
591 if(thrType ==
"jLJ") {
592 auto & jljinfo =
l1menu.thrExtraInfo().jLJ();
593 jThrType[
"ptMinToTopo1"] = (
int)jljinfo.ptMinToTopo(
"1A");
594 jThrType[
"ptMinToTopo2"] = (
int)jljinfo.ptMinToTopo(
"2A");
595 jThrType[
"ptMinToTopo3"] = (
int)jljinfo.ptMinToTopo(
"3A");
596 jThrType[
"ptMinxTOB1"] = (
int)jljinfo.ptMinxTOB(
"1A");
597 jThrType[
"ptMinxTOB2"] = (
int)jljinfo.ptMinxTOB(
"2A");
598 jThrType[
"ptMinxTOB3"] = (
int)jljinfo.ptMinxTOB(
"3A");
601 if(thrType ==
"gJ") {
602 auto & gjinfo =
l1menu.thrExtraInfo().gJ();
603 jThrType[
"ptMinToTopo1"] = (
int)gjinfo.ptMinToTopo(1);
604 jThrType[
"ptMinToTopo2"] = (
int)gjinfo.ptMinToTopo(2);
607 if(thrType ==
"gLJ") {
608 auto & gljinfo =
l1menu.thrExtraInfo().gLJ();
609 jThrType[
"ptMinToTopo1"] = (
int)gljinfo.ptMinToTopo(1);
610 jThrType[
"ptMinToTopo2"] = (
int)gljinfo.ptMinToTopo(2);
611 jThrType[
"seedThrA"] = (
int)gljinfo.seedThr(
'A');
612 jThrType[
"seedThrB"] = (
int)gljinfo.seedThr(
'B');
613 jThrType[
"seedThrC"] = (
int)gljinfo.seedThr(
'C');
615 stream << std::fixed << std::setprecision(3) << gljinfo.rhoTowerMin(
'A');
616 jThrType[
"rhoTowerMinA"] = std::stod(
stream.str());
619 stream << std::fixed << std::setprecision(3) << gljinfo.rhoTowerMin(
'B');
620 jThrType[
"rhoTowerMinB"] = std::stod(
stream.str());
623 stream << std::fixed << std::setprecision(3) << gljinfo.rhoTowerMin(
'C');
624 jThrType[
"rhoTowerMinC"] = std::stod(
stream.str());
627 stream << std::fixed << std::setprecision(3) << gljinfo.rhoTowerMax(
'A');
628 jThrType[
"rhoTowerMaxA"] = std::stod(
stream.str());
631 stream << std::fixed << std::setprecision(3) << gljinfo.rhoTowerMax(
'B');
632 jThrType[
"rhoTowerMaxB"] = std::stod(
stream.str());
635 stream << std::fixed << std::setprecision(3) << gljinfo.rhoTowerMax(
'C');
636 jThrType[
"rhoTowerMaxC"] = std::stod(
stream.str());
639 if(thrType ==
"jXE") {
643 if(thrType ==
"jTE") {
644 auto & ei =
l1menu.thrExtraInfo().jTE();
645 jThrType[
"etaBoundary1"] = ei.etaBoundary(
"1A");
646 jThrType[
"etaBoundary1_fw"] = ei.etaBoundary_fw(
"1A");
647 jThrType[
"etaBoundary2"] = ei.etaBoundary(
"2A");
648 jThrType[
"etaBoundary2_fw"] = ei.etaBoundary_fw(
"2A");
649 jThrType[
"etaBoundary3"] = ei.etaBoundary(
"3A");
650 jThrType[
"etaBoundary3_fw"] = ei.etaBoundary_fw(
"3A");
653 if(thrType ==
"gXE") {
654 auto & ei =
l1menu.thrExtraInfo().gXE();
655 jThrType[
"seedThrA"] = (
int)ei.seedThr(
'A');
656 jThrType[
"seedThrB"] = (
int)ei.seedThr(
'B');
657 jThrType[
"seedThrC"] = (
int)ei.seedThr(
'C');
658 jThrType[
"XERHO_sigmaPosA"] = ei.XERHO_param(
'A',
true);
659 jThrType[
"XERHO_sigmaPosB"] = ei.XERHO_param(
'B',
true);
660 jThrType[
"XERHO_sigmaPosC"] = ei.XERHO_param(
'C',
true);
661 jThrType[
"XERHO_sigmaNegA"] = ei.XERHO_param(
'A',
false);
662 jThrType[
"XERHO_sigmaNegB"] = ei.XERHO_param(
'B',
false);
663 jThrType[
"XERHO_sigmaNegC"] = ei.XERHO_param(
'C',
false);
664 jThrType[
"XEJWOJ_a_A"] = ei.JWOJ_param(
'A',
'a');
665 jThrType[
"XEJWOJ_a_B"] = ei.JWOJ_param(
'B',
'a');
666 jThrType[
"XEJWOJ_a_C"] = ei.JWOJ_param(
'C',
'a');
667 jThrType[
"XEJWOJ_b_A"] = ei.JWOJ_param(
'A',
'b');
668 jThrType[
"XEJWOJ_b_B"] = ei.JWOJ_param(
'B',
'b');
669 jThrType[
"XEJWOJ_b_C"] = ei.JWOJ_param(
'C',
'b');
670 jThrType[
"XEJWOJ_c_A"] = ei.JWOJ_param(
'A',
'c');
671 jThrType[
"XEJWOJ_c_B"] = ei.JWOJ_param(
'B',
'c');
672 jThrType[
"XEJWOJ_c_C"] = ei.JWOJ_param(
'C',
'c');
675 if(thrType ==
"gTE") {
679 std::vector<std::string> legacyCalo = {
"EM",
"JET",
"TAU",
"XE",
"TE",
"XS",
"ZB",
"JB",
"JF",
"JE",
"R2TOPO"};
680 if( std::any_of(
begin(legacyCalo),
end(legacyCalo), [&thrType](
const std::string &
c) {
return c==thrType; }) ) {
681 thresholds[
"legacyCalo"][thrType] = std::move(jThrType);
683 thresholds[thrType] = std::move(jThrType);
687 json boards = json::object_t{};
688 for(
auto & bname :
l1menu.boardNames() ) {
689 auto & bdef =
l1menu.board(bname);
690 boards[bname] =
json{ {
"connectors", bdef.connectorNames()}, {
"type", bdef.type()} };
692 boards[bname][
"legacy"] =
true;
695 json connectors = json::object_t{};
696 for(
auto & cname :
l1menu.connectorNames() ) {
698 auto & cdef =
l1menu.connector(cname);
699 jConn[
"type"] = cdef.type();
701 jConn[
"legacy"] =
true;
702 jConn[
"triggerlines"] = json::array_t();
703 if(cdef.maxClock() == 2){
704 if(cdef.maxFpga() == 2){
706 for(
size_t fpga = 0; fpga<cdef.maxFpga(); ++fpga) {
707 for(
size_t clock = 0; clock<cdef.maxClock(); ++clock) {
708 for(
auto &
tl : cdef.triggerLines(fpga, clock)) {
709 jConn[
"triggerlines"] +=
json({ {
"name",
tl.name()}, {
"nbits",
tl.nbits()}, {
"startbit",
tl.startbit()}, {
"flatindex",
tl.flatindex()}, {
"fpga",
tl.fpga()}, {
"clock",
tl.clock()}, });
715 for(
size_t fpga = 0; fpga<cdef.maxFpga(); ++fpga) {
716 for(
size_t clock = 0; clock<cdef.maxClock(); ++clock) {
717 for(
auto &
tl : cdef.triggerLines(fpga, clock)) {
718 jConn[
"triggerlines"] +=
json({ {
"name",
tl.name()}, {
"nbits",
tl.nbits()}, {
"startbit",
tl.startbit()}, {
"flatindex",
tl.flatindex()}, {
"clock",
tl.clock()}, });
724 for(
auto &
tl : cdef.triggerLines()) {
725 jConn[
"triggerlines"] +=
json({ {
"name",
tl.name()}, {
"nbits",
tl.nbits()}, {
"startbit",
tl.startbit()}, {
"flatindex",
tl.flatindex()} });
728 connectors[cname] = std::move(jConn);
733 for(
size_t slot=7; slot<=9; ++slot) {
735 ctp[
"inputs"][
"ctpin"][sName] =
json({});
740 ctp[
"inputs"][
"electrical"] = json::object_t{};
746 ctp[
"inputs"][
"optical"] = json::object_t{};
752 json ctpmon = json::object_t{};
753 for(
auto &
mon :
l1menu.ctp().ctpMon()) {
754 ctpmon[
mon.first] =
json({{
"multiplicity",
mon.second.first},{
"thr",
mon.second.second}});
756 json ctpin = json::object_t{};
757 for(
auto &
mon :
l1menu.ctp().ctpinMon()) {
758 ctpin[
mon.first] =
json({{
"multiplicity",
mon.second.first},{
"thr",
mon.second.second}});
760 ctp[
"monitoring"] =
json({{
"ctpmon", ctpmon}, {
"ctpin", ctpin}});
763 json jtopo = json::object_t{};
765 std::map<L1TopoAlgorithm::AlgorithmType,std::string> algTypeNames = {
770 auto topoCategories =
l1menu.isRun2() ? std::vector<std::string> {
"R2TOPO"} : std::vector<std::string> {
"TOPO",
"MUTOPO",
"MULTTOPO",
"R2TOPO"};
771 for(
const std::string& topoCat : topoCategories ) {
773 json jalg = json::object_t({});
775 jalg[
"klass"] =
alg.klass();
778 if(
alg.inputs().size()>0) {
779 jalg[
"input"] =
alg.inputs()[0];
781 jalg[
"input"] =
nullptr;
784 jalg[
"input"] =
alg.inputs()[0];
786 jalg[
"input"] =
alg.inputs();
790 jalg[
"output"] =
alg.outputs();
792 jalg[
"output"] =
alg.outputs()[0];
795 if(topoCat ==
"MULTTOPO") {
796 jalg[
"nbits"] =
alg.getAttribute<
unsigned int>(
"nbits");
797 jalg[
"threshold"] =
alg.getAttribute(
"threshold");
798 if(
alg.klass()==
"EnergyThreshold"){
799 for(
const L1TopoAlgorithm::VariableParameter & vpar :
alg.parameters()) {
804 const auto &
ds =
alg.generics();
805 for(
const auto & gpname :
ds.getKeys()) {
806 auto gp =
ds.getObject(gpname);
808 if(gp.hasAttribute(
"position")) {
809 jalg[
"fixedParameters"][
"generics"][gpname][
"position"] = gp.getAttribute<
unsigned int>(
"position");
811 std::string pval =
alg.genericParameter(gpname);
813 int pvali = std::stoi(pval);
814 jalg[
"fixedParameters"][
"generics"][gpname][
"value"] = pvali;
815 }
catch(std::invalid_argument &) {
816 jalg[
"fixedParameters"][
"generics"][gpname][
"value"] = pval;
822 if(topoCat !=
"MULTTOPO") {
823 jalg[
"variableParameters"] = json::array_t({});
824 for(
const L1TopoAlgorithm::VariableParameter & vpar :
alg.parameters()) {
826 jVPar[
"name"] = vpar.name();
827 jVPar[
"value"] = vpar.value();
828 if(
auto sel = vpar.selection_optional()) { jVPar[
"selection"] = *
sel; }
829 jalg[
"variableParameters"] += jVPar;
832 jtopo[topoCat][algTypeNames[
alg.type()]][
algName] = std::move(jalg);
837 json j = json::object_t{};
838 j[
"filetype"] =
"l1menu";
840 j[
"name"] =
l1menu.name();
841 j[
"items"] = std::move(
items);
842 j[
"thresholds"] = std::move(thresholds);
843 j[
"topoAlgorithms"] = std::move(jtopo);
844 j[
"boards"] = std::move(boards);
845 j[
"connectors"] = std::move(connectors);
846 j[
"ctp"] = std::move(
ctp);
849 outfile << std::setw(4) << j << std::endl;