|
||||
File indexing completed on 2024-06-26 07:06:32
0001 // This file is part of the Acts project. 0002 // 0003 // Copyright (C) 2019 CERN for the benefit of the Acts project 0004 // 0005 // This Source Code Form is subject to the terms of the Mozilla Public 0006 // License, v. 2.0. If a copy of the MPL was not distributed with this 0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/. 0008 0009 #pragma once 0010 0011 #include <string> 0012 0013 #include "TEfficiency.h" 0014 #include "TFitResult.h" 0015 #include "TFitResultPtr.h" 0016 #include "TH1F.h" 0017 #include "TH2F.h" 0018 #include "TProfile.h" 0019 #include "TROOT.h" 0020 0021 namespace Jug { 0022 0023 namespace PlotHelpers { 0024 /// @brief Nested binning struct for booking plots 0025 struct Binning { 0026 Binning(){}; 0027 0028 Binning(std::string bTitle, int bins, float bMin, float bMax) 0029 : title(bTitle), nBins(bins), min(bMin), max(bMax){}; 0030 0031 std::string title; ///< title to be displayed 0032 int nBins; ///< number of bins 0033 float min; ///< minimum value 0034 float max; ///< maximum value 0035 }; 0036 0037 /// @brief book a 1D histogram 0038 /// @param histName the name of histogram 0039 /// @param histTitle the title of histogram 0040 /// @param varBinning the binning info of variable 0041 /// @return histogram pointer 0042 TH1F* bookHisto(const char* histName, const char* histTitle, 0043 const Binning& varBinning); 0044 0045 /// @brief book a 2D histogram 0046 /// @param histName the name of histogram 0047 /// @param histTitle the title of histogram 0048 /// @param varXBinning the binning info of variable at x axis 0049 /// @param varYBinning the binning info of variable at y axis 0050 /// @return histogram pointer 0051 TH2F* bookHisto(const char* histName, const char* histTitle, 0052 const Binning& varXBinning, const Binning& varYBinning); 0053 0054 /// @brief fill a 1D histogram 0055 /// @param hist histogram to fill 0056 /// @param value value to fill 0057 /// @param weight weight to fill 0058 void fillHisto(TH1F* hist, float value, float weight = 1.0); 0059 0060 /// @brief fill a 2D histogram 0061 /// @param hist histogram to fill 0062 /// @param xValue x value to fill 0063 /// @param yValue y value to fill 0064 /// @param weight weight to fill 0065 void fillHisto(TH2F* hist, float xValue, float yValue, float weight = 1.0); 0066 0067 /// @brief extract details, i.e. mean and width of a 1D histogram and fill 0068 /// them into histograms 0069 /// @param inputHist histogram to investigate 0070 /// @param j which bin number of meanHist and widthHist to fill 0071 /// @param meanHist histogram to fill the mean value of inputHist 0072 /// @param widthHist histogram to fill the width value of inputHist 0073 /// 0074 /// @todo write specialized helper class to extract details of hists 0075 void anaHisto(TH1D* inputHist, int j, TH1F* meanHist, TH1F* widthHist); 0076 0077 /// @brief book a 1D efficiency plot 0078 /// @param effName the name of plot 0079 /// @param effTitle the title of plot 0080 /// @param varBinning the binning info of variable 0081 /// @return TEfficiency pointer 0082 TEfficiency* bookEff(const char* effName, const char* effTitle, 0083 const Binning& varBinning); 0084 0085 /// @brief book a 2D efficiency plot 0086 /// @param effName the name of plot 0087 /// @param effTitle the title of plot 0088 /// @param varXBinning the binning info of variable at x axis 0089 /// @param varYBinning the binning info of variable at y axis 0090 /// @return TEfficiency pointer 0091 TEfficiency* bookEff(const char* effName, const char* effTitle, 0092 const Binning& varXBinning, const Binning& varYBinning); 0093 0094 /// @brief fill a 1D efficiency plot 0095 /// @param efficiency plot to fill 0096 /// @param value value to fill 0097 /// @param status bool to denote passed or not 0098 void fillEff(TEfficiency* efficiency, float value, bool status); 0099 0100 /// @brief fill a 2D efficiency plot 0101 /// @param efficiency plot to fill 0102 /// @param xValue x value to fill 0103 /// @param yValue y value to fill 0104 /// @param status bool to denote passed or not 0105 void fillEff(TEfficiency* efficiency, float xValue, float yValue, bool status); 0106 0107 /// @brief book a TProfile plot 0108 /// @param profName the name of plot 0109 /// @param profTitle the title of plot 0110 /// @param varXBinning the binning info of variable at x axis 0111 /// @param varYBinning the binning info of variable at y axis 0112 /// @return TProfile pointer 0113 TProfile* bookProf(const char* profName, const char* profTitle, 0114 const Binning& varXBinning, const Binning& varYBinning); 0115 0116 /// @brief fill a TProfile plot 0117 /// @param profile plot to fill 0118 /// @param xValue xvalue to fill 0119 /// @param yValue yvalue to fill 0120 /// @param weight weight to fill 0121 void fillProf(TProfile* profile, float xValue, float yValue, 0122 float weight = 1.0); 0123 0124 } // namespace PlotHelpers 0125 0126 } // namespace FW
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.5 LXR engine. The LXR team |