Skip to content

Commit 7c294e0

Browse files
wiechulasawenzel
authored andcommitted
TPC: Add function to adjust width of the color axis
1 parent a63b0b4 commit 7c294e0

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Detectors/TPC/base/include/TPCBase/Painter.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ TH3F convertCalDetToTH3(const std::vector<CalDet<DataT>>& calDet, const bool nor
190190
/// make summary canvases for laser calibration data
191191
std::vector<TCanvas*> makeSummaryCanvases(const LtrCalibData& ltr, std::vector<TCanvas*>* outputCanvases = nullptr);
192192

193+
/// Adjust the X2 position and the tick length of the color axis
194+
/// \param h histogram to get z axis
195+
/// \param x2ndc new x2 value of color axis in NDC
196+
/// \param tickLength tick length of the color axis
197+
void adjustPalette(TH1* h, float x2ndc, float tickLength = 0.015);
198+
193199
} // namespace painter
194200

195201
} // namespace o2::tpc

Detectors/TPC/base/src/Painter.cxx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "TLatex.h"
2525
#include "TStyle.h"
2626
#include "TPaveText.h"
27+
#include "TPaletteAxis.h"
2728

2829
#include "DataFormatsTPC/Defs.h"
2930
#include "TPCBase/ROC.h"
@@ -931,6 +932,16 @@ std::vector<TCanvas*> painter::makeSummaryCanvases(const LtrCalibData& ltr, std:
931932
return vecCanvases;
932933
}
933934

935+
void painter::adjustPalette(TH1* h, float x2ndc, float tickLength)
936+
{
937+
gPad->Modified();
938+
gPad->Update();
939+
auto palette = (TPaletteAxis*)h->GetListOfFunctions()->FindObject("palette");
940+
palette->SetX2NDC(x2ndc);
941+
auto ax = h->GetZaxis();
942+
ax->SetTickLength(tickLength);
943+
}
944+
934945
// ===| explicit instantiations |===============================================
935946
// this is required to force the compiler to create instances with the types
936947
// we usually would like to deal with

0 commit comments

Comments
 (0)