demo4.C
Go to the documentation of this file.
1 // Do a proper prediction, with all the components included
2 
4 
5 #include "CAFAna/Core/Binning.h"
6 #include "CAFAna/Cuts/Cuts.h"
10 #include "CAFAna/Core/Spectrum.h"
12 #include "CAFAna/Vars/Vars.h"
13 
15 
16 #include "TCanvas.h"
17 #include "TH2.h"
18 
19 using namespace ana;
20 
21 
22 void demo4()
23 {
24  const std::string fname = "prod_sumdecaf_R19-11-18-prod5reco.f_fd_genie_N1810j0211a_nonswap_fhc_nova_v08_full_v1_numu2020";
25  const std::string fnameSwap = "prod_sumdecaf_R19-11-18-prod5reco.f_fd_genie_N1810j0211a_fluxswap_fhc_nova_v08_full_v1_numu2020";
26 
27  SpectrumLoader loader(fname);
28  SpectrumLoader loaderSwap(fnameSwap);
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  // All interaction types
38  PredictionNoExtrap pred(loader, loaderSwap, "Number of hits in slice", bins, kNHit, kNoCut);
39 
40  // Do it!
41  loader.Go();
42  loaderSwap.Go();
43 
44  // How to scale histograms
45  const double pot = 18e20;
46 
47  // Make a calculator. This is the fastest variant
49 
50  calc.SetL(810);
51  calc.SetRho(2.75);
52  calc.SetDmsq21(7.6e-5);
53  calc.SetDmsq32(2.35e-3);
54  calc.SetTh12(asin(sqrt(.87))/2);
55  calc.SetTh13(asin(sqrt(.10))/2);
56  calc.SetTh23(TMath::Pi()/4);
57  calc.SetdCP(0);
58 
59 
60  new TCanvas;
61  // What does it predict at these oscillation parameters?
62  Spectrum spred = pred.Predict(&calc);
63  // Add some poisson fluctuations, for fun
64  Spectrum mock = spred.MockData(pot);
65  // See all the components
66  DataMCComparisonComponents(mock, &pred, &calc);
67 
68  // What did it look like unoscillated?
69  pred.PredictUnoscillated().ToTH1(pot)->Draw("hist same");
70 }
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 SetTh13(const T &th13) override
void SetL(double L) override
string fnameSwap
Definition: demo4.py:6
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
T sqrt(T number)
Definition: d0nt_math.hpp:156
spred
Definition: demo4.py:26
osc::OscCalcDumb calc
void demo4()
Definition: demo4.C:22
Spectrum MockData(double pot, int seed=0) const
Mock data is FakeData with Poisson fluctuations applied.
Definition: Spectrum.cxx:300
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
caf::Proxy< unsigned int > nhit
Definition: SRProxy.h:1315
const Var kNHit
Definition: Vars.cxx:71
Optimized version of OscCalcPMNS.
Definition: StanTypedefs.h:31
#define pot
caf::StandardRecord * sr
virtual void Go() override
Load all the registered spectra.
void SetTh23(const T &th23) override
loader
Definition: demo0.py:10
void SetDmsq21(const T &dmsq21) override
void SetDmsq32(const T &dmsq32) override
const Binning bins
Definition: NumuCC_CPiBin.h:8
TH1 * DataMCComparisonComponents(const Spectrum &data, const IPrediction *mc, osc::IOscCalc *calc)
Plot MC broken down into flavour components, overlayed with data.
Definition: Plots.cxx:114
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
void SetdCP(const T &dCP) override
void SetTh12(const T &th12) override
Prediction that just uses FD MC, with no extrapolation.
mock
Definition: demo4.py:28
Float_t e
Definition: plot.C:35
loaderSwap
Definition: demo4.py:9
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
const Cut kNoCut
The simplest possible cut: pass everything, used as a default.
Definition: Cut.h:109
void SetRho(double rho) override
T asin(T number)
Definition: d0nt_math.hpp:60
enum BeamMode string