ra4_stats
0341147a0dc35f80f4e12c6003afb76a38e2ed6e
|
#include "extract_yields.hpp"
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <initializer_list>
#include <stdexcept>
#include <getopt.h>
#include "TFile.h"
#include "TLine.h"
#include "TCanvas.h"
#include "TPad.h"
#include "TLegend.h"
#include "TColor.h"
#include "TH2D.h"
#include "TStyle.h"
#include "TLatex.h"
#include "RooArgList.h"
#include "RooArgSet.h"
#include "RooRealVar.h"
#include "RooAbsData.h"
#include "RooDataSet.h"
#include "RooProdPdf.h"
#include "RooNLLVar.h"
#include "RooMinuit.h"
#include "utilities.hpp"
#include "styles.hpp"
Go to the source code of this file.
Namespaces | |
anonymous_namespace{extract_yields.cxx} | |
Functions | |
string | anonymous_namespace{extract_yields.cxx}::file_wspace ("") |
bool | anonymous_namespace{extract_yields.cxx}::table_clean (false) |
bool | anonymous_namespace{extract_yields.cxx}::r4_only (false) |
bool | anonymous_namespace{extract_yields.cxx}::show_exp_sig (false) |
int | main (int argc, char *argv[]) |
void | RunFit (const string &path) |
string | GetSignalName (const RooWorkspace &w) |
string | TexFriendly (const string &s) |
void | PrintDebug (RooWorkspace &w, const RooFitResult &f, const string &file_name) |
void | PrintTable (RooWorkspace &w, const RooFitResult &f, const string &file_name) |
double | GetMCYield (const RooWorkspace &w, const string &bin_name, const string &prc_name) |
double | GetMCTotal (const RooWorkspace &w, const string &bin_name) |
double | GetMCTotalErr (RooWorkspace &w, const RooFitResult &f, const string &bin_name) |
double | GetBkgPred (const RooWorkspace &w, const string &bin_name) |
double | GetBkgPredErr (RooWorkspace &w, const RooFitResult &f, const string &bin_name) |
double | GetSigPred (const RooWorkspace &w, const string &bin_name) |
double | GetSigPredErr (RooWorkspace &w, const RooFitResult &f, const string &bin_name) |
double | GetTotPred (const RooWorkspace &w, const string &bin_name) |
double | GetTotPredErr (RooWorkspace &w, const RooFitResult &f, const string &bin_name) |
double | GetObserved (const RooWorkspace &w, const string &bin_name) |
double | GetKappaNoSys (const RooWorkspace &w, const string &bin_name) |
double | GetKappaNoSysErr (RooWorkspace &w, const RooFitResult &f, const string &bin_name) |
double | GetKappaSys (const RooWorkspace &w, const string &bin_name) |
double | GetKappaSysErr (RooWorkspace &w, const RooFitResult &f, const string &bin_name) |
double | GetLambda (const RooWorkspace &w, const string &bin_name) |
double | GetLambdaErr (RooWorkspace &w, const RooFitResult &f, const string &bin_name) |
RooRealVar * | SetVariables (RooWorkspace &w, const RooFitResult &f) |
void | MakeYieldPlot (RooWorkspace &w, const RooFitResult &f, const string &file_name, bool linear) |
vector< string > | GetVarNames (const RooWorkspace &w) |
vector< string > | GetFuncNames (const RooWorkspace &w) |
void | ManuallyAddBins (const RooWorkspace &w, vector< string > &names) |
vector< string > | GetBinNames (const RooWorkspace &w, bool r4_only_local) |
vector< string > | GetPlainBinNames (const RooWorkspace &w) |
vector< string > | GetProcessNames (const RooWorkspace &w) |
vector< vector< double > > | GetComponentYields (const RooWorkspace &w, const vector< string > &bin_names, const vector< string > &prc_names) |
vector< TH1D > | MakeBackgroundHistos (const vector< vector< double > > &yields, const vector< string > &bin_names, const vector< string > &prc_names) |
TH1D | MakeExpSignal (RooWorkspace &w, const vector< string > &bin_names) |
TH1D | MakeTotalHisto (RooWorkspace &w, const RooFitResult &f, const vector< string > &bin_names) |
TH1D | MakeObserved (const RooWorkspace &w, const vector< string > &bin_names) |
void | SetBounds (TH1D &a, TH1D &b, std::vector< TH1D > &cs) |
double | GetMaximum (const TH1D &a, const TH1D &b, const vector< TH1D > &cs) |
double | GetMinimum (const TH1D &a, const TH1D &b, const vector< TH1D > &cs) |
double | GetMaximum (const TH1D &h, double y) |
double | GetMinimum (const TH1D &h, double y) |
TGraphErrors | MakeErrorBand (const TH1D &h) |
TGraphErrors | MakeRatio (const TH1D &num, const TH1D &den) |
string | StripPath (const string &full_path) |
void | MakeCorrectionPlot (RooWorkspace &w, const RooFitResult &f, const string &file_name) |
void | MakeCovarianceMatrix (RooWorkspace &w, const RooFitResult &f, string covar_file_name) |
double | GetError (const RooAbsReal &var, const RooFitResult &f) |
string | PrettyBinName (string name) |
void | GetOptionsExtract (int argc, char *argv[]) |
Variables | |
bool | anonymous_namespace{extract_yields.cxx}::do_global = false |
vector<string> GetBinNames | ( | const RooWorkspace & | w, |
bool | r4_only_local | ||
) |
Definition at line 832 of file extract_yields.cxx.
References Append(), Contains(), GetFuncNames(), and scan_aggregate::name.
Referenced by MakeCorrectionPlot(), and MakeYieldPlot().
double GetBkgPred | ( | const RooWorkspace & | w, |
const string & | bin_name | ||
) |
Definition at line 353 of file extract_yields.cxx.
References Contains(), and scan_aggregate::name.
Referenced by PrintTable().
double GetBkgPredErr | ( | RooWorkspace & | w, |
const RooFitResult & | f, | ||
const string & | bin_name | ||
) |
Definition at line 373 of file extract_yields.cxx.
References Contains(), GetError(), and scan_aggregate::name.
Referenced by PrintTable().
vector<vector<double> > GetComponentYields | ( | const RooWorkspace & | w, |
const vector< string > & | bin_names, | ||
const vector< string > & | prc_names | ||
) |
Definition at line 882 of file extract_yields.cxx.
Referenced by MakeYieldPlot().
double GetError | ( | const RooAbsReal & | var, |
const RooFitResult & | f | ||
) |
Definition at line 1351 of file extract_yields.cxx.
References one_bin_test_statistic::GetName().
Referenced by GetBkgPredErr(), GetKappaNoSysErr(), GetKappaSysErr(), GetLambdaErr(), GetMCTotalErr(), GetSigPredErr(), GetTotPredErr(), MakeCorrectionPlot(), MakeTotalHisto(), MakeYieldPlot(), and PrintDebug().
vector<string> GetFuncNames | ( | const RooWorkspace & | w | ) |
Definition at line 796 of file extract_yields.cxx.
References Append(), and scan_aggregate::name.
Referenced by GetBinNames(), GetPlainBinNames(), PrintDebug(), and SetVariables().
double GetKappaNoSys | ( | const RooWorkspace & | w, |
const string & | bin_name | ||
) |
Definition at line 493 of file extract_yields.cxx.
References Contains(), and scan_aggregate::name.
Referenced by PrintTable().
double GetKappaNoSysErr | ( | RooWorkspace & | w, |
const RooFitResult & | f, | ||
const string & | bin_name | ||
) |
Definition at line 513 of file extract_yields.cxx.
References Contains(), GetError(), and scan_aggregate::name.
Referenced by PrintTable().
double GetKappaSys | ( | const RooWorkspace & | w, |
const string & | bin_name | ||
) |
Definition at line 534 of file extract_yields.cxx.
References Contains(), and scan_aggregate::name.
Referenced by PrintTable().
double GetKappaSysErr | ( | RooWorkspace & | w, |
const RooFitResult & | f, | ||
const string & | bin_name | ||
) |
Definition at line 554 of file extract_yields.cxx.
References Contains(), GetError(), and scan_aggregate::name.
Referenced by PrintTable().
double GetLambda | ( | const RooWorkspace & | w, |
const string & | bin_name | ||
) |
Definition at line 575 of file extract_yields.cxx.
References Contains(), and scan_aggregate::name.
Referenced by PrintTable().
double GetLambdaErr | ( | RooWorkspace & | w, |
const RooFitResult & | f, | ||
const string & | bin_name | ||
) |
Definition at line 595 of file extract_yields.cxx.
References Contains(), GetError(), and scan_aggregate::name.
Referenced by PrintTable().
double GetMaximum | ( | const TH1D & | a, |
const TH1D & | b, | ||
const vector< TH1D > & | cs | ||
) |
Definition at line 1055 of file extract_yields.cxx.
References plot_variations::c.
Referenced by SetBounds(), and styles::testGlobalStyle().
double GetMaximum | ( | const TH1D & | h, |
double | y | ||
) |
Definition at line 1081 of file extract_yields.cxx.
References plot_variations::y.
double GetMCTotal | ( | const RooWorkspace & | w, |
const string & | bin_name | ||
) |
Definition at line 312 of file extract_yields.cxx.
References Contains(), and scan_aggregate::name.
Referenced by PrintTable().
double GetMCTotalErr | ( | RooWorkspace & | w, |
const RooFitResult & | f, | ||
const string & | bin_name | ||
) |
Definition at line 332 of file extract_yields.cxx.
References Contains(), GetError(), and scan_aggregate::name.
Referenced by PrintTable().
double GetMCYield | ( | const RooWorkspace & | w, |
const string & | bin_name, | ||
const string & | prc_name | ||
) |
Definition at line 291 of file extract_yields.cxx.
References Contains(), and scan_aggregate::name.
Referenced by MakeExpSignal(), and PrintTable().
double GetMinimum | ( | const TH1D & | a, |
const TH1D & | b, | ||
const vector< TH1D > & | cs | ||
) |
Definition at line 1068 of file extract_yields.cxx.
References plot_variations::c.
Referenced by SetBounds().
double GetMinimum | ( | const TH1D & | h, |
double | y | ||
) |
Definition at line 1096 of file extract_yields.cxx.
References plot_variations::y.
double GetObserved | ( | const RooWorkspace & | w, |
const string & | bin_name | ||
) |
Definition at line 476 of file extract_yields.cxx.
References Contains(), and scan_aggregate::name.
Referenced by PrintTable().
void GetOptionsExtract | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 1449 of file extract_yields.cxx.
References anonymous_namespace{extract_yields.cxx}::do_global, anonymous_namespace{extract_yields.cxx}::file_wspace(), anonymous_namespace{extract_yields.cxx}::r4_only(), anonymous_namespace{extract_yields.cxx}::show_exp_sig(), and anonymous_namespace{extract_yields.cxx}::table_clean().
Referenced by main().
vector<string> GetPlainBinNames | ( | const RooWorkspace & | w | ) |
Definition at line 845 of file extract_yields.cxx.
References Append(), GetFuncNames(), and scan_aggregate::name.
Referenced by PrintTable().
vector<string> GetProcessNames | ( | const RooWorkspace & | w | ) |
Definition at line 860 of file extract_yields.cxx.
References Append(), and scan_aggregate::name.
Referenced by MakeCorrectionPlot(), MakeYieldPlot(), and PrintTable().
string GetSignalName | ( | const RooWorkspace & | w | ) |
Definition at line 89 of file extract_yields.cxx.
References scan_aggregate::name.
Referenced by PrintTable().
double GetSigPred | ( | const RooWorkspace & | w, |
const string & | bin_name | ||
) |
Definition at line 394 of file extract_yields.cxx.
References Contains(), and scan_aggregate::name.
Referenced by PrintTable().
double GetSigPredErr | ( | RooWorkspace & | w, |
const RooFitResult & | f, | ||
const string & | bin_name | ||
) |
Definition at line 414 of file extract_yields.cxx.
References Contains(), GetError(), and scan_aggregate::name.
Referenced by PrintTable().
double GetTotPred | ( | const RooWorkspace & | w, |
const string & | bin_name | ||
) |
Definition at line 435 of file extract_yields.cxx.
References Contains(), and scan_aggregate::name.
Referenced by PrintTable().
double GetTotPredErr | ( | RooWorkspace & | w, |
const RooFitResult & | f, | ||
const string & | bin_name | ||
) |
Definition at line 455 of file extract_yields.cxx.
References Contains(), GetError(), and scan_aggregate::name.
Referenced by PrintTable().
vector<string> GetVarNames | ( | const RooWorkspace & | w | ) |
Definition at line 779 of file extract_yields.cxx.
References Append(), and scan_aggregate::name.
Referenced by PrintDebug(), and SetVariables().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 47 of file extract_yields.cxx.
References ChangeExtension(), Contains(), ERROR, anonymous_namespace{extract_yields.cxx}::file_wspace(), GetOptionsExtract(), MakeCorrectionPlot(), MakeCovarianceMatrix(), MakeYieldPlot(), PrintDebug(), PrintTable(), RunFit(), styles::setDefaultStyle(), and bin_significance::style().
vector<TH1D> MakeBackgroundHistos | ( | const vector< vector< double > > & | yields, |
const vector< string > & | bin_names, | ||
const vector< string > & | prc_names | ||
) |
Definition at line 906 of file extract_yields.cxx.
References anonymous_namespace{test_agnostic.cxx}::a, anonymous_namespace{test_agnostic.cxx}::b, Contains(), anonymous_namespace{extract_yields.cxx}::file_wspace(), plot_aggregates::GetColor(), and scan_aggregate::name.
Referenced by MakeYieldPlot().
void MakeCorrectionPlot | ( | RooWorkspace & | w, |
const RooFitResult & | f, | ||
const string & | file_name | ||
) |
Definition at line 1155 of file extract_yields.cxx.
References plot_variations::c, GetBinNames(), GetError(), GetProcessNames(), and SetVariables().
Referenced by main().
void MakeCovarianceMatrix | ( | RooWorkspace & | w, |
const RooFitResult & | f, | ||
string | covar_file_name | ||
) |
Definition at line 1181 of file extract_yields.cxx.
References plot_variations::c, Contains(), scan_aggregate::name, PrettyBinName(), anonymous_namespace{extract_yields.cxx}::r4_only(), ReplaceAll(), SetVariables(), plot_variations::x, and plot_variations::y.
Referenced by main().
TGraphErrors MakeErrorBand | ( | const TH1D & | h | ) |
Definition at line 1111 of file extract_yields.cxx.
Referenced by MakeYieldPlot().
TH1D MakeExpSignal | ( | RooWorkspace & | w, |
const vector< string > & | bin_names | ||
) |
Definition at line 952 of file extract_yields.cxx.
References GetMCYield(), and scan_aggregate::name.
Referenced by MakeYieldPlot().
TH1D MakeObserved | ( | const RooWorkspace & | w, |
const vector< string > & | bin_names | ||
) |
Definition at line 1001 of file extract_yields.cxx.
References scan_aggregate::name.
Referenced by MakeYieldPlot().
TGraphErrors MakeRatio | ( | const TH1D & | num, |
const TH1D & | den | ||
) |
Definition at line 1122 of file extract_yields.cxx.
References plot_variations::x.
Referenced by MakeYieldPlot().
TH1D MakeTotalHisto | ( | RooWorkspace & | w, |
const RooFitResult & | f, | ||
const vector< string > & | bin_names | ||
) |
Definition at line 977 of file extract_yields.cxx.
References GetError(), and scan_aggregate::name.
Referenced by MakeYieldPlot().
void MakeYieldPlot | ( | RooWorkspace & | w, |
const RooFitResult & | f, | ||
const string & | file_name, | ||
bool | linear | ||
) |
Definition at line 652 of file extract_yields.cxx.
References plot_variations::c, Contains(), GetBinNames(), GetComponentYields(), GetError(), GetProcessNames(), MakeBackgroundHistos(), MakeErrorBand(), MakeExpSignal(), MakeObserved(), MakeRatio(), MakeTotalHisto(), anonymous_namespace{extract_yields.cxx}::r4_only(), SetBounds(), and SetVariables().
Referenced by main().
void ManuallyAddBins | ( | const RooWorkspace & | w, |
vector< string > & | names | ||
) |
Definition at line 814 of file extract_yields.cxx.
References scan_aggregate::name.
string PrettyBinName | ( | string | name | ) |
Definition at line 1432 of file extract_yields.cxx.
References scan_aggregate::name, and ReplaceAll().
Referenced by MakeCovarianceMatrix().
void PrintDebug | ( | RooWorkspace & | w, |
const RooFitResult & | f, | ||
const string & | file_name | ||
) |
Definition at line 133 of file extract_yields.cxx.
References GetError(), GetFuncNames(), GetVarNames(), SetVariables(), TexFriendly(), and plot_variations::var_names.
Referenced by main().
void PrintTable | ( | RooWorkspace & | w, |
const RooFitResult & | f, | ||
const string & | file_name | ||
) |
Definition at line 178 of file extract_yields.cxx.
References Contains(), DBG, anonymous_namespace{extract_yields.cxx}::do_global, GetBkgPred(), GetBkgPredErr(), GetKappaNoSys(), GetKappaNoSysErr(), GetKappaSys(), GetKappaSysErr(), GetLambda(), GetLambdaErr(), GetMCTotal(), GetMCTotalErr(), GetMCYield(), GetObserved(), GetPlainBinNames(), GetProcessNames(), GetSignalName(), GetSigPred(), GetSigPredErr(), GetTotPred(), GetTotPredErr(), ReplaceAll(), SetVariables(), anonymous_namespace{extract_yields.cxx}::table_clean(), and TexFriendly().
Referenced by main().
void RunFit | ( | const string & | path | ) |
void SetBounds | ( | TH1D & | a, |
TH1D & | b, | ||
std::vector< TH1D > & | cs | ||
) |
Definition at line 1024 of file extract_yields.cxx.
References plot_variations::c, Contains(), anonymous_namespace{extract_yields.cxx}::file_wspace(), GetMaximum(), and GetMinimum().
Referenced by MakeYieldPlot().
RooRealVar* SetVariables | ( | RooWorkspace & | w, |
const RooFitResult & | f | ||
) |
Definition at line 616 of file extract_yields.cxx.
References GetFuncNames(), GetVarNames(), and plot_variations::var_names.
Referenced by MakeCorrectionPlot(), MakeCovarianceMatrix(), MakeYieldPlot(), PrintDebug(), and PrintTable().
string StripPath | ( | const string & | full_path | ) |
Definition at line 1146 of file extract_yields.cxx.
References send_combine_aggregates::full_path.
string TexFriendly | ( | const string & | s | ) |
Definition at line 121 of file extract_yields.cxx.
Referenced by PrintDebug(), and PrintTable().