demo4.C
Go to the documentation of this file.
1 // Do a proper prediction, with all the components included
2 
3 #include "CAFAna/Core/Binning.h"
4 #include "CAFAna/Cuts/Cuts.h"
8 #include "CAFAna/Core/Spectrum.h"
10 #include "CAFAna/Vars/Vars.h"
11 
12 #include "OscLib/OscCalcPMNSOpt.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  //since we have 2 different datasets, we know need 2 different loaders
28  SpectrumLoader loader(fname);
29  SpectrumLoader loaderSwap(fnameSwap);
30 
31  const Binning bins = Binning::Simple(100, 0, 1000);
32 
33  const Var kNHit([](const caf::SRProxy* sr)
34  {
35  return sr->slc.nhit;
36  });
37 
38  // All interaction types
39  PredictionNoExtrap pred(loader, loaderSwap, "Number of hits in slice", bins, kNHit, kNoCut);
40 
41  // Do it!
42  loader.Go();
43  loaderSwap.Go();
44 
45  // How to scale histograms
46  const double pot = 18e20;
47 
48  // Make a calculator. This is the fastest variant
50 
51  calc.SetL(810);
52  calc.SetRho(2.75);
53  calc.SetDmsq21(7.6e-5);
54  calc.SetDmsq32(2.35e-3);
55  calc.SetTh12(asin(sqrt(.87))/2);
56  calc.SetTh13(asin(sqrt(.10))/2);
57  calc.SetTh23(TMath::Pi()/4);
58  calc.SetdCP(0);
59 
60 
61  new TCanvas;
62  // What does it predict at these oscillation parameters?
63  Spectrum spred = pred.Predict(&calc);
64  // Add some poisson fluctuations, for fun
65  Spectrum mock = spred.MockData(pot);
66  // See all the components
67  DataMCComparisonComponents(mock, &pred, &calc);
68 
69  // What did it look like unoscillated?
70  pred.PredictUnoscillated().ToTH1(pot)->Draw("hist same");
71 }
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:328
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
Optimized version of OscCalcPMNS.
Definition: StanTypedefs.h:32
#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
Definition: Cut.h:13
void SetRho(double rho) override
T asin(T number)
Definition: d0nt_math.hpp:60
enum BeamMode string