demo2.C
Go to the documentation of this file.
1 // Create an oscillatable spectrum
2 //these allow for you to see what the spectrum would look like after applying
3 //a set of oscillation parameters (see demo3.C)
4 //osc. spectrum include an axis for true energy in addition to whichever
5 //variable(s) you assign it
6 
7 #include "CAFAna/Core/Binning.h"
8 #include "CAFAna/Cuts/Cuts.h"
10 #include "CAFAna/Core/Spectrum.h"
12 #include "CAFAna/Vars/Vars.h"
13 
14 #include "OscLib/OscCalcPMNSOpt.h"
15 
17 
18 #include "TCanvas.h"
19 #include "TH2.h"
20 
21 using namespace ana;
22 
23 
24 void demo2()
25 {
26  const std::string fname = "prod_sumdecaf_R19-11-18-prod5reco.f_fd_genie_N1810j0211a_nonswap_fhc_nova_v08_full_v1_numu2020";
27 
28  SpectrumLoader loader(fname);
29 
30  const Binning bins = Binning::Simple(100, 0, 1000);
31 
32  const Var kNHit([](const caf::SRProxy* sr)
33  {
34  return sr->slc.nhit;
35  });
36 
37  Spectrum nhit("Number of hits in slice", bins, loader, kNHit, kIsNumuCC);
38 
39  // With true energy axis too
40  OscillatableSpectrum sosc("Number of hits in slice", bins, loader, kNHit, kIsNumuCC);
41 
42  // Do it!
43  loader.Go();
44 
45  // How to scale histograms
46  const double pot = 18e20;
47 
48  // We have histograms
49  nhit.ToTH1(pot)->Draw("hist");
50 
51  // And 2D histograms (remember there is always the True E axis included in an osc. spectrum)
52  new TCanvas;
53  sosc.ToTH2(pot)->Draw("colz");
54 }
const Cut kIsNumuCC(CCFlavSel(14, 14))
Select CC .
Represent the binning of a Spectrum's x-axis.
Definition: Binning.h:16
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
void demo2()
Definition: demo2.C:24
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
nhit
Definition: demo1.py:25
sosc
Definition: demo2.py:18
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:39
caf::Proxy< unsigned int > nhit
Definition: SRProxy.h:1315
const Var kNHit
Definition: Vars.cxx:71
#define pot
caf::StandardRecord * sr
virtual void Go() override
Load all the registered spectra.
loader
Definition: demo0.py:10
const Binning bins
Definition: NumuCC_CPiBin.h:8
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
Spectrum with true energy information, allowing it to be oscillated
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
TH2D * ToTH2(double pot) const
enum BeamMode string