6 #include <initializer_list> 44 int main(
int argc,
char *argv[]){
45 time_t begtime, endtime;
47 cout << fixed << setprecision(2);
49 string midjets(
""); midjets += to_string(atoi(
hijets.c_str())-1);
50 string minjets2l(
""); minjets2l += to_string(atoi(
minjets.c_str())-1);
51 string midjets2l(
""); midjets2l += to_string(atoi(midjets.c_str())-1);
53 string hostname =
execute(
"echo $HOSTNAME");
54 string bfolder(
"/net/cms2/cms2r0/babymaker/");
55 if(
Contains(hostname,
"lxplus")) bfolder =
"/afs/cern.ch/user/m/manuelf/work/";
56 TString foldermc(bfolder+
"babies/2016_06_14/mc/merged_standard/");
57 TString folderdata(bfolder+
"babies/2016_06_14/data/skim_standard/");
58 if(
method.Contains(
"met150")){
59 foldermc = bfolder+
"babies/2016_06_14/mc/merged_1lht500met150nj5/";
60 folderdata = bfolder+
"babies/2016_06_14/data/merged_1lht500met150nj5/";
63 cout<<
"folderdata is "<<folderdata<<endl;
64 cout<<
"foldermc is "<<foldermc<<endl;
66 string stitch_cuts(
"stitch");
68 {foldermc+
"/*TTJets*Lept*.root/tree"},
69 {foldermc+
"/*TTJets_HT*.root/tree"}
72 {foldermc+
"/*_WJetsToLNu*.root/tree"},
73 {foldermc+
"/*_TTWJets*.root/tree"},
74 {foldermc+
"/*_TTZTo*.root/tree"},
75 {foldermc+
"/*_ST_*.root/tree"},
76 {foldermc+
"/*DYJetsToLL*.root/tree"},
77 {foldermc+
"/*QCD_HT*.root/tree"},
78 {foldermc+
"/*_WWTo*.root/tree"},
79 {foldermc+
"/*_TTGJets*.root/tree"},
80 {foldermc+
"/*_TTTT*.root/tree"},
81 {foldermc+
"/*_WZ*.root/tree"},
82 {foldermc+
"/*_ZZ*.root/tree"},
83 {foldermc+
"/*_ZJet*.root/tree"},
84 {foldermc+
"/*_WH_HToBB*.root/tree"},
85 {foldermc+
"/*_ZH_HToBB*.root/tree"},
87 {foldermc+
"/*ttHJetTobb*.root/tree"}
90 {foldermc+
"/*T1tttt*1500*-100_*.root/tree"}
91 },
Cut(),
false,
true};
93 {foldermc+
"/*T1tttt*1200*800*.root/tree"}
94 },
Cut(),
false,
true};
96 string data_cuts(
"(trig[4]||trig[8]||trig[13]||trig[33])&&nonblind");
98 {folderdata+
"/*.root/tree"}
102 set<Process> backgrounds{
ttbar, other};
105 Cut baseline2l{
"pass&&ht>500&&met>150&&met<=500"};
108 string c_r1=
"mt<=140 && mj14>250&&mj14<=400";
109 string c_r2=
"mt<=140 && mj14>400";
110 string c_r3=
"mj14>250&&mj14<=400";
111 string c_r4=
"mj14>400";
114 string c_lowmet=
"&&met>200&&met<=350";
115 string c_midmet=
"&&met>350&&met<=500";
116 if (
method.Contains(
"met150")){
117 c_lowmet=
"&&met>150&&met<=200";
119 cout<<
"c_lowmet is "<<c_lowmet<<endl;
121 string c_allnj=
"&&njets>="+
minjets;
122 string c_lownj=
"&&njets>="+
minjets+
"&&njets<="+midjets;
123 string c_hignj=
"&&njets>"+midjets;
124 string c_allnj2l=
"&&njets>="+minjets2l;
125 string c_lownj2l=
"&&njets>="+minjets2l+
"&&njets<="+midjets2l;
126 string c_hignj2l=
"&&njets>"+midjets2l;
129 string c_1l=
"&&nleps==1&&nveto==0&&nbm>=1";
130 string c_2l=
"nleps==2&&nbm<=2";
131 string c_veto=
"nleps==1&&nveto==1&&nbm>=1&&nbm<=2&&mt>140";
134 string c_2lvetoallnj=
"&&(("+c_2l+c_allnj2l+
")||("+c_veto+c_allnj+
"))";
135 string c_2lvetolownj=
"&&(("+c_2l+c_lownj2l+
")||("+c_veto+c_lownj+
"))";
136 string c_2lvetohignj=
"&&(("+c_2l+c_hignj2l+
")||("+c_veto+c_hignj+
"))";
137 c_2l =
"&&"+c_2l; c_veto =
"&&"+c_veto;
140 string c_2ltotallnj = c_2l+c_allnj2l, c_2ltotlownj = c_2l+c_lownj2l, c_2ltothignj = c_2l+c_hignj2l;
141 if(
method.Contains(
"mveto")) {
142 c_2ltotallnj = c_veto+c_allnj;
143 c_2ltotlownj = c_veto+c_lownj;
144 c_2ltothignj = c_veto+c_hignj;
146 if(
method.Contains(
"m2lveto")) {
147 c_2ltotallnj = c_2lvetoallnj;
148 c_2ltotlownj = c_2lvetolownj;
149 c_2ltothignj = c_2lvetohignj;
152 cout<<c_r1 + c_1l + c_lowmet + c_allnj<<endl;
153 cout<<c_r2 + c_1l + c_lowmet + c_lownj<<endl;
154 cout<<c_r2 + c_1l + c_lowmet + c_hignj<<endl;
155 cout<< c_r3 + c_2ltotallnj + c_lowmet<<endl;
156 cout<< c_r4 + c_2ltotlownj + c_lowmet<<endl;
157 cout<< c_r4 + c_2ltothignj + c_lowmet<<endl;
188 set<Block> blocks_2l{
189 {
"lowmet", {{r1_lowmet_allnj, r2_lowmet_lownj, r2_lowmet_hignj},
190 {d3_lowmet_allnj, d4_lowmet_lownj, d4_lowmet_hignj}}},
191 {
"midmet", {{r1_midmet_allnj, r2_midmet_lownj, r2_midmet_hignj},
192 {d3_midmet_allnj, d4_midmet_lownj, d4_midmet_hignj}}}
195 if(
method.Contains(
"met150")){
197 {
"lowmet", {{r1_lowmet_allnj, r2_lowmet_lownj, r2_lowmet_hignj},
198 {d3_lowmet_allnj, d4_lowmet_lownj, d4_lowmet_hignj}}}
202 Cut *pbaseline(&baseline2l);
203 set<Block> *pblocks(&blocks_2l);
204 string sysfile(
"txt/systematics/m1bk.txt");
206 pbaseline = &baseline2l;
207 pblocks = &blocks_2l;
208 sysfile =
"txt/systematics/m2l.txt";
211 TString lumi_s(
"_lumi"); lumi_s +=
lumi; lumi_s.ReplaceAll(
".",
"p");
212 lumi_s.ReplaceAll(
"00000000000001",
""); lumi_s.ReplaceAll(
"39999999999999",
"4"); lumi_s.ReplaceAll(
"499999999999995",
"5");
213 TString sig_s(
"_sig"); sig_s +=
sig_strength; sig_s.ReplaceAll(
".",
"p");
214 sig_s.ReplaceAll(
"00000000000001",
"");
215 string blind_name =
"";
217 blind_name =
"_unblinded";
219 blind_name =
"_1bunblinded";
221 blind_name =
"_r4blinded";
225 +(
no_kappa ?
"_nokappa" :
"")+
string(
"_c_met")
227 +sig_s+lumi_s.Data()+blind_name+
identifier+
".root");
233 wgc.SetLuminosity(
lumi);
234 wgc.SetDoDilepton(
false);
238 wgc.WriteToFile(outname);
253 cout<<
"Finding workspaces took "<<difftime(endtime, begtime)<<
" seconds"<<endl<<endl;
258 static struct option long_options[] = {
259 {
"lumi", required_argument, 0,
'l'},
260 {
"unblind", required_argument, 0,
'u'},
261 {
"do_syst", no_argument, 0, 0},
262 {
"lowj", required_argument, 0,
'j'},
263 {
"hij", required_argument, 0,
'h'},
264 {
"himet", required_argument, 0,
'm'},
265 {
"mj", required_argument, 0,
's'},
266 {
"nokappa", no_argument, 0,
'k'},
267 {
"method", required_argument, 0,
't'},
268 {
"use_r4", no_argument, 0,
'4'},
269 {
"toys", required_argument, 0, 0},
270 {
"sig_strength", required_argument, 0,
'g'},
271 {
"identifier", required_argument, 0,
'i'},
277 opt = getopt_long(argc, argv,
"l:u:j:h:m:s:kt:4g:i:", long_options, &option_index);
278 if( opt == -1)
break;
289 if(
string(optarg)==
"all"){
291 }
else if(
string(optarg)==
"sideband"){
293 }
else if(
string(optarg)==
"1b"){
324 optname = long_options[option_index].name;
325 if(optname ==
"do_syst"){
327 }
else if(optname ==
"toys"){
330 printf(
"Bad option! Found option name %s\n", optname.c_str());
334 printf(
"Bad option! getopt_long returned character code 0%o\n", opt);
WorkspaceGenerator & SetLuminosity(double luminosity)
WorkspaceGenerator & SetDoSystematics(bool do_systematics)
int main(int argc, char *argv[])
void ReplaceAll(std::string &str, const std::string &orig, const std::string &rep)
bool Contains(const std::string &str, const std::string &pat)
std::string execute(const std::string &cmd)
WorkspaceGenerator & SetKappaCorrected(bool do_kappa_correction)
WorkspaceGenerator & SetDoDilepton(bool do_systematics)
void GetOptions(int argc, char *argv[])
void WriteToFile(const std::string &file_name)
SYSTEMATIC dilep PROCESSES ttbar
TString method("m2lveto")
size_t AddToys(size_t num_toys=0)