Macros | Functions
template_basic.C File Reference
#include "OscLib/OscCalcGeneral.h"
#include "OscLib/OscCalcPMNS.h"
#include "OscLib/OscCalc.h"
#include "CAFAna/Cuts/Cuts.h"
#include "3FlavorAna/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 "3FlavorAna/Vars/Binnings.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 48 of file template_basic.C.

Referenced by template_basic().

#define pot   18e20

Definition at line 49 of file template_basic.C.

Referenced by 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::LikelihoodCovMxExperiment::ChiSq(), 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(), 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::FluxMultiverseSyst::FluxMultiverseSyst(), FOMCalc(), ana::GenieMultiverseSpectra::GenieMultiverseSpectra(), get_cosmic_sample(), GetBkgd(), getContProf(), getContProf_Sensitivity(), ana::GetExposure(), ana::GetNDComponents(), ana::GetNDCompsFromDecomp(), ana::GetNDDecompsFromDecomp(), GetNuePrediction2018(), GetNuePrediction2019(), ana::GetNuePrediction2020(), ana::GetNumuPredictions2020(), GetSig(), HadEFit(), ana::SpectrumSinkBase< T >::HandlePOT(), ana::ExposureSource::HandleSpill(), HCtag(), joint_fit_2017_make_fc_slice(), joint_fit_2017_make_fc_surf(), ana::LikelihoodCovMxExperiment::LikelihoodCovMxExperiment(), 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(), MakeSurfaceJoint(), MakeSurfaceLLTest(), MakeSurfaceNoNDOsc(), 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(), 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(), 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(), 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::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(), PredictionInfo::SpectrumFromPrediction(), ana::StringFromInt(), StringFromInt1(), systematics_summary_from_pred_interp(), template_basic(), test_nue2017Prediction(), test_nue2018_fitter(), test_nue2018_surface(), test_systmultiverse(), ana::Spectrum::ToTH1(), train(), ana::ReweightableSpectrum::Uninitialized(), fnex::CorrSpec_SimpleExtrap::UpdateCorrectedHistograms(), fnex::CorrSpec_MichelDecomp::UpdateCorrectedHistograms(), fnex::CorrSpec_NoExtrapNuE::UpdateCorrectedHistograms(), fnex::CorrSpec_PropDecomp::UpdateCorrectedHistograms(), fnex::CorrSpec_SimpleNuMuExtrap::UpdateCorrectedHistograms(), fnex::CorrSpec_NoExtrapNuMu::UpdateCorrectedHistograms(), fnex::CorrSpec_BENDecomp::UpdateCorrectedHistograms(), validation_numu_nd(), Decomp::Write(), Distribution::Write(), fnex::EventListManipulator::WriteCappedListsAsTrees(), skim::POTSummary::writeResults(), wrong_sign_uncertainty(), ana::IExposureSink::~IExposureSink(), and ana::SpectrumSinkBase< Spectrum >::~SpectrumSinkBase().

Function Documentation

void Simulation ( )

Definition at line 53 of file template_basic.C.

References prelim.

Referenced by template_basic().

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

Definition at line 63 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::_OscCalcPMNS< T >::SetdCP(), osc::_OscCalcPMNS< T >::SetDmsq21(), osc::_OscCalcPMNS< T >::SetDmsq32(), osc::_OscCalcPMNS< T >::SetL(), osc::_OscCalcPMNS< T >::SetRho(), osc::_OscCalcPMNS< T >::SetTh12(), osc::_OscCalcPMNS< T >::SetTh13(), osc::_OscCalcPMNS< T >::SetTh23(), Simulation(), MakeMiniprodValidationCuts::text, and ana::Spectrum::ToTH1().

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