ThinSliceDriver.h
Go to the documentation of this file.
1 #ifndef THINSLICEDRIVER_hh
2 #define THINSLICEDRIVER_hh
3 
4 #include <map>
5 #include <vector>
6 
7 #include "TTree.h"
8 #include "TFile.h"
9 #include "TH1D.h"
10 
11 #include "ThinSliceSample.h"
12 #include "ThinSliceDataSet.h"
13 #include "ThinSliceSystematic.h"
14 #include "ThinSliceEvent.h"
15 
16 #include "fhiclcpp/ParameterSet.h"
17 
18 namespace protoana {
20  public:
21  ThinSliceDriver(const fhicl::ParameterSet & extra_options);
22  virtual ~ThinSliceDriver();
23 
24  virtual void FillMCEvents(
25  TTree * tree, std::vector<ThinSliceEvent> & events,
26  std::vector<ThinSliceEvent> & fake_data_events,
27  int & split_val, const bool & do_split) = 0;
28 
29  virtual void BuildDataHists(
30  TTree * tree, ThinSliceDataSet & data_set, double & flux,
31  int split_val = 0) = 0;
32 
33  virtual void BuildFakeData(
34  TTree * tree,
35  std::map<int, std::vector<std::vector<ThinSliceSample>>> & samples,
36  const std::map<int, bool> & signal_sample_checks,
37  ThinSliceDataSet & data_set, double & flux,
38  std::map<int, std::vector<double>> & sample_scales,
39  std::vector<double> & beam_energy_bins,
40  int split_val = 0) = 0;
41 
42  virtual void BuildMCSamples(
43  //TTree * tree,
44  const std::vector<ThinSliceEvent> & events,
45  std::map<int, std::vector<std::vector<ThinSliceSample>>> & samples,
46  const std::map<int, bool> & signal_sample_checks,
47  std::map<int, double> & nominal_fluxes,
48  std::map<int, std::vector<std::vector<double>>> & fluxes_by_sample,
49  std::vector<double> & beam_energy_bins) = 0;
50 
51  virtual void RefillMCSamples(
52  const std::vector<ThinSliceEvent> & events,
53  std::map<int, std::vector<std::vector<ThinSliceSample>>> & samples,
54  const std::map<int, bool> & signal_sample_checks,
55  std::vector<double> & beam_energy_bins,
56  const std::map<int, std::vector<double>> & signal_pars,
57  const std::map<int, double> & flux_pars,
58  const std::map<std::string, ThinSliceSystematic> & syst_pars,
59  bool fit_under_over, bool fill_incident = false) = 0;
60 
61  /*
62  virtual void BuildSystSamples(
63  TTree * tree,
64  std::map<int, std::vector<std::vector<ThinSliceSample>>> & samples,
65  const std::map<int, bool> & signal_sample_checks,
66  std::vector<double> & beam_energy_bins) = 0;*/
67 
68  virtual std::pair<double, size_t> CalculateChi2(
69  std::map<int, std::vector<std::vector<ThinSliceSample>>> & samples,
70  ThinSliceDataSet & data_set) = 0;
71 
72  virtual void CompareSelections(
73  std::map<int, std::vector<std::vector<ThinSliceSample>>> & samples,
74  ThinSliceDataSet & data_set,
75  TFile & output_file,
76  std::vector<std::pair<int, int>> plot_style,
77  bool plot_rebinned,
78  bool post_fit, int nPars,
79  TDirectory * plot_dir) = 0;
80 
81  virtual void GetCurrentHists(
82  std::map<int, std::vector<std::vector<ThinSliceSample>>> & samples,
83  ThinSliceDataSet & data_set,
84  std::map<int, std::vector<TH1*>> & hists,
85  bool plot_rebinned) = 0;
86 
87  virtual void GetCurrentTruthHists(
88  std::map<int, std::vector<std::vector<ThinSliceSample>>> & samples,
89  std::map<int, std::vector<TH1*>> & hists,
90  std::map<int, std::vector<TH1*>> & inc_hists,
91  std::map<int, std::vector<TH1*>> & xsec_hists,
92  const std::vector<int> & incident_samples,
93  const std::map<int, std::vector<double>> & signal_bins) = 0;
94 
95  virtual void PlotThrows(
96  ThinSliceDataSet & data_set, std::map<int, std::vector<TH1*>> & throw_hists,
97  std::map<int, std::vector<std::vector<ThinSliceSample>>> & samples,
98  size_t nThrows,
99  std::map<int, std::vector<TH1*>> & truth_throw_hists,
100  std::map<int, std::vector<TH1*>> & truth_inc_hists,
101  std::map<int, std::vector<TH1*>> & truth_xsec_hists,
102  std::map<int, TH1*> & best_fit_incs,
103  std::map<int, TH1*> & best_fit_xsecs,
104  std::map<int, TH1*> & nominal_incs,
105  std::map<int, TH1*> & nominal_xsecs,
106  TFile & output_file, bool plot_rebinned,
107  std::map<int, std::vector<double>> * sample_scales = 0x0) = 0;
108 
109  /*virtual void PostFitThrows(
110  std::map<int, std::vector<std::vector<ThinSliceSample>>> & samples,
111  ThinSliceDataSet & data_set,
112  TH1D & pars,
113  TH2D & cov,
114  TFile & output_file,
115  std::vector<std::pair<int, int>> plot_style,
116  bool plot_rebinned) = 0;*/
117 
118  void CompareDataMC(
119  std::map<int, std::vector<std::vector<ThinSliceSample>>> & samples,
120  ThinSliceDataSet & data_set,
121  TFile & output_file,
122  std::vector<std::pair<int, int>> plot_style,
123  int nPars,
124  TDirectory * plot_dir,
125  bool plot_rebinned = false,
126  bool post_fit = false);
127 
128  std::pair<int, int> GetColorAndStyle(
129  size_t i, const std::vector<std::pair<int, int>> & plot_style);
130 
131  virtual void SetupSysts(
132  const std::vector<ThinSliceEvent> & events,
133  std::map<int, std::vector<std::vector<ThinSliceSample>>> & samples,
134  const std::map<int, bool> & signal_sample_checks,
135  std::vector<double> & beam_energy_bins,
136  const std::map<std::string, ThinSliceSystematic> & pars,
137  TFile & output_file) = 0;
138  virtual void WrapUpSysts(TFile & output_file) = 0;
139  protected:
141  private:
142 };
143 }
144 #endif
virtual void BuildDataHists(TTree *tree, ThinSliceDataSet &data_set, double &flux, int split_val=0)=0
std::pair< int, int > GetColorAndStyle(size_t i, const std::vector< std::pair< int, int >> &plot_style)
virtual void BuildMCSamples(const std::vector< ThinSliceEvent > &events, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, std::map< int, double > &nominal_fluxes, std::map< int, std::vector< std::vector< double >>> &fluxes_by_sample, std::vector< double > &beam_energy_bins)=0
void CompareDataMC(std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, ThinSliceDataSet &data_set, TFile &output_file, std::vector< std::pair< int, int >> plot_style, int nPars, TDirectory *plot_dir, bool plot_rebinned=false, bool post_fit=false)
virtual void CompareSelections(std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, ThinSliceDataSet &data_set, TFile &output_file, std::vector< std::pair< int, int >> plot_style, bool plot_rebinned, bool post_fit, int nPars, TDirectory *plot_dir)=0
virtual void RefillMCSamples(const std::vector< ThinSliceEvent > &events, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, std::vector< double > &beam_energy_bins, const std::map< int, std::vector< double >> &signal_pars, const std::map< int, double > &flux_pars, const std::map< std::string, ThinSliceSystematic > &syst_pars, bool fit_under_over, bool fill_incident=false)=0
virtual void FillMCEvents(TTree *tree, std::vector< ThinSliceEvent > &events, std::vector< ThinSliceEvent > &fake_data_events, int &split_val, const bool &do_split)=0
struct vector vector
ThinSliceDriver(const fhicl::ParameterSet &extra_options)
virtual std::pair< double, size_t > CalculateChi2(std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, ThinSliceDataSet &data_set)=0
virtual void SetupSysts(const std::vector< ThinSliceEvent > &events, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, std::vector< double > &beam_energy_bins, const std::map< std::string, ThinSliceSystematic > &pars, TFile &output_file)=0
virtual void GetCurrentHists(std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, ThinSliceDataSet &data_set, std::map< int, std::vector< TH1 * >> &hists, bool plot_rebinned)=0
virtual void WrapUpSysts(TFile &output_file)=0
fhicl::ParameterSet fExtraOptions
virtual void GetCurrentTruthHists(std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, std::map< int, std::vector< TH1 * >> &hists, std::map< int, std::vector< TH1 * >> &inc_hists, std::map< int, std::vector< TH1 * >> &xsec_hists, const std::vector< int > &incident_samples, const std::map< int, std::vector< double >> &signal_bins)=0
virtual void PlotThrows(ThinSliceDataSet &data_set, std::map< int, std::vector< TH1 * >> &throw_hists, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, size_t nThrows, std::map< int, std::vector< TH1 * >> &truth_throw_hists, std::map< int, std::vector< TH1 * >> &truth_inc_hists, std::map< int, std::vector< TH1 * >> &truth_xsec_hists, std::map< int, TH1 * > &best_fit_incs, std::map< int, TH1 * > &best_fit_xsecs, std::map< int, TH1 * > &nominal_incs, std::map< int, TH1 * > &nominal_xsecs, TFile &output_file, bool plot_rebinned, std::map< int, std::vector< double >> *sample_scales=0x0)=0
virtual void BuildFakeData(TTree *tree, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, ThinSliceDataSet &data_set, double &flux, std::map< int, std::vector< double >> &sample_scales, std::vector< double > &beam_energy_bins, int split_val=0)=0