CbmRoot
Loading...
Searching...
No Matches
CbmQaCanvas.cxx
Go to the documentation of this file.
1/* Copyright (C) 2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergey Gorbunov [committer] */
4
9
10#include "CbmQaCanvas.h"
11
12#include "TBuffer.h"
13#include "TVirtualPad.h"
14
16
20void CbmQaCanvas::Streamer(TBuffer& R__b)
21{
22
23 // Save global gPad pointer,
24 // because it will be modified by TCanvas streamer
25 auto store = gPad;
26 if (R__b.IsReading()) {
27 R__b.ReadClassBuffer(CbmQaCanvas::Class(), this);
28 }
29 else {
30 R__b.WriteClassBuffer(CbmQaCanvas::Class(), this);
31 }
32 // restore the global pointer
33 gPad = store;
34}
35
36void CbmQaCanvas::Divide2D(int nPads)
37{
38 if (nPads < 1) nPads = 1;
39 int rows = (int) sqrt(nPads);
40 int cols = nPads / rows;
41 if (cols * rows < nPads) cols++;
42 TCanvas::Divide(cols, rows);
43}
ClassImp(CbmQaCanvas)
Definition of the CbmQaCanvas class.
friend fvec sqrt(const fvec &a)
void Divide2D(int nPads)
Divide canvas into nPads in 2D in a nice way.