15#include <fmt/format.h>
19#include "TMultiGraph.h"
20#include "TGraphErrors.h"
26#include "TProfile2D.h"
32#include "TPaletteAxis.h"
51#include <boost/geometry.hpp>
52#include <boost/geometry/geometries/point_xy.hpp>
53#include <boost/geometry/geometries/polygon.hpp>
59std::array<int, 6> painter::colors = {EColor::kBlack, EColor::kRed + 1, EColor::kOrange + 2, EColor::kGreen + 2, EColor::kBlue + 1, EColor::kMagenta + 1};
60std::array<int, 10> painter::markers = {20, 21, 33, 34, 47, 24, 25, 27, 28, 46};
62std::vector<painter::PadCoordinates> painter::getPadCoordinatesSector()
64 std::vector<painter::PadCoordinates> padCoords;
68 for (
const auto& padReg : regInf) {
69 const auto npr = padReg.getNumberOfPadRows();
70 const auto ro = padReg.getRowOffset();
71 const auto xm = padReg.getXhelper();
72 const auto ph = padReg.getPadHeight();
73 const auto pw = padReg.getPadWidth();
74 const auto yro = padReg.getRadiusFirstRow();
75 const auto ks = ph / pw * std::tan(1.74532925199432948e-01);
77 for (
int irow = 0; irow < npr; ++irow) {
78 const auto npads = std::floor(ks * (irow + ro) + xm);
79 for (
int ipad = -npads; ipad < npads; ++ipad) {
80 const auto xPadBottomRight = yro + ph * irow;
81 const auto xPadTopRight = yro + ph * (irow + 1);
82 const auto ri = xPadBottomRight;
83 const auto yPadBottomRight = pw * ipad * xPadBottomRight / (ri + ph / 2);
84 const auto yPadTopRight = pw * ipad * xPadTopRight / (ri + ph / 2);
85 const auto yPadBottomLeft = pw * (ipad + 1) * xPadBottomRight / (ri + ph / 2);
86 const auto yPadTopLeft = pw * (ipad + 1) * xPadTopRight / (ri + ph / 2);
87 auto& padCoord = padCoords.emplace_back();
88 padCoord.xVals = {xPadBottomRight, xPadTopRight, xPadTopRight, xPadBottomRight};
89 padCoord.yVals = {yPadBottomRight, yPadTopRight, yPadTopLeft, yPadBottomLeft};
99 std::vector<painter::PadCoordinates> padCoords;
102 std::vector<GEMstack> stacks;
105 stacks.emplace_back(
CRU(cru).gemStack());
109 auto& padCoord = padCoords.emplace_back();
110 padCoord.xVals.resize(0);
111 padCoord.yVals.resize(0);
114 const auto first = std::find(stacks.cbegin(), stacks.cend(), currentStack);
115 const auto last = std::find(stacks.crbegin(), stacks.crend(), currentStack);
116 const int firstRegion = std::distance(stacks.cbegin(),
first);
117 const int lastRegion = (stacks.size() - std::distance(stacks.crbegin(), last) - 1);
119 for (
int region = firstRegion; region <= lastRegion; ++region) {
120 const auto& padReg = regInf[region];
121 const auto npr = padReg.getNumberOfPadRows();
122 const auto ro = padReg.getRowOffset();
123 const auto xm = padReg.getXhelper();
124 const auto ph = padReg.getPadHeight();
125 const auto pw = padReg.getPadWidth();
126 const auto yro = padReg.getRadiusFirstRow();
127 const auto ks = ph / pw * std::tan(1.74532925199432948e-01);
129 for (
int irow = 0; irow < npr; ++irow) {
130 const auto npads = std::floor(ks * (irow + ro) + xm);
131 const int ipad = -npads;
132 const auto xPadBottomRight = yro + ph * irow;
133 const auto xPadTopRight = yro + ph * (irow + 1);
134 const auto ri = xPadBottomRight;
135 const auto yPadBottomRight = pw * ipad * xPadBottomRight / (ri + ph / 2);
136 const auto yPadTopRight = pw * ipad * xPadTopRight / (ri + ph / 2);
137 const auto yPadBottomLeft = pw * (ipad + 1) * xPadBottomRight / (ri + ph / 2);
138 const auto yPadTopLeft = pw * (ipad + 1) * xPadTopRight / (ri + ph / 2);
139 padCoord.xVals.emplace_back(xPadBottomRight);
140 padCoord.yVals.emplace_back(yPadBottomRight);
141 padCoord.xVals.emplace_back(xPadTopRight);
142 padCoord.yVals.emplace_back(yPadTopRight);
146 for (
int i = padCoord.xVals.size() - 1;
i >= 0;
i--) {
147 padCoord.xVals.emplace_back(padCoord.xVals[
i]);
148 padCoord.yVals.emplace_back(std::abs(padCoord.yVals[
i]));
156 std::vector<painter::PadCoordinates> padCoords;
161 const int regionStart = 2 *
stack;
162 const int regionEnd = regionStart + 2;
165 void addPad(
int pad,
int row) { pad_map[
row].emplace_back(pad); }
166 const std::vector<int>& getPads(
const int row) {
return pad_map[
row]; }
167 std::unordered_map<int, std::vector<int>> pad_map;
170 std::unordered_map<size_t, std::array<fecInf, 2>> fecs;
171 for (
int region = regionStart; region < regionEnd; ++region) {
175 const size_t fecIndex = fec.
getIndex();
176 fecs[fecIndex][region - regionStart].addPad(pad, lrow);
181 for (
auto& fec : fecs) {
182 auto& padCoord = padCoords.emplace_back();
183 padCoord.xVals.resize(0);
184 padCoord.yVals.resize(0);
185 for (
int j = 0;
j < 2; ++
j) {
186 for (
int regionTmp = regionStart; regionTmp < regionEnd; ++regionTmp) {
187 const int region = (
j == 0) ? regionTmp : (regionStart + regionEnd - regionTmp - 1);
188 const auto& padReg = regInf[region];
189 const auto npr = padReg.getNumberOfPadRows();
190 const auto ro = padReg.getRowOffset();
191 const auto xm = padReg.getXhelper();
192 const auto ph = padReg.getPadHeight();
193 const auto pw = padReg.getPadWidth();
194 const auto yro = padReg.getRadiusFirstRow();
195 const auto ks = ph / pw * std::tan(1.74532925199432948e-01);
197 for (
int irowTmp = 0; irowTmp < npr; ++irowTmp) {
198 const int irow = (
j == 0) ? irowTmp : (npr - irowTmp - 1);
199 const auto npads = std::floor(ks * (irow + ro) + xm);
200 const std::vector<int>& padsFEC = fec.second[region - regionStart].getPads(irow);
201 const int padOff = (
j == 0) ? padsFEC.front() : (padsFEC.back() + 1);
202 const int ipad = -npads + padOff;
203 const auto xPadBottomRight = yro + ph * irow;
204 const auto xPadTopRight = yro + ph * (irow + 1);
205 const auto ri = xPadBottomRight;
206 const auto yPadBottomRight = pw * ipad * xPadBottomRight / (ri + ph / 2);
207 const auto yPadTopRight = pw * ipad * xPadTopRight / (ri + ph / 2);
208 const auto yPadBottomLeft = pw * (ipad + 1) * xPadBottomRight / (ri + ph / 2);
209 const auto yPadTopLeft = pw * (ipad + 1) * xPadTopRight / (ri + ph / 2);
211 padCoord.xVals.emplace_back(xPadBottomRight);
212 padCoord.yVals.emplace_back(yPadBottomRight);
213 padCoord.xVals.emplace_back(xPadTopRight);
214 padCoord.yVals.emplace_back(yPadTopRight);
216 padCoord.yVals.emplace_back(yPadTopRight);
217 padCoord.xVals.emplace_back(xPadTopRight);
218 padCoord.yVals.emplace_back(yPadBottomRight);
219 padCoord.xVals.emplace_back(xPadBottomRight);
231 const float deadZone = 1.5;
232 const float secPhi = 20.0 * TMath::DegToRad();
233 std::vector<painter::PadCoordinates> padCoords;
236 std::vector<float> maxY2X(nPadRows);
237 auto binCenters = o2::RangeTokenizer::tokenize<float>(binningStr);
238 size_t nY2XBins = 20;
239 std::vector<float> halfBinWidth;
241 auto setUniformBinning = [&binCenters, &halfBinWidth](
int nY2XBins) {
242 binCenters.resize(nY2XBins);
243 halfBinWidth.resize(nY2XBins);
244 for (
int i = 0;
i < nY2XBins; ++
i) {
245 const auto binWidth = 2.f / nY2XBins;
246 halfBinWidth[
i] = binWidth / 2.f;
247 binCenters[
i] = -1.f + (
i + 0.5f) * binWidth;
251 if (binCenters.size() == 0) {
252 LOGP(info,
"Empty binning provided, will use default uniform y/x binning with {} bins", nY2XBins);
253 setUniformBinning(nY2XBins);
254 }
else if (binCenters.size() == 1) {
255 nY2XBins =
static_cast<int>(binCenters.at(0));
256 LOGP(info,
"Setting uniform binning for y/x with {} bins", nY2XBins);
257 setUniformBinning(nY2XBins);
259 nY2XBins = binCenters.size() - 1;
260 if (std::abs(binCenters[0] + 1.f) > 1e-6 || std::abs(binCenters[nY2XBins] - 1.f) > 1e-6) {
261 LOG(error) <<
"Provided binning for y/x not in range -1 to 1: " << binCenters[0] <<
" - " << binCenters[nY2XBins] <<
". Using default uniform binning with " << nY2XBins <<
" bins";
262 setUniformBinning(nY2XBins);
264 LOGP(info,
"Setting custom binning for y/x with {} bins", nY2XBins);
265 halfBinWidth.reserve(nY2XBins);
266 halfBinWidth.clear();
267 for (
int i = 0;
i < nY2XBins; ++
i) {
268 halfBinWidth.push_back(.5f * (binCenters[
i + 1] - binCenters[
i]));
269 binCenters[
i] = .5f * (binCenters[
i] + binCenters[
i + 1]);
271 binCenters.resize(nY2XBins);
275 for (
int irow = 0; irow < nPadRows; ++irow) {
277 maxY2X[irow] = std::tan(.5f * secPhi) - deadZone /
x;
280 const auto xPadBottom =
x - ph / 2;
281 const auto xPadTop =
x + ph / 2;
282 for (
int iy2x = 0; iy2x < nY2XBins; ++iy2x) {
283 auto& padCoord = padCoords.emplace_back();
286 yPadRight = maxY2X[irow] * (binCenters[iy2x] - halfBinWidth[iy2x]);
288 yPadRight = maxY2X[irow] * (binCenters[iy2x - 1] + halfBinWidth[iy2x - 1]);
290 const auto yPadLeft = maxY2X[irow] * (binCenters[iy2x] + halfBinWidth[iy2x]);
291 padCoord.xVals = {xPadBottom, xPadTop, xPadTop, xPadBottom};
292 padCoord.yVals = {yPadRight * xPadBottom, yPadRight * xPadTop, yPadLeft * xPadTop, yPadLeft * xPadBottom};
310 LOGP(warning,
"Wrong Type provided!");
311 return std::vector<o2::tpc::painter::PadCoordinates>();
319 int firstRegion = 0, lastRegion = 10;
323 }
else if (
roc < 72) {
332 binning.emplace_back(localX - 3);
334 for (
int iregion = firstRegion; iregion < lastRegion; ++iregion) {
338 if (std::abs(padHeight - lastPadHeight) > 1e-5) {
339 lastPadHeight = padHeight;
340 localX = regionInfo.getRadiusFirstRow();
344 for (
int irow = 0; irow < regionInfo.getNumberOfPadRows(); ++irow) {
345 localX += lastPadHeight;
349 binning.emplace_back(localX + 3);
356 const std::string_view
type = (rocNumber < 36) ?
"IROC" :
"OROC";
357 const std::string_view
side = ((rocNumber % 36) < 18) ?
"A" :
"C";
358 return fmt::format(
"{} {}{:02}",
type,
side, rocNumber % 18);
362TCanvas*
painter::draw(
const CalDet<T>& calDet,
int nbins1D,
float xMin1D,
float xMax1D, TCanvas* outputCanvas)
369 const bool draw1D = nbins1D > 0;
372 std::string title = calDet.
getName();
374 std::replace(
name.begin(),
name.end(),
' ',
'_');
375 std::replace(title.begin(), title.end(),
'_',
' ');
382 const int bufferSize = TH1::GetDefaultBufferSize();
385 auto hAside1D = draw1D ?
new TH1F(fmt::format(
"h_Aside_1D_{}",
name).
data(), fmt::format(
"{0} (A-Side);{0}", title).
data(),
386 nbins1D, xMin1D, xMax1D)
389 auto hCside1D = draw1D ?
new TH1F(fmt::format(
"h_Cside_1D_{}",
name).
data(), fmt::format(
"{0} (C-Side);{0}", title).
data(),
390 nbins1D, xMin1D, xMax1D)
393 auto hAside2D =
new TH2F(fmt::format(
"h_Aside_2D_{}",
name).
data(), fmt::format(
"{0} (A-Side);#it{{x}} (cm);#it{{y}} (cm);{0}", title).
data(),
394 330, -270, 270, 330, -270, 270);
396 auto hCside2D =
new TH2F(fmt::format(
"h_Cside_2D_{}",
name).
data(), fmt::format(
"{0} (C-Side);#it{{x}} (cm);#it{{y}} (cm);{0}", title).
data(),
397 330, -270, 270, 330, -270, 270);
401 auto hist2D = hAside2D;
402 auto hist1D = hAside1D;
409 for (
int irow = 0; irow < nrows; ++irow) {
411 for (
int ipad = 0; ipad < npads; ++ipad) {
414 const int bin = hist2D->FindBin(
pos.X(),
pos.Y());
415 if (!hist2D->GetBinContent(bin)) {
416 hist2D->SetBinContent(bin,
double(
val));
419 hist1D->Fill(
double(
val));
425 if (xMax1D > xMin1D) {
426 hAside2D->SetMinimum(xMin1D);
427 hAside2D->SetMaximum(xMax1D);
428 hCside2D->SetMinimum(xMin1D);
429 hCside2D->SetMaximum(xMax1D);
433 gStyle->SetOptStat(
"mr");
434 auto c = outputCanvas;
436 c =
new TCanvas(fmt::format(
"c_{}",
name).
data(), title.data(), 1000, draw1D ? 1000 : 500);
438 gStyle->SetStatX(1. - gPad->GetRightMargin());
439 gStyle->SetStatY(1. - gPad->GetTopMargin());
442 c->Divide(2, draw1D ? 2 : 1);
445 hAside2D->Draw(
"colz");
446 hAside2D->SetStats(0);
447 hAside2D->SetTitleOffset(1.05,
"XY");
448 hAside2D->SetTitleSize(0.05,
"XY");
453 hCside2D->Draw(
"colz");
454 hCside2D->SetStats(0);
455 hCside2D->SetTitleOffset(1.05,
"XY");
456 hCside2D->SetTitleSize(0.05,
"XY");
468 hAside1D->SetBit(TObject::kCanDelete);
469 hCside1D->SetBit(TObject::kCanDelete);
473 TH1::SetDefaultBufferSize(bufferSize);
476 hAside2D->SetBit(TObject::kCanDelete);
477 hCside2D->SetBit(TObject::kCanDelete);
487 std::string
name = hist->GetName();
489 auto c =
new TCanvas(fmt::format(
"c_{}",
name).
data(), hist->GetTitle());
494 hist->SetBit(TObject::kCanDelete);
511 for (
int irow = 0; irow < nrows; ++irow) {
513 for (
int ipad = 0; ipad < npads; ++ipad) {
516 const int bin = h2D.FindBin(
pos.X(),
pos.Y());
517 if (!h2D.GetBinContent(bin)) {
518 h2D.SetBinContent(bin,
double(
val));
536 for (
int irow = 0; irow < nrows; ++irow) {
538 for (
int ipad = 0; ipad < padsInRow; ++ipad) {
541 const int cpad = ipad - padsInRow / 2;
542 h2D.Fill(irow, cpad,
double(
val));
551 std::string title = calDet.
getName();
553 std::replace(
name.begin(),
name.end(),
' ',
'_');
554 std::replace(title.begin(), title.end(),
'_',
' ');
555 const char side_name = (
side ==
Side::A) ?
'A' :
'C';
557 auto h2D =
new TH2F(fmt::format(
"h_{}side_2D_{}", side_name,
name).
data(),
558 fmt::format(
"{} ({}-Side);x (cm);y (cm)", title, side_name).
data(),
559 300, -300, 300, 300, -300, 300);
580 std::string title = calArray.
getName();
582 std::replace(title.begin(), title.end(),
'_',
' ');
583 std::replace(
name.begin(),
name.end(),
' ',
'_');
586 title += fmt::format(
" ({})",
getROCTitle(position));
589 auto hist =
new TH2F(fmt::format(
"h_{}",
name).
data(),
590 fmt::format(
"{};pad row;pad", title).
data(),
592 npads, -npads / 2., npads / 2.);
602 return std::abs(cal.
getSum()) > T{0};
608 return cal.
getSum() > T{0};
614 for (
const auto v : cal.
getData()) {
626 std::vector<TCanvas*> vecCanvases;
628 auto nROCs = calDet.
getData().size();
632 for (
size_t iroc = 0; iroc < calDet.
getData().
size(); ++iroc) {
646 TCanvas* cSides =
nullptr;
647 TCanvas* cROCs1D =
nullptr;
648 TCanvas* cROCs2D =
nullptr;
649 const std::string_view calName = calDet.
getName();
651 if (outputCanvases) {
652 if (outputCanvases->size() < 3) {
653 LOGP(error,
"At least 3 canvases are needed to fill the output, only {} given", outputCanvases->size());
657 cSides = outputCanvases->at(0);
658 cROCs1D = outputCanvases->at(1);
659 cROCs2D = outputCanvases->at(2);
665 cROCs1D =
new TCanvas(fmt::format(
"c_ROCs_{}_1D", calName).
data(), fmt::format(
"{} values for each ROC", calName).
data(), 1400, 1000);
666 cROCs2D =
new TCanvas(fmt::format(
"c_ROCs_{}_2D", calName).
data(), fmt::format(
"{} values for each ROC", calName).
data(), 1400, 1000);
668 cSides =
draw(calDet, nbins1D, xMin1D, xMax1D, cSides);
669 cROCs1D->DivideSquare(nROCs);
670 cROCs2D->DivideSquare(nROCs);
672 vecCanvases.emplace_back(cSides);
673 vecCanvases.emplace_back(cROCs1D);
674 vecCanvases.emplace_back(cROCs2D);
678 for (
size_t iroc = 0; iroc < calDet.
getData().
size(); ++iroc) {
686 auto h1D =
new TH1F(fmt::format(
"h1_{}_{:02d}", calName, iroc).
data(), fmt::format(
"{} distribution ROC {:02d} ({});ADC value", calName, iroc,
getROCTitle(iroc)).
data(), nbins1D, xMin1D, xMax1D);
688 h1D->Fill(
double(
val));
694 if (xMax1D > xMin1D) {
695 h2D->SetMinimum(xMin1D);
696 h2D->SetMaximum(xMax1D);
698 h2D->SetUniqueID(iroc);
709 h1D->SetBit(TObject::kCanDelete);
710 h2D->SetBit(TObject::kCanDelete);
720 std::vector<TCanvas*> vecCanvases;
723 std::string title = draw.data();
724 std::string
name = title;
725 std::replace(
name.begin(),
name.end(),
' ',
'_');
726 std::replace(
name.begin(),
name.end(),
'/',
'_');
727 const std::string_view calName =
name;
731 const size_t nROCs = 72;
732 auto cROCs1D =
new TCanvas(fmt::format(
"c_ROCs_{}_1D", calName).
data(), fmt::format(
"{} values for each ROC", calName).
data(), 1400, 1000);
733 auto cROCs2D =
new TCanvas(fmt::format(
"c_ROCs_{}_2D", calName).
data(), fmt::format(
"{} values for each ROC", calName).
data(), 1400, 1000);
735 cROCs1D->DivideSquare(nROCs);
736 cROCs2D->DivideSquare(nROCs);
738 vecCanvases.emplace_back(cROCs1D);
739 vecCanvases.emplace_back(cROCs2D);
743 for (
size_t iroc = 0; iroc < nROCs; ++iroc) {
746 auto h1D =
new TH1F(fmt::format(
"h1_{}_{:02d}", calName, iroc).
data(), fmt::format(
"{} distribution ROC {:02d} ({});{}", calName, iroc, getROCTitle(iroc), draw).
data(), nbins1D, xMin1D, xMax1D);
747 tree.Draw(fmt::format(
"{} >> {}", draw, h1D->GetName()).data(), fmt::format(
"(roc == {}) && ({})", iroc, cut).data(),
"goff");
755 const std::string rocTitle = title + fmt::format(
" ({})", getROCTitle(iroc));
757 auto h2D =
new TProfile2D(fmt::format(
"h_{}_ROC{}",
name, iroc).
data(),
758 fmt::format(
"{};pad row;pad;{}", rocTitle, draw).
data(),
760 npads, -npads / 2., npads / 2.);
761 tree.Draw(fmt::format(
"{} : cpad : row >> {}", draw, h2D->GetName()).data(), fmt::format(
"(roc == {}) && ({})", iroc, cut).data(),
"profcolzgoff");
764 if (xMax1D > xMin1D) {
765 h2D->SetMinimum(xMin1D);
766 h2D->SetMaximum(xMax1D);
768 h2D->SetUniqueID(iroc);
779 h1D->SetBit(TObject::kCanDelete);
780 h2D->SetBit(TObject::kCanDelete);
791 const int bufferSize = TH1::GetDefaultBufferSize();
794 auto hAside1D =
new TH1F(fmt::format(
"h_Aside_1D_{}",
name).
data(), fmt::format(
"{0} (A-Side);{0}", title).
data(),
795 std::abs(nbins1D), xMin1D, xMax1D);
797 auto hCside1D =
new TH1F(fmt::format(
"h_Cside_1D_{}",
name).
data(), fmt::format(
"{0} (C-Side);{0}", title).
data(),
798 std::abs(nbins1D), xMin1D, xMax1D);
800 auto hAside2D =
new TProfile2D(fmt::format(
"h_Aside_2D_{}",
name).
data(), fmt::format(
"{} (A-Side);#it{{x}} (cm);#it{{y}} (cm);{}", title, draw).
data(),
801 330, -270, 270, 330, -270, 270);
803 auto hCside2D =
new TProfile2D(fmt::format(
"h_Cside_2D_{}",
name).
data(), fmt::format(
"{} (C-Side);#it{{x}} (cm);#it{{y}} (cm);{}", title, draw).
data(),
804 330, -270, 270, 330, -270, 270);
806 tree.Draw(fmt::format(
"{} >> {}", draw, hAside1D->GetName()).data(), fmt::format(
"(A_Side) && ({})", cut).data(),
"goff");
807 tree.Draw(fmt::format(
"{} >> {}", draw, hCside1D->GetName()).data(), fmt::format(
"(C_Side) && ({})", cut).data(),
"goff");
808 tree.Draw(fmt::format(
"{} : gy : gx >> {}", draw, hAside2D->GetName()).data(), fmt::format(
"(A_Side) && ({})", cut).data(),
"profcolzgoff");
809 tree.Draw(fmt::format(
"{} : gy : gx >> {}", draw, hCside2D->GetName()).data(), fmt::format(
"(C_Side) && ({})", cut).data(),
"profcolzgoff");
811 if (xMax1D > xMin1D) {
812 hAside2D->SetMinimum(xMin1D);
813 hAside2D->SetMaximum(xMax1D);
814 hCside2D->SetMinimum(xMin1D);
815 hCside2D->SetMaximum(xMax1D);
819 gStyle->SetOptStat(
"mr");
820 auto cSides =
new TCanvas(fmt::format(
"c_{}",
name).
data(), title.data(), 1000, 1000);
821 vecCanvases.emplace_back(cSides);
823 gStyle->SetStatX(1. - gPad->GetRightMargin());
824 gStyle->SetStatY(1. - gPad->GetTopMargin());
827 cSides->Divide(2, 2);
830 hAside2D->Draw(
"colz");
831 hAside2D->SetStats(0);
832 hAside2D->SetTitleOffset(1.05,
"XY");
833 hAside2D->SetTitleSize(0.05,
"XY");
834 adjustPalette(hAside2D, 0.92);
838 hCside2D->Draw(
"colz");
839 hCside2D->SetStats(0);
840 hCside2D->SetTitleOffset(1.05,
"XY");
841 hCside2D->SetTitleSize(0.05,
"XY");
842 adjustPalette(hCside2D, 0.92);
852 TH1::SetDefaultBufferSize(bufferSize);
855 hAside1D->SetBit(TObject::kCanDelete);
856 hCside1D->SetBit(TObject::kCanDelete);
857 hAside2D->SetBit(TObject::kCanDelete);
858 hCside2D->SetBit(TObject::kCanDelete);
864std::vector<TCanvas*>
painter::makeSummaryCanvases(
const std::string_view fileName,
const std::string_view calPadNames,
int nbins1D,
float xMin1D,
float xMax1D,
bool onlyFilled)
870 std::vector<TCanvas*> vecCanvases;
872 for (
const auto calPad : calPads) {
874 for (
auto c : canvases) {
875 vecCanvases.emplace_back(
c);
883TH2Poly*
painter::makeSectorHist(
const std::string_view
name,
const std::string_view title,
const float xMin,
const float xMax,
const float yMin,
const float yMax,
const Type
type, std::string binningStr)
885 auto poly =
new TH2Poly(
name.data(), title.data(), xMin, xMax, yMin,
yMax);
889 poly->AddBin(
coord.xVals.size(),
coord.xVals.data(),
coord.yVals.data());
899 auto poly =
new TH2Poly(fmt::format(
"hSide_{}", s).
data(), fmt::format(
"{}-Side;#it{{x}} (cm);#it{{y}} (cm)", s).
data(), -270., 270., -270., 270.);
902 for (
int isec = 0; isec < 18; ++isec) {
903 const float angDeg = 10.f + isec * 20;
905 coord.rotate(angDeg);
906 poly->AddBin(
coord.xVals.size(),
coord.xVals.data(),
coord.yVals.data());
920 for (
const auto& calROC : calDet.
getData()) {
921 ROC roc(calROC.getPadSubsetNumber());
927 for (
int irow = 0; irow < nrows; ++irow) {
929 for (
int ipad = 0; ipad <= padMax; ++ipad) {
942 l.SetLineColor(std::abs(sectorLineColor));
945 latSide.SetTextColor(sectorTextColor);
946 latSide.SetTextAlign(22);
947 latSide.SetTextSize(0.08);
948 if (sectorTextColor >= 0) {
949 latSide.DrawLatex(0, 0, (
side ==
Side::C) ?
"C" :
"A");
953 lat.SetTextAlign(22);
954 lat.SetTextSize(0.03);
955 lat.SetTextColor(std::abs(sectorLineColor));
958 const float rFactor = std::cos(phiWidth / 2.);
959 const float rLow = 83.65 / rFactor;
960 const float rIROCup = 133.3 / rFactor;
961 const float rOROClow = 133.5 / rFactor;
962 const float rOROC12 = 169.75 / rFactor;
963 const float rOROC23 = 207.85 / rFactor;
964 const float rOut = 247.7 / rFactor;
965 const float rText = rLow * rFactor * 3. / 4.;
967 for (Int_t isector = 0; isector < 18; ++isector) {
968 const float sinR = std::sin(phiWidth * isector);
969 const float cosR = std::cos(phiWidth * isector);
971 const float sinL = std::sin(phiWidth * ((isector + 1) % 18));
972 const float cosL = std::cos(phiWidth * ((isector + 1) % 18));
974 const float sinText = std::sin(phiWidth * (isector + 0.5));
975 const float cosText = std::cos(phiWidth * (isector + 0.5));
977 const float xR1 = rLow * cosR;
978 const float yR1 = rLow * sinR;
979 const float xR2 = rOut * cosR;
980 const float yR2 = rOut * sinR;
982 const float xL1 = rLow * cosL;
983 const float yL1 = rLow * sinL;
984 const float xL2 = rOut * cosL;
985 const float yL2 = rOut * sinL;
987 const float xOROCmup1 = rOROClow * cosR;
988 const float yOROCmup1 = rOROClow * sinR;
989 const float xOROCmup2 = rOROClow * cosL;
990 const float yOROCmup2 = rOROClow * sinL;
992 const float xIROCmup1 = rIROCup * cosR;
993 const float yIROCmup1 = rIROCup * sinR;
994 const float xIROCmup2 = rIROCup * cosL;
995 const float yIROCmup2 = rIROCup * sinL;
997 const float xO121 = rOROC12 * cosR;
998 const float yO121 = rOROC12 * sinR;
999 const float xO122 = rOROC12 * cosL;
1000 const float yO122 = rOROC12 * sinL;
1002 const float xO231 = rOROC23 * cosR;
1003 const float yO231 = rOROC23 * sinR;
1004 const float xO232 = rOROC23 * cosL;
1005 const float yO232 = rOROC23 * sinL;
1007 const float xText = rText * cosText;
1008 const float yText = rText * sinText;
1011 l.DrawLine(xR1, yR1, xR2, yR2);
1014 l.DrawLine(xR1, yR1, xL1, yL1);
1017 l.DrawLine(xIROCmup1, yIROCmup1, xIROCmup2, yIROCmup2);
1020 l.DrawLine(xOROCmup1, yOROCmup1, xOROCmup2, yOROCmup2);
1023 l.DrawLine(xO121, yO121, xO122, yO122);
1026 l.DrawLine(xO231, yO231, xO232, yO232);
1029 l.DrawLine(xR2, yR2, xL2, yL2);
1032 if (sectorLineColor >= 0) {
1033 lat.DrawLatex(xText, yText, fmt::format(
"{}", isector).
data());
1043 lat.SetTextAlign(12);
1044 lat.SetTextSize(0.002f);
1045 lat.SetTextColor(padTextColor);
1046 gStyle->SetLineScalePS(lineScalePS);
1053 const auto coordinate =
coords[padNum];
1054 const float yPos = (coordinate.yVals[0] + coordinate.yVals[2]) / 2;
1055 const float xPos = (coordinate.xVals[0] + coordinate.xVals[2]) / 2;
1056 lat.DrawLatex(xPos, yPos, Form(
"%i", ipad));
1067 lat.SetTextColor(rowTextColor);
1068 lat.SetTextSize(0.02f);
1069 lat.SetTextAlign(12);
1072 line.SetLineColor(regionLineColor);
1080 line.DrawLine(rad, -43, rad, 43);
1085 lat.DrawLatex((radii[ireg] + radii[ireg + 1]) / 2, 45, Form(
"%i", ireg));
1088 lat.SetTextSize(0.002f);
1089 lat.SetTextAlign(13);
1091 const std::array<float, Mapper::NREGIONS> posRow{16.2f, 18.2f, 20.2f, 22.3f, 26.f, 29.f, 33.f, 35.f, 39.f, 42.5f};
1095 const float nRows = reg.getNumberOfPadRows();
1097 const float padHeight = reg.getPadHeight();
1098 const float radiusFirstRow = reg.getRadiusFirstRow();
1099 const float xPos = radiusFirstRow + (
i + 0.5f) * padHeight;
1100 const float yPos = posRow[ireg];
1102 lat.DrawLatex(xPos, yPos, Form(
"%i",
i));
1103 lat.DrawLatex(xPos, -yPos, Form(
"%i",
i));
1105 const float offs = 0.5f;
1106 lat.DrawLatex(xPos, yPos + offs, Form(
"%i", globalRow));
1107 lat.DrawLatex(xPos, -yPos - offs, Form(
"%i", globalRow++));
1112template <
typename DataT>
1115 const int nZBins = calDet.size();
1116 TH3F histConvSum(
"hisCalDet",
"hisCalDet", nPhiBins, 0,
o2::constants::math::TwoPI, nRBins, rMin, rMax, 2 * nZBins, -
zMax,
zMax);
1117 TH3F histConvWeight(
"histConvWeight",
"histConvWeight", nPhiBins, 0,
o2::constants::math::TwoPI, nRBins, rMin, rMax, 2 * nZBins, -
zMax,
zMax);
1119 typedef boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<float>> polygon;
1123 std::vector<polygon> geoBin;
1124 const int nGeoBins = nPhiBins * nRBins;
1125 geoBin.reserve(nGeoBins);
1126 for (
int iphi = 1; iphi <= nPhiBins; ++iphi) {
1127 const double phiLow = histConvSum.GetXaxis()->GetBinLowEdge(iphi);
1128 const double phiUp = histConvSum.GetXaxis()->GetBinUpEdge(iphi);
1129 for (
int ir = 1;
ir <= nRBins; ++
ir) {
1130 const double rLow = histConvSum.GetYaxis()->GetBinLowEdge(
ir);
1131 const double rUp = histConvSum.GetYaxis()->GetBinUpEdge(
ir);
1132 const double xPos1 = rLow * std::cos(phiLow);
1133 const double yPos1 = rLow * std::sin(phiLow);
1134 const double xPos2 = rLow * std::cos(phiUp);
1135 const double yPos2 = rLow * std::sin(phiUp);
1136 const double xPos4 = rUp * std::cos(phiLow);
1137 const double yPos4 = rUp * std::sin(phiLow);
1138 const double xPos3 = rUp * std::cos(phiUp);
1139 const double yPos3 = rUp * std::sin(phiUp);
1141 boost::geometry::read_wkt(Form(
"POLYGON((%.4f %.4f, %.4f %.4f, %.4f %.4f, %.4f %.4f, %.4f %.4f))", xPos1, yPos1, xPos2, yPos2, xPos3, yPos3, xPos4, yPos4, xPos1, yPos1), geoBin.emplace_back());
1142 boost::geometry::correct(geoBin.back());
1149 for (
unsigned int iRow = 0; iRow < rowsRegion; ++iRow) {
1151 for (
unsigned int iPad = 0; iPad <= padsInRow; ++iPad) {
1154 const float angDeg = 10.f + sector * 20;
1155 auto coordinate =
coords[padNum];
1156 coordinate.rotate(angDeg);
1158 const std::array<double, 2> radiusPadCoord{
1159 std::sqrt(coordinate.xVals[0] * coordinate.xVals[0] + coordinate.yVals[0] * coordinate.yVals[0]),
1160 std::sqrt(coordinate.xVals[2] * coordinate.xVals[2] + coordinate.yVals[2] * coordinate.yVals[2]),
1163 std::array<float, 4> phiPadCoord{
1164 static_cast<float>(std::atan2(coordinate.yVals[0], coordinate.xVals[0])),
1165 static_cast<float>(std::atan2(coordinate.yVals[1], coordinate.xVals[1])),
1166 static_cast<float>(std::atan2(coordinate.yVals[2], coordinate.xVals[2])),
1167 static_cast<float>(std::atan2(coordinate.yVals[3], coordinate.xVals[3]))};
1169 for (
auto& phi : phiPadCoord) {
1174 const int binRBottomStart = std::clamp(histConvSum.GetYaxis()->FindBin(radiusPadCoord[0]) - 1, 1, nRBins);
1175 const int binRTopEnd = std::clamp(histConvSum.GetYaxis()->FindBin(radiusPadCoord[1]) + 1, 1, nRBins);
1176 int binPhiStart = std::min(histConvSum.GetXaxis()->FindBin(phiPadCoord[0]), histConvSum.GetXaxis()->FindBin(phiPadCoord[1]));
1177 int binPhiEnd = std::max(histConvSum.GetXaxis()->FindBin(phiPadCoord[2]), histConvSum.GetXaxis()->FindBin(phiPadCoord[3]));
1181 boost::geometry::read_wkt(Form(
"POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))", coordinate.xVals[0], coordinate.yVals[0], coordinate.xVals[1], coordinate.yVals[1], coordinate.xVals[2], coordinate.yVals[2], coordinate.xVals[3], coordinate.yVals[3], coordinate.xVals[0], coordinate.yVals[0]), geoPad);
1182 boost::geometry::correct(geoPad);
1184 for (
int binR = binRBottomStart; binR <= binRTopEnd; ++binR) {
1185 for (
int binPhi = binPhiStart; binPhi <= binPhiEnd; ++binPhi) {
1186 const int ind = (binPhi - 1) * nRBins + binR - 1;
1188 std::deque<polygon>
output;
1189 boost::geometry::intersection(geoPad, geoBin[ind],
output);
1193 const double area = boost::geometry::area(
output.front());
1196 for (
int iSide = 0; iSide < 2; ++iSide) {
1199 const CRU cru(iCRU);
1201 for (
int iz = 0;
iz < nZBins; ++
iz) {
1204 const auto globBin = histConvSum.GetBin(binPhi, binR, zBin);
1205 histConvSum.AddBinContent(globBin,
val * fac);
1207 histConvWeight.AddBinContent(globBin, fac);
1219 histConvSum.Divide(&histConvWeight);
1227 std::vector<TCanvas*> vecCanvases;
1230 TCanvas* cLtrCoverage =
nullptr;
1231 TCanvas* cLtrdEdx =
nullptr;
1232 TCanvas* cCalibValues =
nullptr;
1234 const auto size = 1400;
1235 if (outputCanvases) {
1236 if (outputCanvases->size() < 3) {
1237 LOGP(error,
"At least 3 canvases are needed to fill the output, only {} given", outputCanvases->size());
1241 cLtrCoverage = outputCanvases->at(0);
1242 cCalibValues = outputCanvases->at(1);
1243 cLtrdEdx = outputCanvases->at(2);
1244 cLtrCoverage->Clear();
1245 cCalibValues->Clear();
1247 cLtrCoverage->SetCanvasSize(
size, 2. *
size * 7 / 24 * 1.1);
1248 cCalibValues->SetCanvasSize(
size, 2. *
size * 7 / 24 * 1.1);
1249 cLtrdEdx->SetCanvasSize(
size, 2. *
size * 7 / 24 * 1.1);
1251 cLtrCoverage =
new TCanvas(
"cLtrCoverage",
"laser track coverage",
size, 2. *
size * 7 / 24 * 1.1);
1252 cLtrdEdx =
new TCanvas(
"cLtrdEdx",
"laser track average dEdx",
size, 2. *
size * 7 / 24 * 1.1);
1253 cCalibValues =
new TCanvas(
"cCalibValues",
"calibration values",
size, 2. *
size * 7 / 24 * 1.1);
1258 auto getLtrStatHist = [](
Side side, std::string_view
type =
"Coverage") -> TH2F* {
1260 auto hltr =
new TH2F(fmt::format(
"hltr{}_{}",
type, sideName).
data(),
";Bundle ID;Track in bundle", 24, 0, 24, 7, 0, 7);
1261 hltr->SetBit(TObject::kCanDelete);
1263 hltr->GetXaxis()->SetNdivisions(406,
false);
1264 hltr->GetYaxis()->SetNdivisions(107,
false);
1265 hltr->SetLabelSize(0.05,
"XY");
1266 hltr->SetTitleSize(0.06,
"X");
1267 hltr->SetTitleSize(0.07,
"Y");
1268 hltr->SetTitleOffset(0.8,
"X");
1269 hltr->SetTitleOffset(0.4,
"Y");
1274 const std::array<const std::string_view, 6> namesA{
"A01/02",
"A04/05",
"A07/08",
"A10/11",
"A13/14",
"A16/17"};
1275 const std::array<const std::string_view, 6> namesC{
"C00/01",
"C03/04",
"C06/07",
"C09/10",
"C12/13",
"C15/16"};
1276 const auto& names = (
side ==
Side::A) ? namesA : namesC;
1279 lat.SetTextAlign(22);
1280 lat.SetTextSize(0.06);
1283 for (
int i = 0;
i < 6; ++
i) {
1284 lat.DrawLatex(2.f +
i * 4.f, 7.5, names[
i].
data());
1286 line.DrawLine(4.f +
i * 4.f, 0, 4.f +
i * 4.f, 8);
1291 auto hltrCoverageA = getLtrStatHist(
Side::A);
1292 auto hltrCoverageC = getLtrStatHist(
Side::C);
1294 auto hltrdEdxA = getLtrStatHist(
Side::A,
"dEdx");
1295 auto hltrdEdxC = getLtrStatHist(
Side::C,
"dEdx");
1297 float dEdxSumA = 0.f;
1298 float dEdxSumC = 0.f;
1302 for (
size_t itrack = 0; itrack < ltr.
matchedLtrIDs.size(); ++itrack) {
1304 const auto dEdx = ltr.
dEdx.at(itrack);
1309 auto hltrCoverage = (sideA) ? hltrCoverageA : hltrCoverageC;
1310 auto hltrdEdx = (sideA) ? hltrdEdxA : hltrdEdxC;
1312 hltrCoverage->Fill(bundleID, trackID);
1313 hltrdEdx->Fill(bundleID, trackID, dEdx);
1326 dEdxSumA /= nTrackA;
1330 dEdxSumC /= nTrackC;
1334 cLtrCoverage->Divide(1, 2);
1337 cLtrCoverage->cd(1);
1340 gPad->SetRightMargin(0.01);
1341 hltrCoverageA->Draw(
"col text");
1345 cLtrCoverage->cd(2);
1348 gPad->SetRightMargin(0.01);
1349 hltrCoverageC->Draw(
"col text");
1353 cLtrdEdx->Divide(1, 2);
1359 gPad->SetRightMargin(0.01);
1360 hltrdEdxA->Divide(hltrCoverageA);
1361 hltrdEdxA->Draw(
"col text");
1368 gPad->SetRightMargin(0.01);
1369 hltrdEdxC->Divide(hltrCoverageC);
1370 hltrdEdxC->Draw(
"col text");
1375 auto calibValMsg =
new TPaveText(0.1, 0.1, 0.9, 0.9,
"NDC");
1376 calibValMsg->SetFillColor(0);
1377 calibValMsg->SetBorderSize(0);
1378 calibValMsg->AddText(fmt::format(
"processedTFs: {}", ltr.
processedTFs).data());
1379 calibValMsg->AddText(fmt::format(
"dvCorrectionA: {}", ltr.
dvCorrectionA).data());
1380 calibValMsg->AddText(fmt::format(
"dvCorrectionC: {}", ltr.
dvCorrectionC).data());
1383 calibValMsg->AddText(fmt::format(
"dvOffsetA: {}", ltr.
dvOffsetA).data());
1384 calibValMsg->AddText(fmt::format(
"dvOffsetC: {}", ltr.
dvOffsetC).data());
1385 calibValMsg->AddText(fmt::format(
"t0A: {}", ltr.
getT0A()).data());
1386 calibValMsg->AddText(fmt::format(
"t0C: {}", ltr.
getT0C()).data());
1387 calibValMsg->AddText(fmt::format(
"nTracksA: {}", ltr.
nTracksA).data());
1388 calibValMsg->AddText(fmt::format(
"nTracksC: {}", ltr.
nTracksC).data());
1389 calibValMsg->AddText(fmt::format(
"#LTdEdx A#GT: {}", dEdxSumA).
data());
1390 calibValMsg->AddText(fmt::format(
"#LTdEdx C#GT: {}", dEdxSumC).
data());
1393 calibValMsg->Draw();
1395 vecCanvases.emplace_back(cLtrCoverage);
1396 vecCanvases.emplace_back(cCalibValues);
1397 vecCanvases.emplace_back(cLtrdEdx);
1403 auto c = outputCanvas;
1405 c =
new TCanvas(
"junk_detection",
"Junk Detection", 1000, 1000);
1410 auto strA = (TH2F*)
data->At(4);
1411 auto strB = (TH2F*)
data->At(5);
1416 strA->GetStats(statsA);
1417 strB->GetStats(statsB);
1419 auto junkDetectionMsg =
new TPaveText(0.1, 0.1, 0.9, 0.9,
"NDC");
1420 junkDetectionMsg->SetFillColor(0);
1421 junkDetectionMsg->SetBorderSize(0);
1422 junkDetectionMsg->AddText(
"Removal Strategy A");
1423 junkDetectionMsg->AddText(fmt::format(
"Number of Clusters before Removal: {}", statsA[2]).
data());
1424 junkDetectionMsg->AddText(fmt::format(
"Removed Fraction: {:.2f}%", statsA[4]).
data());
1425 junkDetectionMsg->AddLine(.0, .5, 1., .5);
1426 junkDetectionMsg->AddText(
"Removal Strategy B");
1427 junkDetectionMsg->AddText(fmt::format(
"Number of Clusters before Removal: {}", statsB[2]).
data());
1428 junkDetectionMsg->AddText(fmt::format(
"Removed Fraction: {:.2f}%", statsB[4]).
data());
1431 junkDetectionMsg->Draw();
1440 auto palette = (TPaletteAxis*)
h->GetListOfFunctions()->FindObject(
"palette");
1444 palette->SetX2NDC(x2ndc);
1445 auto ax =
h->GetZaxis();
1446 ax->SetTickLength(tickLength);
1449TMultiGraph*
painter::makeMultiGraph(TTree&
tree, std::string_view varX, std::string_view varsY, std::string_view errVarsY, std::string_view cut,
bool makeSparse)
1451 bool hasErrors = errVarsY.size() > 0 && (std::count(varsY.begin(), varsY.end(),
':') == std::count(errVarsY.begin(), errVarsY.end(),
':'));
1453 tree.Draw(fmt::format(
"{} : {} {} {}", varX, varsY, hasErrors ?
" : " :
"", hasErrors ? errVarsY :
"").
data(), cut.
data(),
"goff");
1454 const auto nRows =
tree.GetSelectedRows();
1457 std::vector<size_t>
idx(
tree.GetSelectedRows());
1458 std::iota(
idx.begin(),
idx.end(),
static_cast<size_t>(0));
1459 std::sort(
idx.begin(),
idx.end(), [&
tree](
auto a,
auto b) { return tree.GetVal(0)[a] < tree.GetVal(0)[b]; });
1461 auto mgr =
new TMultiGraph();
1464 for (
size_t ivarY = 0; ivarY <
params.size(); ++ivarY) {
1465 auto gr =
new TGraphErrors(nRows);
1466 gr->SetMarkerSize(1);
1471 for (Long64_t iEntry = 0; iEntry <
nRows; ++iEntry) {
1473 gr->SetPoint(iEntry, iEntry + 0.5,
tree.GetVal(ivarY + 1)[idx[iEntry]]);
1475 gr->SetPoint(iEntry,
tree.GetVal(0)[idx[iEntry]],
tree.GetVal(ivarY + 1)[idx[iEntry]]);
1478 gr->SetPointError(iEntry, 0,
tree.GetVal(ivarY + 1 +
params.size())[idx[iEntry]]);
1486 auto xax = mgr->GetXaxis();
1487 xax->Set(nRows, 0.,
static_cast<Double_t
>(nRows));
1488 for (Long64_t iEntry = 0; iEntry <
nRows; ++iEntry) {
1489 xax->SetBinLabel(iEntry + 1, fmt::format(
"{}",
tree.GetVal(0)[idx[iEntry]]).data());
1491 xax->LabelsOption(
"v");
1500template TCanvas* painter::draw<float>(
const CalDet<float>& calDet,
int,
float,
float, TCanvas*);
1501template std::vector<TCanvas*> painter::makeSummaryCanvases<float>(
const CalDet<float>& calDet,
int,
float,
float,
bool, std::vector<TCanvas*>*);
1502template TCanvas* painter::draw<float>(
const CalArray<float>& calArray);
1505template void painter::fillHistogram2D<float>(TH2& h2D,
const CalArray<float>& calArray);
1507template TH2* painter::getHistogram2D<float>(
const CalArray<float>& calArray);
1509template TCanvas* painter::draw<double>(
const CalDet<double>& calDet,
int,
float,
float, TCanvas*);
1510template std::vector<TCanvas*> painter::makeSummaryCanvases<double>(
const CalDet<double>& calDet,
int,
float,
float,
bool, std::vector<TCanvas*>*);
1513template TH2* painter::getHistogram2D<double>(
const CalArray<double>& calArray);
1515template TCanvas* painter::draw<int>(
const CalDet<int>& calDet,
int,
float,
float, TCanvas*);
1516template std::vector<TCanvas*> painter::makeSummaryCanvases<int>(
const CalDet<int>& calDet,
int,
float,
float,
bool, std::vector<TCanvas*>*);
1517template TCanvas* painter::draw<int>(
const CalArray<int>& calArray);
1519template TH2* painter::getHistogram2D<int>(
const CalArray<int>& calArray);
1521template TCanvas* painter::draw<short>(
const CalDet<short>& calDet,
int,
float,
float, TCanvas*);
1522template std::vector<TCanvas*> painter::makeSummaryCanvases<short>(
const CalDet<short>& calDet,
int,
float,
float,
bool, std::vector<TCanvas*>*);
1523template TCanvas* painter::draw<short>(
const CalArray<short>& calArray);
1525template TH2* painter::getHistogram2D<short>(
const CalArray<short>& calArray);
1527template TCanvas* painter::draw<PadFlags>(
const CalDet<PadFlags>& calDet,
int,
float,
float, TCanvas*);
1528template std::vector<TCanvas*> painter::makeSummaryCanvases<PadFlags>(
const CalDet<PadFlags>& calDet,
int,
float,
float,
bool, std::vector<TCanvas*>*);
1533template TCanvas* painter::draw<bool>(
const CalDet<bool>& calDet,
int,
float,
float, TCanvas*);
1534template std::vector<TCanvas*> painter::makeSummaryCanvases<bool>(
const CalDet<bool>& calDet,
int,
float,
float,
bool, std::vector<TCanvas*>*);
1535template TCanvas* painter::draw<bool>(
const CalArray<bool>& calArray);
1537template TH2* painter::getHistogram2D<bool>(
const CalArray<bool>& calArray);
1539template TH3F painter::convertCalDetToTH3<float>(
const std::vector<
CalDet<float>>&,
const bool,
const int,
const float,
const float,
const int,
const float);
General auxilliary methods.
std::enable_if_t< std::is_signed< T >::value, bool > hasData(const CalArray< T > &cal)
Helper function to tokenize sequences and ranges of integral numbers.
Class for time synchronization of RawReader instances.
const U getSum() const
calculate the sum of all elements
const std::string & getName() const
PadSubset getPadSubset() const
const std::vector< T > & getData() const
int getPadSubsetNumber() const
const T getValue(const size_t channel) const
const CalType & getCalArray(size_t position) const
const T getValue(const int sec, const int globalPadInSector) const
const std::vector< CalType > & getData() const
const std::string & getName() const
unsigned char getIndex() const
static constexpr int RodsPerSide
Number of laser rods per side.
static constexpr int BundlesPerRod
number of micro-mirror bundle per laser rod
static constexpr int NumberOfTracks
Total number of laser tracks.
static constexpr int TracksPerBundle
number of micro-mirrors per bundle
const std::array< PadRegionInfo, 10 > & getMapPadRegionInfo() const
static GlobalPadNumber getGlobalPadNumber(const unsigned int lrow, const unsigned int pad, const unsigned int region)
static const std::vector< unsigned int > PADSPERROW[NREGIONS]
number of pads per row in region
const FECInfo & fecInfo(GlobalPadNumber padNumber) const
int getNumberOfRowsROC(ROC roc) const
int getNumberOfPadsInRow(PadSubset padSubset, int position, int row) const
int getNumberOfPadsInRowROC(int roc, int row) const
static constexpr float INVPADAREA[NREGIONS]
inverse size of the pad area padwidth*padLength
static Mapper & instance(const std::string mappingDir="")
GlobalPadNumber getPadNumber(const PadSubset padSubset, const size_t padSubsetNumber, const int row, const int pad) const
static constexpr unsigned int ROWSPERREGION[NREGIONS]
number of pad rows for region
static constexpr unsigned int NSECTORS
total number of sectors in the TPC
const PadRegionInfo & getPadRegionInfo(const unsigned char region) const
static constexpr unsigned int NREGIONS
total number of regions in one sector
static constexpr unsigned short getPadsInSector()
int getNumberOfPadRows(PadSubset padSubset, int position) const
static constexpr unsigned int PADROWS
total number of pad rows
GlobalPosition2D getPadCentre(const PadSecPos &padSec) const
static constexpr unsigned REGION[PADROWS]
region for global pad row
Pad and row inside a ROC.
float getRadiusFirstRow() const
float getPadHeight() const
bool looped() const
if increment operator went above MaxROC
static constexpr int MAXSECTOR
GLsizei const GLubyte GLsizei GLenum const void * coords
GLuint const GLchar * name
GLboolean GLboolean GLboolean b
GLint GLint GLsizei GLint GLenum GLenum type
GLenum const GLfloat * params
GLboolean GLboolean GLboolean GLboolean a
int32_t const char int32_t line
void bringTo02PiGen(float &phi)
std::vector< CalPad * > readCalPads(const std::string_view fileName, const std::vector< std::string > &calPadNames)
Global TPC definitions and constants.
GEMstack
TPC GEM stack types.
constexpr double SECPHIWIDTH
PadSubset
Definition of the different pad subsets.
constexpr unsigned short GEMSTACKSPERSECTOR
constexpr std::array< double, nLayers > radii
constexpr std::array< int, nLayers > nRows
float getDriftVCorrection() const
float dvCorrectionA
drift velocity correction factor A-Side (inverse multiplicative)
float dvOffsetC
drift velocity trigger offset C-Side
float dvOffsetA
drift velocity trigger offset A-Side
float dvCorrectionC
drift velocity correction factor C-Side (inverse multiplicative)
std::vector< uint16_t > matchedLtrIDs
matched laser track IDs
std::vector< float > dEdx
dE/dx of each track
size_t processedTFs
number of processed TFs with laser track candidates
uint16_t nTracksC
number of tracks used for C-Side fit
uint16_t nTracksA
number of tracks used for A-Side fit
float refVDrift
reference vdrift for which factor was extracted
static TH2Poly * makeSectorHist(const std::string_view name="hSector", const std::string_view title="Sector;local #it{x} (cm);local #it{y} (cm)", const float xMin=83.65f, const float xMax=247.7f, const float yMin=-43.7f, const float yMax=43.7f, const Type type=Type::Pad, std::string binningStr="")
static std::vector< double > getRowBinningCM(uint32_t roc=72)
static std::array< int, 6 > colors
static TH2Poly * makeSideHist(Side side, const Type type=Type::Pad, std::string binningStr="")
static std::vector< painter::PadCoordinates > getSCDY2XCoordinatesSector(std::string binningStr)
static TH3F convertCalDetToTH3(const std::vector< CalDet< DataT > > &calDet, const bool norm=true, const int nRBins=150, const float rMin=83.5, const float rMax=254.5, const int nPhiBins=720, const float zMax=1)
static std::vector< PadCoordinates > getStackCoordinatesSector()
create a vector of stack corner coordinate for one full sector
static std::array< int, 10 > markers
static void fillHistogram2D(TH2 &h2D, const CalDet< T > &calDet, Side side)
static TMultiGraph * makeMultiGraph(TTree &tree, std::string_view varX, std::string_view varsY, std::string_view errVarsY="", std::string_view cut="", bool makeSparse=true)
static std::vector< o2::tpc::painter::PadCoordinates > getCoordinates(const Type type, std::string binningStr="")
static std::string getROCTitle(const int rocNumber)
ROC title from ROC number.
static std::vector< PadCoordinates > getFECCoordinatesSector()
create a vector of FEC corner coordinates for one full sector
static void drawSectorLocalPadNumberPoly(short padTextColor=kBlack, float lineScalePS=1)
static void adjustPalette(TH1 *h, float x2ndc, float tickLength=0.015)
static void fillPoly2D(TH2Poly &h2D, const CalDet< T > &calDet, Side side)
static TH2 * getHistogram2D(const CalDet< T > &calDet, Side side)
static void drawSectorInformationPoly(short regionLineColor=kRed, short rowTextColor=kRed)
static void drawSectorsXY(Side side, int sectorLineColor=920, int sectorTextColor=1)
draw sector boundaris, side name and sector numbers
static std::vector< PadCoordinates > getPadCoordinatesSector()
create a vector of pad corner coordinate for one full sector
static TCanvas * makeJunkDetectionCanvas(const TObjArray *data, TCanvas *outputCanvas=nullptr)
make a canvas for junk detection data
static TCanvas * draw(const CalDet< T > &calDet, int nbins1D=300, float xMin1D=0, float xMax1D=0, TCanvas *outputCanvas=nullptr)
static std::vector< TCanvas * > makeSummaryCanvases(const CalDet< T > &calDet, int nbins1D=300, float xMin1D=0, float xMax1D=0, bool onlyFilled=true, std::vector< TCanvas * > *outputCanvases=nullptr)
static std::vector< std::string > tokenize(const std::string &src, char delim, bool trimToken=true, bool skipEmpty=true)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
o2::InteractionRecord ir(0, 0)
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))