File indexing completed on 2026-05-23 08:11:25
0001 #include <TFile.h>
0002 #include <TH1D.h>
0003 #include <TH2D.h>
0004 #include "BootstrapGenerator/BootstrapGenerator.h"
0005 #include "BootstrapGenerator/TH1DBootstrap.h"
0006 #include "BootstrapGenerator/TH2DBootstrap.h"
0007
0008 R__LOAD_LIBRARY(libBootstrapGenerator.so)
0009
0010 void combine_truthjet(TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, TFile* f_out);
0011 void combine_1Dhist(string histname, string surfix, std::string datatype, TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, TFile* f_out);
0012 void combine_2Dhist(string histname, string surfix, TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, TFile* f_out);
0013 void combine_1Dhist_closure(string surfix, string tag, TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, TFile* f_out);
0014 void combine_2Dhist_closure(string surfix, string tag, TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, TFile* f_out);
0015 void combine_1Dhist_stat(string histname, string surfix, std::string datatype, TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, TFile* f_out);
0016 void combine_2Dhist_stat(string histname, string surfix, TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, TFile* f_out);
0017
0018 const double mb_cross_section = 4.1970e+10;
0019 const double jet5_cross_section = 1.3878e+8;
0020 const double jet12_cross_section = 1.4903e+6;
0021 const double jet20_cross_section = 6.2623e+4;
0022 const double jet30_cross_section = 2.5298e+3;
0023 const double jet40_cross_section = 1.3553e+2;
0024 const double jet50_cross_section = 7.3113;
0025 const double jet60_cross_section = 3.3261e-01;
0026
0027 void get_combinedoutput_mix(int radius_index = 4) {
0028
0029
0030
0031 TFile* f_Jet12GeV = new TFile(Form("output_sim_hadd/output_sim_r0%d_Jet12GeV.root", radius_index), "READ");
0032 TFile* f_Jet20GeV = new TFile(Form("output_sim_hadd/output_sim_r0%d_Jet20GeV.root", radius_index), "READ");
0033 TFile* f_Jet30GeV = new TFile(Form("output_sim_hadd/output_sim_r0%d_Jet30GeV.root", radius_index), "READ");
0034 TFile* f_Jet40GeV = new TFile(Form("output_sim_hadd/output_sim_r0%d_Jet40GeV.root", radius_index), "READ");
0035 TFile* f_Jet50GeV = new TFile(Form("output_sim_hadd/output_sim_r0%d_Jet50GeV.root", radius_index), "READ");
0036
0037 if ( !f_Jet12GeV || !f_Jet20GeV || !f_Jet30GeV || !f_Jet40GeV || !f_Jet50GeV ) {
0038 std::cout << "Error: cannot open one or more input files." << std::endl;
0039 return;
0040 }
0041 TFile* f_combined = new TFile(Form("output_sim_r0%d.root", radius_index), "RECREATE");
0042
0043 combine_truthjet(f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0044
0045 combine_1Dhist("h_recojet_pt_record_nocut", "", "reco", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0046 combine_1Dhist("h_recojet_pt_record", "", "reco", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0047
0048
0049 combine_1Dhist("h_truth", "", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0050 combine_1Dhist("h_measure", "", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0051 combine_2Dhist("h_respmatrix", "", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0052 combine_1Dhist("h_fake", "", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0053 combine_1Dhist("h_miss", "", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0054
0055 combine_1Dhist_stat("h_truth", "_stat", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0056 combine_1Dhist_stat("h_measure", "_stat", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0057 combine_2Dhist_stat("h_respmatrix", "_stat", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0058 combine_1Dhist_stat("h_fake", "_stat", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0059 combine_1Dhist_stat("h_miss", "_stat", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0060
0061
0062 combine_1Dhist("h_truth", "_unreweighted", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0063 combine_1Dhist("h_measure", "_unreweighted", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0064 combine_2Dhist("h_respmatrix", "_unreweighted", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0065 combine_1Dhist("h_fake", "_unreweighted", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0066 combine_1Dhist("h_miss", "_unreweighted", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0067
0068
0069 combine_1Dhist("h_truth", "_jesup", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0070 combine_1Dhist("h_measure", "_jesup", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0071 combine_2Dhist("h_respmatrix", "_jesup", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0072 combine_1Dhist("h_fake", "_jesup", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0073 combine_1Dhist("h_miss", "_jesup", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0074
0075
0076 combine_1Dhist("h_truth", "_jesdown", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0077 combine_1Dhist("h_measure", "_jesdown", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0078 combine_2Dhist("h_respmatrix", "_jesdown", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0079 combine_1Dhist("h_fake", "_jesdown", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0080 combine_1Dhist("h_miss", "_jesdown", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0081
0082
0083 combine_1Dhist("h_truth", "_jerup", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0084 combine_1Dhist("h_measure", "_jerup", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0085 combine_2Dhist("h_respmatrix", "_jerup", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0086 combine_1Dhist("h_fake", "_jerup", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0087 combine_1Dhist("h_miss", "_jerup", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0088
0089
0090 combine_1Dhist("h_truth", "_jerdown", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0091 combine_1Dhist("h_measure", "_jerdown", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0092 combine_2Dhist("h_respmatrix", "_jerdown", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0093 combine_1Dhist("h_fake", "_jerdown", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0094 combine_1Dhist("h_miss", "_jerdown", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0095
0096
0097 combine_1Dhist("h_truth", "_jetup", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0098 combine_1Dhist("h_measure", "_jetup", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0099 combine_2Dhist("h_respmatrix", "_jetup", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0100 combine_1Dhist("h_fake", "_jetup", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0101 combine_1Dhist("h_miss", "_jetup", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0102
0103
0104 combine_1Dhist("h_truth", "_jetdown", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0105 combine_1Dhist("h_measure", "_jetdown", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0106 combine_2Dhist("h_respmatrix", "_jetdown", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0107 combine_1Dhist("h_fake", "_jetdown", "meas", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0108 combine_1Dhist("h_miss", "_jetdown", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0109
0110
0111 combine_1Dhist_closure("h_fullclosure_", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0112 combine_1Dhist_closure("h_fullclosure_", "measure", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0113 combine_2Dhist_closure("h_fullclosure_", "respmatrix", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0114 combine_1Dhist_closure("h_fullclosure_", "fake", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0115 combine_1Dhist_closure("h_fullclosure_", "miss", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0116
0117 combine_1Dhist_closure("h_halfclosure_", "inputmeasure", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0118 combine_1Dhist_closure("h_halfclosure_", "truth", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0119 combine_1Dhist_closure("h_halfclosure_", "measure", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0120 combine_2Dhist_closure("h_halfclosure_", "respmatrix", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0121 combine_1Dhist_closure("h_halfclosure_", "fake", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0122 combine_1Dhist_closure("h_halfclosure_", "miss", f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, f_combined);
0123 }
0124
0125 void combine_truthjet(TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, TFile* f_out) {
0126
0127
0128 TH1D *h_Jet12GeV_event_all = (TH1D*)f_Jet12GeV->Get("h_event_all"); int jet12_event_all = h_Jet12GeV_event_all->GetBinContent(1); double jet12_scale_all = jet12_cross_section / (double)jet12_event_all;
0129 TH1D *h_Jet20GeV_event_all = (TH1D*)f_Jet20GeV->Get("h_event_all"); int jet20_event_all = h_Jet20GeV_event_all->GetBinContent(1); double jet20_scale_all = jet20_cross_section / (double)jet20_event_all;
0130 TH1D *h_Jet30GeV_event_all = (TH1D*)f_Jet30GeV->Get("h_event_all"); int jet30_event_all = h_Jet30GeV_event_all->GetBinContent(1); double jet30_scale_all = jet30_cross_section / (double)jet30_event_all;
0131 TH1D *h_Jet40GeV_event_all = (TH1D*)f_Jet40GeV->Get("h_event_all"); int jet40_event_all = h_Jet40GeV_event_all->GetBinContent(1); double jet40_scale_all = jet40_cross_section / (double)jet40_event_all;
0132 TH1D *h_Jet50GeV_event_all = (TH1D*)f_Jet50GeV->Get("h_event_all"); int jet50_event_all = h_Jet50GeV_event_all->GetBinContent(1); double jet50_scale_all = jet50_cross_section / (double)jet50_event_all;
0133
0134
0135 string histname_all = "h_truthjet_pt_record_all";
0136
0137
0138
0139 TH1D* h_Jet12GeV_all_forcombine = (TH1D*)f_Jet12GeV->Get(histname_all.c_str());
0140 TH1D* h_Jet20GeV_all_forcombine = (TH1D*)f_Jet20GeV->Get(histname_all.c_str());
0141 TH1D* h_Jet30GeV_all_forcombine = (TH1D*)f_Jet30GeV->Get(histname_all.c_str());
0142 TH1D* h_Jet40GeV_all_forcombine = (TH1D*)f_Jet40GeV->Get(histname_all.c_str());
0143 TH1D* h_Jet50GeV_all_forcombine = (TH1D*)f_Jet50GeV->Get(histname_all.c_str());
0144
0145
0146
0147
0148 TH1D* h_all_combined = (TH1D*)h_Jet12GeV_all_forcombine->Clone(histname_all.c_str());
0149 h_all_combined->Scale(jet12_scale_all);
0150
0151
0152 h_all_combined->Add(h_Jet20GeV_all_forcombine, jet20_scale_all);
0153 h_all_combined->Add(h_Jet30GeV_all_forcombine, jet30_scale_all);
0154 h_all_combined->Add(h_Jet40GeV_all_forcombine, jet40_scale_all);
0155 h_all_combined->Add(h_Jet50GeV_all_forcombine, jet50_scale_all);
0156
0157
0158 f_out->cd();
0159 h_all_combined->Write();
0160 }
0161
0162 void combine_1Dhist(string histname, string surfix, std::string datatype, TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, TFile* f_out) {
0163
0164
0165 TH1D *h_Jet12GeV_event_all = (TH1D*)f_Jet12GeV->Get("h_event_all"); int jet12_event_all = h_Jet12GeV_event_all->GetBinContent(1); double jet12_scale_all = jet12_cross_section / (double)jet12_event_all;
0166 TH1D *h_Jet20GeV_event_all = (TH1D*)f_Jet20GeV->Get("h_event_all"); int jet20_event_all = h_Jet20GeV_event_all->GetBinContent(1); double jet20_scale_all = jet20_cross_section / (double)jet20_event_all;
0167 TH1D *h_Jet30GeV_event_all = (TH1D*)f_Jet30GeV->Get("h_event_all"); int jet30_event_all = h_Jet30GeV_event_all->GetBinContent(1); double jet30_scale_all = jet30_cross_section / (double)jet30_event_all;
0168 TH1D *h_Jet40GeV_event_all = (TH1D*)f_Jet40GeV->Get("h_event_all"); int jet40_event_all = h_Jet40GeV_event_all->GetBinContent(1); double jet40_scale_all = jet40_cross_section / (double)jet40_event_all;
0169 TH1D *h_Jet50GeV_event_all = (TH1D*)f_Jet50GeV->Get("h_event_all"); int jet50_event_all = h_Jet50GeV_event_all->GetBinContent(1); double jet50_scale_all = jet50_cross_section / (double)jet50_event_all;
0170
0171
0172 string histname_all = histname + "_all" + surfix;
0173 string histname_zvertex60 = histname + "_zvertex60" + surfix;
0174
0175
0176
0177 TH1D* h_Jet12GeV_all_forcombine = (TH1D*)f_Jet12GeV->Get(histname_all.c_str());
0178 TH1D* h_Jet20GeV_all_forcombine = (TH1D*)f_Jet20GeV->Get(histname_all.c_str());
0179 TH1D* h_Jet30GeV_all_forcombine = (TH1D*)f_Jet30GeV->Get(histname_all.c_str());
0180 TH1D* h_Jet40GeV_all_forcombine = (TH1D*)f_Jet40GeV->Get(histname_all.c_str());
0181 TH1D* h_Jet50GeV_all_forcombine = (TH1D*)f_Jet50GeV->Get(histname_all.c_str());
0182
0183
0184
0185
0186 TH1D* h_all_combined = (TH1D*)h_Jet12GeV_all_forcombine->Clone(histname_all.c_str());
0187 h_all_combined->Scale(jet12_scale_all);
0188
0189
0190 h_all_combined->Add(h_Jet20GeV_all_forcombine, jet20_scale_all);
0191 h_all_combined->Add(h_Jet30GeV_all_forcombine, jet30_scale_all);
0192 h_all_combined->Add(h_Jet40GeV_all_forcombine, jet40_scale_all);
0193 h_all_combined->Add(h_Jet50GeV_all_forcombine, jet50_scale_all);
0194
0195
0196
0197
0198 TH1D* h_Jet12GeV_zvertex60_forcombine = (TH1D*)f_Jet12GeV->Get(histname_zvertex60.c_str());
0199 TH1D* h_Jet20GeV_zvertex60_forcombine = (TH1D*)f_Jet20GeV->Get(histname_zvertex60.c_str());
0200 TH1D* h_Jet30GeV_zvertex60_forcombine = (TH1D*)f_Jet30GeV->Get(histname_zvertex60.c_str());
0201 TH1D* h_Jet40GeV_zvertex60_forcombine = (TH1D*)f_Jet40GeV->Get(histname_zvertex60.c_str());
0202 TH1D* h_Jet50GeV_zvertex60_forcombine = (TH1D*)f_Jet50GeV->Get(histname_zvertex60.c_str());
0203
0204
0205
0206
0207 TH1D* h_zvertex60_combined = (TH1D*)h_Jet12GeV_zvertex60_forcombine->Clone(histname_zvertex60.c_str());
0208 h_zvertex60_combined->Scale(jet12_scale_all);
0209
0210
0211 h_zvertex60_combined->Add(h_Jet20GeV_zvertex60_forcombine, jet20_scale_all);
0212 h_zvertex60_combined->Add(h_Jet30GeV_zvertex60_forcombine, jet30_scale_all);
0213 h_zvertex60_combined->Add(h_Jet40GeV_zvertex60_forcombine, jet40_scale_all);
0214 h_zvertex60_combined->Add(h_Jet50GeV_zvertex60_forcombine, jet50_scale_all);
0215
0216
0217 f_out->cd();
0218 h_all_combined->Write();
0219 h_zvertex60_combined->Write();
0220 }
0221
0222 void combine_2Dhist(string histname, string surfix, TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, TFile* f_out) {
0223
0224
0225 TH1D *h_Jet12GeV_event_all = (TH1D*)f_Jet12GeV->Get("h_event_all"); int jet12_event_all = h_Jet12GeV_event_all->GetBinContent(1); double jet12_scale_all = jet12_cross_section / (double)jet12_event_all;
0226 TH1D *h_Jet20GeV_event_all = (TH1D*)f_Jet20GeV->Get("h_event_all"); int jet20_event_all = h_Jet20GeV_event_all->GetBinContent(1); double jet20_scale_all = jet20_cross_section / (double)jet20_event_all;
0227 TH1D *h_Jet30GeV_event_all = (TH1D*)f_Jet30GeV->Get("h_event_all"); int jet30_event_all = h_Jet30GeV_event_all->GetBinContent(1); double jet30_scale_all = jet30_cross_section / (double)jet30_event_all;
0228 TH1D *h_Jet40GeV_event_all = (TH1D*)f_Jet40GeV->Get("h_event_all"); int jet40_event_all = h_Jet40GeV_event_all->GetBinContent(1); double jet40_scale_all = jet40_cross_section / (double)jet40_event_all;
0229 TH1D *h_Jet50GeV_event_all = (TH1D*)f_Jet50GeV->Get("h_event_all"); int jet50_event_all = h_Jet50GeV_event_all->GetBinContent(1); double jet50_scale_all = jet50_cross_section / (double)jet50_event_all;
0230
0231
0232 string histname_all = histname + "_all" + surfix;
0233 string histname_zvertex60 = histname + "_zvertex60" + surfix;
0234
0235
0236
0237 TH2D* h_Jet12GeV_all_forcombine = (TH2D*)f_Jet12GeV->Get(histname_all.c_str());
0238 TH2D* h_Jet20GeV_all_forcombine = (TH2D*)f_Jet20GeV->Get(histname_all.c_str());
0239 TH2D* h_Jet30GeV_all_forcombine = (TH2D*)f_Jet30GeV->Get(histname_all.c_str());
0240 TH2D* h_Jet40GeV_all_forcombine = (TH2D*)f_Jet40GeV->Get(histname_all.c_str());
0241 TH2D* h_Jet50GeV_all_forcombine = (TH2D*)f_Jet50GeV->Get(histname_all.c_str());
0242
0243
0244
0245
0246 TH2D* h_all_combined = (TH2D*)h_Jet12GeV_all_forcombine->Clone(histname_all.c_str());
0247 h_all_combined->Scale(jet12_scale_all);
0248
0249
0250 h_all_combined->Add(h_Jet20GeV_all_forcombine, jet20_scale_all);
0251 h_all_combined->Add(h_Jet30GeV_all_forcombine, jet30_scale_all);
0252 h_all_combined->Add(h_Jet40GeV_all_forcombine, jet40_scale_all);
0253 h_all_combined->Add(h_Jet50GeV_all_forcombine, jet50_scale_all);
0254
0255
0256
0257
0258 TH2D* h_Jet12GeV_zvertex60_forcombine = (TH2D*)f_Jet12GeV->Get(histname_zvertex60.c_str());
0259 TH2D* h_Jet20GeV_zvertex60_forcombine = (TH2D*)f_Jet20GeV->Get(histname_zvertex60.c_str());
0260 TH2D* h_Jet30GeV_zvertex60_forcombine = (TH2D*)f_Jet30GeV->Get(histname_zvertex60.c_str());
0261 TH2D* h_Jet40GeV_zvertex60_forcombine = (TH2D*)f_Jet40GeV->Get(histname_zvertex60.c_str());
0262 TH2D* h_Jet50GeV_zvertex60_forcombine = (TH2D*)f_Jet50GeV->Get(histname_zvertex60.c_str());
0263
0264
0265
0266
0267 TH2D* h_zvertex60_combined = (TH2D*)h_Jet12GeV_zvertex60_forcombine->Clone(histname_zvertex60.c_str());
0268 h_zvertex60_combined->Scale(jet12_scale_all);
0269
0270
0271 h_zvertex60_combined->Add(h_Jet20GeV_zvertex60_forcombine, jet20_scale_all);
0272 h_zvertex60_combined->Add(h_Jet30GeV_zvertex60_forcombine, jet30_scale_all);
0273 h_zvertex60_combined->Add(h_Jet40GeV_zvertex60_forcombine, jet40_scale_all);
0274 h_zvertex60_combined->Add(h_Jet50GeV_zvertex60_forcombine, jet50_scale_all);
0275
0276
0277 f_out->cd();
0278 h_all_combined->Write();
0279 h_zvertex60_combined->Write();
0280 }
0281
0282 void combine_1Dhist_stat(string histname, string surfix, std::string datatype, TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, TFile* f_out) {
0283
0284
0285 TH1D *h_Jet12GeV_event_all = (TH1D*)f_Jet12GeV->Get("h_event_all"); int jet12_event_all = h_Jet12GeV_event_all->GetBinContent(1); double jet12_scale_all = jet12_cross_section / (double)jet12_event_all;
0286 TH1D *h_Jet20GeV_event_all = (TH1D*)f_Jet20GeV->Get("h_event_all"); int jet20_event_all = h_Jet20GeV_event_all->GetBinContent(1); double jet20_scale_all = jet20_cross_section / (double)jet20_event_all;
0287 TH1D *h_Jet30GeV_event_all = (TH1D*)f_Jet30GeV->Get("h_event_all"); int jet30_event_all = h_Jet30GeV_event_all->GetBinContent(1); double jet30_scale_all = jet30_cross_section / (double)jet30_event_all;
0288 TH1D *h_Jet40GeV_event_all = (TH1D*)f_Jet40GeV->Get("h_event_all"); int jet40_event_all = h_Jet40GeV_event_all->GetBinContent(1); double jet40_scale_all = jet40_cross_section / (double)jet40_event_all;
0289 TH1D *h_Jet50GeV_event_all = (TH1D*)f_Jet50GeV->Get("h_event_all"); int jet50_event_all = h_Jet50GeV_event_all->GetBinContent(1); double jet50_scale_all = jet50_cross_section / (double)jet50_event_all;
0290
0291
0292 string histname_all = histname + "_all" + surfix;
0293 string histname_zvertex60 = histname + "_zvertex60" + surfix;
0294
0295
0296
0297
0298 TH1DBootstrap* h_all_combined = (TH1DBootstrap*)f_Jet12GeV->Get(histname_all.c_str());
0299 TH1DBootstrap* h_Jet20GeV_all_forcombine = (TH1DBootstrap*)f_Jet20GeV->Get(histname_all.c_str());
0300 TH1DBootstrap* h_Jet30GeV_all_forcombine = (TH1DBootstrap*)f_Jet30GeV->Get(histname_all.c_str());
0301 TH1DBootstrap* h_Jet40GeV_all_forcombine = (TH1DBootstrap*)f_Jet40GeV->Get(histname_all.c_str());
0302 TH1DBootstrap* h_Jet50GeV_all_forcombine = (TH1DBootstrap*)f_Jet50GeV->Get(histname_all.c_str());
0303
0304
0305
0306
0307 h_all_combined->Scale(jet12_scale_all);
0308 h_all_combined->Add(h_Jet20GeV_all_forcombine, jet20_scale_all);
0309 h_all_combined->Add(h_Jet30GeV_all_forcombine, jet30_scale_all);
0310 h_all_combined->Add(h_Jet40GeV_all_forcombine, jet40_scale_all);
0311 h_all_combined->Add(h_Jet50GeV_all_forcombine, jet50_scale_all);
0312
0313
0314
0315
0316
0317 TH1DBootstrap* h_zvertex60_combined = (TH1DBootstrap*)f_Jet12GeV->Get(histname_zvertex60.c_str());
0318 TH1DBootstrap* h_Jet20GeV_zvertex60_forcombine = (TH1DBootstrap*)f_Jet20GeV->Get(histname_zvertex60.c_str());
0319 TH1DBootstrap* h_Jet30GeV_zvertex60_forcombine = (TH1DBootstrap*)f_Jet30GeV->Get(histname_zvertex60.c_str());
0320 TH1DBootstrap* h_Jet40GeV_zvertex60_forcombine = (TH1DBootstrap*)f_Jet40GeV->Get(histname_zvertex60.c_str());
0321 TH1DBootstrap* h_Jet50GeV_zvertex60_forcombine = (TH1DBootstrap*)f_Jet50GeV->Get(histname_zvertex60.c_str());
0322
0323
0324
0325
0326 h_zvertex60_combined->Scale(jet12_scale_all);
0327 h_zvertex60_combined->Add(h_Jet20GeV_zvertex60_forcombine, jet20_scale_all);
0328 h_zvertex60_combined->Add(h_Jet30GeV_zvertex60_forcombine, jet30_scale_all);
0329 h_zvertex60_combined->Add(h_Jet40GeV_zvertex60_forcombine, jet40_scale_all);
0330 h_zvertex60_combined->Add(h_Jet50GeV_zvertex60_forcombine, jet50_scale_all);
0331
0332
0333 f_out->cd();
0334 h_all_combined->Write();
0335 h_zvertex60_combined->Write();
0336 }
0337
0338 void combine_2Dhist_stat(string histname, string surfix, TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, TFile* f_out) {
0339
0340
0341 TH1D *h_Jet12GeV_event_all = (TH1D*)f_Jet12GeV->Get("h_event_all"); int jet12_event_all = h_Jet12GeV_event_all->GetBinContent(1); double jet12_scale_all = jet12_cross_section / (double)jet12_event_all;
0342 TH1D *h_Jet20GeV_event_all = (TH1D*)f_Jet20GeV->Get("h_event_all"); int jet20_event_all = h_Jet20GeV_event_all->GetBinContent(1); double jet20_scale_all = jet20_cross_section / (double)jet20_event_all;
0343 TH1D *h_Jet30GeV_event_all = (TH1D*)f_Jet30GeV->Get("h_event_all"); int jet30_event_all = h_Jet30GeV_event_all->GetBinContent(1); double jet30_scale_all = jet30_cross_section / (double)jet30_event_all;
0344 TH1D *h_Jet40GeV_event_all = (TH1D*)f_Jet40GeV->Get("h_event_all"); int jet40_event_all = h_Jet40GeV_event_all->GetBinContent(1); double jet40_scale_all = jet40_cross_section / (double)jet40_event_all;
0345 TH1D *h_Jet50GeV_event_all = (TH1D*)f_Jet50GeV->Get("h_event_all"); int jet50_event_all = h_Jet50GeV_event_all->GetBinContent(1); double jet50_scale_all = jet50_cross_section / (double)jet50_event_all;
0346
0347
0348 string histname_all = histname + "_all" + surfix;
0349 string histname_zvertex60 = histname + "_zvertex60" + surfix;
0350
0351
0352
0353
0354 TH2DBootstrap* h_all_combined = (TH2DBootstrap*)f_Jet12GeV->Get(histname_all.c_str());
0355 TH2DBootstrap* h_Jet20GeV_all_forcombine = (TH2DBootstrap*)f_Jet20GeV->Get(histname_all.c_str());
0356 TH2DBootstrap* h_Jet30GeV_all_forcombine = (TH2DBootstrap*)f_Jet30GeV->Get(histname_all.c_str());
0357 TH2DBootstrap* h_Jet40GeV_all_forcombine = (TH2DBootstrap*)f_Jet40GeV->Get(histname_all.c_str());
0358 TH2DBootstrap* h_Jet50GeV_all_forcombine = (TH2DBootstrap*)f_Jet50GeV->Get(histname_all.c_str());
0359
0360
0361
0362
0363 h_all_combined->Scale(jet12_scale_all);
0364 h_all_combined->Add(h_Jet20GeV_all_forcombine, jet20_scale_all);
0365 h_all_combined->Add(h_Jet30GeV_all_forcombine, jet30_scale_all);
0366 h_all_combined->Add(h_Jet40GeV_all_forcombine, jet40_scale_all);
0367 h_all_combined->Add(h_Jet50GeV_all_forcombine, jet50_scale_all);
0368
0369
0370
0371
0372
0373 TH2DBootstrap* h_zvertex60_combined = (TH2DBootstrap*)f_Jet12GeV->Get(histname_zvertex60.c_str());
0374 TH2DBootstrap* h_Jet20GeV_zvertex60_forcombine = (TH2DBootstrap*)f_Jet20GeV->Get(histname_zvertex60.c_str());
0375 TH2DBootstrap* h_Jet30GeV_zvertex60_forcombine = (TH2DBootstrap*)f_Jet30GeV->Get(histname_zvertex60.c_str());
0376 TH2DBootstrap* h_Jet40GeV_zvertex60_forcombine = (TH2DBootstrap*)f_Jet40GeV->Get(histname_zvertex60.c_str());
0377 TH2DBootstrap* h_Jet50GeV_zvertex60_forcombine = (TH2DBootstrap*)f_Jet50GeV->Get(histname_zvertex60.c_str());
0378
0379
0380
0381
0382 h_zvertex60_combined->Scale(jet12_scale_all);
0383 h_zvertex60_combined->Add(h_Jet20GeV_zvertex60_forcombine, jet20_scale_all);
0384 h_zvertex60_combined->Add(h_Jet30GeV_zvertex60_forcombine, jet30_scale_all);
0385 h_zvertex60_combined->Add(h_Jet40GeV_zvertex60_forcombine, jet40_scale_all);
0386 h_zvertex60_combined->Add(h_Jet50GeV_zvertex60_forcombine, jet50_scale_all);
0387
0388
0389 f_out->cd();
0390 h_all_combined->Write();
0391 h_zvertex60_combined->Write();
0392 }
0393
0394 void combine_1Dhist_closure(string surfix, string tag, TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, TFile* f_out) {
0395
0396
0397 TH1D *h_Jet12GeV_event_all = (TH1D*)f_Jet12GeV->Get("h_event_all"); int jet12_event_all = h_Jet12GeV_event_all->GetBinContent(1); double jet12_scale_all = jet12_cross_section / (double)jet12_event_all;
0398 TH1D *h_Jet20GeV_event_all = (TH1D*)f_Jet20GeV->Get("h_event_all"); int jet20_event_all = h_Jet20GeV_event_all->GetBinContent(1); double jet20_scale_all = jet20_cross_section / (double)jet20_event_all;
0399 TH1D *h_Jet30GeV_event_all = (TH1D*)f_Jet30GeV->Get("h_event_all"); int jet30_event_all = h_Jet30GeV_event_all->GetBinContent(1); double jet30_scale_all = jet30_cross_section / (double)jet30_event_all;
0400 TH1D *h_Jet40GeV_event_all = (TH1D*)f_Jet40GeV->Get("h_event_all"); int jet40_event_all = h_Jet40GeV_event_all->GetBinContent(1); double jet40_scale_all = jet40_cross_section / (double)jet40_event_all;
0401 TH1D *h_Jet50GeV_event_all = (TH1D*)f_Jet50GeV->Get("h_event_all"); int jet50_event_all = h_Jet50GeV_event_all->GetBinContent(1); double jet50_scale_all = jet50_cross_section / (double)jet50_event_all;
0402
0403
0404 string histname = surfix + tag + "_zvertex60";
0405
0406
0407
0408 TH1D* h_Jet12GeV_zvertex60_forcombine = (TH1D*)f_Jet12GeV->Get(histname.c_str());
0409 TH1D* h_Jet20GeV_zvertex60_forcombine = (TH1D*)f_Jet20GeV->Get(histname.c_str());
0410 TH1D* h_Jet30GeV_zvertex60_forcombine = (TH1D*)f_Jet30GeV->Get(histname.c_str());
0411 TH1D* h_Jet40GeV_zvertex60_forcombine = (TH1D*)f_Jet40GeV->Get(histname.c_str());
0412 TH1D* h_Jet50GeV_zvertex60_forcombine = (TH1D*)f_Jet50GeV->Get(histname.c_str());
0413
0414
0415
0416
0417 TH1D* h_zvertex60_combined = (TH1D*)h_Jet12GeV_zvertex60_forcombine->Clone(histname.c_str());
0418 h_zvertex60_combined->Scale(jet12_scale_all);
0419
0420
0421 h_zvertex60_combined->Add(h_Jet20GeV_zvertex60_forcombine, jet20_scale_all);
0422 h_zvertex60_combined->Add(h_Jet30GeV_zvertex60_forcombine, jet30_scale_all);
0423 h_zvertex60_combined->Add(h_Jet40GeV_zvertex60_forcombine, jet40_scale_all);
0424 h_zvertex60_combined->Add(h_Jet50GeV_zvertex60_forcombine, jet50_scale_all);
0425
0426
0427 f_out->cd();
0428 h_zvertex60_combined->Write();
0429 }
0430
0431 void combine_2Dhist_closure(string surfix, string tag, TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, TFile* f_out) {
0432
0433
0434 TH1D *h_Jet12GeV_event_all = (TH1D*)f_Jet12GeV->Get("h_event_all"); int jet12_event_all = h_Jet12GeV_event_all->GetBinContent(1); double jet12_scale_all = jet12_cross_section / (double)jet12_event_all;
0435 TH1D *h_Jet20GeV_event_all = (TH1D*)f_Jet20GeV->Get("h_event_all"); int jet20_event_all = h_Jet20GeV_event_all->GetBinContent(1); double jet20_scale_all = jet20_cross_section / (double)jet20_event_all;
0436 TH1D *h_Jet30GeV_event_all = (TH1D*)f_Jet30GeV->Get("h_event_all"); int jet30_event_all = h_Jet30GeV_event_all->GetBinContent(1); double jet30_scale_all = jet30_cross_section / (double)jet30_event_all;
0437 TH1D *h_Jet40GeV_event_all = (TH1D*)f_Jet40GeV->Get("h_event_all"); int jet40_event_all = h_Jet40GeV_event_all->GetBinContent(1); double jet40_scale_all = jet40_cross_section / (double)jet40_event_all;
0438 TH1D *h_Jet50GeV_event_all = (TH1D*)f_Jet50GeV->Get("h_event_all"); int jet50_event_all = h_Jet50GeV_event_all->GetBinContent(1); double jet50_scale_all = jet50_cross_section / (double)jet50_event_all;
0439
0440
0441 string histname = surfix + tag + "_zvertex60";
0442
0443
0444
0445 TH2D* h_Jet12GeV_zvertex60_forcombine = (TH2D*)f_Jet12GeV->Get(histname.c_str());
0446 TH2D* h_Jet20GeV_zvertex60_forcombine = (TH2D*)f_Jet20GeV->Get(histname.c_str());
0447 TH2D* h_Jet30GeV_zvertex60_forcombine = (TH2D*)f_Jet30GeV->Get(histname.c_str());
0448 TH2D* h_Jet40GeV_zvertex60_forcombine = (TH2D*)f_Jet40GeV->Get(histname.c_str());
0449 TH2D* h_Jet50GeV_zvertex60_forcombine = (TH2D*)f_Jet50GeV->Get(histname.c_str());
0450
0451
0452
0453
0454 TH2D* h_zvertex60_combined = (TH2D*)h_Jet12GeV_zvertex60_forcombine->Clone(histname.c_str());
0455 h_zvertex60_combined->Scale(jet12_scale_all);
0456
0457
0458 h_zvertex60_combined->Add(h_Jet20GeV_zvertex60_forcombine, jet20_scale_all);
0459 h_zvertex60_combined->Add(h_Jet30GeV_zvertex60_forcombine, jet30_scale_all);
0460 h_zvertex60_combined->Add(h_Jet40GeV_zvertex60_forcombine, jet40_scale_all);
0461 h_zvertex60_combined->Add(h_Jet50GeV_zvertex60_forcombine, jet50_scale_all);
0462
0463
0464 f_out->cd();
0465 h_zvertex60_combined->Write();
0466 }