Macros | Functions
template_basic.C File Reference
#include "OscLib/func/OscCalculatorGeneral.h"
#include "OscLib/func/OscCalculatorPMNS.h"
#include "OscLib/func/OscCalculator.h"
#include "CAFAna/Cuts/Cuts.h"
#include "CAFAna/Cuts/NumuCuts.h"
#include "CAFAna/Fit/Fit.h"
#include "CAFAna/Vars/FitVars.h"
#include "CAFAna/Experiment/MultiExperiment.h"
#include "CAFAna/Analysis/Plots.h"
#include "CAFAna/Prediction/PredictionNoExtrap.h"
#include "CAFAna/Experiment/SingleSampleExperiment.h"
#include "CAFAna/Fit/FrequentistSurface.h"
#include "CAFAna/Core/Utilities.h"
#include "CAFAna/Vars/Vars.h"
#include "CAFAna/Core/SpectrumLoader.h"
#include "CAFAna/Core/Binning.h"
#include "TCanvas.h"
#include "TFile.h"
#include "TGraph.h"
#include "TH1.h"
#include "TMath.h"
#include "TGaxis.h"
#include "TMultiGraph.h"
#include "TLegend.h"
#include "TLatex.h"
#include "TStyle.h"
#include "THStack.h"
#include "TPaveText.h"
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <fstream>
#include <iomanip>
#include "Utilities/func/MathUtil.h"

Go to the source code of this file.

Macros

#define location   0
 
#define mcset   1
 
#define pot   18e20
 

Functions

void Simulation ()
 
void template_basic ()
 

Macro Definition Documentation

#define location   0
#define mcset   1

Definition at line 47 of file template_basic.C.

Referenced by template_basic().

#define pot   18e20

Definition at line 48 of file template_basic.C.

Referenced by ana::SpectrumLoader::AccumulateExposures(), fnex::EventList::AddBadPOT(), ana::DataMCPair::AddExposure(), DataMCPair::AddExposure(), DataMCPair::AddExposureArea(), DataMCPair::AddExposurePOT(), fnex::EventList::AddGoodPOT(), AnalyzeNus18Pred(), AnalyzeNus18Systs(), ana::FitInAnaBinsBkgdEstimator::Background(), ana::NumuCC2p2hBkgdEstimator::Background(), skim::RandomEventFilter::beginSubRun(), skim::SkimmerAna::beginSubRun(), skim::CosmicBeamComparison::beginSubRun(), bin_composition_pie_chart(), BuildMetricsTree_OnMon(), BuildOldTree(), caf_numu_fd_validation_data(), caf_numu_nd_cutflow(), caf_numu_nuenergy_vs_xy(), caf_numu_reco_minus_true(), caf_numu_validation(), caf_numu_vars(), calculateComponentsNumu(), calculateWrongSignNue(), calculateWrongSignNumuQ1(), calculateWrongSignNumuQ2(), calculateWrongSignNumuQ3(), calculateWrongSignNumuQ4(), ana::OscCovMxExperiment::ChiSq(), ana::CovMxExperiment::ChiSq(), compare_cos_numi(), CondenseRunList(), ConvertToGRooTracker(), CVNphotonHist(), CVNphotonSplitHist(), demo0(), demo1(), demo2(), demo3(), demo4(), demo5(), demo_CPT(), demo_numuOnly(), demoBarChart(), demoPlotSystBands(), demoStarPlots(), ana::SingleSampleExperiment::Derivative(), DrawSurface(), demo::DrawUpDownRatioCanvas(), genie::flux::GJPARCNuFlux::End(), fnex::EventListMaker::endJob(), lem::MakeLibrary::endSubRun(), slicer::SlicerAna::endSubRun(), bpfit::BPFTmvaTrainer::endSubRun(), bpfit::BreakPointProtonAna::endSubRun(), ncs::Xbeam::endSubRun(), ncs::Xeff::endSubRun(), ncs::ROCKMRE::endSubRun(), ncs::NCAna::endSubRun(), caf::CAFMaker::endSubRun(), energyResolution(), estimate_cosmics(), estimate_cosmics_triggeronly(), ana::Spectrum::FakeData(), FidOptHist(), FillHists(), ana::PredictionInterp::FitSumComponent(), ana::FluxMultiverseSyst::FluxMultiverseSyst(), FOMCalc(), ana::GenieMultiverseSpectra::GenieMultiverseSpectra(), get_cosmic_sample(), GetBkgd(), getContProf(), getContProf_Sensitivity(), ana::GetExposure(), ana::GetFDMCComponents(), ana::GetNDComponents(), GetNuePrediction2018(), GetNuePrediction2019(), ana::GetNuePrediction2020(), ana::GetNumuPredictions2020(), GetSig(), HadEFit(), HCtag(), joint_fit_2017_make_fc_slice(), joint_fit_2017_make_fc_surf(), main(), Make2DPlot(), make_dst_cosrejbdttrain(), make_estimate_energy(), make_fc_nus_surfs_nersc_2018(), make_fc_surfaces_2020_validation(), make_nus17_fc_surfs(), make_nus_fc_surfs(), make_plots(), make_rhcpred_2017(), make_rockpred_2017(), make_starplots(), make_surfprof(), make_xsec_tuning_hists_mp5(), make_xsec_wgts_2018_hists(), MakeExtrapSurface(), MakeFakeExperiment(), MakeNus17CosBkgd(), MakeNus18CosBkgd(), MakeNus2019CovMxSysts(), MakePeriCutPlot(), MakePlot(), MakePlots(), makePredTables(), MakeRunList(), MakeSurface(), MakeSysts(), MakeTable(), ana::FluxDecomp::MakeWeightsNumuFromKaon(), ana::BENDecomp::MakeWeightsNumuFromKaon(), mec_tuning(), mec_tuning_fitter_2020(), modularextrap_demo_nue(), modularextrap_demo_numu(), monoprob(), mrbrem_get_reweighted_spectra(), mrbrem_plots(), MuonFit(), ana::NDOscillatableSpectrum::NDOscillatableSpectrum(), ndrockmacro(), evgen::NuMISpillTimeStructure::NewSpill(), nue_decomp_scales(), nue_decomp_scales_for_make_decomp(), nue_fnex_vs_caf(), nue_fnex_vs_caf_events(), nue_fnex_vs_caf_noextrapolation(), nue_fnex_vs_caf_one_to_one(), nue_michelDataMC(), numu_sig_nonmax(), numu_validation_numuvars(), ana::OscillatableSpectrum::OscillatableSpectrum(), PIDBinLabels(), plot_DataMCComp_numu(), plot_datapredictions(), plot_nd_data_mc(), plot_nue_xsec_pred(), plot_rationoosc(), plot_recoE_numu(), plot_shifts(), plot_spectra_2dplots(), plotDataPred(), plotDataPred_SplitCanvas(), PlotMCComponentsErrorBand(), PlotResolution(), Plotsidebandfittest(), ana::PlotStack(), Plotting_DataAndPrediction(), PlotVertices(), genie::flux::GJPARCNuFlux::POT_1cycle(), genie::flux::GJPARCNuFlux::POT_curravg(), ana::NuePlotStyle::POTLabel(), pred_err(), PredictionInfo::PredictionInfo(), ana::PredictionScaleComp::PredictSyst(), ana::PredictionExtendToPeripheral::ReduceHelper(), ana::PredictionExtendToPeripheral::ReduceHelperNC(), ReMIdHist(), resolutionplotter(), ana::ReweightableSpectrum::ReweightableSpectrum(), ana::ReweightableSpectrum::ReweightVar(), ana::MichelDecomp::SaveCompPlots(), ana::FluxDecomp::SavePlotsKa(), ana::BENDecomp::SavePlotsKa(), ana::BENDecomp::SavePlotsPi(), ana::MichelDecomp::SaveTempPlots(), sensitivity2018(), sensitivity2020(), fnex::EventListMaker::Serialize(), fnex::ReadCAFMakeEventList::Serialize(), genie::flux::GJPARCNuFlux::SetFilePOT(), ana::T2KToyExperiment::SetPOT(), ana::T2KToyExperiment::SetPOTAnti(), ana::ModularExtrapComponent::SetQuiet(), ShwZOptHist(), ana::Spectrum::Spectrum(), PredictionInfo::SpectrumFromPrediction(), ana::SpectrumLoader::StoreExposures(), ana::StringFromInt(), StringFromInt1(), systematics_summary_from_pred_interp(), template_basic(), test_nue2017Prediction(), test_nue2018_fitter(), test_nue2018_surface(), test_systmultiverse(), ana::Spectrum::ToTH1(), train(), fnex::CorrSpec_NoExtrapNuE::UpdateCorrectedHistograms(), fnex::CorrSpec_MichelDecomp::UpdateCorrectedHistograms(), fnex::CorrSpec_NoExtrapNuMu::UpdateCorrectedHistograms(), fnex::CorrSpec_SimpleNuMuExtrap::UpdateCorrectedHistograms(), fnex::CorrSpec_PropDecomp::UpdateCorrectedHistograms(), fnex::CorrSpec_SimpleExtrap::UpdateCorrectedHistograms(), fnex::CorrSpec_BENDecomp::UpdateCorrectedHistograms(), validation_numu_nd(), Decomp::Write(), Distribution::Write(), fnex::EventListManipulator::WriteCappedListsAsTrees(), skim::POTSummary::writeResults(), wrong_sign_uncertainty(), and ana::CovarianceMatrix::~CovarianceMatrix().

Function Documentation

void Simulation ( )

Definition at line 52 of file template_basic.C.

References prelim.

Referenced by template_basic().

53 {
54  TLatex* prelim = new TLatex(.9, .95, "NO#nuA Simulation");
55  prelim->SetTextColor(kGray+1);
56  prelim->SetNDC();
57  prelim->SetTextSize(2/30.);
58  prelim->SetTextAlign(32);
59  prelim->Draw();
60 }
TLatex * prelim
Definition: Xsec_final.C:133
void template_basic ( )

Definition at line 62 of file template_basic.C.

References calc, ana::DataMCComparison(), ana::ISurface::DrawBestFit(), ana::ISurface::DrawContour(), e, ana::Spectrum::FakeData(), shutoffs::filename, plot_validation_datamc::fname, demo4::fnameSwap, ana::Gaussian2Sigma2D(), ana::Gaussian68Percent2D(), ana::Gaussian90Percent2D(), ana::SpectrumLoader::Go(), ana::kCCE, ana::kFitDmSq32Scaled, ana::kFitSinSq2Theta23, ana::kNumuEnergyBinning, ana::kNumuFD, MECModelEnuComparisons::leg, demo0::loader, demo4::loaderSwap, location, mcset, pot, ana::PredictionExtrap::Predict(), ana::IPrediction::PredictUnoscillated(), osc::_OscCalculatorPMNS< T >::SetdCP(), osc::_OscCalculatorPMNS< T >::SetDmsq21(), osc::_OscCalculatorPMNS< T >::SetDmsq32(), osc::_OscCalculatorPMNS< T >::SetL(), osc::_OscCalculatorPMNS< T >::SetRho(), osc::_OscCalculatorPMNS< T >::SetTh12(), osc::_OscCalculatorPMNS< T >::SetTh13(), osc::_OscCalculatorPMNS< T >::SetTh23(), Simulation(), MakeMiniprodValidationCuts::text, and ana::Spectrum::ToTH1().

63 {
64 
65  TGaxis::SetMaxDigits(2);
66 
67  gStyle->SetTitleOffset(.85, "y");
68  gStyle->SetTitleOffset(.84, "x");
69  gStyle->SetTitleSize(0.05,"x");
70 
72 
73  if(mcset==1) {
74 
75  if(location==1) {
76  fname = "$NOVA_DATA/mc/forFA/fdgenie.nonswap.decaf.root";
77  fnameSwap = "$NOVA_DATA/mc/forFA/fdgenie.swap.decaf.root";
78  }
79  else if(location==0) {
80  fname = "prod_decaf_S15-05-22a_fd_genie_fhc_nonswap_numu_contain";
81  fnameSwap = "prod_decaf_S15-05-22a_fd_genie_fhc_fluxswap_numu_contain";
82  }
83  }
84 
85  else if(mcset==0) {
86 
87  if(location==1) {
88  fname = "prod_decaf_S15-05-22a_fd_genie_fhc_nonswap_ideal_numu_contain";
89  fnameSwap = "prod_decaf_S15-05-22a_fd_genie_fhc_fluxswap_ideal_numu_contain";
90  }
91  else if(location==0) {
92  fname = "prod_decaf_S15-05-22a_fd_genie_fhc_nonswap_ideal_numu_contain";
93  fnameSwap = "prod_decaf_S15-05-22a_fd_genie_fhc_fluxswap_ideal_numu_contain";
94  }
95  }
96 
98 
99  calc.SetL(810);
100  calc.SetRho(0); // No matter effects
101  calc.SetDmsq21(7.59e-5);
102  calc.SetDmsq32(2.4e-3);
103  calc.SetTh12(.601);
104  calc.SetTh13(.1567);
105  // calc.SetdCP(TMath::Pi()/2);
106  calc.SetdCP(0);
107  calc.SetTh23(TMath::Pi()/4); // sin^2(2theta) = 1
108 
109  const std::string filename = fname;
110  const std::string filenameSwap = fnameSwap;
111 
112  SpectrumLoader loader(filename);
113  SpectrumLoader loaderSwap(filenameSwap);
114 
115  // Load up the necessary histograms, seperated by flavour etc
117  "CC Neutrino Energy (GeV)", kNumuEnergyBinning,
118  kCCE, kNumuFD);
119 
120  loader.Go();
121  loaderSwap.Go();
122 
123  Spectrum obsCC = predCC.Predict(&calc); // the prediction
124  Spectrum fakeCC = obsCC.FakeData(pot); // the data, faked
125  SingleSampleExperiment exptCC(&predCC, fakeCC); // made into an 'experiment'
126 
127  TLatex text;
128  text.SetNDC(true);
129  text.SetTextSize(0.04);
130 
131  // now, the same but with a different truth value of theta_23
132  calc.SetTh23(.67264); // sin^2(2theta) = 0.95
133 
134  Spectrum obsCC2 = predCC.Predict(&calc);
135  Spectrum fakeCC2 = obsCC2.FakeData(pot);
136  SingleSampleExperiment exptCC2(&predCC, fakeCC2);
137 
138  new TCanvas("comp1b","CC spectra .95"); // plot spectra for each sample
139  DataMCComparison(fakeCC2, obsCC2);
140  TH1* ccu2 = predCC.PredictUnoscillated().ToTH1(pot);
141  ccu2->SetLineStyle(7);
142  ccu2->Draw("hist same");
143  gPad->Print("plots/comp1b.ps");
144 
145  calc.SetTh23(1); // Seed value
146 
147  TH1F *hcc = new TH1F("cc", "cc", 10, 0, 1);
148  TH1F *hqe = new TH1F("qe", "qe", 10, 0, 1);
149  TH1F *huc = new TH1F("uc", "uc", 10, 0, 1);
150  TH1F *hall = new TH1F("all", "all", 10, 0, 1);
151 
152  hcc->SetLineWidth(2);
153  hqe->SetLineWidth(2);
154  huc->SetLineWidth(2);
155  hall->SetLineWidth(2);
156  hcc->SetLineColor(2);
157  hqe->SetLineColor(4);
158  huc->SetLineColor(kMagenta);
159  hall->SetLineColor(1);
160 
161  //The log-likelihood surface: FHC
162  new TCanvas("contoursfhc1","contoursfhc1") ;
163 
164  FrequentistSurface surfCC(&exptCC, &calc,
165  &kFitSinSq2Theta23, 30, .9, 1,
166  &kFitDmSq32Scaled, 30, 2.2, 2.7);
167  surfCC.DrawBestFit(kBlack);
168  surfCC.DrawContour(Gaussian90Percent2D(surfCC), kSolid, kBlack);
169 
170  Simulation();
171 
172  TLegend *leg = new TLegend(0.11,0.11,0.42,0.35);
173  leg->SetFillColor(10);
174  leg->SetFillStyle(0);
175  leg->SetBorderSize(0);
176  if(pot==18e20) leg->SetHeader("18e20 POT, FHC, 14 kton: 90% CL");
177  else if(pot==6e20) leg->SetHeader("6e20 POT, FHC, 14 kton: 90% CL");
178  else if(pot==2e20) leg->SetHeader("2e20 POT, FHC, 14 kton: 90% CL");
179  else if(pot==1e20) leg->SetHeader("1e20 POT, FHC, 14 kton: 90% CL");
180 
181  leg->AddEntry(hall,"Contained CC","L");
182  leg->Draw("same");
183  text.DrawLatex(0.3,0.85,"NO#nuA #nu_{#mu} Sensitivity (14kton, 700kW)");
184 
185  gPad->Print("plots/basic.1.ps");
186  gPad->Print("plots/basic.1.C");
187 
188  //2
189 
190  new TCanvas("contoursfhc2","contoursfhc2") ;
191 
192  FrequentistSurface surfCC2(&exptCC2, &calc,
193  &kFitSinSq2Theta23, 30, .87, 1,
194  &kFitDmSq32Scaled, 30, 2.2, 2.7);
195  surfCC2.DrawBestFit(kRed);
196  surfCC2.DrawContour(Gaussian90Percent2D(surfCC2), kSolid, kRed);
197 
198  leg->Draw("same");
199  text.DrawLatex(0.3,0.85,"NO#nuA #nu_{#mu} Sensitivity (14kton, 700kW)");
200 
201  Simulation();
202 
203  gPad->Print("plots/basic.fhc.2.ps");
204  gPad->Print("plots/basic.fhc.2.C");
205 
206  new TCanvas("contourscombine","contours90percent") ;
207  surfCC2.DrawBestFit(kRed);
208  surfCC2.DrawContour(Gaussian2Sigma2D(surfCC2), kSolid, kRed);
209  surfCC2.DrawContour(Gaussian68Percent2D(surfCC2), 7, kRed);
210 
211  surfCC.DrawBestFit(kBlack);
212  surfCC.DrawContour(Gaussian2Sigma2D(surfCC), kSolid, kBlack);
213  surfCC.DrawContour(Gaussian68Percent2D(surfCC), 7, kBlack);
214 
215  TH1F *solid = new TH1F("90% CL", "90% CL", 10, 0, 1);
216  TH1F *dashed = new TH1F("68% CL", "68% CL", 10, 0, 1);
217 
218  solid->SetLineWidth(2);
219  dashed->SetLineWidth(2);
220  dashed->SetLineStyle(7);
221  solid->SetLineColor(1);
222  dashed->SetLineColor(1);
223 
224  TLegend *leg4 = new TLegend(0.12,0.12,0.5,0.4);
225  leg4->SetFillColor(10);
226  leg4->SetFillStyle(0);
227  leg4->SetHeader("18e20 POT FHC, 14 kton");
228 
229  leg4->AddEntry(solid, "2 #sigma","L");
230  leg4->AddEntry(dashed,"1 #sigma","L");
231  leg4->SetBorderSize(0);
232  leg4->Draw("");
233  text.DrawLatex(0.3,0.92,"NO#nuA #nu_{#mu} Sensitivity (14kton, 700kW)");
234 
235  gPad->Print("plots/basic.overlay.ps");
236  gPad->Print("plots/basic.overlay.C");
237 }
void SetL(double L) override
void SetDmsq21(const T &dmsq21) override
#define location
void SetRho(double rho) override
const FitSinSq2Theta23 kFitSinSq2Theta23
string fnameSwap
Definition: demo4.py:6
void Simulation()
TH2 * Gaussian68Percent2D(const FrequentistSurface &s)
Up-value surface for 68% confidence in 2D in gaussian approximation.
void SetTh23(const T &th23) override
TH2 * Gaussian2Sigma2D(const FrequentistSurface &s)
Up-value surface for 2 sigma confidence in 2D in gaussian approximation.
string filename
Definition: shutoffs.py:106
const Cut kNumuFD
Definition: NumuCuts.h:52
Adapt the PMNS calculator to standard interface.
Definition: StanTypedefs.h:28
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:37
void SetDmsq32(const T &dmsq32) override
Log-likelihood scan across two parameters.
const Binning kNumuEnergyBinning
Definition: Binning.cxx:289
Spectrum FakeData(double pot) const
Fake data is a MC spectrum scaled to the POT expected in the data.
Definition: Spectrum.cxx:830
const Var kCCE
Definition: Vars.h:96
#define pot
void SetdCP(const T &dCP) override
const FitDmSq32Scaled kFitDmSq32Scaled
Definition: FitVars.cxx:19
loader
Definition: demo0.py:10
osc::OscCalculatorDumb calc
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
void SetTh12(const T &th12) override
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
TH2 * Gaussian90Percent2D(const FrequentistSurface &s)
Up-value surface for 90% confidence in 2D in gaussian approximation.
Prediction that just uses FD MC, with no extrapolation.
TH1 * DataMCComparison(const Spectrum &data, const Spectrum &mc, EBinType bintype)
Definition: Plots.cxx:36
Float_t e
Definition: plot.C:35
loaderSwap
Definition: demo4.py:9
void SetTh13(const T &th13) override
#define mcset
Compare a single data spectrum to the MC + cosmics expectation.