28 , fuNbPads(uNbPadsX * uNbPadsY)
31 , fvbGridx(fuNbPads, false)
32 , fvbGridy(fuNbPads, false)
33 , fvbLogx(fuNbPads, false)
34 , fvbLogy(fuNbPads, false)
35 , fvbLogz(fuNbPads, false)
36 , fvvsObjName(fuNbPads)
37 , fvvsOptions(fuNbPads) {}
46 for (uint32_t uObj = 0; uObj <
fvvsObjName.size(); ++uObj) {
62 <<
"CanvasConfig::GetGridx => Pad index out of bounds, returning false! "
63 << uPadIdx <<
" VS " <<
fuNbPads << std::endl;
74 <<
"CanvasConfig::GetGridy => Pad index out of bounds, returning false! "
75 << uPadIdx <<
" VS " <<
fuNbPads << std::endl;
86 <<
"CanvasConfig::GetLogx => Pad index out of bounds, returning false! "
87 << uPadIdx <<
" VS " <<
fuNbPads << std::endl;
98 <<
"CanvasConfig::GetLogy => Pad index out of bounds, returning false! "
99 << uPadIdx <<
" VS " <<
fuNbPads << std::endl;
110 <<
"CanvasConfig::GetLogz => Pad index out of bounds, returning false! "
111 << uPadIdx <<
" VS " <<
fuNbPads << std::endl;
122 <<
"CanvasConfig::GetLogz => Pad index out of bounds, returning 0! "
123 << uPadIdx <<
" VS " <<
fuNbPads << std::endl;
130 std::cerr <<
"CanvasConfig::GetObjName => Pad index out of bounds, "
131 "returning nullptr! "
132 << uPadIdx <<
" VS " <<
fuNbPads << std::endl;
133 return std::string(
"nullptr");
141 std::cerr <<
"CanvasConfig::GetObjName => Object index out of bounds, "
142 "returning nullptr! "
143 <<
"Pad " << uPadIdx <<
" " << uObjIdx <<
" VS "
145 return std::string(
"nullptr");
151 std::cerr <<
"CanvasConfig::GetObjName => Pad index out of bounds, "
152 "returning nullptr! "
153 << uPadIdx <<
" VS " <<
fuNbPads << std::endl;
154 return std::string(
"nullptr");
162 std::cerr <<
"CanvasConfig::GetObjName => Object index out of bounds, "
163 "returning nullptr! "
164 <<
"Pad " << uPadIdx <<
" " << uObjIdx <<
" VS "
166 return std::string(
"nullptr");
175 std::cout <<
"CanvasConfig::SetNbPadsX => Warning: Number of pads "
176 "changed, stored configuration cleared!"
192 std::cout <<
"CanvasConfig::SetNbPadsY => Warning: Number of pads "
193 "changed, stored configuration cleared!"
212 std::vector<std::string> vsObjName,
213 std::vector<std::string> vsOptions) {
225 std::cerr <<
"CanvasConfig::SetConfig => Pad index out of bounds! "
226 << uPadIdx <<
" VS " <<
fuNbPads << std::endl;
240 for (uint32_t uObj = 0; uObj <
fvvsObjName.size(); ++uObj) {
258 void GetNbPadsXY(TPad* pPad, uint32_t& uNbPadsX, uint32_t& uNbPadsY) {
259 uint32_t uNbPads = 1;
271 while (pPad->GetPad(uNbPads)) {
276 if (dPrevX < gPad->GetXlowNDC()) {
278 dPrevX = gPad->GetXlowNDC();
282 if (dPrevY > gPad->GetYlowNDC()) {
284 dPrevY = gPad->GetYlowNDC();
297 if (
nullptr == pCanv)
return std::string(
"");
300 std::string sConfig = pCanv->GetName();
304 sConfig += pCanv->GetTitle();
308 std::string sPadsConfig =
"";
309 uint32_t uNbPads = 1;
310 uint32_t uNbPadsX = 0;
311 uint32_t uNbPadsY = 0;
321 while (pCanv->GetPad(uNbPads)) {
326 if (dPrevX < gPad->GetXlowNDC()) {
328 dPrevX = gPad->GetXlowNDC();
332 if (dPrevY > gPad->GetYlowNDC()) {
334 dPrevY = gPad->GetYlowNDC();
339 sPadsConfig += Form(
"%d,%d,%d,%d,%d",
346 TObjLink* lnkHist = gPad->GetListOfPrimitives()->FirstLink();
349 if (!lnkHist) sPadsConfig +=
",(nullptr,nullptr)";
352 if (
nullptr !=
dynamic_cast<TH1*
>(lnkHist->GetObject()))
354 ",(%s,%s)", lnkHist->GetObject()->GetName(), lnkHist->GetOption());
355 lnkHist = lnkHist->Next();
365 sConfig += Form(
"%u;%u;", uNbPadsX, uNbPadsY);
366 sConfig += sPadsConfig;
375 std::string sName =
"";
376 std::string sTitle =
"";
377 uint32_t uNbPads = 0;
378 uint32_t uNbPadsX = 0;
379 uint32_t uNbPadsY = 0;
385 std::vector<std::string> vsObjName;
386 std::vector<std::string> vsOptions;
392 charPosDel = sFullConfig.find(
';');
393 sName = sFullConfig.substr(0, charPosDel);
395 std::string sNext = sFullConfig.substr(charPosDel);
398 charPosDel = sNext.find(
';');
399 sTitle = sNext.substr(0, charPosDel);
401 sNext = sNext.substr(charPosDel);
404 uNbPadsX = std::stoul(sNext, &charPosDel);
406 sNext = sNext.substr(charPosDel);
409 uNbPadsY = std::stoul(sNext, &charPosDel);
411 sNext = sNext.substr(charPosDel);
414 uNbPads = uNbPadsX * uNbPadsY;
420 for (UInt_t uPadIdx = 0; uPadIdx < uNbPads; ++uPadIdx) {
421 if (0 == sNext.size()) {
423 <<
"ExtractCanvasConfigFromString => Empty configuration string while "
424 << uPadIdx <<
" over " << uNbPads <<
" pads remain! "
425 <<
"last ones will have default config!" << std::endl;
430 bGridx = std::stoul(sNext, &charPosDel);
432 sNext = sNext.substr(charPosDel);
435 bGridy = std::stoul(sNext, &charPosDel);
437 sNext = sNext.substr(charPosDel);
440 bLogx = std::stoul(sNext, &charPosDel);
442 sNext = sNext.substr(charPosDel);
445 bLogy = std::stoul(sNext, &charPosDel);
447 sNext = sNext.substr(charPosDel);
450 bLogz = std::stoul(sNext, &charPosDel);
452 sNext = sNext.substr(charPosDel);
455 charPosDel = sNext.find(
';');
456 std::string sObjs = sNext.substr(0, charPosDel);
459 size_t charPosOpBrkt = sObjs.find(
'(');
460 while (charPosOpBrkt != std::string::npos) {
462 sObjs = sObjs.substr(charPosOpBrkt);
465 charPosOpBrkt = sObjs.find(
'(');
466 size_t charPosComma = sObjs.find(
',');
467 size_t charPosClBrkt = sObjs.find(
')');
474 std::string sObjName =
475 sObjs.substr(charPosOpBrkt, charPosComma - charPosOpBrkt - 1);
476 std::string sObjOpt =
477 sObjs.substr(charPosComma, charPosClBrkt - charPosComma - 1);
479 vsObjName.push_back(sObjName);
480 vsOptions.push_back(sObjOpt);
483 sObjs = sObjs.substr(charPosClBrkt);
484 charPosOpBrkt = sObjs.find(
'(');
488 charPosDel = sNext.find(
';');
490 sNext = sNext.substr(charPosDel);
494 uPadIdx, bGridx, bGridy, bLogx, bLogy, bLogz, vsObjName, vsOptions);