File indexing completed on 2024-04-06 12:31:25
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef LRHelpFunctions_h
0009 #define LRHelpFunctions_h
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include <cmath>
0020 #include <iostream>
0021
0022 #include "TROOT.h"
0023 #include "TString.h"
0024 #include "TFile.h"
0025 #include "TKey.h"
0026 #include "TH1F.h"
0027 #include "TH2F.h"
0028 #include "TF1.h"
0029 #include "TGraph.h"
0030 #include "TList.h"
0031 #include "TPaveText.h"
0032 #include "TText.h"
0033 #include "TCanvas.h"
0034
0035 class LRHelpFunctions {
0036 public:
0037 LRHelpFunctions();
0038 LRHelpFunctions(const std::vector<int>&,
0039 int,
0040 const std::vector<double>&,
0041 const std::vector<double>&,
0042 const std::vector<const char*>&);
0043 LRHelpFunctions(int, double, double, const char*);
0044 ~LRHelpFunctions();
0045 void recreateFitFct(const std::vector<int>& obsNr, const std::vector<const char*>& functions);
0046 void initLRHistsAndFits(int, double, double, const char*);
0047 void setObsFitParameters(int obs, const std::vector<double>&);
0048 void fillToSignalHists(const std::vector<double>&, double weight = 1.0);
0049 void fillToBackgroundHists(const std::vector<double>&, double weight = 1.0);
0050 void fillToSignalHists(int, double, double weight = 1.0);
0051 void fillToBackgroundHists(int, double, double weight = 1.0);
0052 void fillToSignalCorrelation(int obsNbr1, double obsVal1, int obsNbr2, double obsVal2, double weight);
0053 void normalizeSandBhists();
0054 void makeAndFitSoverSplusBHists();
0055 void readObsHistsAndFits(const TString&, const std::vector<int>&, bool);
0056 void storeToROOTfile(const TString&);
0057 void storeControlPlots(const TString&);
0058 void fillLRSignalHist(double, double weight = 1.0);
0059 void fillLRBackgroundHist(double, double weight = 1.0);
0060 void makeAndFitPurityHists();
0061 double calcLRval(const std::vector<double>&);
0062 double calcPtdrLRval(const std::vector<double>& vals, bool useCorrelation = false);
0063 double calcProb(double);
0064 bool obsFitIncluded(int);
0065 void setXlabels(const std::vector<std::string>& xLabels);
0066 void setYlabels(const std::vector<std::string>& yLabels);
0067 void singlePlot(const TString& fname, int obsNbr, const TString& extension = TString("eps"));
0068 void purityPlot(const TString& fname, const TString& extension = TString("eps"));
0069
0070 private:
0071 std::vector<TH1F*> hObsS, hObsB, hObsSoverSplusB;
0072 std::vector<TH2F*> hObsCorr;
0073 std::vector<TF1*> fObsSoverSplusB;
0074 TH1F *hLRtotS, *hLRtotB, *hLRtotSoverSplusB;
0075 TF1* fLRtotSoverSplusB;
0076 TGraph *hEffvsPur, *hLRValvsPur, *hLRValvsEff;
0077 bool constructPurity;
0078 std::vector<int> obsNumbers;
0079 };
0080
0081 #endif