demo2.py
Go to the documentation of this file.
1 # Create an oscillatable spectrum
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 
9 loader = cafana.SpectrumLoader(fname)
10 
11 bins = cafana.Binning.Simple(100, 0, 1000)
12 
13 # In fact kNHit was already defined within CAFAna. It's better to use that
14 
15 nhit = cafana.Spectrum('Number of hits in slice', bins, loader, cafana.kNHit, cafana.kIsNumuCC)
16 
17 # With true energy axis too
18 sosc = cafana.OscillatableSpectrum('Number of hits in slice', bins, loader, kNHit, cafana.kIsNumuCC)
19 
20 
21 loader.Go()
22 
23 pot = 18e20
24 
25 nhit.ToTH1(pot).Draw('hist')
26 
27 # And 2D histograms
28 canv = ROOT.TCanvas()
29 sosc.ToTH2(pot).Draw('colz')
30 
tree Draw("slc.nhit")