-
Notifications
You must be signed in to change notification settings - Fork 3
/
CalcBackground.cc
31 lines (25 loc) · 1014 Bytes
/
CalcBackground.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
void CalcBackground(){
vector<TString> years = {"2016v3", "2017v2", "2018"};
// vector<TString> years = {"2016v3"};
vector<TString> processes = {"TTbar", "WJets", "SingleTop", "DYJets", "DiBoson", "QCD"};
vector<TString> channels = {"muon", "elec"};
TString histname = "XCone_cor/M_jet1_";
for(auto year: years){
double mcsum = 0;
vector<double> integrals;
for(auto process: processes){
double integral = 0;
for(auto channel: channels){
TFile *file = new TFile("/nfs/dust/cms/user/schwarzd/MTopJet_Run2/PostSel/"+channel+"/uhh2.AnalysisModuleRunner.MC."+process+"_"+year+".root");
TH1F* hist = (TH1F*) file->Get(histname);
integral += hist->Integral();
mcsum += hist->Integral();
}
integrals.push_back(integral);
}
cout << "--------------------" << endl;
cout << year << endl;
for(int i=0; i<processes.size();i++) cout << " - " << processes[i] << " = " << 100*integrals[i]/mcsum << "%"<< endl;
}
return;
}