EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Helpers.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Helpers.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
11 #include <string>
12 
13 #include "TEfficiency.h"
14 #include "TFitResult.h"
15 #include "TFitResultPtr.h"
16 #include "TH1F.h"
17 #include "TH2F.h"
18 #include "TProfile.h"
19 #include "TROOT.h"
20 
21 namespace ActsExamples {
22 
23 namespace PlotHelpers {
25 struct Binning {
26  Binning(){};
27 
28  Binning(std::string bTitle, int bins, float bMin, float bMax)
29  : title(bTitle), nBins(bins), min(bMin), max(bMax){};
30 
31  std::string title;
32  int nBins;
33  float min;
34  float max;
35 };
36 
42 TH1F* bookHisto(const char* histName, const char* histTitle,
43  const Binning& varBinning);
44 
51 TH2F* bookHisto(const char* histName, const char* histTitle,
52  const Binning& varXBinning, const Binning& varYBinning);
53 
58 void fillHisto(TH1F* hist, float value, float weight = 1.0);
59 
65 void fillHisto(TH2F* hist, float xValue, float yValue, float weight = 1.0);
66 
75 void anaHisto(TH1D* inputHist, int j, TH1F* meanHist, TH1F* widthHist);
76 
82 TEfficiency* bookEff(const char* effName, const char* effTitle,
83  const Binning& varBinning);
84 
91 TEfficiency* bookEff(const char* effName, const char* effTitle,
92  const Binning& varXBinning, const Binning& varYBinning);
93 
98 void fillEff(TEfficiency* efficiency, float value, bool status);
99 
105 void fillEff(TEfficiency* efficiency, float xValue, float yValue, bool status);
106 
113 TProfile* bookProf(const char* profName, const char* profTitle,
114  const Binning& varXBinning, const Binning& varYBinning);
115 
121 void fillProf(TProfile* profile, float xValue, float yValue,
122  float weight = 1.0);
123 
124 } // namespace PlotHelpers
125 
126 } // namespace ActsExamples