-
Notifications
You must be signed in to change notification settings - Fork 2
/
ra2bRoostatsClass4ln.h
505 lines (336 loc) · 13.9 KB
/
ra2bRoostatsClass4ln.h
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
#ifndef ra2bRoostatsClass4ln_h
#define ra2bRoostatsClass4ln_h
#include "TRandom2.h"
#include "RooRealVar.h"
#include "RooFormulaVar.h"
#include "RooWorkspace.h"
#include "RooPoisson.h"
#include "RooGaussian.h"
#include "RooProdPdf.h"
#include "RooWorkspace.h"
#include "RooDataSet.h"
#include "RooFitResult.h"
//
// Owen Long, UCR
// Harrison Prosper, FSU
// Sezen Sekmen, FSU
//
class ra2bRoostatsClass4ln {
public :
ra2bRoostatsClass4ln( bool ArgUseSigTtwjVar=false, bool ArgUseLdpVars=true, int ArgznnModel=1 ) ;
virtual ~ra2bRoostatsClass4ln();
bool initialize( const char* infile ) ;
bool reinitialize( ) ;
bool doFit() ;
bool susyScanNoContam( const char* inputScanFile, const char* outputFilebase="output-files/scanplot-nocontam" ) ;
bool susyScanWithContam( const char* inputScanFile, const char* outputFilebase="output-files/scanplot-withcontam" , bool isT1bbbb = false ) ;
bool discoveryScanWithContam( const char* inputScanFile ) ;
bool nosusysignifScanWithContam( const char* inputScanFile ) ;
bool setSusyScanPoint( const char* inputScanFile, double m0, double m12, bool isT1bbbb = false, double t1bbbbXsec=0. ) ;
bool profileSusySig( float& susySigLow, float& susySigHigh, bool makePlot=true, const char* plotname="output-files/prof_susy_sig.png", double scanMax=-1. ) ;
bool profileZnnSig( float& znnSigLow, float& znnSigHigh, bool makePlot=true, const char* plotname="output-files/prof_znn_sig.png", double scanMax=-1. ) ;
bool profileZnnSb( float& znnSbLow, float& znnSbHigh, bool makePlot=true, const char* plotname="output-files/prof_znn_sb.png", double scanMax=-1. ) ;
bool profilettwjSig( float& ttwjSigLow, float& ttwjSigHigh, bool makePlot=true, const char* plotname="output-files/prof_ttwj_sig.png", double scanMax=-1. ) ;
bool profilettwjSb( float& ttwjSbLow, float& ttwjSbHigh, bool makePlot=true, const char* plotname="output-files/prof_ttwj_sb.png", double scanMax=-1. ) ;
bool profileqcdSig( float& qcdSigLow, float& qcdSigHigh, bool makePlot=true, const char* plotname="output-files/prof_qcd_sig.png", double scanMax=-1. ) ;
bool profileqcdSb( float& qcdSbLow, float& qcdSbHigh, bool makePlot=true, const char* plotname="output-files/prof_qcd_sb.png", double scanMax=-1. ) ;
void parameterSnapshot() ;
bool fitQualityPlot( bool doNorm=false, const char* plotname="output-files/fit_qual.png", double hmax=1.5 ) ;
void setAndFixSusySig( double setVal = 0. ) ;
void freeSusySig() ;
//--- things for CLs
void saveToymeanSnapshot() ;
void genToyExperiment() ;
void saveDataObservableVals() ;
void setObservablesToDataVals() ;
double doToyStudy( int nToys=1000, bool isBgonlyStudy=true, double data_q = 0. ) ;
double doToyStudyNoSusyInFit( int nToys=1000, const char* trueValsInputFile="" ) ;
void setAndFixSusySigToPredictedValue() ;
double getLogLikelihoodValue() ;
private :
char initializeFile[10000] ;
bool varsAtFitVals ;
bool useSigTtwjVar ;
bool useLdpVars ;
int znnModel ;
bool initialized ;
double toy_mu0_ttbar_sig ;
double toy_mu0_qcd_sig ;
double toy_mu0_ttbar_sb ;
double toy_mu0_qcd_sb ;
double toy_mu0_susy_sig ;
double toy_mu0_allbg_sig ;
//======= Observables ==============================================================
//-- data counts in signal region, A, and D, SB, SIG-SL, SB-SL.
RooRealVar* rv_Nsig ;
RooRealVar* rv_Nsb ;
RooRealVar* rv_Nsig_sl ;
RooRealVar* rv_Nsb_sl ;
RooRealVar* rv_Nsig_ldp ;
RooRealVar* rv_Nsb_ldp ;
RooRealVar* rv_Nlsb_0b ;
RooRealVar* rv_Nlsb_0b_ldp ;
//-- Znn model 1
RooRealVar* rv_Nsb_ee ;
RooRealVar* rv_Nsig_ee ;
RooRealVar* rv_Nsb_mm ;
RooRealVar* rv_Nsig_mm ;
//-- Znn model 2
RooRealVar* rv_Nsigsb_ee ;
RooRealVar* rv_Nsigsb_mm ;
//========= Parameters ==============================================================
//-- ttwj
RooRealVar* rrv_mu_ttwj_sig ;
RooRealVar* rrv_mu_ttwj_sb ;
RooFormulaVar* rfv_mu_ttwj_sig ;
RooFormulaVar* rfv_mu_ttwj_sb ;
RooAbsArg* rv_mu_ttwj_sig ;
RooAbsArg* rv_mu_ttwj_sb ;
RooRealVar* rv_mu_ttwj_sig_sl ;
RooRealVar* rv_mu_ttwj_sb_sl ;
RooFormulaVar* rv_mu_ttwj_sig_ldp ;
RooFormulaVar* rv_mu_ttwj_sb_ldp ;
//-- susy
RooRealVar* rv_mu_susy_sig ;
RooFormulaVar* rv_mu_susy_sb ;
RooFormulaVar* rv_mu_susy_sig_sl ;
RooFormulaVar* rv_mu_susy_sb_sl ;
RooFormulaVar* rv_mu_susy_sig_ldp ;
RooFormulaVar* rv_mu_susy_sb_ldp ;
//-- QCD
RooRealVar* rrv_mu_qcd_sig ;
RooRealVar* rrv_mu_qcd_sb ;
RooRealVar* rrv_mu_qcd_sig_ldp ;
RooRealVar* rrv_mu_qcd_sb_ldp ;
RooFormulaVar* rfv_mu_qcd_sig ;
RooFormulaVar* rfv_mu_qcd_sb ;
RooFormulaVar* rfv_mu_qcd_sig_ldp ;
RooFormulaVar* rfv_mu_qcd_sb_ldp ;
RooAbsArg* rv_mu_qcd_sig ;
RooAbsArg* rv_mu_qcd_sb ;
RooAbsArg* rv_mu_qcd_sig_ldp ;
RooAbsArg* rv_mu_qcd_sb_ldp ;
RooRealVar* rv_mu_qcd_lsb_0b ;
RooRealVar* rv_mu_qcd_lsb_0b_ldp ;
//-- Z to nunu, general
RooRealVar* rv_mu_znn_sig ;
RooAbsArg* rv_mu_znn_sb ;
RooFormulaVar* rv_mu_znn_sig_ldp ;
RooFormulaVar* rv_mu_znn_sb_ldp ;
//-- Z to nunu, model 1
RooRealVar* rrv_mu_znn_sb ;
RooFormulaVar* rv_mu_zee_sig_ee ;
RooFormulaVar* rv_mu_zee_sb_ee ;
RooFormulaVar* rv_mu_zmm_sig_mm ;
RooFormulaVar* rv_mu_zmm_sb_mm ;
//-- Z to nunu, model 2
RooFormulaVar* rfv_mu_znn_sb ;
RooFormulaVar* rv_mu_zee_sigsb_ee ;
RooFormulaVar* rv_mu_zmm_sigsb_mm ;
//-- EW0
RooFormulaVar* rv_mu_ewo_sig ;
RooFormulaVar* rv_mu_ewo_sb ;
RooFormulaVar* rv_mu_ewo_sig_ldp ;
RooFormulaVar* rv_mu_ewo_sb_ldp ;
//-- Gaussian constraints and constants.
RooRealVar* rv_eff_sf_prim ;
RooRealVar* rv_eff_sf_nom ;
RooFormulaVar* rv_eff_sf_sig ;
RooFormulaVar* rv_eff_sf_sb ;
RooFormulaVar* rv_eff_sf_sig_sl ;
RooFormulaVar* rv_eff_sf_sb_sl ;
RooFormulaVar* rv_eff_sf_sig_ldp ;
RooFormulaVar* rv_eff_sf_sb_ldp ;
RooRealVar* rv_width_eff_sf_sig ;
RooRealVar* rv_width_eff_sf_sb ;
RooRealVar* rv_width_eff_sf_sig_sl ;
RooRealVar* rv_width_eff_sf_sb_sl ;
RooRealVar* rv_width_eff_sf_sig_ldp ;
RooRealVar* rv_width_eff_sf_sb_ldp ;
RooRealVar* rv_mean_eff_sf_sig ;
RooRealVar* rv_mean_eff_sf_sb ;
RooRealVar* rv_mean_eff_sf_sig_sl ;
RooRealVar* rv_mean_eff_sf_sb_sl ;
RooRealVar* rv_mean_eff_sf_sig_ldp ;
RooRealVar* rv_mean_eff_sf_sb_ldp ;
RooRealVar* rv_sf_mc ;
RooRealVar* rv_sf_qcd_sb ;
RooRealVar* rv_sf_qcd_sig ;
RooRealVar* rv_sf_ttwj_sig ;
RooRealVar* rv_sf_ee ;
RooRealVar* rv_sf_mm ;
RooRealVar* rv_acc_ee ;
RooRealVar* rv_acc_mm ;
RooRealVar* rv_eff_ee ;
RooRealVar* rv_eff_mm ;
RooRealVar* rv_fsig_ee ;
RooRealVar* rv_fsig_mm ;
RooRealVar* rv_knn_sig ;
RooRealVar* rv_knn_sb ;
RooRealVar* rv_znnoverll_bfratio ;
RooRealVar* rv_dataoverll_lumiratio ;
//++++ MC inputs +++++++++++++++++++++++
RooRealVar* rv_mu_susymc_sig ;
RooRealVar* rv_mu_susymc_sb ;
RooRealVar* rv_mu_susymc_sig_sl ;
RooRealVar* rv_mu_susymc_sb_sl ;
RooRealVar* rv_mu_susymc_sig_ldp ;
RooRealVar* rv_mu_susymc_sb_ldp ;
//-- SIG
RooRealVar* rv_mu_Ewomc_sig ;
//-- SB
RooRealVar* rv_mu_Ewomc_sb ;
//-- SIG, LDP
RooRealVar* rv_mu_ttbarmc_sig_ldp ;
RooRealVar* rv_mu_WJmc_sig_ldp ;
RooRealVar* rv_mu_Znnmc_sig_ldp ;
RooRealVar* rv_mu_Ewomc_sig_ldp ;
//-- SB, LDP
RooRealVar* rv_mu_ttbarmc_sb_ldp ;
RooRealVar* rv_mu_WJmc_sb_ldp ;
RooRealVar* rv_mu_Znnmc_sb_ldp ;
RooRealVar* rv_mu_Ewomc_sb_ldp ;
//========= Expected counts for observables in terms of parameters ============================
RooFormulaVar* rv_n_sig ;
RooFormulaVar* rv_n_sb ;
RooFormulaVar* rv_n_sig_ldp ;
RooFormulaVar* rv_n_sb_ldp ;
RooFormulaVar* rv_n_sig_sl ;
RooFormulaVar* rv_n_sb_sl ;
RooFormulaVar* rv_n_lsb_0b ;
RooFormulaVar* rv_n_lsb_0b_ldp ;
//-- Znn model 1
RooFormulaVar* rv_n_sig_ee ;
RooFormulaVar* rv_n_sb_ee ;
RooFormulaVar* rv_n_sig_mm ;
RooFormulaVar* rv_n_sb_mm ;
//-- Znn model 2
RooFormulaVar* rv_n_sigsb_ee ;
RooFormulaVar* rv_n_sigsb_mm ;
//=========== Mean values and sigmas for nuisance parameters (things with Gaussian PDFs in likelihood).
RooRealVar* np_m_sf_mc ;
RooRealVar* np_m_sf_qcd_sb ;
RooRealVar* np_m_sf_qcd_sig ;
RooRealVar* np_m_sf_ttwj_sig ;
RooRealVar* np_m_sf_ee ;
RooRealVar* np_m_sf_mm ;
RooRealVar* np_m_acc_ee ;
RooRealVar* np_m_acc_mm ;
RooRealVar* np_m_eff_ee ;
RooRealVar* np_m_eff_mm ;
RooRealVar* np_m_fsig_ee ;
RooRealVar* np_m_fsig_mm ;
RooRealVar* np_m_knn_sig ;
RooRealVar* np_m_knn_sb ;
RooRealVar* np_s_sf_mc ;
RooRealVar* np_s_sf_qcd_sb ;
RooRealVar* np_s_sf_qcd_sig ;
RooRealVar* np_s_sf_ttwj_sig ;
RooRealVar* np_s_sf_ee ;
RooRealVar* np_s_sf_mm ;
RooRealVar* np_s_acc_ee ;
RooRealVar* np_s_acc_mm ;
RooRealVar* np_s_eff_ee ;
RooRealVar* np_s_eff_mm ;
RooRealVar* np_s_fsig_ee ;
RooRealVar* np_s_fsig_mm ;
RooRealVar* np_s_knn_sig ;
RooRealVar* np_s_knn_sb ;
//=========== PDFs for the likelihood ============================================================
RooPoisson* pdf_Nsig ;
RooPoisson* pdf_Nsb ;
RooPoisson* pdf_Nsig_ldp ;
RooPoisson* pdf_Nsb_ldp ;
RooPoisson* pdf_Nsig_sl ;
RooPoisson* pdf_Nsb_sl ;
RooPoisson* pdf_Nlsb_0b ;
RooPoisson* pdf_Nlsb_0b_ldp ;
RooGaussian* pdf_eff_sf_prim ;
RooGaussian* pdf_sf_mc ;
RooGaussian* pdf_sf_qcd_sb ;
RooGaussian* pdf_sf_qcd_sig ;
RooGaussian* pdf_sf_ttwj_sig ;
RooGaussian* pdf_sf_ee ;
RooGaussian* pdf_sf_mm ;
RooGaussian* pdf_acc_ee ;
RooGaussian* pdf_acc_mm ;
RooGaussian* pdf_eff_ee ;
RooGaussian* pdf_eff_mm ;
RooGaussian* pdf_fsig_ee ;
RooGaussian* pdf_fsig_mm ;
//-- Znn model 1
RooPoisson* pdf_Nsig_ee ;
RooPoisson* pdf_Nsb_ee ;
RooPoisson* pdf_Nsig_mm ;
RooPoisson* pdf_Nsb_mm ;
//-- Znn model 2
RooPoisson* pdf_Nsigsb_ee ;
RooPoisson* pdf_Nsigsb_mm ;
RooGaussian* pdf_knn_sig ;
RooGaussian* pdf_knn_sb ;
RooProdPdf* likelihood ;
//============ Other things =================================================================
float EffScaleFactor, EffScaleFactorErr ;
float lsf_WJmc, lsf_WJmc_err ;
float lsf_Znnmc, lsf_Znnmc_err ;
float lsf_Ewomc, lsf_Ewomc_err ;
float sf_ttbarmc, sf_ttbarmc_err ;
float DataLumi ;
float acc_ee_mean ;
float acc_ee_err ;
float acc_mm_mean ;
float acc_mm_err ;
float eff_ee_mean ;
float eff_ee_err ;
float eff_mm_mean ;
float eff_mm_err ;
float knn_sig_mean ;
float knn_sig_err ;
float knn_sb_mean ;
float knn_sb_err ;
float Ztoll_lumi ;
float fsig_ee_mean ;
float fsig_ee_err ;
float fsig_mm_mean ;
float fsig_mm_err ;
RooArgSet observedParametersList ;
RooDataSet* dsObserved ;
RooWorkspace* workspace ;
RooFitResult* fitResult ;
//========= Stuff needed for CLs below here ==================================================
//++++ Model predictions from fitting data to BG-only hypothesis (susy fixed to zero in fit)
double toymean_n_sig ;
double toymean_n_sb ;
double toymean_n_sig_ldp ;
double toymean_n_sb_ldp ;
double toymean_n_sig_sl ;
double toymean_n_sb_sl ;
double toymean_n_lsb_0b ;
double toymean_n_lsb_0b_ldp ;
//-- Znn model 1
double toymean_n_sig_ee ;
double toymean_n_sb_ee ;
double toymean_n_sig_mm ;
double toymean_n_sb_mm ;
//-- Znn model 2
double toymean_n_sigsb_ee ;
double toymean_n_sigsb_mm ;
TTree* tt_bgonly ;
TTree* tt_splusb ;
TRandom2* trandom_cls ;
double dataval_Nsig ;
double dataval_Nsb ;
double dataval_Nsig_sl ;
double dataval_Nsb_sl ;
double dataval_Nsig_ldp ;
double dataval_Nsb_ldp ;
double dataval_Nlsb_0b ;
double dataval_Nlsb_0b_ldp ;
double dataval_Nsig_ee ;
double dataval_Nsb_ee ;
double dataval_Nsig_mm ;
double dataval_Nsb_mm ;
double dataval_Nsigsb_ee ;
double dataval_Nsigsb_mm ;
} ;
#endif