27 : TH2D(name, title, nCols, 0., static_cast<Double_t>(nCols), nRows, 0., static_cast<Double_t>(nRows))
33 TH2D::SetStats(kFALSE);
34 TH2D::SetOption(
"textX+");
35 TH2D::GetXaxis()->SetTickLength(0.);
36 TH2D::GetYaxis()->SetTickLength(0.);
41 for (Int_t iRow = 1; iRow <=
fNrows; ++iRow) {
43 TH2D::GetYaxis()->SetBinLabel(
fNrows - iRow + 1,
"");
45 for (Int_t iCol = 1; iCol <=
fNcols; ++iCol) {
46 TH2D::GetXaxis()->SetBinLabel(iCol, TString::Format(
"col %d", iCol).Data());
66 TH2D::SetBinContent(iCol + 1,
fNrows - iRow, content);
67 TH2D::SetBinError(iCol + 1,
fNrows - iRow, error);
74 Int_t nEntries = (
fNcols >
static_cast<Int_t
>(names.size())) ?
static_cast<Int_t
>(names.size()) :
fNcols;
76 for (Int_t iCol = 1; iCol <= nEntries; ++iCol) {
77 TH2D::GetXaxis()->SetBinLabel(iCol, names[iCol - 1].c_str());
85 Int_t nEntries = (
fNrows >
static_cast<Int_t
>(names.size())) ?
static_cast<Int_t
>(names.size()) :
fNrows;
87 for (Int_t iRow = 1; iRow <= nEntries; ++iRow) {
88 TH2D::GetYaxis()->SetBinLabel(
fNrows - iRow + 1, names[iRow - 1].c_str());
100 std::stringstream aStream;
101 aStream.setf(std::ios::fixed);
102 aStream.setf(std::ios::showpoint);
103 aStream.setf(std::ios::left);
104 aStream.precision(prec);
106 aStream <<
"Table: " << GetTitle() <<
'\n';
107 aStream << std::setw(
fColWidth + 10) << std::setfill(
' ') <<
' ' <<
' ';
109 for (Int_t iCol = 0; iCol <
fNcols; ++iCol) {
110 std::string entry = std::string(this->GetXaxis()->GetBinLabel(iCol + 1));
111 if (Int_t(entry.size()) + 3 >
fColWidth) {
112 entry = entry.substr(0,
fColWidth - 3) +
"...";
114 aStream << std::setw(
fColWidth) << std::setfill(
' ') << entry <<
' ';
118 for (Int_t iRow = 0; iRow <
fNrows; ++iRow) {
120 std::string entry = std::string(GetYaxis()->GetBinLabel(
fNrows - iRow));
121 if (
static_cast<Int_t
>(entry.size()) >
fColWidth) {
122 entry = entry.substr(0,
fColWidth + 7) +
"...";
124 aStream << std::setw(
fColWidth + 10) << std::setfill(
' ') << entry <<
' ';
126 for (Int_t iCol = 0; iCol <
fNcols; ++iCol) {
127 std::stringstream cell;
128 cell.setf(std::ios::fixed);
129 cell.setf(std::ios::showpoint);
130 cell.setf(std::ios::left);
131 cell.precision(prec);
136 aStream << std::setw(
fColWidth) << std::setfill(
' ') << cell.str() <<
' ';
140 return aStream.str();
147 std::ofstream fileOut(fileName, mode);
157 TH2D::GetXaxis()->SetLabelSize(
size);
158 TH2D::GetYaxis()->SetLabelSize(
size);
std::ostream & operator<<(std::ostream &out, const CbmQaTable &aTable)
Definition of CbmQaTable class.
static constexpr size_t size()
TODO: SZh, 30.01.2023: Override THistPainter::PaintText() to add zeroes in tables.
void ToTextFile(const std::string &fileName, std::ios_base::openmode mode=std::ios_base::out) const
static constexpr Float_t kDefaultTextSize
default size of text
Int_t fNcols
number of columns in a table
Double_t GetCell(Int_t iRow, Int_t iCol) const
Gets cell content. Please mind, that the signature and result of this function is different to TH2D::...
void SetNamesOfCols(const std::vector< std::string > &names)
Sets the names of table columns.
Double_t GetCellError(Int_t iRow, Int_t iCol) const
Gets cell error. Please mind, that the signature and result of this function is different to TH2D::Ge...
void SetNamesOfRows(const std::vector< std::string > &names)
Sets the names of table rows.
virtual ~CbmQaTable()
Destructor.
static constexpr Style_t kDefaultFontStyle
default text style
void SetCell(Int_t iRow, Int_t iCol, Double_t content, Double_t error=0.)
CbmQaTable()
Default constructor.
Int_t fColWidth
Width of column in number of symbols.
Int_t fNrows
number of rows in a table
void SetRowName(Int_t iRow, const char *name)
Set name of a row.
void SetTextSize(Float_t size=0.03)
Sets size of the text.
std::string ToString(int prec, bool useErr=false) const