-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompilereference_4e_bkg.C
174 lines (131 loc) · 6.05 KB
/
compilereference_4e_bkg.C
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#if !defined(__CINT__) || defined(__MAKECINT__)
#include "HZZ4LeptonsAnalysis_4e.h"
#include <TTree.h>
#include <TFile.h>
#include <TString.h>
#include <TROOT.h>
//#include <string>
#include <iostream>
#include <TSystem.h>
#include <TH2.h>
#include "TChain.h"
#include <stdlib.h>
#endif
using namespace std;
int main (int argc, char ** argv){
string site=argv[7];
cout << site << " configuration" <<endl;
string dataconf=argv[8];
cout << dataconf << " data configuration" <<endl;
string mcconf=argv[9];
cout << mcconf << " mc configuration" <<endl;
// bkg
ifstream fbkg;
fbkg.open(argv[3]);
const int nlines = atoi(argv[4]);
string bkgsamples[nlines];
float bkgninput[nlines];
float bkgnhlt[nlines];
float bkgnskim[nlines];
float bkgxsection[nlines];
cout << "Bkg samples" << endl;
for(int i=0;i<nlines;i++){
fbkg >> bkgsamples[i] >> bkgninput[i] >> bkgnhlt[i] >> bkgnskim[i] >> bkgxsection[i];
cout << "Sample=" << bkgsamples[i] << " Ninput=" << bkgninput[i] << " NHLT=" << bkgnhlt[i] << " NSkim=" << bkgnskim[i] << " Xsection(pb)=" << bkgxsection[i] << endl;
}
//
float lumifb=0.;
if (mcconf.find("Fall15")<5) lumifb=2.8;
Double_t mH=150.;
cout << "mH= " << mH << endl;
// Run on bkg
bool runonbkg=true;
if (runonbkg==true){
bool itera=false;
//if (mH<=160.){
// if (i==0) itera=true;
//}
//else {
itera=true;
//}
for(int i=0;i<nlines && itera==true;i++){
string name= "roottree_leptons_crab_"+bkgsamples[i]+".root";
TString dirInput;
if (site.find("CERN")<5){
if (mcconf.find("Fall11")<5) dirInput="/castor/cern.ch/user/n/ndefilip/Paper/MCFall11"; // to run at CERN
else dirInput="/castor/cern.ch/user/n/ndefilip/Paper/MCSummer12"; // to run at CERN
}
else if (site.find("DESY")<5){
dirInput="/nfs/dust/test/cmsdas/school16/HZZ4lExercise/bkg"; //to run at DESY
}
else if (site.find("FNAL")<5 && mcconf.find("Fall11")<5){
dirInput="dcap://cmsgridftp.fnal.gov:24125/pnfs/fnal.gov/usr/cms/WAX/11/store/user/cmsdas/2014/HZZ4lExercise/bkg/Fall11";
}
else if (site.find("FNAL")<5 && mcconf.find("Summer12")<5 ){
dirInput="dcap://cmsgridftp.fnal.gov:24125/pnfs/fnal.gov/usr/cms/WAX/11/store/user/cmsdas/2014/HZZ4lExercise/bkg/Summer12";
}
else if (mcconf.find("Fall11")<5){
dirInput="/lustre/cms/store/user/defilip/Fall11_445_paper_step_analysis_merged";
}
else if (mcconf.find("Summer12")<5){
dirInput="/lustre/cms/store/user/defilip/Summer12_53X_paper_step_analysis_merged";
}
else if (mcconf.find("Fall15")<5){
dirInput="/lustre/cms/store/user/dburns/MonoHiggs/Fall15_25ns_merged";
}
TString bkgFile=name;
Char_t nome[300];
sprintf(nome,"%s/%s",dirInput.Data(),bkgFile.Data());
float weight= lumifb*(bkgxsection[i]*1000.*bkgnskim[i]/bkgninput[i])/bkgnskim[i];
cout << "weight is " << weight << endl;
TFile *file3;
TTree *tree3;
if (bkgFile.Contains("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8")){
TChain* chain = new TChain("HZZ4LeptonsAnalysis","");
chain->Add("/lustre/cms/store/user/gminiell/MonoHiggs/Fall15_25ns_merged/roottree_leptons_crab_DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8.root");
chain->Add("/lustre/cms/store/user/gminiell/MonoHiggs/Fall15_25ns_merged/roottree_leptons_crab_DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_1.root");
chain->Add("/lustre/cms/store/user/gminiell/MonoHiggs/Fall15_25ns_merged/roottree_leptons_crab_DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_2.root");
chain->Add("/lustre/cms/store/user/gminiell/MonoHiggs/Fall15_25ns_merged/roottree_leptons_crab_DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_3.root");
tree3 = chain;
}
else if (bkgFile.Contains("ZZTo4L_13TeV_powheg_pythia8")){
TChain* chain = new TChain("HZZ4LeptonsAnalysis","");
chain->Add("/lustre/cms/store/user/dburns/MonoHiggs/Fall15_25ns_merged/roottree_leptons_crab_ZZTo4L_13TeV_powheg_pythia8.root");
chain->Add("/lustre/cms/store/user/dburns/MonoHiggs/Fall15_25ns_merged/roottree_leptons_crab_ZZTo4L_13TeV_powheg_pythia8_1.root");
tree3 = chain;
}
else if (bkgFile.Contains("TTTo2L2Nu_13TeV-powheg")){
TChain* chain = new TChain("HZZ4LeptonsAnalysis","");
chain->Add("/lustre/cms/store/user/dburns/MonoHiggs/Fall15_25ns_merged/roottree_leptons_crab_TTTo2L2Nu_13TeV-powheg.root");
chain->Add("/lustre/cms/store/user/dburns/MonoHiggs/Fall15_25ns_merged/roottree_leptons_crab_TTTo2L2Nu_13TeV-powheg_1.root");
tree3 = chain;
}
else if (bkgFile.Contains("WJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8")){
TChain* chain = new TChain("HZZ4LeptonsAnalysis","");
chain->Add("/lustre/cms/store/user/dburns/MonoHiggs/Fall15_25ns_merged/roottree_leptons_crab_WJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8.root");
chain->Add("/lustre/cms/store/user/dburns/MonoHiggs/Fall15_25ns_merged/roottree_leptons_crab_WJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_1.root");
chain->Add("/lustre/cms/store/user/dburns/MonoHiggs/Fall15_25ns_merged/roottree_leptons_crab_WJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_2.root");
chain->Add("/lustre/cms/store/user/dburns/MonoHiggs/Fall15_25ns_merged/roottree_leptons_crab_WJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_3.root");
chain->Add("/lustre/cms/store/user/dburns/MonoHiggs/Fall15_25ns_merged/roottree_leptons_crab_WJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_4.root");
tree3 = chain;
}
else {
file3 = TFile::Open(nome);
cout << "Read file with name: " << nome << endl;
tree3 = (TTree*)file3->Get("HZZ4LeptonsAnalysis");
}
HZZ4LeptonsAnalysis make3(tree3,weight,dataconf,mcconf);
char *path=NULL;
size_t size=300;
path=getcwd(path,size);
// cout << "Path is " << path << endl;
sprintf(nome,"%s/output_%s.root",path,bkgsamples[i].c_str());
// cout << "Output file name is " << nome << endl;
make3.Loop(nome);
cout << "Create file with name: " << nome << endl;
delete tree3;
file3 -> Close();
}
}
return 0;
}