Select Git revision
L1AlgoPulls.cxx
CbmQaHist.h 3.97 KiB
/* Copyright (C) 2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Sergey Gorbunov [committer] */
/// \file CbmQaHist.h
/// \brief Definition of the CbmQaHist class
/// \author Sergey Gorbunov <se.gorbunov@gsi.de>
/// \date 22.11.2020
#ifndef CbmQaHist_H
#define CbmQaHist_H
#include "CbmQaCanvas.h"
#include <Logger.h>
#include <TFitResultPtr.h>
#include <TPaveStats.h>
#include <TStyle.h>
#include <TVirtualPad.h>
// The TH* headers are needed here for the ROOT linker
#include <TF1.h>
#include <TH1D.h>
#include <TH1F.h>
#include <TH1I.h>
#include <TProfile.h>
#include <TProfile2D.h>
/// A modification of TH* and TProfile* classes that keeps statistics & fit drawing options
/// and resizes the stat window accordingly without the actual drawing.
/// In the original classes, hist->Draw() & canv->Update() must be called
/// for resetting Stat/Fit window.
///
template<class HistTypeT>
class CbmQaHist : public HistTypeT {
public:
/// Default constructor only for the streamer
CbmQaHist() : HistTypeT()
{
// we don't call SetOptStatFit() here since it will call Clone()
// which calls this default constructor in an endless recursion
if (gStyle) {
fOptStat = gStyle->GetOptStat();
fOptFit = gStyle->GetOptFit();
}
this->SetLineWidth(2);
}
/// Copy constructor
CbmQaHist(const CbmQaHist& h) : HistTypeT(h) { SetOptStatFit(h.fOptStat, h.fOptFit); }
/// Reimplementation of all other HistTypeT constructors
/// that creates a stat window with current gStyle options.
template<typename... Types>
CbmQaHist(Types... args) : HistTypeT(args...)
{
if (gStyle) { SetOptStatFit(gStyle->GetOptStat(), gStyle->GetOptFit()); }
this->SetLineWidth(2);
}
/// Destructor
~CbmQaHist() {}
/// Reimplementation of Fit()
/// that suppresses an immediate drawing in the active window
///
template<typename... Types>
TFitResultPtr Fit(Types... args)