demo5.py
Go to the documentation of this file.
1 # Use that prediction to make a contour for a really dumb numu analysis
2 
3 import cafana
4 
5 import ROOT
6 
7 fname = 'prod_sumdecaf_R17-03-01-prod3reco.k_fd_genie_nonswap_fhc_nova_v08_full_nue_or_numu_or_nus_contain_v1'
8 fnameSwap = 'prod_sumdecaf_R17-03-01-prod3reco.k_fd_genie_fluxswap_fhc_nova_v08_period1_nue_or_numu_or_nus_contain_v1'
9 
10 loader = cafana.SpectrumLoader(fname)
11 loaderSwap = cafana.SpectrumLoader(fnameSwap)
12 
13 bins = cafana.Binning.Simple(100, 0, 1000)
14 
15 pred = cafana.PredictionNoExtrap(loader, loaderSwap, 'Number of hits in slice', bins, cafana.kNHit, cafana.kNoCut)
16 
17 loader.Go()
18 loaderSwap.Go()
19 
20 pot = 18e20
21 
22 calc = cafana.DefaultOscCalc()
23 
24 c1 = ROOT.TCanvas()
25 
26 spred = pred.Predict(calc)
27 mock = spred.MockData(pot)
28 cafana.DataMCComparisonComponents(mock, pred, calc)
29 pred.PredictUnoscillated().ToTH1(pot).Draw('hist same')
30 
31 
32 # Not too complicated to make a contour too
33 c2 = ROOT.TCanvas()
34 expt = cafana.SingleSampleExperiment(pred, mock)
35 surf = cafana.FrequentistSurface(expt, calc,
36  cafana.kFitSinSqTheta23, 30, .35, .65,
37  cafana.kFitDmSq32Scaled, 30, 2.2, 2.8)
38 surf.Draw()
39 surf.DrawContour(cafana.Gaussian68Percent2D(surf), 7, ROOT.kRed) # dashed
40 surf.DrawBestFit(ROOT.kRed)
41 
tree Draw("slc.nhit")