CbmRoot
Loading...
Searching...
No Matches
CbmQaCheckerHist2DHandler.cxx
Go to the documentation of this file.
1/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergei Zharko [committer] */
4
9
11
12#include "TCanvas.h"
13#include "TH2.h"
14
16
17// ---------------------------------------------------------------------------------------------------------------------
18//
19Hist2DHandler::Hist2DHandler(int iObject, int iFile, int iDataset) : Hist1DHandler(iObject, iFile, iDataset) {}
20
21// ---------------------------------------------------------------------------------------------------------------------
22//
24{
25 std::string sCanvName = fsBaseName + "_cmp_canvas";
26
27 // Title definitions
28 const char* title = fvpObjects[0]->GetTitle();
29 const char* xAxisTitle = static_cast<TH1*>(fvpObjects[0])->GetXaxis()->GetTitle();
30 const char* yAxisTitle = static_cast<TH1*>(fvpObjects[0])->GetYaxis()->GetTitle();
31 const char* zAxisTitle = static_cast<TH1*>(fvpObjects[0])->GetZaxis()->GetTitle();
32
33 int nVersions = fpObjDB->GetNofVersions();
34 fpCanvas = std::make_shared<TCanvas>(sCanvName.data(), title, 1500, 700);
35 fpCanvas->DivideSquare(nVersions);
36 for (int iVer = 0; iVer < nVersions; ++iVer) {
37 fpCanvas->cd(iVer + 1);
38 gPad->SetMargin(0.20, 0.20, 0.20, 0.10);
39 auto* pCopy = static_cast<TH2*>(static_cast<TH2*>(fvpObjects[iVer])->Clone());
40 pCopy->SetTitle(Form("%s: %s", title, fpObjDB->GetVersionLabel(iVer).c_str()));
41 pCopy->GetXaxis()->SetTitle(xAxisTitle);
42 pCopy->GetYaxis()->SetTitle(yAxisTitle);
43 pCopy->GetZaxis()->SetTitle(zAxisTitle);
44 pCopy->Draw("colz");
45 }
46}
Handler class for 2D-histograms (implementation)
Specification of the handler for TProfile class.
Hist2DHandler(int iObject, int iFile, int iDataset)
Constructor.
void CreateCanvases(Option_t *opt="") override
Creates object comparison canvas.
std::string fsBaseName
Base names of the object.
std::shared_ptr< TCanvas > fpCanvas
Comparison canvas.
std::shared_ptr< ObjectDB > fpObjDB
Pointer to object database.
std::vector< TNamed * > fvpObjects
Vector of objects.