test_nue2017Prediction.C
Go to the documentation of this file.
1 #include "OscLib/OscCalcDumb.h"
3 
4 #include "CAFAna/Core/Spectrum.h"
6 
7 #include "CAFAna/Vars/FitVars.h"
8 
12 
13 #include "Utilities/func/MathUtil.h"
14 
15 #include "TCanvas.h"
16 #include "TH1.h"
17 #include "TFile.h"
18 
19 #include <iostream>
20 #include <cmath>
21 
22 using namespace ana;
23 
25 {
26  double pot = 9.48e20; // From Nitish
27 
28  std::string dirName = "/nova/ana/users/dpershey/Extraps2017/";
29  std::string fName1 = "out_nue2017_extrap.root";
30  std::string fName2 = "out_fdrock.root";
31 
32  // First step, take the extrapolated core sample and extend the dcmp result
33  // to the peripheral sample
34  // The extrapolated result
35  PredictionExtrap *core_merge =
36  LoadFromFile<PredictionExtrap>(dirName+fName1,"predProp").release();
37  // The FD MC
38  PredictionNoExtrap *fdmc_merge =
39  LoadFromFile<PredictionNoExtrap>(dirName+fName1,"fdmcNom").release();
40  // Those together give the fiducial prediction
41  PredictionExtendToPeripheral pred_merge(core_merge,fdmc_merge,true);
42 
43 
44  PredictionExtrap *core =
45  LoadFromFile<PredictionExtrap>(dirName+fName1,"predProp").release();
46  // The FD MC
47  PredictionNoExtrap *fdmc =
48  LoadFromFile<PredictionNoExtrap>(dirName+fName1,"fdmcNom").release();
49  PredictionExtendToPeripheral pred(core,fdmc,false);
50 
51  // Now, make a plot
52  // Close to one of the SA best fit points
53  double dCP = 1.5;
54  double ssth23 = 0.402;
55  double dmsq32 = 0.0027;
56 
58 
59  kFitDeltaInPiUnits.SetValue(calc,dCP);
60  kFitDmSq32.SetValue(calc,dmsq32);
61  kFitSinSqTheta23.SetValue(calc,ssth23);
62 
63  Spectrum tot = pred.Predict(calc);
66  Spectrum bb = pred.Predict(calc);
67  bb -= sig;
68 
69  TH1 *htot = tot.ToTH1(pot);
70  TH1 *hsig = sig.ToTH1(pot);
71  TH1 *hbb = bb. ToTH1(pot);
72 
73  htot->SetLineColor(kRed);
74  hsig->SetLineColor(kPink+9);
75  hbb ->SetLineColor(kAzure);
76 
77 
78 
79  TCanvas *can = new TCanvas();
80  htot->Draw("hist");
81  hsig->Draw("hist,same");
82  hbb ->Draw("hist,same");
83 
84 
85  Spectrum tot_merge = pred_merge.Predict(calc);
86  Spectrum sig_merge = pred_merge.PredictComponent(calc, Flavors::kNuMuToNuE,
88  Spectrum bb_merge = pred_merge.Predict(calc);
89  bb_merge -= sig_merge;
90 
91  TH1 *htot_merge = tot_merge.ToTH1(pot);
92  TH1 *hsig_merge = sig_merge.ToTH1(pot);
93  TH1 *hbb_merge = bb_merge. ToTH1(pot);
94 
95  htot_merge->SetLineColor(kRed);
96  hsig_merge->SetLineColor(kPink+9);
97  hbb_merge ->SetLineColor(kAzure);
98 
99  TCanvas *can_merge = new TCanvas();
100  htot_merge->Draw("hist");
101  hsig_merge->Draw("hist,same");
102  hbb_merge ->Draw("hist,same");
103 
104  std::cout << "Compare the event counts in the peripheral: " << std::endl;
105  std::cout << "Total: Merged - " << htot_merge->Integral(28,28) << " and Not Merged - " << htot->Integral(28,36) << std::endl;
106  std::cout << "Signal: Merged - " << hsig_merge->Integral(28,28) << " and Not Merged - " << hsig->Integral(28,36) << std::endl;
107  std::cout << "Beam Bkgd: Merged - " << hbb_merge->Integral(28,28) << " and Not Merged - " << hbb->Integral(28,36) << std::endl;
108 
109 
110 }
enum BeamMode kRed
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
double ssth23
(&#39; appearance&#39;)
Definition: IPrediction.h:18
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:148
const FitDmSq32 kFitDmSq32
Definition: FitVars.cxx:18
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:177
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Forward to wrapped Var&#39;s SetValue()
TH1F * hsig
Definition: Xdiff_gwt.C:59
osc::OscCalcDumb calc
osc::IOscCalcAdjustable * DefaultOscCalc()
Create a new calculator with default assumptions for all parameters.
Definition: Calcs.cxx:49
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
Charged-current interactions.
Definition: IPrediction.h:39
void test_nue2017Prediction()
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
double dCP
#define pot
Neutrinos-only.
Definition: IPrediction.h:49
OStream cout
Definition: OStream.cxx:6
virtual Spectrum Predict(osc::IOscCalc *calc) const override
std::string dirName
Definition: PlotSpectra.h:47
double dmsq32
const ConstrainedFitVarWithPrior fitSsqTh23_UniformPriorSsqTh23 & kFitSinSqTheta23
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
Prediction that just uses FD MC, with no extrapolation.
Take the output of an extrapolation and oscillate it as required.
const FitVarWithPrior fitDeltaInPiUnits_UniformPriordCP & kFitDeltaInPiUnits
enum BeamMode string