drawPreds.C
Go to the documentation of this file.
3 #include "CAFAna/Fit/Fit.h"
6 #include "CAFAna/Core/Loaders.h"
9 #include "CAFAna/Core/Spectrum.h"
11 #include "CAFAna/Cuts/Cuts.h"
13 #include "CAFAna/Cuts/SpillCuts.h"
14 #include "CAFAna/Cuts/TimingCuts.h"
28 #include "CAFAna/Vars/FitVars.h"
32 #include "CAFAna/Vars/Vars.h"
33 
34 #include "OscLib/OscCalcPMNSOpt.h"
35 
36 #include "TCanvas.h"
37 #include "TH1.h"
38 #include "TLegend.h"
39 #include "TStyle.h"
40 #include "TGraphAsymmErrors.h"
41 
42 using namespace ana;
43 
44 void drawPlot()
45 {
46  TFile* fPred_Q1 = new TFile("Predictions/pred_Q1.root");
47  TFile* fPred_Q2 = new TFile("Predictions/pred_Q2.root");
48  TFile* fPred_Q3 = new TFile("Predictions/pred_Q3.root");
49  TFile* fPred_Q4 = new TFile("Predictions/pred_Q4.root");
50 
51  PredictionNoExtrap* prediction_Q1 = LoadFrom<PredictionNoExtrap>(fPred_Q1, "prediction").release();
52  PredictionNoExtrap* prediction_Q2 = LoadFrom<PredictionNoExtrap>(fPred_Q2, "prediction").release();
53  PredictionNoExtrap* prediction_Q3 = LoadFrom<PredictionNoExtrap>(fPred_Q3, "prediction").release();
54  PredictionNoExtrap* prediction_Q4 = LoadFrom<PredictionNoExtrap>(fPred_Q4, "prediction").release();
55 
56  // And we're ready to go
57 
58  // custom osc. parameters (non-max mixing) Get the numu result parameters!
61  calc.SetDmsq32(2.43071e-3);
62  calc.SetTh23(asin(sqrt(0.471974)));
63  calc.SetdCP(M_PI*0.915869); // preliminary Ana2017
64 
65  TFile* fData = new TFile("Data/fd_data_AllQuants.root");
66 
67  Spectrum* data = LoadFrom<Spectrum>(fData, "fd_data").release();
68 
69  TH1* h1 = prediction_Q1->Predict(&calc).ToTH1(data->POT());
70  TH1* h2 = prediction_Q2->Predict(&calc).ToTH1(data->POT());
71  TH1* h3 = prediction_Q3->Predict(&calc).ToTH1(data->POT());
72  TH1* h4 = prediction_Q4->Predict(&calc).ToTH1(data->POT());
73  TH1* hAll = (TH1*) h4->Clone("hAll");
74  hAll->Add(h2);
75  hAll->Add(h3);
76  hAll->Add(h4);
77 
78  TH1* hData = data->ToTH1(data->POT());
79  hData->GetXaxis()->CenterTitle();
80  hData->GetYaxis()->CenterTitle();
81 
82  TGraphAsymmErrors* grSig = GraphWithPoissonErrors(hData, true, true);
83  grSig->SetMarkerColor(kBlack);
84  grSig->SetLineColor(kBlack);
85  grSig->SetLineWidth(2);
86  grSig->SetMarkerStyle(20);
87 
88  TCanvas* c = new TCanvas("c","c");
89 
90  hData->SetLineColor(10);
91  hData->SetLineWidth(0);
92  hData->Draw();
93 
94  hAll->SetLineColor(kRed);
95 
96  hAll->Draw("hist same");
97  grSig->Draw("P");
98 
99  c->SaveAs("plots/timepeak.pdf");
100  c->SaveAs("plots/timepeak.root");
101 
102  fPred_Q1->Close();
103  fPred_Q2->Close();
104  fPred_Q3->Close();
105  fPred_Q4->Close();
106 
107 } // End of function
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
void ResetOscCalcToDefault(osc::IOscCalcAdjustable *calc)
Reset calculator to default assumptions for all parameters.
Definition: Calcs.cxx:23
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
TH1F * h3
Definition: berger.C:36
T sqrt(T number)
Definition: d0nt_math.hpp:156
TGraphAsymmErrors * GraphWithPoissonErrors(const TH1 *h, bool noErrorsXaxis, bool drawEmptyBins)
Calculate statistical errors appropriate for small Poisson numbers.
Definition: Plots.cxx:910
osc::OscCalcDumb calc
#define M_PI
Definition: SbMath.h:34
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
const XML_Char const XML_Char * data
Definition: expat.h:268
void drawPlot()
Definition: drawPreds.C:44
Spectrum Predict(osc::IOscCalc *calc) const override
Optimized version of OscCalcPMNS.
Definition: StanTypedefs.h:31
void SetTh23(const T &th23) override
double POT() const
Definition: Spectrum.h:219
TH1F * h2
Definition: plot.C:45
void SetDmsq32(const T &dmsq32) override
TH1F * h1
void SetdCP(const T &dCP) override
Prediction that just uses FD MC, with no extrapolation.
Float_t e
Definition: plot.C:35
T asin(T number)
Definition: d0nt_math.hpp:60