40 |
|
// |
41 |
|
// |
42 |
|
|
43 |
< |
void makeNtuple(){ |
43 |
> |
void makeNtuple(int iflag=0){ |
44 |
> |
|
45 |
> |
//------------------------------ |
46 |
> |
// Check the flags |
47 |
> |
//------------------------------ |
48 |
> |
if (iflag < 1 || iflag > 6) { |
49 |
> |
cout << "Usage:" << endl; |
50 |
> |
cout << "makeNtuple(1) for T1tttt" << endl; |
51 |
> |
cout << "makeNtuple(2) for glstop lsp50" << endl; |
52 |
> |
cout << "makeNtuple(3) for glstop lsp250" << endl; |
53 |
> |
cout << "makeNtuple(4) for glsbottom chi150" << endl; |
54 |
> |
cout << "makeNtuple(5) for glsbottom chi300" << endl; |
55 |
> |
cout << "makeNtuple(6) for glsbottom sbpair" << endl; |
56 |
> |
return; |
57 |
> |
} |
58 |
> |
//--------------------------------------------------- |
59 |
> |
// This the model name, used for the root file name |
60 |
> |
//---------------------------------------------------- |
61 |
> |
if (iflag == 1) modelName = "T1tttt"; |
62 |
> |
if (iflag == 2) modelName = "glstop50"; |
63 |
> |
if (iflag == 3) modelName = "glstop250"; |
64 |
> |
if (iflag == 4) modelName = "glsb150"; |
65 |
> |
if (iflag == 5) modelName = "glsb300"; |
66 |
> |
if (iflag == 6) modelName = "sbpair"; |
67 |
|
|
68 |
|
//----------------------------------------------- |
69 |
|
// The name of the file with the output ntuple |
70 |
|
//----------------------------------------------- |
71 |
< |
char* ntFile = "ntuple.root"; |
71 |
> |
char* ntFile = Form("ntuple_%s.root",modelName); |
72 |
|
cout << "The output ntuple will be: " << ntFile << endl; |
73 |
|
|
74 |
|
//----------------------------------------------- |
75 |
< |
// Read in the gluino pair production xsection |
75 |
> |
// Read in the gluino or sbottom pair production xsection |
76 |
|
//----------------------------------------------- |
77 |
|
float xsec_mass[2000]; |
78 |
|
float xsec[2000]; |
79 |
|
float xsecup[2000]; |
80 |
|
float xsecdwn[2000]; |
81 |
|
int nxsec=0; |
82 |
< |
char* xsecFile = "../xsec/xsec_gluino.txt"; |
82 |
> |
char* xsecFile; |
83 |
> |
if (iflag == 6) { |
84 |
> |
xsecFile = "../xsec/xsec_sbottom.txt"; |
85 |
> |
} else { |
86 |
> |
xsecFile = "../xsec/xsec_gluino.txt"; |
87 |
> |
} |
88 |
|
ifstream fromfile(Form("%s",xsecFile)); |
89 |
|
if ( !fromfile.good() ) { |
90 |
|
cout << "gluino xsec file does not exist" << endl ; |
91 |
|
return; |
92 |
|
} |
93 |
< |
cout << "Reading gluino xsection from " << xsecFile << endl; |
93 |
> |
cout << "Reading xsection from " << xsecFile << endl; |
94 |
|
// cout << "ASSUMING THAT THE XSEC IS IN fb...TURN IT INTO pb" << endl; |
95 |
|
int xs=0; |
96 |
|
while (!fromfile.eof()) { |
132 |
|
float err[9][1000]; |
133 |
|
float obslim[9][1000]; |
134 |
|
float explim[9][1000]; |
135 |
+ |
float explimplus[9][1000]; |
136 |
+ |
float explimminus[9][1000]; |
137 |
|
bool usedflag[9][1000]; // a flag to be used later |
138 |
|
int nentries[9]; // number of entries in the file |
139 |
|
|
140 |
|
//----------------------------------------------- |
141 |
|
// The file names, ordered by signal region... |
142 |
+ |
// Again, have to sort out the file names |
143 |
|
//----------------------------------------------- |
144 |
+ |
char* fileWhere; |
145 |
+ |
if (iflag == 1) fileWhere = "../T1tttt/L2_T1tttt"; |
146 |
+ |
if (iflag == 2) fileWhere = "../glstop/lsp50/L2_lsp50"; |
147 |
+ |
if (iflag == 3) fileWhere = "../glstop/lsp250/L2_lsp250"; |
148 |
+ |
if (iflag == 4) fileWhere = "../glsbottom/chi150/L2_chi150"; |
149 |
+ |
if (iflag == 5) fileWhere = "../glsbottom/chi300/L2_chi300"; |
150 |
+ |
if (iflag == 6) fileWhere = "../sbottompair/L2_sbottompair"; |
151 |
|
vector<TString> filenames; |
152 |
< |
filenames.push_back("../T1tttt/L2_T1tttt_SR0_CC.txt"); |
153 |
< |
filenames.push_back("../T1tttt/L2_T1tttt_SR1_CC.txt"); |
154 |
< |
filenames.push_back("../T1tttt/L2_T1tttt_SR2_CC.txt"); |
155 |
< |
filenames.push_back("../T1tttt/L2_T1tttt_SR3_CC.txt"); |
156 |
< |
filenames.push_back("../T1tttt/L2_T1tttt_SR4_CC.txt"); |
157 |
< |
filenames.push_back("../T1tttt/L2_T1tttt_SR5_CC.txt"); |
158 |
< |
filenames.push_back("../T1tttt/L2_T1tttt_SR6_CC.txt"); |
159 |
< |
filenames.push_back("../T1tttt/L2_T1tttt_SR7_CC.txt"); |
160 |
< |
filenames.push_back("../T1tttt/L2_T1tttt_SR8_CC.txt"); |
152 |
> |
for (int kk=0; kk<9; kk++) { |
153 |
> |
filenames.push_back(Form("%s_SR%d_CC.txt", fileWhere,kk)); |
154 |
> |
cout << "Will read from file " << filenames[kk] << endl; |
155 |
> |
} |
156 |
> |
//filenames.push_back("../sbottompair/L2_sbottompair_SR0_CC.txt"); |
157 |
> |
//filenames.push_back("../sbottompair/L2_sbottompair_SR1_CC.txt"); |
158 |
> |
//filenames.push_back("../sbottompair/L2_sbottompair_SR2_CC.txt"); |
159 |
> |
//filenames.push_back("../sbottompair/L2_sbottompair_SR3_CC.txt"); |
160 |
> |
//filenames.push_back("../sbottompair/L2_sbottompair_SR4_CC.txt"); |
161 |
> |
//filenames.push_back("../sbottompair/L2_sbottompair_SR5_CC.txt"); |
162 |
> |
//filenames.push_back("../sbottompair/L2_sbottompair_SR6_CC.txt"); |
163 |
> |
//filenames.push_back("../sbottompair/L2_sbottompair_SR7_CC.txt"); |
164 |
> |
//filenames.push_back("../sbottompair/L2_sbottompair_SR8_CC.txt"); |
165 |
|
|
166 |
|
|
167 |
|
//----------------------------------------------- |
188 |
|
nentries[ireg]++; |
189 |
|
} |
190 |
|
fromfile.close(); |
191 |
< |
// the last entry is junk |
191 |
> |
// the last entry is junk |
192 |
|
nentries[ireg] = nentries[ireg]-1; |
193 |
|
} |
194 |
|
//------------------------------------------- |
246 |
|
for (int sr=0; sr<9; sr++) { |
247 |
|
cout << "Calculating limits for SR" << sr << endl; |
248 |
|
for (int il=0; il<numbLines; il++) { |
249 |
< |
float thisErr = err[sr][il]; |
250 |
< |
double blahObs = observedLimitOnNumberOfEvents(sr+1, 100.*thisErr, false ); |
251 |
< |
double blahExp = expectedLimitOnNumberOfEvents(sr+1, 100.*thisErr, false ); |
252 |
< |
obslim[sr][il] = (float) blahObs; |
253 |
< |
explim[sr][il] = (float) blahExp; |
249 |
> |
float thisErr = err[sr][il]; |
250 |
> |
double blahObs = observedLimitOnNumberOfEvents(sr+1, 100.*thisErr, true ); |
251 |
> |
double blahExp = expectedLimitOnNumberOfEvents(sr+1, 100.*thisErr, false ); |
252 |
> |
double blahExpplus = expectedPlusOneSigmaLimitOnNumberOfEvents(sr+1, 100.*thisErr, false ); |
253 |
> |
double blahExpminus = expectedMinusOneSigmaLimitOnNumberOfEvents(sr+1, 100.*thisErr, false ); |
254 |
> |
obslim[sr][il] = (float) blahObs; |
255 |
> |
explim[sr][il] = (float) blahExp; |
256 |
> |
explimplus[sr][il] = (float) blahExpplus; |
257 |
> |
explimminus[sr][il] = (float) blahExpminus; |
258 |
|
} |
259 |
|
} |
260 |
|
//----------------------------------------------------- |
323 |
|
float explimsr8_ = -1.; |
324 |
|
float explimsrb_ = -1.; // b = best SR |
325 |
|
|
326 |
+ |
float explimplussr0_ = -1.; |
327 |
+ |
float explimplussr1_ = -1.; |
328 |
+ |
float explimplussr2_ = -1.; |
329 |
+ |
float explimplussr3_ = -1.; |
330 |
+ |
float explimplussr4_ = -1.; |
331 |
+ |
float explimplussr5_ = -1.; |
332 |
+ |
float explimplussr6_ = -1.; |
333 |
+ |
float explimplussr7_ = -1.; |
334 |
+ |
float explimplussr8_ = -1.; |
335 |
+ |
float explimplussrb_ = -1.; // b = best SR |
336 |
+ |
|
337 |
+ |
float explimminussr0_ = -1.; |
338 |
+ |
float explimminussr1_ = -1.; |
339 |
+ |
float explimminussr2_ = -1.; |
340 |
+ |
float explimminussr3_ = -1.; |
341 |
+ |
float explimminussr4_ = -1.; |
342 |
+ |
float explimminussr5_ = -1.; |
343 |
+ |
float explimminussr6_ = -1.; |
344 |
+ |
float explimminussr7_ = -1.; |
345 |
+ |
float explimminussr8_ = -1.; |
346 |
+ |
float explimminussrb_ = -1.; // b = best SR |
347 |
+ |
|
348 |
|
|
349 |
|
// put the branches in the tree |
350 |
|
babyTree_->Branch("glmass", &glmass_); |
399 |
|
babyTree_->Branch("explimsr8", &explimsr8_); |
400 |
|
babyTree_->Branch("explimsrb", &explimsrb_); // b = best SR |
401 |
|
|
402 |
+ |
babyTree_->Branch("explimplussr0", &explimplussr0_); |
403 |
+ |
babyTree_->Branch("explimplussr1", &explimplussr1_); |
404 |
+ |
babyTree_->Branch("explimplussr2", &explimplussr2_); |
405 |
+ |
babyTree_->Branch("explimplussr3", &explimplussr3_); |
406 |
+ |
babyTree_->Branch("explimplussr4", &explimplussr4_); |
407 |
+ |
babyTree_->Branch("explimplussr5", &explimplussr5_); |
408 |
+ |
babyTree_->Branch("explimplussr6", &explimplussr6_); |
409 |
+ |
babyTree_->Branch("explimplussr7", &explimplussr7_); |
410 |
+ |
babyTree_->Branch("explimplussr8", &explimplussr8_); |
411 |
+ |
babyTree_->Branch("explimplussrb", &explimplussrb_); // b = best SR |
412 |
+ |
|
413 |
+ |
babyTree_->Branch("explimminussr0", &explimminussr0_); |
414 |
+ |
babyTree_->Branch("explimminussr1", &explimminussr1_); |
415 |
+ |
babyTree_->Branch("explimminussr2", &explimminussr2_); |
416 |
+ |
babyTree_->Branch("explimminussr3", &explimminussr3_); |
417 |
+ |
babyTree_->Branch("explimminussr4", &explimminussr4_); |
418 |
+ |
babyTree_->Branch("explimminussr5", &explimminussr5_); |
419 |
+ |
babyTree_->Branch("explimminussr6", &explimminussr6_); |
420 |
+ |
babyTree_->Branch("explimminussr7", &explimminussr7_); |
421 |
+ |
babyTree_->Branch("explimminussr8", &explimminussr8_); |
422 |
+ |
babyTree_->Branch("explimminussrb", &explimminussrb_); // b = best SR |
423 |
+ |
|
424 |
+ |
|
425 |
|
// fill the variables. |
426 |
|
// Note: the best region is the one with the smallest |
427 |
|
// ratio of expected limit and efficiency |
428 |
|
cout << "Filling an ntuple with " << numbLines << " entries" << endl; |
429 |
+ |
cout << "SR0 is not allowed to be the best region" << endl; |
430 |
|
for (int il=0; il<numbLines; il++) { |
431 |
|
float best = 999999.; |
432 |
|
int ibest = -1; |
438 |
|
errsr0_ = eff[0][il]; |
439 |
|
obslimsr0_ = obslim[0][il]; |
440 |
|
explimsr0_ = explim[0][il]; |
441 |
+ |
explimplussr0_ = explimplus[0][il]; |
442 |
+ |
explimminussr0_ = explimminus[0][il]; |
443 |
|
float temp = explimsr0_/effsr0_; |
444 |
< |
if (temp < best) { |
445 |
< |
best = temp; |
446 |
< |
ibest = 0; |
447 |
< |
} |
444 |
> |
// if (temp < best) { |
445 |
> |
// best = temp; |
446 |
> |
// ibest = 0; |
447 |
> |
// } |
448 |
|
} |
449 |
|
if (nentries[1] != 0) { |
450 |
|
glmass_ = glmass[1][il]; |
453 |
|
errsr1_ = eff[1][il]; |
454 |
|
obslimsr1_ = obslim[1][il]; |
455 |
|
explimsr1_ = explim[1][il]; |
456 |
+ |
explimplussr1_ = explimplus[1][il]; |
457 |
+ |
explimminussr1_ = explimminus[1][il]; |
458 |
|
float temp = explimsr1_/effsr1_; |
459 |
|
if (temp < best) { |
460 |
|
best = temp; |
468 |
|
errsr2_ = eff[2][il]; |
469 |
|
obslimsr2_ = obslim[2][il]; |
470 |
|
explimsr2_ = explim[2][il]; |
471 |
+ |
explimplussr2_ = explimplus[2][il]; |
472 |
+ |
explimminussr2_ = explimminus[2][il]; |
473 |
|
float temp = explimsr2_/effsr2_; |
474 |
|
if (temp < best) { |
475 |
|
best = temp; |
483 |
|
errsr3_ = eff[3][il]; |
484 |
|
obslimsr3_ = obslim[3][il]; |
485 |
|
explimsr3_ = explim[3][il]; |
486 |
+ |
explimplussr3_ = explimplus[3][il]; |
487 |
+ |
explimminussr3_ = explimminus[3][il]; |
488 |
|
float temp = explimsr3_/effsr3_; |
489 |
|
if (temp < best) { |
490 |
|
best = temp; |
498 |
|
errsr4_ = eff[4][il]; |
499 |
|
obslimsr4_ = obslim[4][il]; |
500 |
|
explimsr4_ = explim[4][il]; |
501 |
+ |
explimplussr4_ = explimplus[4][il]; |
502 |
+ |
explimminussr4_ = explimminus[4][il]; |
503 |
|
float temp = explimsr4_/effsr4_; |
504 |
|
if (temp < best) { |
505 |
|
best = temp; |
513 |
|
errsr5_ = eff[5][il]; |
514 |
|
obslimsr5_ = obslim[5][il]; |
515 |
|
explimsr5_ = explim[5][il]; |
516 |
+ |
explimplussr5_ = explimplus[5][il]; |
517 |
+ |
explimminussr5_ = explimminus[5][il]; |
518 |
|
float temp = explimsr5_/effsr5_; |
519 |
|
if (temp < best) { |
520 |
|
best = temp; |
528 |
|
errsr6_ = eff[6][il]; |
529 |
|
obslimsr6_ = obslim[6][il]; |
530 |
|
explimsr6_ = explim[6][il]; |
531 |
+ |
explimplussr6_ = explimplus[6][il]; |
532 |
+ |
explimminussr6_ = explimminus[6][il]; |
533 |
|
float temp = explimsr6_/effsr6_; |
534 |
|
if (temp < best) { |
535 |
|
best = temp; |
543 |
|
errsr7_ = eff[7][il]; |
544 |
|
obslimsr7_ = obslim[7][il]; |
545 |
|
explimsr7_ = explim[7][il]; |
546 |
+ |
explimplussr7_ = explimplus[7][il]; |
547 |
+ |
explimminussr7_ = explimminus[7][il]; |
548 |
|
float temp = explimsr7_/effsr7_; |
549 |
|
if (temp < best) { |
550 |
|
best = temp; |
558 |
|
errsr8_ = eff[8][il]; |
559 |
|
obslimsr8_ = obslim[8][il]; |
560 |
|
explimsr8_ = explim[8][il]; |
561 |
+ |
explimplussr8_ = explimplus[8][il]; |
562 |
+ |
explimminussr8_ = explimminus[8][il]; |
563 |
|
float temp = explimsr8_/effsr8_; |
564 |
|
if (temp < best) { |
565 |
|
best = temp; |
572 |
|
errsrb_ = eff[ibest][il]; |
573 |
|
obslimsrb_ = obslim[ibest][il]; |
574 |
|
explimsrb_ = explim[ibest][il]; |
575 |
+ |
explimplussrb_ = explimplus[ibest][il]; |
576 |
+ |
explimminussrb_ = explimminus[ibest][il]; |
577 |
|
|
578 |
|
// Fill the cross-section |
579 |
|
bool done = false; |