@@ -40,7 +40,7 @@ bool useRatioFit=false;
40
40
std ::string tags = "nominal" ; // MMMM
41
41
42
42
double SR_lo = 600. ;
43
- double SR_hi = 3500 . ;
43
+ double SR_hi = 3600 . ;
44
44
45
45
Double_t ErfExp (Double_t x , Double_t c , Double_t offset , Double_t width ){
46
46
if (width < 1e-2 )width = 1e-2 ;
@@ -151,6 +151,7 @@ void BackgroundPrediction(std::string pname,int rebin_factor)
151
151
{
152
152
rebin = rebin_factor ;
153
153
std ::string fname = std ::string ("../fitFilesBtagSF/" ) + pname + std ::string ("/histos_bkg.root" );
154
+ //std::string fname = std::string("../fitFilesAll/") + pname + std::string("/histos_bkg.root");
154
155
155
156
gStyle -> SetOptStat (000000000 );
156
157
gStyle -> SetPadGridX (0 );
@@ -191,9 +192,11 @@ void BackgroundPrediction(std::string pname,int rebin_factor)
191
192
}
192
193
h_SR_Prediction -> SetMarkerSize (0.7 );
193
194
h_SR_Prediction -> GetYaxis ()-> SetTitleOffset (1.2 );
195
+ h_SR_Prediction -> Sumw2 ();
194
196
195
197
196
198
RooRealVar x ("x" , "m_{X} (GeV)" , SR_lo , SR_hi );
199
+ //RooRealVar x("x", "m_{X} (GeV)", SR_lo, 2000);
197
200
198
201
/* RooRealVar bg_p0("bg_p0", "bg_p0", 700., 1200.);
199
202
RooRealVar bg_p1("bg_p1", "bg_p1", 50., 300.1);
@@ -202,9 +205,9 @@ void BackgroundPrediction(std::string pname,int rebin_factor)
202
205
string name_output="CR_RooFit_GaussExp";
203
206
*/
204
207
205
- RooRealVar bg_p0 ((std ::string ("bg_p0_ ")+pname).c_str(), " bg_p0 ", 0., 200. );
206
- RooRealVar bg_p1 ((std ::string ("bg_p1_" )+ pname ).c_str (), "bg_p1" , 0. , 30.1 );
207
- RooRealVar bg_p2 ((std ::string ("bg_p2_ ")+pname).c_str(), " bg_p2 ", 0., 10.1);
208
+ RooRealVar bg_p0 ((std ::string ("bg_p0_ ")+pname).c_str(), " bg_p0 ", 2.5, 0., 30 );
209
+ RooRealVar bg_p1 ((std ::string ("bg_p1_" )+ pname ).c_str (), "bg_p1" , 4.7 , 0. , 50 );
210
+ RooRealVar bg_p2 ((std ::string ("bg_p2_ ")+pname).c_str(), " bg_p2 ", 0.004,0. , 10.1);
208
211
RooGenericPdf bg = RooGenericPdf ((std ::string ("bg_" )+ pname ).c_str (),"(pow(1-@0/13000,@1)/pow(@0/13000,@2+@3*log(@0/13000)))" ,RooArgList (x ,bg_p0 ,bg_p1 ,bg_p2 ));
209
212
string name_output = "CR_RooFit_Exp" ;
210
213
@@ -233,9 +236,11 @@ void BackgroundPrediction(std::string pname,int rebin_factor)
233
236
RooBernstein bg("bg", "bg", x, RooArgList(*bg_p1,*bg_p2, *bg_p3, *bg_p4, *bg_p5));// *bg_p6, *bg_p7, *bg_p8));
234
237
string name_output = "CR_RooFit_Bernestein";
235
238
*/
239
+
236
240
237
241
RooDataHist pred ("pred" , "Prediction from SB" , RooArgList (x ), h_SR_Prediction );
238
- RooFitResult * r_bg = bg .fitTo (pred , RooFit ::Range (SR_lo , SR_hi ), RooFit ::Save ());
242
+ RooFitResult * r_bg = bg .fitTo (pred , RooFit ::Range (SR_lo , SR_hi ), RooFit ::Save ());//RooFit::SumW2Error(kTRUE)
243
+ //RooFitResult *r_bg=bg.fitTo(pred, RooFit::Range(SR_lo, SR_hi), RooFit::Save(),RooFit::SumW2Error(kTRUE));
239
244
//RooDataHist data_=*(bg.generateBinned(x, h_mMMMMa_3Tag_SR_Prediction->Integral(h_mMMMMa_3Tag_SR_Prediction->FindBin(SR_lo), h_mX_SR->FindBin(SR_hi)-1) , RooAbsData::Poisson));
240
245
std ::cout <<" --------------------- Building Envelope --------------------- " <<std ::endl ;
241
246
std ::cout << "bg_p0_" << pname << " param " <<bg_p0 .getVal () << " " <<bg_p0 .getError ()<<std ::endl ;
@@ -273,14 +278,14 @@ void BackgroundPrediction(std::string pname,int rebin_factor)
273
278
int nbins = (int ) (SR_hi - SR_lo )/rebin ;
274
279
x .setBins (nbins );
275
280
276
- std ::cout << "chi2(data) " << aC_plot -> chiSquare ()<<std ::endl ;
281
+ std ::cout << "chi2(data) " << aC_plot -> chiSquare (( std :: string ( "bg_" ) + pname ). c_str (), "h_SR_Prediction" , 3 )<<std ::endl ;
277
282
278
283
//std::cout << "p-value: data under hypothesis H0: " << TMath::Prob(chi2_data->getVal(), nbins - 1) << std::endl;
279
284
280
285
281
286
aC_plot -> GetXaxis ()-> SetRangeUser (SR_lo , SR_hi );
282
287
aC_plot -> GetXaxis ()-> SetLabelOffset (0.03 );
283
- aC_plot -> GetYaxis ()-> SetRangeUser (1 , 500. );
288
+ aC_plot -> GetYaxis ()-> SetRangeUser (0.3 , 500. );
284
289
h_SR_Prediction -> GetXaxis ()-> SetRangeUser (SR_lo , SR_hi );
285
290
string rebin_ = itoa (rebin );
286
291
@@ -310,7 +315,8 @@ void BackgroundPrediction(std::string pname,int rebin_factor)
310
315
311
316
TLegend * leg = new TLegend (0.85625 ,0.7721654 ,0.6765625 ,0.8903839 ,NULL ,"brNDC" );
312
317
leg -> SetBorderSize (0 );
313
- leg -> SetTextSize (0.035 );
318
+ leg -> SetTextSize (0.04 );
319
+ leg -> SetTextFont (42 );
314
320
leg -> SetLineColor (1 );
315
321
leg -> SetLineStyle (1 );
316
322
leg -> SetLineWidth (2 );
@@ -320,7 +326,7 @@ void BackgroundPrediction(std::string pname,int rebin_factor)
320
326
h_SR_Prediction -> SetLineColor (kBlack );
321
327
h_SR_Prediction -> SetMarkerStyle (20 );
322
328
//h_mMMMMa_3Tag_SR->GetXaxis()->SetTitleSize(0.09);
323
- leg -> AddEntry (h_SR_Prediction , "Data" , "lep" );
329
+ leg -> AddEntry (h_SR_Prediction , "Data: sideband " , "lep" );
324
330
TH1F * h = new TH1F ();
325
331
h -> SetLineColor (kRed );
326
332
h -> SetLineWidth (3 );
@@ -336,7 +342,8 @@ void BackgroundPrediction(std::string pname,int rebin_factor)
336
342
frameP -> GetXaxis ()-> SetRangeUser (SR_lo , SR_hi );
337
343
338
344
frameP -> addPlotable (hpull ,"P" );
339
- frameP -> GetYaxis ()-> SetRangeUser (-5 ,5 );
345
+ frameP -> GetYaxis ()-> SetRangeUser (-7 ,7 );
346
+ frameP -> GetYaxis ()-> SetNdivisions (505 );
340
347
frameP -> GetYaxis ()-> SetTitle ("Pull" );
341
348
342
349
frameP -> GetYaxis ()-> SetTitleSize ((1. - xPad )/xPad * 0.06 );
0 commit comments