Back to home page

sPhenix code displayed by LXR

 
 

    


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_MB, TFile* f_Jet5GeV, */TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, /*TFile* f_Jet60GeV, */TFile* f_out);
0011 void combine_1Dhist(string histname, string surfix, std::string datatype, /*TFile* f_MB, TFile* f_Jet5GeV, */TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, /*TFile* f_Jet60GeV, */TFile* f_out);
0012 void combine_2Dhist(string histname, string surfix, /*TFile* f_MB, TFile* f_Jet5GeV, */TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, /*TFile* f_Jet60GeV, */TFile* f_out);
0013 void combine_1Dhist_closure(string surfix, string tag, /*TFile* f_MB, TFile* f_Jet5GeV, */TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, /*TFile* f_Jet60GeV, */TFile* f_out);
0014 void combine_2Dhist_closure(string surfix, string tag, /*TFile* f_MB, TFile* f_Jet5GeV, */TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, /*TFile* f_Jet60GeV, */TFile* f_out);
0015 void combine_1Dhist_stat(string histname, string surfix, std::string datatype, /*TFile* f_MB, TFile* f_Jet5GeV, */TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, /*TFile* f_Jet60GeV, */TFile* f_out);
0016 void combine_2Dhist_stat(string histname, string surfix, /*TFile* f_MB, TFile* f_Jet5GeV, */TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, /*TFile* f_Jet60GeV, */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   //TFile* f_MB = new TFile(Form("output_sim_hadd/output_sim_r0%d_MB.root", radius_index), "READ");
0030   //TFile* f_Jet5GeV = new TFile(Form("output_sim_hadd/output_sim_r0%d_Jet5GeV.root", radius_index), "READ");
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   //TFile* f_Jet60GeV = new TFile(Form("output_sim_hadd/output_sim_r0%d_Jet60GeV.root", radius_index), "READ");
0037   if (/*!f_MB || !f_Jet5GeV ||*/ !f_Jet12GeV || !f_Jet20GeV || !f_Jet30GeV || !f_Jet40GeV || !f_Jet50GeV /*|| !f_Jet60GeV*/) {
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_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0044 
0045   combine_1Dhist("h_recojet_pt_record_nocut", "", "reco", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0046   combine_1Dhist("h_recojet_pt_record", "", "reco", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0047 
0048   // Combine nominal histograms
0049   combine_1Dhist("h_truth", "", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0050   combine_1Dhist("h_measure", "", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0051   combine_2Dhist("h_respmatrix", "", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0052   combine_1Dhist("h_fake", "", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0053   combine_1Dhist("h_miss", "", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0054 
0055   combine_1Dhist_stat("h_truth", "_stat", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0056   combine_1Dhist_stat("h_measure", "_stat", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0057   combine_2Dhist_stat("h_respmatrix", "_stat", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0058   combine_1Dhist_stat("h_fake", "_stat", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0059   combine_1Dhist_stat("h_miss", "_stat", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0060 
0061   // Combine unreweighted histograms
0062   combine_1Dhist("h_truth", "_unreweighted", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0063   combine_1Dhist("h_measure", "_unreweighted", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0064   combine_2Dhist("h_respmatrix", "_unreweighted", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0065   combine_1Dhist("h_fake", "_unreweighted", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0066   combine_1Dhist("h_miss", "_unreweighted", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0067 
0068   // Combine JES up variation histograms
0069   combine_1Dhist("h_truth", "_jesup", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0070   combine_1Dhist("h_measure", "_jesup", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0071   combine_2Dhist("h_respmatrix", "_jesup", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0072   combine_1Dhist("h_fake", "_jesup", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0073   combine_1Dhist("h_miss", "_jesup", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0074 
0075   // Combine JES down variation histograms
0076   combine_1Dhist("h_truth", "_jesdown", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0077   combine_1Dhist("h_measure", "_jesdown", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0078   combine_2Dhist("h_respmatrix", "_jesdown", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0079   combine_1Dhist("h_fake", "_jesdown", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0080   combine_1Dhist("h_miss", "_jesdown", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0081 
0082   // Combine JER up variation histograms
0083   combine_1Dhist("h_truth", "_jerup", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0084   combine_1Dhist("h_measure", "_jerup", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0085   combine_2Dhist("h_respmatrix", "_jerup", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0086   combine_1Dhist("h_fake", "_jerup", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0087   combine_1Dhist("h_miss", "_jerup", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0088 
0089   // Combine JER down variation histograms
0090   combine_1Dhist("h_truth", "_jerdown", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0091   combine_1Dhist("h_measure", "_jerdown", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0092   combine_2Dhist("h_respmatrix", "_jerdown", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0093   combine_1Dhist("h_fake", "_jerdown", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0094   combine_1Dhist("h_miss", "_jerdown", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0095 
0096   // Combine jet trigger up variation histograms
0097   combine_1Dhist("h_truth", "_jetup", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0098   combine_1Dhist("h_measure", "_jetup", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0099   combine_2Dhist("h_respmatrix", "_jetup", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0100   combine_1Dhist("h_fake", "_jetup", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0101   combine_1Dhist("h_miss", "_jetup", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0102 
0103   // Combine jet trigger down variation histograms
0104   combine_1Dhist("h_truth", "_jetdown", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0105   combine_1Dhist("h_measure", "_jetdown", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0106   combine_2Dhist("h_respmatrix", "_jetdown", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0107   combine_1Dhist("h_fake", "_jetdown", "meas", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0108   combine_1Dhist("h_miss", "_jetdown", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0109 
0110   // full closure test
0111   combine_1Dhist_closure("h_fullclosure_", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0112   combine_1Dhist_closure("h_fullclosure_", "measure", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0113   combine_2Dhist_closure("h_fullclosure_", "respmatrix", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0114   combine_1Dhist_closure("h_fullclosure_", "fake", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0115   combine_1Dhist_closure("h_fullclosure_", "miss", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0116 
0117   combine_1Dhist_closure("h_halfclosure_", "inputmeasure", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0118   combine_1Dhist_closure("h_halfclosure_", "truth", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0119   combine_1Dhist_closure("h_halfclosure_", "measure", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0120   combine_2Dhist_closure("h_halfclosure_", "respmatrix", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0121   combine_1Dhist_closure("h_halfclosure_", "fake", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0122   combine_1Dhist_closure("h_halfclosure_", "miss", /*f_MB, f_Jet5GeV, */f_Jet12GeV, f_Jet20GeV, f_Jet30GeV, f_Jet40GeV, f_Jet50GeV, /*f_Jet60GeV, */f_combined);
0123 }
0124 
0125 void combine_truthjet(/*TFile* f_MB, TFile* f_Jet5GeV, */TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, /*TFile* f_Jet60GeV, */TFile* f_out) {
0126   //TH1D *h_MB_event_all = (TH1D*)f_MB->Get("h_event_all"); int mb_event_all = h_MB_event_all->GetBinContent(1); double mb_scale_all = mb_cross_section / (double)mb_event_all;
0127   //TH1D *h_Jet5GeV_event_all = (TH1D*)f_Jet5GeV->Get("h_event_all"); int jet5_event_all = h_Jet5GeV_event_all->GetBinContent(1); double jet5_scale_all = jet5_cross_section / (double)jet5_event_all;
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   //TH1D *h_Jet60GeV_event_all = (TH1D*)f_Jet60GeV->Get("h_event_all"); int jet60_event_all = h_Jet60GeV_event_all->GetBinContent(1); double jet60_scale_all = jet60_cross_section / (double)jet60_event_all;
0134 
0135   string histname_all = "h_truthjet_pt_record_all";
0136 
0137   //TH1D* h_MB_all_forcombine = (TH1D*)f_MB->Get(histname_all.c_str());
0138   //TH1D* h_Jet5GeV_all_forcombine = (TH1D*)f_Jet5GeV->Get(histname_all.c_str());
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   //TH1D* h_Jet60GeV_all_forcombine = (TH1D*)f_Jet60GeV->Get(histname_all.c_str());
0145 
0146   //TH1D* h_all_combined = (TH1D*)h_MB_all_forcombine->Clone(histname_all.c_str());
0147   //h_all_combined->Scale(mb_scale_all);
0148   TH1D* h_all_combined = (TH1D*)h_Jet12GeV_all_forcombine->Clone(histname_all.c_str());
0149   h_all_combined->Scale(jet12_scale_all);
0150   //h_all_combined->Add(h_Jet5GeV_all_forcombine, jet5_scale_all);
0151   //h_all_combined->Add(h_Jet12GeV_all_forcombine, jet12_scale_all);
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   //h_all_combined->Add(h_Jet60GeV_all_forcombine, jet60_scale_all);
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_MB, TFile* f_Jet5GeV, */TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, /*TFile* f_Jet60GeV, */TFile* f_out) {
0163   //TH1D *h_MB_event_all = (TH1D*)f_MB->Get("h_event_all"); int mb_event_all = h_MB_event_all->GetBinContent(1); double mb_scale_all = mb_cross_section / (double)mb_event_all;
0164   //TH1D *h_Jet5GeV_event_all = (TH1D*)f_Jet5GeV->Get("h_event_all"); int jet5_event_all = h_Jet5GeV_event_all->GetBinContent(1); double jet5_scale_all = jet5_cross_section / (double)jet5_event_all;
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   //TH1D *h_Jet60GeV_event_all = (TH1D*)f_Jet60GeV->Get("h_event_all"); int jet60_event_all = h_Jet60GeV_event_all->GetBinContent(1); double jet60_scale_all = jet60_cross_section / (double)jet60_event_all;
0171 
0172   string histname_all = histname + "_all" + surfix;
0173   string histname_zvertex60 = histname + "_zvertex60" + surfix;
0174 
0175   //TH1D* h_MB_all_forcombine = (TH1D*)f_MB->Get(histname_all.c_str());
0176   //TH1D* h_Jet5GeV_all_forcombine = (TH1D*)f_Jet5GeV->Get(histname_all.c_str());
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   //TH1D* h_Jet60GeV_all_forcombine = (TH1D*)f_Jet60GeV->Get(histname_all.c_str());
0183 
0184   //TH1D* h_all_combined = (TH1D*)h_MB_all_forcombine->Clone(histname_all.c_str());
0185   //h_all_combined->Scale(mb_scale_all);
0186   TH1D* h_all_combined = (TH1D*)h_Jet12GeV_all_forcombine->Clone(histname_all.c_str());
0187   h_all_combined->Scale(jet12_scale_all);
0188   //h_all_combined->Add(h_Jet5GeV_all_forcombine, jet5_scale_all);
0189   //h_all_combined->Add(h_Jet12GeV_all_forcombine, jet12_scale_all);
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   //h_all_combined->Add(h_Jet60GeV_all_forcombine, jet60_scale_all);
0195 
0196   //TH1D* h_MB_zvertex60_forcombine = (TH1D*)f_MB->Get(histname_zvertex60.c_str());
0197   //TH1D* h_Jet5GeV_zvertex60_forcombine = (TH1D*)f_Jet5GeV->Get(histname_zvertex60.c_str());
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   //TH1D* h_Jet60GeV_zvertex60_forcombine = (TH1D*)f_Jet60GeV->Get(histname_zvertex60.c_str());
0204 
0205   //TH1D* h_zvertex60_combined = (TH1D*)h_MB_zvertex60_forcombine->Clone(histname_zvertex60.c_str());
0206   //h_zvertex60_combined->Scale(mb_scale_all);
0207   TH1D* h_zvertex60_combined = (TH1D*)h_Jet12GeV_zvertex60_forcombine->Clone(histname_zvertex60.c_str());
0208   h_zvertex60_combined->Scale(jet12_scale_all);
0209   //h_zvertex60_combined->Add(h_Jet5GeV_zvertex60_forcombine, jet5_scale_all);
0210   //h_zvertex60_combined->Add(h_Jet12GeV_zvertex60_forcombine, jet12_scale_all);
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   //h_zvertex60_combined->Add(h_Jet60GeV_zvertex60_forcombine, jet60_scale_all);
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_MB, TFile* f_Jet5GeV, */TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, /*TFile* f_Jet60GeV, */TFile* f_out) {
0223   //TH1D *h_MB_event_all = (TH1D*)f_MB->Get("h_event_all"); int mb_event_all = h_MB_event_all->GetBinContent(1); double mb_scale_all = mb_cross_section / (double)mb_event_all;
0224   //TH1D *h_Jet5GeV_event_all = (TH1D*)f_Jet5GeV->Get("h_event_all"); int jet5_event_all = h_Jet5GeV_event_all->GetBinContent(1); double jet5_scale_all = jet5_cross_section / (double)jet5_event_all;
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   //TH1D *h_Jet60GeV_event_all = (TH1D*)f_Jet60GeV->Get("h_event_all"); int jet60_event_all = h_Jet60GeV_event_all->GetBinContent(1); double jet60_scale_all = jet60_cross_section / (double)jet60_event_all;
0231 
0232   string histname_all = histname + "_all" + surfix;
0233   string histname_zvertex60 = histname + "_zvertex60" + surfix;
0234 
0235   //TH2D* h_MB_all_forcombine = (TH2D*)f_MB->Get(histname_all.c_str());
0236   //TH2D* h_Jet5GeV_all_forcombine = (TH2D*)f_Jet5GeV->Get(histname_all.c_str());
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   //TH2D* h_Jet60GeV_all_forcombine = (TH2D*)f_Jet60GeV->Get(histname_all.c_str());
0243 
0244   //TH2D* h_all_combined = (TH2D*)h_MB_all_forcombine->Clone(histname_all.c_str());
0245   //h_all_combined->Scale(mb_scale_all);
0246   TH2D* h_all_combined = (TH2D*)h_Jet12GeV_all_forcombine->Clone(histname_all.c_str());
0247   h_all_combined->Scale(jet12_scale_all);
0248   //h_all_combined->Add(h_Jet5GeV_all_forcombine, jet5_scale_all);
0249   //h_all_combined->Add(h_Jet12GeV_all_forcombine, jet12_scale_all);
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   //h_all_combined->Add(h_Jet60GeV_all_forcombine, jet60_scale_all);
0255 
0256   //TH2D* h_MB_zvertex60_forcombine = (TH2D*)f_MB->Get(histname_zvertex60.c_str());
0257   //TH2D* h_Jet5GeV_zvertex60_forcombine = (TH2D*)f_Jet5GeV->Get(histname_zvertex60.c_str());
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   //TH2D* h_Jet60GeV_zvertex60_forcombine = (TH2D*)f_Jet60GeV->Get(histname_zvertex60.c_str());
0264 
0265   //TH2D* h_zvertex60_combined = (TH2D*)h_MB_zvertex60_forcombine->Clone(histname_zvertex60.c_str());
0266   //h_zvertex60_combined->Scale(mb_scale_all);
0267   TH2D* h_zvertex60_combined = (TH2D*)h_Jet12GeV_zvertex60_forcombine->Clone(histname_zvertex60.c_str());
0268   h_zvertex60_combined->Scale(jet12_scale_all);
0269   //h_zvertex60_combined->Add(h_Jet5GeV_zvertex60_forcombine, jet5_scale_all);
0270   //h_zvertex60_combined->Add(h_Jet12GeV_zvertex60_forcombine, jet12_scale_all);
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   //h_zvertex60_combined->Add(h_Jet60GeV_zvertex60_forcombine, jet60_scale_all);
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_MB, TFile* f_Jet5GeV, */TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, /*TFile* f_Jet60GeV, */TFile* f_out) {
0283   //TH1D *h_MB_event_all = (TH1D*)f_MB->Get("h_event_all"); int mb_event_all = h_MB_event_all->GetBinContent(1); double mb_scale_all = mb_cross_section / (double)mb_event_all;
0284   //TH1D *h_Jet5GeV_event_all = (TH1D*)f_Jet5GeV->Get("h_event_all"); int jet5_event_all = h_Jet5GeV_event_all->GetBinContent(1); double jet5_scale_all = jet5_cross_section / (double)jet5_event_all;
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   //TH1D *h_Jet60GeV_event_all = (TH1D*)f_Jet60GeV->Get("h_event_all"); int jet60_event_all = h_Jet60GeV_event_all->GetBinContent(1); double jet60_scale_all = jet60_cross_section / (double)jet60_event_all;
0291 
0292   string histname_all = histname + "_all" + surfix;
0293   string histname_zvertex60 = histname + "_zvertex60" + surfix;
0294 
0295   //TH1DBootstrap* h_all_combined = (TH1DBootstrap*)f_MB->Get(histname_all.c_str());
0296   //TH1DBootstrap* h_Jet5GeV_all_forcombine = (TH1DBootstrap*)f_Jet5GeV->Get(histname_all.c_str());
0297   //TH1DBootstrap* h_Jet12GeV_all_forcombine = (TH1DBootstrap*)f_Jet12GeV->Get(histname_all.c_str());
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   //TH1DBootstrap* h_Jet60GeV_all_forcombine = (TH1DBootstrap*)f_Jet60GeV->Get(histname_all.c_str());
0304   //h_all_combined->Scale(mb_scale_all);
0305   //h_all_combined->Add(h_Jet5GeV_all_forcombine, jet5_scale_all);
0306   //h_all_combined->Add(h_Jet12GeV_all_forcombine, jet12_scale_all);
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   //h_all_combined->Add(h_Jet60GeV_all_forcombine, jet60_scale_all);
0313 
0314   //TH1DBootstrap* h_zvertex60_combined = (TH1DBootstrap*)f_MB->Get(histname_zvertex60.c_str());
0315   //TH1DBootstrap* h_Jet5GeV_zvertex60_forcombine = (TH1DBootstrap*)f_Jet5GeV->Get(histname_zvertex60.c_str());
0316   //TH1DBootstrap* h_Jet12GeV_zvertex60_forcombine = (TH1DBootstrap*)f_Jet12GeV->Get(histname_zvertex60.c_str());
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   //TH1DBootstrap* h_Jet60GeV_zvertex60_forcombine = (TH1DBootstrap*)f_Jet60GeV->Get(histname_zvertex60.c_str());
0323   //h_zvertex60_combined->Scale(mb_scale_all);
0324   //h_zvertex60_combined->Add(h_Jet5GeV_zvertex60_forcombine, jet5_scale_all);
0325   //h_zvertex60_combined->Add(h_Jet12GeV_zvertex60_forcombine, jet12_scale_all);
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   //h_zvertex60_combined->Add(h_Jet60GeV_zvertex60_forcombine, jet60_scale_all);
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_MB, TFile* f_Jet5GeV, */TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, /*TFile* f_Jet60GeV, */TFile* f_out) {
0339   //TH1D *h_MB_event_all = (TH1D*)f_MB->Get("h_event_all"); int mb_event_all = h_MB_event_all->GetBinContent(1); double mb_scale_all = mb_cross_section / (double)mb_event_all;
0340   //TH1D *h_Jet5GeV_event_all = (TH1D*)f_Jet5GeV->Get("h_event_all"); int jet5_event_all = h_Jet5GeV_event_all->GetBinContent(1); double jet5_scale_all = jet5_cross_section / (double)jet5_event_all;
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   //TH1D *h_Jet60GeV_event_all = (TH1D*)f_Jet60GeV->Get("h_event_all"); int jet60_event_all = h_Jet60GeV_event_all->GetBinContent(1); double jet60_scale_all = jet60_cross_section / (double)jet60_event_all;
0347 
0348   string histname_all = histname + "_all" + surfix;
0349   string histname_zvertex60 = histname + "_zvertex60" + surfix;
0350 
0351   //TH2DBootstrap* h_all_combined = (TH2DBootstrap*)f_MB->Get(histname_all.c_str());
0352   //TH2DBootstrap* h_Jet5GeV_all_forcombine = (TH2DBootstrap*)f_Jet5GeV->Get(histname_all.c_str());
0353   //TH2DBootstrap* h_Jet12GeV_all_forcombine = (TH2DBootstrap*)f_Jet12GeV->Get(histname_all.c_str());
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   //TH2DBootstrap* h_Jet60GeV_all_forcombine = (TH2DBootstrap*)f_Jet60GeV->Get(histname_all.c_str());
0360   //h_all_combined->Scale(mb_scale_all);
0361   //h_all_combined->Add(h_Jet5GeV_all_forcombine, jet5_scale_all);
0362   //h_all_combined->Add(h_Jet12GeV_all_forcombine, jet12_scale_all);
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   //h_all_combined->Add(h_Jet60GeV_all_forcombine, jet60_scale_all);
0369 
0370   //TH2DBootstrap* h_zvertex60_combined = (TH2DBootstrap*)f_MB->Get(histname_zvertex60.c_str());
0371   //TH2DBootstrap* h_Jet5GeV_zvertex60_forcombine = (TH2DBootstrap*)f_Jet5GeV->Get(histname_zvertex60.c_str());
0372   //TH2DBootstrap* h_Jet12GeV_zvertex60_forcombine = (TH2DBootstrap*)f_Jet12GeV->Get(histname_zvertex60.c_str());
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   //TH2DBootstrap* h_Jet60GeV_zvertex60_forcombine = (TH2DBootstrap*)f_Jet60GeV->Get(histname_zvertex60.c_str());
0379   //h_zvertex60_combined->Scale(mb_scale_all);
0380   //h_zvertex60_combined->Add(h_Jet5GeV_zvertex60_forcombine, jet5_scale_all);
0381   //h_zvertex60_combined->Add(h_Jet12GeV_zvertex60_forcombine, jet12_scale_all);
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   //h_zvertex60_combined->Add(h_Jet60GeV_zvertex60_forcombine, jet60_scale_all);
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_MB, TFile* f_Jet5GeV, */TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, /*TFile* f_Jet60GeV, */TFile* f_out) {
0395   //TH1D *h_MB_event_all = (TH1D*)f_MB->Get("h_event_all"); int mb_event_all = h_MB_event_all->GetBinContent(1); double mb_scale_all = mb_cross_section / (double)mb_event_all;
0396   //TH1D *h_Jet5GeV_event_all = (TH1D*)f_Jet5GeV->Get("h_event_all"); int jet5_event_all = h_Jet5GeV_event_all->GetBinContent(1); double jet5_scale_all = jet5_cross_section / (double)jet5_event_all;
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   //TH1D *h_Jet60GeV_event_all = (TH1D*)f_Jet60GeV->Get("h_event_all"); int jet60_event_all = h_Jet60GeV_event_all->GetBinContent(1); double jet60_scale_all = jet60_cross_section / (double)jet60_event_all;
0403 
0404   string histname = surfix + tag + "_zvertex60";
0405 
0406   //TH1D* h_MB_zvertex60_forcombine = (TH1D*)f_MB->Get(histname.c_str());
0407   //TH1D* h_Jet5GeV_zvertex60_forcombine = (TH1D*)f_Jet5GeV->Get(histname.c_str());
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   //TH1D* h_Jet60GeV_zvertex60_forcombine = (TH1D*)f_Jet60GeV->Get(histname.c_str());
0414 
0415   //TH1D* h_zvertex60_combined = (TH1D*)h_MB_zvertex60_forcombine->Clone(histname.c_str());
0416   //h_zvertex60_combined->Scale(mb_scale_all);
0417   TH1D* h_zvertex60_combined = (TH1D*)h_Jet12GeV_zvertex60_forcombine->Clone(histname.c_str());
0418   h_zvertex60_combined->Scale(jet12_scale_all);
0419   //h_zvertex60_combined->Add(h_Jet5GeV_zvertex60_forcombine, jet5_scale_all);
0420   //h_zvertex60_combined->Add(h_Jet12GeV_zvertex60_forcombine, jet12_scale_all);
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   //h_zvertex60_combined->Add(h_Jet60GeV_zvertex60_forcombine, jet60_scale_all);
0426 
0427   f_out->cd();
0428   h_zvertex60_combined->Write();
0429 }
0430 
0431 void combine_2Dhist_closure(string surfix, string tag, /*TFile* f_MB, TFile* f_Jet5GeV, */TFile* f_Jet12GeV, TFile* f_Jet20GeV, TFile* f_Jet30GeV, TFile* f_Jet40GeV, TFile* f_Jet50GeV, /*TFile* f_Jet60GeV, */TFile* f_out) {
0432   //TH1D *h_MB_event_all = (TH1D*)f_MB->Get("h_event_all"); int mb_event_all = h_MB_event_all->GetBinContent(1); double mb_scale_all = mb_cross_section / (double)mb_event_all;
0433   //TH1D *h_Jet5GeV_event_all = (TH1D*)f_Jet5GeV->Get("h_event_all"); int jet5_event_all = h_Jet5GeV_event_all->GetBinContent(1); double jet5_scale_all = jet5_cross_section / (double)jet5_event_all;
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   //TH1D *h_Jet60GeV_event_all = (TH1D*)f_Jet60GeV->Get("h_event_all"); int jet60_event_all = h_Jet60GeV_event_all->GetBinContent(1); double jet60_scale_all = jet60_cross_section / (double)jet60_event_all;
0440 
0441   string histname = surfix + tag + "_zvertex60";
0442 
0443   //TH2D* h_MB_zvertex60_forcombine = (TH2D*)f_MB->Get(histname.c_str());
0444   //TH2D* h_Jet5GeV_zvertex60_forcombine = (TH2D*)f_Jet5GeV->Get(histname.c_str());
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   //TH2D* h_Jet60GeV_zvertex60_forcombine = (TH2D*)f_Jet60GeV->Get(histname.c_str());
0451 
0452   //TH2D* h_zvertex60_combined = (TH2D*)h_MB_zvertex60_forcombine->Clone(histname.c_str());
0453   //h_zvertex60_combined->Scale(mb_scale_all);
0454   TH2D* h_zvertex60_combined = (TH2D*)h_Jet12GeV_zvertex60_forcombine->Clone(histname.c_str());
0455   h_zvertex60_combined->Scale(jet12_scale_all);
0456   //h_zvertex60_combined->Add(h_Jet5GeV_zvertex60_forcombine, jet5_scale_all);
0457   //h_zvertex60_combined->Add(h_Jet12GeV_zvertex60_forcombine, jet12_scale_all);
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   //h_zvertex60_combined->Add(h_Jet60GeV_zvertex60_forcombine, jet60_scale_all);
0463 
0464   f_out->cd();
0465   h_zvertex60_combined->Write();
0466 }