Classes | Functions | Variables
plot_uncertainty.C File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "Utilities/rootlogon.C"
#include "CAFAna/Cuts/SpillCuts.h"
#include "CAFAna/Core/Utilities.h"
#include "CAFAna/Core/SpectrumLoader.h"
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Cuts/TimingCuts.h"
#include "CAFAna/Analysis/Plots.h"
#include "CAFAna/Analysis/Style.h"
#include "CAFAna/Core/LoadFromFile.h"
#include "CAFAna/Core/Ratio.h"
#include "CAFAna/XSec/GenieMultiverseSyst.h"
#include "TH1D.h"
#include "TCanvas.h"
#include "TGraph.h"
#include "TMultiGraph.h"
#include "TLine.h"
#include "TLegend.h"
#include "TPad.h"
#include "TGaxis.h"

Go to the source code of this file.

Classes

struct  FileUp
 
struct  DateUp
 

Functions

void NDSimulation ()
 
void PlotWithSystErrorBandWidth (TH1 *&nom, std::vector< TH1 * > &ups, std::vector< TH1 * > &dns, int col, int errCol, float headroom, bool newaxis)
 
void PlotDeltaSigmaWithSigma (TH1 *&nom, TH1 *&nomsel, std::vector< TH1 * > &ups, std::vector< TH1 * > &dns, std::vector< TH1 * > &upssel, std::vector< TH1 * > &dnssel, TH1 *&heff, std::vector< TH1 * > &effups, std::vector< TH1 * > &effdns, TString outname1, TString outname2, TString outname3, TString outname4, TString outname5, TString outname6, TString outname7, TString outname8, TString outname9, Bool_t printme=false)
 
void GetFluxError (const Spectrum *nom, std::vector< ana::Spectrum * > univs, std::vector< ana::Spectrum * > &supdown)
 
void plot_uncertainty ()
 

Variables

const double pot = 8.09e20
 
TString outDir2 = "/nova/app/users/rbowles/tag_releaseS18-01-19/NDAna/ncpi0/Systematics/Plots"
 
const int File =10
 
const FileUp CurrentFile [File]
 
const int Date = 1
 
const DateUp CurrentDate [Date]
 

Function Documentation

void GetFluxError ( const Spectrum nom,
std::vector< ana::Spectrum * >  univs,
std::vector< ana::Spectrum * > &  supdown 
)

Definition at line 497 of file plot_uncertainty.C.

References make_syst_table_plots::ibin, ana::Spectrum::Livetime(), extractScale::mean, pot, cet::pow(), std::sqrt(), and ana::Spectrum::ToTH1().

499 {
500  //Define nominal, up, and down histograms.
501  TH1* hnom = nom->ToTH1(pot);
502  TH1* hup = (TH1*)hnom->Clone("up");
503  TH1* hdown= (TH1*)hnom->Clone("down");
504 
505  //Loop over number of bins.
506  for(int ibin=1; ibin <= hnom->GetNbinsX(); ibin++)
507  {
508  //Mean
509  double mean = hnom->GetBinContent(ibin);
510  if(mean<=0) continue;
511 
512  //Error:
513  double err = 0.0;
514  for(unsigned int iuniv=0; iuniv < univs.size(); iuniv++)
515  {
516  err += pow(univs[iuniv]->ToTH1(pot)->GetBinContent(ibin) - mean, 2);
517  }
518  err /= double(univs.size());
519  err = sqrt(err);
520  hup->SetBinContent(ibin, mean+err);
521  hdown->SetBinContent(ibin, mean-err);
522  }
523  supdown.push_back(new Spectrum(hup, pot, nom->Livetime()) );
524  supdown.push_back(new Spectrum(hdown, pot, nom->Livetime()) );
525 }
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
T sqrt(T number)
Definition: d0nt_math.hpp:156
constexpr T pow(T x)
Definition: pow.h:75
std::vector< float > Spectrum
Definition: Constants.h:728
const double pot
double Livetime() const
Seconds. For informational purposes only. No calculations use this.
Definition: Spectrum.h:230
void NDSimulation ( )

Definition at line 41 of file plot_uncertainty.C.

References prelim.

42 {
43  TLatex* prelim = new TLatex(.9, .95, "NOvA Simulation");
44  prelim->SetTextColor(kGray+1);
45  prelim->SetNDC();
46  prelim->SetTextSize(2/30.);
47  prelim->SetTextAlign(32);
48  TGaxis::SetMaxDigits(3);
49  prelim->Draw();
50 }
TLatex * prelim
Definition: Xsec_final.C:133
void plot_uncertainty ( )

Definition at line 529 of file plot_uncertainty.C.

References om::cout, cut_labels, DateUp::date, allTimeWatchdog::endl, MakeMiniprodValidationCuts::f, fin, plot_validation_datamc::fname, GetFluxError(), ana::GenieMultiverseSpectra::kBandFromNominal, kRed, MECModelEnuComparisons::leg, leg1, ana::Spectrum::LoadFrom(), ana::GenieMultiverseSpectra::LowerSigma(), getGoodRuns4SAM::n, NDSimulation(), outDir2, PlotDeltaSigmaWithSigma(), PlotWithSystErrorBandWidth(), pot, PandAna.Demos.pi0_spectra::pur, runNovaSAM::release, SetTextSize(), string, art::to_string(), and ana::GenieMultiverseSpectra::UpperSigma().

530 {
531  //Provide input root file to the function.
532  std::string fname = "/nova/ana/users/rbowles/RootFiles/CVNPhotonOptimization/CVNphoton_optimization_Grid.root ";
533 
534  TFile fin(fname.c_str());
535 
536  //Define number of variables, variables, and cuts to be used.
537  const int nvar = 1;
538  std::vector<std::string> taxes_labels = {"1Prong_CVN_Photon_ID"};
539  std::vector<std::string> cut_labels = {"totmc","NSel_Cuts","Nsig_fid_only","Nbkg_Cuts"};
540 
541  //Loop over all the provided variables.
542  for(int ivar = 0; ivar < nvar; ivar++)
543  {
544  //Create vectors for different cut levels.
545  std::vector<ana::Spectrum*> calibup, calibdown;
546  std::vector<ana::Spectrum*> lightup, lightdown;
547  std::vector<ana::Spectrum*> fluxup, fluxdown;
548  std::vector<ana::Spectrum*> ckv, calib_shape;
549  std::vector<ana::Spectrum*> nominal;
550  std::vector<const ana::Spectrum*> xsecup, xsecdown;
551 
552  //Loop over cuts. (Input total number of cuts desired)
553  for(int icut = 0; icut < 4; icut++)
554  {
555  nominal.push_back(LoadFromFile<Spectrum>(fname, "nominal/"+cut_labels[icut]+"_"+taxes_labels[ivar]).release());
556  calibup.push_back(LoadFromFile<Spectrum>(fname, "calibpos/"+cut_labels[icut]+"_"+taxes_labels[ivar]).release());
557  calibdown.push_back(LoadFromFile<Spectrum>(fname, "calibneg/"+cut_labels[icut]+"_"+taxes_labels[ivar]).release());
558 
559  //Comment these if just calibup or calibdown is needed for plots.
560  lightup.push_back(LoadFromFile<Spectrum>(fname, "lightup/"+cut_labels[icut]+"_"+taxes_labels[ivar]).release());
561  lightdown.push_back(LoadFromFile<Spectrum>(fname, "lightdown/"+cut_labels[icut]+"_"+taxes_labels[ivar]).release());
562  ckv.push_back(LoadFromFile<Spectrum>(fname, "ckv/"+cut_labels[icut]+"_"+taxes_labels[ivar]).release());
563  calib_shape.push_back(LoadFromFile<Spectrum>(fname, "calibshape/"+cut_labels[icut]+"_"+taxes_labels[ivar]).release());
564 
565  //Get the univese spectra.
566  std::vector<ana::Spectrum*> flux_univs;
567  std::vector<std::unique_ptr<ana::Spectrum> > xsec_univs;
568 
569  //Loop over all universes.
570  for(int iuniv = 0; iuniv < 100; iuniv++)
571  {
572  xsec_univs.push_back(Spectrum::LoadFrom((TDirectory*)fin.Get(("xsec_"+cut_labels[icut]+"_"+taxes_labels[ivar]+"/spec"+ std::to_string(iuniv)).c_str() )));
573  flux_univs.push_back(LoadFromFile<Spectrum>(fname, "flux_"+cut_labels[icut]+"_"+taxes_labels[ivar]+"/spec"+ std::to_string(iuniv)).release());
574  }
575 
576  //Create vector for flux error.
577  std::vector<ana::Spectrum*> fupdown;
578  GetFluxError( nominal[icut], flux_univs, fupdown);
579  fluxup.push_back(fupdown[0]);
580  fluxdown.push_back(fupdown[1]);
581 
582  //Create spectrum for xsec errors
583  ana::MultiverseSpectra verses(xsec_univs);
584  xsecup.push_back(verses.UpperSigma(MultiverseSpectra::kBandFromNominal));
585  xsecdown.push_back(verses.LowerSigma(MultiverseSpectra::kBandFromNominal));
586 
587  }// end loop over cuts
588 
589  /***************************************************************************/
590  //Create total background histograms.
591 
592  //Comment these if just clibup or calibdown are needed for plots.
593  TH1* Nbkg_Cuts_xsecdown = xsecdown[3]->ToTH1(pot);
594  TH1* Nbkg_Cuts_xsecup = xsecup[3]->ToTH1(pot);
595  TH1* Nbkg_Cuts_fluxdown = fluxdown[3]->ToTH1(pot);
596  TH1* Nbkg_Cuts_fluxup = fluxup[3]->ToTH1(pot);
597  TH1* Nbkg_Cuts_calib_shape = calib_shape[3]->ToTH1(pot);
598  TH1* Nbkg_Cuts_ckv = ckv[3]->ToTH1(pot);
599  TH1* Nbkg_Cuts_lightup = lightup[3]->ToTH1(pot);
600  TH1* Nbkg_Cuts_lightdown = lightdown[3]->ToTH1(pot);
601 
602  TH1* Nbkg_Cuts_calibdown = calibdown[3]->ToTH1(pot);
603  TH1* Nbkg_Cuts_calibup = calibup[3]->ToTH1(pot);
604 
605 
606  //Background systematic "up" distributions.
607  std::vector<TH1*> vector_up_Nbkg_Cuts = {fluxup[3]->ToTH1(pot), xsecup[3]->ToTH1(pot), calibup[3]->ToTH1(pot), lightup[3]->ToTH1(pot), ckv[3]->ToTH1(pot), calib_shape[3]->ToTH1(pot)};
608 
609  //Background systematic "down" distributions.
610  std::vector<TH1*> vector_dwn_Nbkg_Cuts = {fluxdown[3]->ToTH1(pot), xsecdown[3]->ToTH1(pot), calibdown[3]->ToTH1(pot), lightdown[3]->ToTH1(pot),ckv[3]->ToTH1(pot), calib_shape[3]->ToTH1(pot)};
611 
612  TH1* hnom_Nbkg_Cuts = nominal[3]->ToTH1(pot);
613  std::cout << "*************Bins nominal*************: " << hnom_Nbkg_Cuts->GetXaxis()->GetNbins() << std::endl;
614  hnom_Nbkg_Cuts->SetTitle(";Prong CVN Gamma ID; Background Events/8.09 #times 10^{20}POT");
615  gROOT->ProcessLine(".! mkdir -p plots");
616 
617  TCanvas* Prong_CVN_Gamma_ID_Nbkg_Cuts = new TCanvas("Prong_CVN_Gamma_ID_Nbkg_Cuts", "Prong_CVN_Gamma_ID_Nbkg_Cuts");
618  Prong_CVN_Gamma_ID_Nbkg_Cuts->SetLeftMargin(0.15);
619  PlotWithSystErrorBandWidth(hnom_Nbkg_Cuts, vector_up_Nbkg_Cuts, vector_dwn_Nbkg_Cuts, -1, -1, 1.3f, true);
620 
621  TLegend * leg = new TLegend(0.55,0.5,0.65,0.8);
622  leg-> SetTextFont(42);
623  leg-> SetTextSize(0.05);
624  leg->AddEntry(hnom_Nbkg_Cuts, " NC #pi^{0} > 0.3 E");
625  leg->Draw("same");
626  NDSimulation();
627 
628  Prong_CVN_Gamma_ID_Nbkg_Cuts->SaveAs(outDir2+CurrentFile[0].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
629  //Prong_CVN_Gamma_ID_Nbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/Updatedfid_containment_all_daisysknobs/Prong_CVN_Gamma_ID_Nbkg_Cuts_0_3_high_Updatedfid_containment_all_daisysknobs.pdf");
630  //Prong_CVN_Gamma_ID_Nbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_ID_Nbkg_Cuts_0_3_high_Combined_OneKnob1_out_3_MaNCRES.pdf");
631  //Prong_CVN_Gamma_ID_Nbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_ID_Nbkg_Cuts_0_3_high.pdf");
632  //Prong_CVN_Gamma_ID_Nbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration/Prong_CVN_Gamma_ID_Nbkg_Cuts_calib_0_3_high.pdf");
633  // Prong_CVN_Gamma_ID_Nbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration_shape/Prong_CVN_Gamma_ID_Nbkg_Cuts__calib_shape_0_3_high.pdf");
634  //Prong_CVN_Gamma_ID_Nbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Cherenkov/Prong_CVN_Gamma_ID_Nbkg_Cuts_Cherenkov_0_3_high.pdf");
635  // Prong_CVN_Gamma_ID_Nbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/GENIE/Prong_CVN_Gamma_ID_Nbkg_Cuts_GENIE_0_3_high.pdf");
636  // Prong_CVN_Gamma_ID_Nbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/light_level/Prong_CVN_Gamma_ID_Nbkg_Cuts_light_level_0_3_high.pdf");
637  // Prong_CVN_Gamma_ID_Nbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/ppfx/Prong_CVN_Gamma_ID_Nbkg_Cuts_ppfx_0_3_high.pdf");
638 
639  /*********************************************************************************/
640  //Create Total Preselection histograms.
641 
642  //Comment these if just calibup or calibdown is needed for plots.
643  TH1* NSel_Cuts_xsecdown = xsecdown[0]->ToTH1(pot);
644  TH1* NSel_Cuts_xsecup = xsecup[0]->ToTH1(pot);
645  TH1* NSel_Cuts_fluxdown = fluxdown[0]->ToTH1(pot);
646  TH1* NSel_Cuts_fluxup = fluxup[0]->ToTH1(pot);
647  TH1* NSel_Cuts_calib_shape = calib_shape[0]->ToTH1(pot);
648  TH1* NSel_Cuts_ckv = ckv[0]->ToTH1(pot);
649  TH1* NSel_Cuts_lightup = lightup[0]->ToTH1(pot);
650  TH1* NSel_Cuts_lightdown = lightdown[0]->ToTH1(pot);
651 
652  TH1* NSel_Cuts_calibdown = calibdown[0]->ToTH1(pot);
653  TH1* NSel_Cuts_calibup = calibup[0]->ToTH1(pot);
654 
655 
656  //Signal statistical "up" error distributions.
657  std::vector<TH1*> vector_up_NSel_Cuts = {fluxup[0]->ToTH1(pot), xsecup[0]->ToTH1(pot),calibup[0]->ToTH1(pot), lightup[0]->ToTH1(pot), ckv[0]->ToTH1(pot), calib_shape[0]->ToTH1(pot)};
658 
659  //Signal statistical "down" error distrubitions.
660  std::vector<TH1*> vector_dwn_NSel_Cuts = {fluxdown[0]->ToTH1(pot), xsecdown[0]->ToTH1(pot),calibdown[0]->ToTH1(pot), lightdown[0]->ToTH1(pot),ckv[0]->ToTH1(pot), calib_shape[0]->ToTH1(pot)};
661 
662 
663  TH1* hnom_NSel_Cuts = nominal[0]->ToTH1(pot);
664  hnom_NSel_Cuts->SetTitle(";Prong CVN Gamma ID; Selected Events/8.09 #times 10^{20}POT");
665  std::cout << "*************Bins nominal*************: " << hnom_NSel_Cuts->GetXaxis()->GetNbins() << std::endl;
666  gROOT->ProcessLine(".! mkdir -p plots");
667 
668  TCanvas* Prong_CVN_Gamma_ID_NSel_Cuts = new TCanvas("Prong_CVN_Gamma_ID_NSel_Cuts", "Prong_CVN_Gamma_ID_NSel_Cuts");
669  Prong_CVN_Gamma_ID_NSel_Cuts ->SetLeftMargin(0.15);
670 
671  PlotWithSystErrorBandWidth(hnom_NSel_Cuts, vector_up_NSel_Cuts, vector_dwn_NSel_Cuts, -1, -1, 1.3f, true);
672  TLegend * leg0 = new TLegend(0.55,0.5,0.65,0.8);
673  leg0-> SetTextFont(42);
674  leg0-> SetTextSize(0.05);
675  leg0->AddEntry(hnom_NSel_Cuts, " NC #pi^{0} > 0.3 E");
676  leg0->Draw("same");
677  NDSimulation();
678 
679  Prong_CVN_Gamma_ID_NSel_Cuts->SaveAs(outDir2+CurrentFile[1].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
680  // Prong_CVN_Gamma_ID_NSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_ID_NSel_Cuts_0_3_high_Combined_OneKnob1_out_3_MaNCRES.pdf");
681  // CvtxX_sig_nopresel->SaveAs("plots/vtxX_sig_nopresel.png");
682  // Prong_CVN_Gamma_ID_NSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_ID_NSel_Cuts_0_3_high.pdf");
683  // Prong_CVN_Gamma_ID_NSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration/Prong_CVN_Gamma_ID_NSel_Cuts_calib_0_3_high.pdf");
684  //Prong_CVN_Gamma_ID_NSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration_shape/Prong_CVN_Gamma_ID_NSel_Cuts__calib_shape_0_3_high.pdf");
685  //Prong_CVN_Gamma_ID_NSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Cherenkov/Prong_CVN_Gamma_ID_NSel_Cuts_Cherenkov_0_3_high.pdf");
686  // Prong_CVN_Gamma_ID_NSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/GENIE/Prong_CVN_Gamma_ID_NSel_Cuts_GENIE_0_3_high.pdf");
687  // Prong_CVN_Gamma_ID_NSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/light_level/Prong_CVN_Gamma_ID_NSel_Cuts_light_level_0_3_high.pdf");
688  // Prong_CVN_Gamma_ID_NSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/ppfx/Prong_CVN_Gamma_ID_NSel_Cuts_ppfx_0_3_high.pdf");
689 
690  /*******************************************************************************/
691  //Create total signal histograms.
692 
693  //Comment these if just calibup or calibdown is needed for plots.
694  TH1* signal_xsecdown = xsecdown[1]->ToTH1(pot);
695  TH1* signal_xsecup = xsecup[1]->ToTH1(pot);
696  TH1* signal_fluxdown = fluxdown[1]->ToTH1(pot);
697  TH1* signal_fluxup = fluxup[1]->ToTH1(pot);
698  TH1* signal_calib_shape = calib_shape[1]->ToTH1(pot);
699  TH1* signal_ckv = ckv[1]->ToTH1(pot);
700  TH1* signal_lightup = lightup[1]->ToTH1(pot);
701  TH1* signal_lightdown = lightdown[1]->ToTH1(pot);
702 
703  TH1* signal_calibdown = calibdown[1]->ToTH1(pot);
704  TH1* signal_calibup = calibup[1]->ToTH1(pot);
705 
706 
707  //Signal uncertainty "up" distributions
708  std::vector<TH1*> vector_up_signal = {fluxup[1]->ToTH1(pot), xsecup[1]->ToTH1(pot), calibup[1]->ToTH1(pot), lightup[1]->ToTH1(pot), ckv[1]->ToTH1(pot), calib_shape[1]->ToTH1(pot)};
709 
710  //Signal uncertainty "down" distributions.
711  std::vector<TH1*> vector_dwn_signal = {fluxdown[1]->ToTH1(pot), xsecdown[1]->ToTH1(pot), calibdown[1]->ToTH1(pot), lightdown[1]->ToTH1(pot), ckv[1]->ToTH1(pot), calib_shape[1]->ToTH1(pot)};
712 
713  TH1* hnom_signal = nominal[1]->ToTH1(pot);
714  hnom_signal->SetTitle(";Prong CVN Gamma ID; Signal events/8.09 #times 10^{20}POT");
715  std::cout << "*************Bins nominal*************: " << hnom_signal->GetXaxis()->GetNbins() << std::endl;
716  gROOT->ProcessLine(".! mkdir -p plots");
717 
718  TCanvas* Prong_CVN_Gamma_ID_NSig_Cuts = new TCanvas("Prong_CVN_Gamma_ID_NSig_Cuts", "Prong_CVN_Gamma_ID_NSig_Cuts");
719  Prong_CVN_Gamma_ID_NSig_Cuts->SetLeftMargin(0.15);
720 
721  PlotWithSystErrorBandWidth(hnom_signal, vector_up_signal, vector_dwn_signal, -1, -1, 1.3f, true);
722  TLegend * leg1 = new TLegend(0.55,0.5,0.65,0.8);
723  leg1-> SetTextFont(42);
724  leg1-> SetTextSize(0.05);
725  leg1->AddEntry(hnom_signal, "NC #pi^{0} > 0.3 E");
726  leg1->Draw("same");
727  NDSimulation();
728 
729  Prong_CVN_Gamma_ID_NSig_Cuts->SaveAs(outDir2+CurrentFile[2].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
730  //Prong_CVN_Gamma_ID_NSig_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_ID_NSig_Cuts_0_3_high_Combined_OneKnob1_out_3_MaNCRES.pdf");
731  //Prong_CVN_Gamma_ID_NSig_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_ID_NSig_Cuts_0_3_high.pdf");
732  // Prong_CVN_Gamma_ID_NSig_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration/Prong_CVN_Gamma_ID_NSig_Cuts_calib_0_3_high.pdf");
733  // Prong_CVN_Gamma_ID_NSig_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration_shape/Prong_CVN_Gamma_ID_NSig_Cuts__calib_shape_0_3_high.pdf");
734  // Prong_CVN_Gamma_ID_NSig_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Cherenkov/Prong_CVN_Gamma_ID_NSig_Cuts_Cherenkov_0_3_high.pdf");
735  // Prong_CVN_Gamma_ID_NSig_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/GENIE/Prong_CVN_Gamma_ID_NSig_Cuts_GENIE_0_3_high.pdf");
736  // Prong_CVN_Gamma_ID_NSig_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/light_level/Prong_CVN_Gamma_ID_NSig_Cuts_light_level_0_3_high.pdf");
737  // Prong_CVN_Gamma_ID_NSig_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/ppfx/Prong_CVN_Gamma_ID_NSig_Cuts_ppfx_0_3_high.pdf");
738 
739  /**************************************************************************/
740  //Create histograms for total true signal. (Just signal and true fiducial cuts)
741 
742  //Comment these if just calibup or calibdown are needed for plots.
743  TH1* truesignal_xsecdown = xsecdown[2]->ToTH1(pot);
744  TH1* truesignal_xsecup = xsecup[2]->ToTH1(pot);
745  TH1* truesignal_fluxdown = fluxdown[2]->ToTH1(pot);
746  TH1* truesignal_fluxup = fluxup[2]->ToTH1(pot);
747  TH1* truesignal_calib_shape = calib_shape[2]->ToTH1(pot);
748  TH1* truesignal_ckv = ckv[2]->ToTH1(pot);
749  TH1* truesignal_lightup = lightup[2]->ToTH1(pot);
750  TH1* truesignal_lightdown = lightdown[2]->ToTH1(pot);
751 
752  TH1* truesignal_calibdown = calibdown[2]->ToTH1(pot);
753  TH1* truesignal_calibup = calibup[2]->ToTH1(pot);
754 
755 
756  //True signal uncertainty "up" distributions.
757  std::vector<TH1*> vector_up_truesignal = {fluxup[2]->ToTH1(pot), xsecup[2]->ToTH1(pot), calibup[2]->ToTH1(pot), lightup[2]->ToTH1(pot), ckv[2]->ToTH1(pot), calib_shape[2]->ToTH1(pot)};
758 
759  //True signal uncertainty "down" distributions.
760  std::vector<TH1*> vector_dwn_truesignal = {fluxdown[2]->ToTH1(pot), xsecdown[2]->ToTH1(pot), calibdown[2]->ToTH1(pot), lightdown[2]->ToTH1(pot), ckv[2]->ToTH1(pot), calib_shape[2]->ToTH1(pot)};
761 
762 
763  TH1* hnom_truesignal = nominal[2]->ToTH1(pot);
764  hnom_truesignal->SetTitle(";Prong CVN Gamma ID; True signal events/8.09 #times 10^{20}POT");
765 
766  gROOT->ProcessLine(".! mkdir -p plots");
767 
768  TCanvas* Prong_CVN_Gamma_ID_NtrueSig_Cut= new TCanvas("Prong_CVN_Gamma_ID_NtrueSig_Cut", "Prong_CVN_Gamma_ID_NtrueSig_Cut");
769  Prong_CVN_Gamma_ID_NtrueSig_Cut->SetLeftMargin(0.15);
770 
771  PlotWithSystErrorBandWidth(hnom_truesignal, vector_up_truesignal, vector_dwn_truesignal, -1, -1, 1.3f, true);
772  TLegend * leg2 = new TLegend(0.55,0.5,0.65,0.8);
773  leg2-> SetTextFont(42);
774  leg2-> SetTextSize(0.05);
775  leg2->AddEntry(hnom_truesignal, "NC #pi^{0} > 0.3 E");
776  leg2->Draw("same");
777  NDSimulation();
778 
779  Prong_CVN_Gamma_ID_NtrueSig_Cut->SaveAs(outDir2+CurrentFile[3].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
780  //Prong_CVN_Gamma_ID_NtrueSig_Cut->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_ID_NtrueSig_Cuts_0_3_high_Combined_OneKnob2_out_3_MaNCRES_MaCOHPi.pdf");
781  //Prong_CVN_Gamma_ID_NtrueSig_Cut->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_ID_NtrueSig_Cuts_0_3_high.pdf");
782  //Prong_CVN_Gamma_ID_NtrueSig_Cut->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration/Prong_CVN_Gamma_ID_NtrueSig_Cuts_calib_0_3_high.pdf");
783  // Prong_CVN_Gamma_ID_NtrueSig_Cut->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration_shape/Prong_CVN_Gamma_ID_NtrueSig_Cuts__calib_shape_0_3_high.pdf");
784  // Prong_CVN_Gamma_ID_NtrueSig_Cut->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Cherenkov/Prong_CVN_Gamma_ID_NtrueSig_Cuts_Cherenkov_0_3_high.pdf");
785  // Prong_CVN_Gamma_ID_NtrueSig_Cut->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/GENIE/Prong_CVN_Gamma_ID_NtrueSig_Cuts_GENIE_0_3_high.pdf");
786  // Prong_CVN_Gamma_ID_NtrueSig_Cut->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/light_level/Prong_CVN_Gamma_ID_NtrueSig_Cuts_light_level_0_3_high.pdf");
787  // Prong_CVN_Gamma_ID_NtrueSig_Cut->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/ppfx/Prong_CVN_Gamma_ID_NtrueSig_Cuts_ppfx_0_3_high.pdf");
788 
789 
790  /***************************************************************************/
791 
792  TH1* hNbkg_Cuts = new TH1F("Nbkg_Cuts","Nbkg_Cuts", 48,0,0.95 );
793  hNbkg_Cuts->GetXaxis()->CenterTitle();
794  hNbkg_Cuts->GetYaxis()->CenterTitle();
795 
796  //Comment these if just calibup or calibdown are needed for plots.
797  TH1* hNbkg_Cuts_xsecdown = new TH1F("xsecdown","xsecdown",48,0,0.95);
798  TH1* hNbkg_Cuts_xsecup = new TH1F("xsecup","xsecup",48,0,0.95);
799  TH1* hNbkg_Cuts_fluxdown = new TH1F("fluxdown","fluxdown",48,0,0.95);
800  TH1* hNbkg_Cuts_fluxup = new TH1F("fluxup","fluxup",48,0,0.95);
801  TH1* hNbkg_Cuts_calib_shape = new TH1F("calibshape","calibshape",48,0,0.95);
802  TH1* hNbkg_Cuts_ckv = new TH1F("ckv","ckv",48,0,0.95);
803  TH1* hNbkg_Cuts_lightup = new TH1F("lightup","lightup",48,0,0.95);
804  TH1* hNbkg_Cuts_lightdown = new TH1F("lightdown","lightdown",48,0,0.95);
805 
806  TH1* hNbkg_Cuts_calibdown = new TH1F("calibdown","calibdown",48,0,0.95);
807  TH1* hNbkg_Cuts_calibup = new TH1F("calibup","calibup",48,0,0.95 ) ;
808 
809  TH1* hPur=new TH1F("hPur","",48,0,0.95);
810  float pur=0.0;
811 
812  for(int n = 1; n < hnom_Nbkg_Cuts->GetNbinsX()-3; ++n)
813  {
814  const float nNSel_Cuts = hnom_NSel_Cuts->Integral(n, 48);
815  const float nNbkg_Cuts = hnom_Nbkg_Cuts->Integral(n, 48);
816 
817  hNbkg_Cuts->SetBinContent(n,nNbkg_Cuts);
818 
819  hNbkg_Cuts_calibup->SetBinContent(n, Nbkg_Cuts_calibup->Integral(n,48));
820  hNbkg_Cuts_calibdown->SetBinContent(n, Nbkg_Cuts_calibdown->Integral(n, 48));
821 
822  //Purity plots
823  float Purity_den = nNSel_Cuts;
824  float Purity_num = nNSel_Cuts-nNbkg_Cuts;
825  if (Purity_num!=0 && Purity_den!=0)
826  {
827  pur=Purity_num/nNSel_Cuts;
828  cout<<"Total Selected:"<<nNSel_Cuts<<endl;
829  cout<<"Background:"<<nNbkg_Cuts<<endl;
830  cout<<"Purity_num:"<<nNSel_Cuts-nNbkg_Cuts<<endl;
831  cout<<"Purity:"<<Purity_num/nNSel_Cuts<<endl;
832  }
833  hPur->SetBinContent(n,pur);
834 
835  //Comment these if just calibup or calibdown are needed for plots.
836  hNbkg_Cuts_xsecup->SetBinContent(n, Nbkg_Cuts_xsecup->Integral(n,48));
837  hNbkg_Cuts_xsecdown->SetBinContent(n, Nbkg_Cuts_xsecdown->Integral(n,48));
838  hNbkg_Cuts_lightup->SetBinContent(n, Nbkg_Cuts_lightup->Integral(n,48));
839  hNbkg_Cuts_lightdown->SetBinContent(n, Nbkg_Cuts_lightdown->Integral(n,48));
840  hNbkg_Cuts_fluxup->SetBinContent(n, Nbkg_Cuts_fluxup->Integral(n,48));
841  hNbkg_Cuts_fluxdown->SetBinContent(n, Nbkg_Cuts_fluxdown->Integral(n,48));
842  hNbkg_Cuts_calib_shape->SetBinContent(n,Nbkg_Cuts_calib_shape->Integral(n,48));
843  hNbkg_Cuts_ckv->SetBinContent(n, Nbkg_Cuts_ckv->Integral(n,48));
844  }
845 
846  std::vector<TH1*> vector_up_Nbkg_Cuts_binbybin = {hNbkg_Cuts_fluxup, hNbkg_Cuts_xsecup, hNbkg_Cuts_calibup, hNbkg_Cuts_lightup, hNbkg_Cuts_ckv, hNbkg_Cuts_calib_shape};
847 
848  std::vector<TH1*> vector_dwn_Nbkg_Cuts_binbybin = {hNbkg_Cuts_fluxdown, hNbkg_Cuts_xsecdown, hNbkg_Cuts_calibdown, hNbkg_Cuts_lightdown, hNbkg_Cuts_ckv, hNbkg_Cuts_calib_shape};
849 
850  /****************************************************************************/
851  //Plot Nbkg with systematic errors.
852  TCanvas* cNbkg_Cuts = new TCanvas("cNbkg_Cuts","cNbkg_Cuts");
853  cNbkg_Cuts->SetLeftMargin(0.15);
854  hNbkg_Cuts->SetTitle(";Prong CVN Gamma ID Cut value; Background Events/8.09 #times 10^{20} POT");
855 
856  PlotWithSystErrorBandWidth(hNbkg_Cuts, vector_up_Nbkg_Cuts_binbybin, vector_dwn_Nbkg_Cuts_binbybin, -1, -1, 1.3f, true);
857  TLegend * leg3 = new TLegend(0.55,0.5,0.65,0.8);
858  leg3-> SetTextFont(42);
859  leg3-> SetTextSize(0.05);
860  leg3->AddEntry(hNbkg_Cuts, "NC #pi^{0} > 0.3 E");
861  leg3->Draw("same");
862  NDSimulation();
863 
864  cNbkg_Cuts->SaveAs(outDir2+CurrentFile[4].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
865  //cNbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_ID_Cut_WithErrorBand_Nbkg_Cuts_0_3_high_Combined_OneKnob1_out_3_MaNCRES.pdf");
866  //cNbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_ID_Cut_WithErrorBand_Nbkg_Cuts_0_3_high.pdf");
867  //cNbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration/Prong_CVN_Gamma_ID_Nbkg_Cuts_calib_0_3_high.pdf");
868  // cNbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration_shape/Prong_CVN_Gamma_ID_Nbkg_Cuts__calib_shape_0_3_high.pdf");
869  // cNbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Cherenkov/Prong_CVN_Gamma_ID_Nbkg_Cuts_Cherenkov_0_3_high.pdf");
870  // cNbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/GENIE/Prong_CVN_Gamma_ID_Nbkg_Cuts_GENIE_0_3_high.pdf");
871  // cNbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/light_level/Prong_CVN_Gamma_ID_Nbkg_Cuts_light_level_0_3_high.pdf");
872  // cNbkg_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/ppfx/Prong_CVN_Gamma_ID_Nbkg_Cuts_ppfx_0_3_high.pdf");
873 
874 
875  /*********************************************************************************/
876  //Plot Purity.
877  TCanvas* cpur = new TCanvas("cpur","cpur");
878  cpur->SetLeftMargin(0.15);
879  hPur->SetLineColor(kRed);
880  hPur->GetYaxis()->SetTitle("Purity");
881  hPur->GetXaxis()->SetTitle("Prong 2 CVN Gamma ID Cut Value");
882  hPur->Draw();
883  TLegend * leg4 = new TLegend(0.6,0.35,0.7,0.5);
884  leg4-> SetTextFont(42);
885  leg4-> SetTextSize(0.05);
886  leg4->SetFillStyle(0);
887  leg4->AddEntry(hPur, "NC #pi^{0} > 0.3 E");
888  leg4->Draw("same");
889  NDSimulation();
890  cpur->SaveAs(outDir2+CurrentFile[4].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
891 
892  /************************************************************************************/
893  ////Total Preselection, selected bin by bin.
894 
895  TH1* hNSel_Cuts = new TH1F("NSel_Cuts","NSel_Cuts", 48,0,0.95 );
896  hNSel_Cuts->GetXaxis()->CenterTitle();
897  hNSel_Cuts->GetYaxis()->CenterTitle();
898 
899  //Comment these if just calibup or calibdown are needed for plots.
900  TH1* hNSel_Cuts_xsecdown = new TH1F("xsecdown","xsecdown",48,0,0.95);
901  TH1* hNSel_Cuts_xsecup = new TH1F("xsecup","xsecup",48,0,0.95);
902  TH1* hNSel_Cuts_fluxdown = new TH1F("fluxdown","fluxdown",48,0,0.95);
903  TH1* hNSel_Cuts_fluxup = new TH1F("fluxup","fluxup",48,0,0.95);
904  TH1* hNSel_Cuts_calib_shape = new TH1F("calibshape","calibshape",48,0,0.95);
905  TH1* hNSel_Cuts_ckv = new TH1F("ckv","ckv", 48,0,0.95 );
906  TH1* hNSel_Cuts_lightup = new TH1F("lightup","lightup",48,0,0.95);
907  TH1* hNSel_Cuts_lightdown = new TH1F("lightdown","lightdown", 48,0,0.95);
908 
909  TH1* hNSel_Cuts_calibdown = new TH1F("calibdown","calibdown",48,0,0.95 );
910  TH1* hNSel_Cuts_calibup = new TH1F("calibup","calibup" ,48,0,0.95);
911 
912  for(int n = 1; n < hnom_NSel_Cuts->GetNbinsX() - 3; ++n)
913  {
914  const float nsel_cuts = hnom_NSel_Cuts->Integral(n,48);
915 
916  hNSel_Cuts->SetBinContent(n, nsel_cuts);
917  hNSel_Cuts_calibup->SetBinContent(n,NSel_Cuts_calibup->Integral(n,48));
918  hNSel_Cuts_calibdown->SetBinContent(n, NSel_Cuts_calibdown->Integral(n,48));
919 
920  //Comment these if just calibup or calibdown are needed for plots.
921  hNSel_Cuts_xsecup->SetBinContent(n, NSel_Cuts_xsecup->Integral(n,48));
922  hNSel_Cuts_xsecdown->SetBinContent(n, NSel_Cuts_xsecdown->Integral(n,48));
923  hNSel_Cuts_lightup->SetBinContent(n, NSel_Cuts_lightup->Integral(n,48));
924  hNSel_Cuts_lightdown->SetBinContent(n, NSel_Cuts_lightdown->Integral(n,48));
925  hNSel_Cuts_fluxup->SetBinContent(n, NSel_Cuts_fluxup->Integral(n,48));
926  hNSel_Cuts_fluxdown->SetBinContent(n, NSel_Cuts_fluxdown->Integral(n,48));
927  hNSel_Cuts_calib_shape->SetBinContent(n, NSel_Cuts_calib_shape->Integral(n,48));
928  hNSel_Cuts_ckv->SetBinContent(n, NSel_Cuts_ckv->Integral(n,48));
929  }
930 
931 
932  std::vector<TH1*> vector_up_NSel_Cuts_binbybin = {hNSel_Cuts_fluxup, hNSel_Cuts_xsecup, hNSel_Cuts_calibup, hNSel_Cuts_lightup, hNSel_Cuts_ckv, hNSel_Cuts_calib_shape};
933 
934  std::vector<TH1*> vector_dwn_NSel_Cuts_binbybin = {hNSel_Cuts_fluxdown, hNSel_Cuts_xsecdown, hNSel_Cuts_calibdown, hNSel_Cuts_lightdown, hNSel_Cuts_ckv, hNSel_Cuts_calib_shape};
935 
936 
937 
938  /***************************************************************************/
939  //Plot total number selected with systematic uncertainty.
940  TCanvas* cNSel_Cuts = new TCanvas("cNSel_Cuts","cNSel_Cuts");
941  cNSel_Cuts->SetLeftMargin(0.15);
942  hNSel_Cuts->SetTitle(";Prong CVN Gamma ID Cut Value;Selected Events/8.09 #times 10^{20} POT");
943 
944  PlotWithSystErrorBandWidth(hNSel_Cuts, vector_up_NSel_Cuts_binbybin, vector_dwn_NSel_Cuts_binbybin, -1, -1, 1.3f, true);
945  TLegend * leg5 = new TLegend(0.55,0.5,0.65,0.8);
946  leg5-> SetTextFont(42);
947  leg5-> SetTextSize(0.05);
948  leg5->AddEntry(hNSel_Cuts, "NC #pi^{0} > 0.3 E");
949  leg5->Draw("same");
950  NDSimulation();
951 
952  cNSel_Cuts->SaveAs(outDir2+CurrentFile[5].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
953  //cNSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_IDcut_WithErrorBand_NSel_Cuts_0_3_high_Combined_OneKnob1_out_3_MaNCRES.pdf");
954  //cNSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_IDcut_WithErrorBand_NSel_Cuts_0_3_high.pdf");
955  // cNSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration/Prong_CVN_Gamma_IDcut_WithErrorBand_NSel_Cuts_calib_0_3_high.pdf");
956  // cNSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration_shape/Prong_CVN_Gamma_IDcut_WithErrorBand_NSel_Cuts_calib_shape_0_3_high.pdf");
957  // cNSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Cherenkov/Prong_CVN_Gamma_IDcut_WithErrorBand_NSel_Cuts_Cherenkov_0_3_high.pdf");
958  // cNSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/GENIE/Prong_CVN_Gamma_IDcut_WithErrorBand_NSel_Cuts_GENIE_0_3_high.pdf");
959  // cNSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/light_level/Prong_CVN_Gamma_IDcut_WithErrorBand_NSel_Cuts_light_level_0_3_high.pdf");
960  // cNSel_Cuts->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/ppfx/Prong_CVN_Gamma_IDcut_WithErrorBand_NSel_Cuts_ppfx_0_3_high.pdf");
961 
962  /************************************************************************************/
963 
964  //Selected signal.
965 
966  TH1* hsignal = new TH1F("signal","signal", 48,0,0.95);
967  hsignal->GetXaxis()->CenterTitle();
968  hsignal->GetYaxis()->CenterTitle();
969 
970  TH1* hsignal_xsecdown = new TH1F("xsecdown","xsecdown", 48,0,0.95);
971  TH1* hsignal_xsecup = new TH1F("xsecup","xsecup", 48,0,0.95);
972  TH1* hsignal_fluxdown = new TH1F("fluxdown","fluxdown", 48,0,0.95);
973  TH1* hsignal_fluxup = new TH1F("fluxup","fluxup", 48,0,0.95);
974  TH1* hsignal_calib_shape = new TH1F("calibshape","calibshape", 48,0,0.95);
975  TH1* hsignal_ckv = new TH1F("ckv","ckv", 48,0,0.95);
976  TH1* hsignal_lightup = new TH1F("lightup","lightup", 48,0,0.95);
977  TH1* hsignal_lightdown = new TH1F("lightdown","lightdown", 48,0,0.95);
978 
979  TH1* hsignal_calibdown = new TH1F("calibdown","calibdown", 48,0,0.95);
980  TH1* hsignal_calibup = new TH1F("calibup","calibup", 48,0,0.95);
981 
982  for(int n = 1; n < hnom_signal->GetNbinsX()-3; ++n)
983  {
984  const float nsig = hnom_signal->Integral(n,48);
985  hsignal->SetBinContent(n, nsig);
986 
987  hsignal_calibup->SetBinContent(n,signal_calibup->Integral(n,48));
988  hsignal_calibdown->SetBinContent(n, signal_calibdown->Integral(n,48));
989  hsignal_xsecup->SetBinContent(n, signal_xsecup->Integral(n,48));
990  hsignal_xsecdown->SetBinContent(n, signal_xsecdown->Integral(n,48));
991  hsignal_lightup->SetBinContent(n, signal_lightup->Integral(n,48));
992  hsignal_lightdown->SetBinContent(n, signal_lightdown->Integral(n,48));
993  hsignal_fluxup->SetBinContent(n, signal_fluxup->Integral(n,48));
994  hsignal_fluxdown->SetBinContent(n, signal_fluxdown->Integral(n,48));
995 
996  hsignal_calib_shape->SetBinContent(n, signal_calib_shape->Integral(n,48));
997  hsignal_ckv->SetBinContent(n, signal_ckv->Integral(n,48));
998  }
999 
1000  std::vector<TH1*> vector_up_signal_binbybin = {hsignal_fluxup, hsignal_xsecup, hsignal_calibup, hsignal_lightup, hsignal_ckv, hsignal_calib_shape};
1001 
1002  std::vector<TH1*> vector_dwn_signal_binbybin = {hsignal_fluxdown, hsignal_xsecdown,hsignal_calibdown, hsignal_lightdown, hsignal_ckv, hsignal_calib_shape};
1003 
1004  /*********************************************************************/
1005  //Plot selected signal with systematic uncertainty.
1006  TCanvas* csignal = new TCanvas("csignal","csignal");
1007  csignal->SetLeftMargin(0.15);
1008  hsignal->SetTitle(";Prong CVN Gamma ID Cut Value;Signal Events/8.09 #times 10^{20} POT");
1009 
1010  PlotWithSystErrorBandWidth(hsignal, vector_up_signal_binbybin, vector_dwn_signal_binbybin, -1, -1, 1.3f, true);
1011  TLegend * leg6 = new TLegend(0.55,0.5,0.65,0.8);
1012  leg6-> SetTextFont(42);
1013  leg6-> SetTextSize(0.05);
1014  leg6->AddEntry(hsignal, "NC #pi^{0} > 0.3 E");
1015  leg6->Draw("same");
1016  NDSimulation();
1017 
1018  csignal->SaveAs(outDir2+CurrentFile[6].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
1019  //csignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_IDcut_WithErrorBand_NSig_Cuts_0_3_high_Combined_OneKnob1_out_3_MaNCRES.pdf");
1020  //csignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_IDcut_WithErrorBand_NSig_Cuts_0_3_high.pdf");
1021  // csignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration/Prong_CVN_Gamma_IDcut_WithErrorBand_NSig_Cuts_calib_0_3_high.pdf");
1022  // csignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration_shape/Prong_CVN_Gamma_IDcut_WithErrorBand_NSig_Cuts_calib_shape_0_3_high.pdf");
1023  // csignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Cherenkov/Prong_CVN_Gamma_IDcut_WithErrorBand_NSig_Cuts_Cherenkov_0_3_high.pdf");
1024  // csignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/GENIE/Prong_CVN_Gamma_IDcut_WithErrorBand_NSig_Cuts_GENIE_0_3_high.pdf");
1025  // csignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/light_level/Prong_CVN_Gamma_IDcut_WithErrorBand_NSig_Cuts_light_level_0_3_high.pdf");
1026  // csignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/ppfx/Prong_CVN_Gamma_IDcut_WithErrorBand_NSig_Cuts_ppfx_0_3_high.pdf");
1027 
1028  /************************************************************************************/
1029  //For true signal.
1030 
1031  TH1* htruesignal = new TH1F("","", 48,0,0.95);
1032  htruesignal->GetXaxis()->CenterTitle();
1033  htruesignal->GetYaxis()->CenterTitle();
1034 
1035  TH1* htruesignal_xsecdown = new TH1F("xsecdown","xsecdown", 48,0,0.95);
1036  TH1* htruesignal_xsecup = new TH1F("xsecup","xsecup", 48,0,0.95);
1037  TH1* htruesignal_fluxdown = new TH1F("fluxdown","fluxdown", 48,0,0.95);
1038  TH1* htruesignal_fluxup = new TH1F("fluxup","fluxup", 48,0,0.95);
1039  TH1* htruesignal_calib_shape = new TH1F("calibshape","calibshape", 48,0,0.95);
1040  TH1* htruesignal_ckv = new TH1F("ckv","ckv", 48,0,0.95);
1041  TH1* htruesignal_lightup = new TH1F("lightup","lightup", 48,0,0.95);
1042  TH1* htruesignal_lightdown = new TH1F("lightdown","lightdown", 48,0,0.95);
1043 
1044  TH1* htruesignal_calibdown = new TH1F("calibdown","calibdown", 48,0,0.95);
1045  TH1* htruesignal_calibup = new TH1F("calibup","calibup", 48,0,0.95);
1046 
1047 
1048 
1049 
1050  for(int n = 1; n < hnom_truesignal->GetNbinsX()-3; ++n)
1051  {
1052  const float nsig = hnom_truesignal->Integral(n,48);
1053  htruesignal->SetBinContent(n, nsig);
1054 
1055  htruesignal_calibup->SetBinContent(n,truesignal_calibup->Integral(n,48));
1056  htruesignal_calibdown->SetBinContent(n, truesignal_calibdown->Integral(n,48));
1057 
1058  htruesignal_xsecup->SetBinContent(n, truesignal_xsecup->Integral(n,48));
1059  htruesignal_xsecdown->SetBinContent(n, truesignal_xsecdown->Integral(n,48));
1060  htruesignal_lightup->SetBinContent(n, truesignal_lightup->Integral(n,48));
1061  htruesignal_lightdown->SetBinContent(n, truesignal_lightdown->Integral(n,48));
1062  htruesignal_fluxup->SetBinContent(n, truesignal_fluxup->Integral(n,48));
1063  htruesignal_fluxdown->SetBinContent(n, truesignal_fluxdown->Integral(n,48));
1064  htruesignal_calib_shape->SetBinContent(n, truesignal_calib_shape->Integral(n,48));
1065  htruesignal_ckv->SetBinContent(n, truesignal_ckv->Integral(n,48));
1066  }
1067 
1068 
1069  std::vector<TH1*> vector_up_truesignal_binbybin = {htruesignal_fluxup, htruesignal_xsecup, htruesignal_calibup, htruesignal_lightup, htruesignal_ckv, htruesignal_calib_shape};
1070 
1071  std::vector<TH1*> vector_dwn_truesignal_binbybin = {htruesignal_fluxdown, htruesignal_xsecdown, htruesignal_calibdown, htruesignal_lightdown, htruesignal_ckv, htruesignal_calib_shape};
1072 
1073 
1074 
1075 
1076  /*************************************************************************/
1077  //Plotting true signal with systematics
1078 
1079  TCanvas* ctruesignal = new TCanvas("ctruesignal","ctruesignal");
1080  htruesignal->GetYaxis()->SetTitle("True signal Events/8.09 #times 10^{20} POT");
1081  htruesignal->SetTitleOffset(0.75,"Y");
1082  htruesignal->GetXaxis()->SetTitle("Prong CVN Gamma ID Cut Value");
1083 
1084  PlotWithSystErrorBandWidth(htruesignal, vector_up_truesignal_binbybin, vector_dwn_truesignal_binbybin, -1, -1, 1.3f, true);
1085 
1086  TLegend* leg7 = new TLegend(0.55,0.5,0.65,0.8);
1087  leg7-> SetTextFont(42);
1088  leg7-> SetTextSize(0.05);
1089  leg7->AddEntry(htruesignal, "NC #pi^{0} > 0.3 E");
1090  leg7->Draw("same");
1091  NDSimulation();
1092 
1093  ctruesignal->SaveAs(outDir2+CurrentFile[7].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
1094  //ctruesignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_IDcut_WithErrorBand_NtrueSig_Cuts_0_3_high_Combined_OneKnob1_out_3_MaNCRES.pdf");
1095  //ctruesignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Prong_CVN_Gamma_IDcut_WithErrorBand_NtrueSig_Cuts_0_3_high.pdf");
1096  // ctruesignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration/Prong_CVN_Gamma_IDcut_WithErrorBand_NtrueSig_Cuts_calib_0_3_high.pdf");
1097  // ctruesignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration_shape/Prong_CVN_Gamma_IDcut_WithErrorBand_NtrueSig_Cuts_calib_shape_0_3_high.pdf");
1098  // ctruesignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Cherenkov/Prong_CVN_Gamma_IDcut_WithErrorBand_NtrueSig_Cuts_Cherenkov_0_3_high.pdf");
1099  // ctruesignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/GENIE/Prong_CVN_Gamma_IDcut_WithErrorBand_NtrueSig_Cuts_GENIE_0_3_high.pdf");
1100  // ctruesignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/light_level/Prong_CVN_Gamma_IDcut_WithErrorBand_NtrueSig_Cuts_light_level_0_3_high.pdf");
1101  // ctruesignal->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/ppfx/Prong_CVN_Gamma_IDcut_WithErrorBand_NtrueSig_Cuts_ppfx_0_3_high.pdf");
1102  /*****************************************************************/
1103 
1104  //Comment these if just calibup or calibdown are needed for plots.
1105  TH1* num_xsecdown = xsecdown[1]->ToTH1(pot);
1106  TH1* num_xsecup = xsecup[1]->ToTH1(pot);
1107  TH1* denom_xsecdown = xsecdown[2]->ToTH1(pot);
1108  TH1* denom_xsecup = xsecup[2]->ToTH1(pot);
1109  TH1* num_fluxdown = fluxdown[1]->ToTH1(pot);
1110  TH1* num_fluxup = fluxup[1]->ToTH1(pot);
1111  TH1* denom_fluxdown = fluxdown[2]->ToTH1(pot);
1112  TH1* denom_fluxup = fluxup[2]->ToTH1(pot);
1113  TH1* num_calib_shape = calib_shape[1]->ToTH1(pot);
1114  TH1* denom_calib_shape = calib_shape[2]->ToTH1(pot);
1115  TH1* num_ckv = ckv[1]->ToTH1(pot);
1116  TH1* denom_ckv = ckv[2]->ToTH1(pot);
1117  TH1* num_lightup = lightup[1]->ToTH1(pot);
1118  TH1* num_lightdown = lightdown[1]->ToTH1(pot);
1119  TH1* denom_lightup = lightup[2]->ToTH1(pot);
1120  TH1* denom_lightdown = lightdown[2]->ToTH1(pot);
1121 
1122  TH1* num_calibdown = calibdown[1]->ToTH1(pot);
1123  TH1* num_calibup = calibup[1]->ToTH1(pot);
1124  TH1* denom_calibdown = calibdown[2]->ToTH1(pot);
1125  TH1* denom_calibup = calibup[2]->ToTH1(pot);
1126 
1127  //Selected signal for nominal.
1128  TH1* sig = nominal[1]->ToTH1(pot);
1129 
1130  //True signal for nominal.
1131  TH1* denome = nominal[2]->ToTH1(pot);
1132 
1133  float totsig = denome->Integral(1, 48);
1134 
1135  //Comment these if just calibup or calibdown are needed for plots.
1136  float vdenom_xsecdown = denom_xsecdown->Integral(1, 48);
1137  float vdenom_xsecup = denom_xsecup->Integral(1, 48);
1138  float vdenom_fluxdown = denom_fluxdown->Integral(1, 48);
1139  float vdenom_fluxup = denom_fluxup->Integral(1, 48);
1140  float vdenom_lightdown = denom_lightdown->Integral(1, 48);
1141  float vdenom_lightup = denom_lightup->Integral(1, 48);
1142  float vdenom_calib_shape = denom_calib_shape->Integral(1, 48);
1143  float vdenom_ckv = denom_ckv->Integral(1, 48);
1144 
1145  float vdenom_calibdown = denom_calibdown->Integral(1, 48);
1146  float vdenom_calibup = denom_calibup->Integral(1, 48);
1147 
1148  std::cout << "******************T=Sig: "<< sig <<std::endl;
1149  std::cout << "******************T=denome: "<< denome <<std::endl;
1150 
1151  gPad->RedrawAxis();
1152 
1153  /***************************************************************************/
1154  TH1* nomeff = new TH1F("eff_","; Prong CVN Gamma ID Cut;Selection Efficiency",48,0,0.95);
1155 
1156  TH1* eff_calibdown = new TH1F("eff_calibdown","Efficiency vs Cut Value; Prong CVN Gamma ID ;Efficiency",48,0,0.95);
1157 
1158  TH1* eff_calibup = new TH1F("eff_calibup","Efficiency vs Cut Value;Prong CVN Gamma ID ;Efficiency",48,0,0.95);
1159 
1160  TH1* eff_lightdown = new TH1F("eff_lightdown","Efficiency vs Cut Value; Prong CVN Gamma ID ;Efficiency",48,0,0.95);
1161 
1162  TH1* eff_lightup = new TH1F("eff_lightup","Efficiency vs Cut Value; Prong CVN Gamma ID ;Efficiency",48,0,0.95 );
1163 
1164  TH1* eff_ckv = new TH1F("eff_ckv","Efficiency vs Cut Value;Prong CVN Gamma ID ;Efficiency",48,0,0.95);
1165 
1166  TH1* eff_calib_shape = new TH1F("eff_calibshape","Efficiency vs Cut Value; Prong CVN Gamma ID ;Efficiency",48,0,0.95);
1167 
1168  TH1* eff_fluxdown = new TH1F("eff_fluxdown","Efficiency vs Cut Value; Prong CVN Gamma ID ;Efficiency",48,0,0.95);
1169 
1170  TH1* eff_fluxup = new TH1F("eff_fluxup","Efficiency vs Cut Value; Prong CVN Gamma ID ;Efficiency",48,0,0.95);
1171 
1172  TH1* eff_xsecdown = new TH1F("eff_xsecdown","Efficiency vs Cut Value; Prong CVN Gamma ID ;Efficiency",48,0,0.95);
1173 
1174  TH1* eff_xsecup = new TH1F("eff_xsecup","Efficiency vs Cut Value; Prong CVN Gamma ID ;Efficiency",48,0,0.95);
1175 
1176  std::cout << "******************Total selected events (sta+sys): "<< totsig <<std::endl;
1177  /****************************************************************************/
1178 
1179  for(int n = 1; n < hnom_Nbkg_Cuts->GetNbinsX() - 3; ++n)
1180  {
1181  //Comment these if just calibup or calibdown are needed for plots.
1182  const float n1sig = sig->Integral(n, 48);
1183  const float nxsecdown = num_xsecdown->Integral(n, 48)/vdenom_xsecdown;
1184  const float nxsecup = num_xsecup->Integral(n, 48)/vdenom_xsecup;
1185  const float nfluxdown = num_fluxdown->Integral(n, 48)/vdenom_fluxdown;
1186  const float nfluxup = num_fluxup->Integral(n, 48)/vdenom_fluxup;
1187  const float nlightdown = num_lightdown->Integral(n, 48)/vdenom_lightdown;
1188  const float nlightup = num_lightup->Integral(n, 48)/vdenom_lightup;
1189  const float ncalib_shape = num_calib_shape->Integral(n, 48)/vdenom_calib_shape;
1190  const float nckv = num_ckv->Integral(n, 48)/vdenom_ckv;
1191 
1192 
1193  const float ncalibdown = num_calibdown->Integral(n, 48)/vdenom_calibdown;
1194  const float ncalibup = num_calibup->Integral(n, 48)/vdenom_calibup;
1195  std::cout << "******************n1sig: "<< n1sig <<std::endl;
1196  std::cout << "******************Total selected events (sta+sys): "<< totsig <<std::endl;
1197 
1198 
1199  float neff = n1sig/(totsig); //Signal Presel/True vtx fiducial only signal
1200  std::cout << "******************neff: "<< neff <<std::endl;
1201 
1202  /*******************************************************************************************/
1203 
1204 
1205  nomeff->SetBinContent(n, neff);
1206 
1207  std::cout << "******************nomeff: "<< nomeff <<std::endl;
1208  eff_xsecdown->SetBinContent(n, nxsecdown);
1209 
1210  //Comment these if just calibup or calibdown are needed for plots.
1211  eff_xsecup->SetBinContent(n, nxsecup);
1212  eff_fluxdown->SetBinContent(n, nfluxdown);
1213  eff_fluxup->SetBinContent(n, nfluxup);
1214  eff_calibdown->SetBinContent(n, ncalibdown);
1215  eff_calibup->SetBinContent(n, ncalibup);
1216  eff_lightdown->SetBinContent(n, nlightdown);
1217  eff_lightup->SetBinContent(n, nlightup);
1218  eff_calib_shape->SetBinContent(n, ncalib_shape);
1219  eff_ckv->SetBinContent(n, nckv);
1220  }
1221 
1222  std::vector<TH1*> rdn = {eff_calibdown, eff_lightdown, eff_ckv, eff_calib_shape, eff_fluxdown, eff_xsecdown};
1223 
1224  std::vector<TH1*> rup = {eff_calibup, eff_lightup, eff_ckv, eff_calib_shape, eff_fluxup, eff_xsecup};
1225 
1226  PlotDeltaSigmaWithSigma(hNbkg_Cuts,hNSel_Cuts,
1227  vector_up_Nbkg_Cuts_binbybin,
1228  vector_dwn_Nbkg_Cuts_binbybin,
1229  vector_up_NSel_Cuts_binbybin,
1230  vector_dwn_NSel_Cuts_binbybin,
1231  nomeff, rup, rdn,
1232  "Prong__CVN_Gamma_ID_sigma_Systematics_optimization_Myfid_cont","Prong__CVN_Gamma_ID_Nbkg_Cuts_syst_Systematics_optimization_Myfid_cont","Prong__CVN_Gamma_ID_Nbkg_Cuts_stat__Systematics_optimization_Myfid_cont", "Prong__CVN_Gamma_ID_NSel_Cuts_syst__Systematics_optimization_Myfid_cont","Prong__CVN_Gamma_ID_NSel_Cuts_stat_Systematics_optimization_Myfid_cont","Prong_CVN_Gamma_ID_delta_eff__Systematics_optimization_Myfid_cont","c7__Systematics_Prong__CVN_optimization_Myfid_cont","c8__Systematics_Prong__CVN_optimization_Myfid_cont","c9__Systematics_Prong__CVN_optimization_Myfid_cont", true);
1233 
1234  TLegend * leg8 = new TLegend(0.55,0.5,0.65,0.8);
1235  leg8-> SetTextFont(42);
1236  leg8-> SetTextSize(0.05);
1237  leg8->AddEntry(hNbkg_Cuts, "NC #pi^{0} < 0.3 E");
1238  leg8->Draw("same");
1239 
1240  TCanvas* ceff = new TCanvas("ceff", "ceff");
1241  ceff->SetLeftMargin(0.15);
1242  PlotWithSystErrorBandWidth(nomeff, rup, rdn, -1, -1, 1.3f, true);
1243  //TLegend * leg9 = new TLegend(0.55,0.5,0.65,0.8);
1244  //leg9-> SetTextFont(42);
1245  //leg9-> SetTextSize(0.05);
1246  //leg9->AddEntry(nomeff, "NC #pi^{0} > 0.3 E");
1247  //leg9->Draw("same");
1248  NDSimulation();
1249 
1250  ceff->SaveAs(outDir2+CurrentFile[8].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
1251  //ceff->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/ceff03GEV_Combined_OneKnob1_out_3_MaNCRES.pdf");
1252  //ceff->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/ceff03GEV.pdf");
1253  // ceff->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration/Prong_CVN_Gamma_ID_eff_cutvalue_calib_0_3s_high.pdf");
1254  // ceff->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Calibration_shape/Prong_CVN_Gamma_ID_eff_cutvalue_calib_shape_0_3_high.pdf");
1255  // ceff->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/Cherenkov/Prong_CVN_Gamma_ID_eff_cutvalue_Cherenkov_0_3_high.pdf");
1256  // ceff->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/GENIE/Prong_CVN_Gamma_ID_eff_cutvalue_GENIE_0_3_high.pdf");
1257  // ceff->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/light_level/Prong_CVN_Gamma_ID_eff_cutvalue_light_level_0_3_high.pdf");
1258  // ceff->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/plots/2prong03high/ppfx/Prong_CVN_Gamma_ID_eff_cutvalue_ppfx_0_3_high.pdf");
1259 
1260  }// end loop over vars
1261 
1262 }
TString fin
Definition: Style.C:24
const XML_Char * name
Definition: expat.h:151
void GetFluxError(const Spectrum *nom, std::vector< ana::Spectrum * > univs, std::vector< ana::Spectrum * > &supdown)
enum BeamMode kRed
void NDSimulation()
prelim SetTextSize(2/30.)
const DateUp CurrentDate[Date]
TLegend * leg1
Definition: plot_hist.C:105
void PlotWithSystErrorBandWidth(TH1 *&nom, std::vector< TH1 * > &ups, std::vector< TH1 * > &dns, int col, int errCol, float headroom, bool newaxis)
std::unique_ptr< T > LoadFrom(TDirectory *dir, const std::string &label)
Definition: LoadFromFile.h:17
std::vector< std::string > cut_labels
const FileUp CurrentFile[File]
void PlotDeltaSigmaWithSigma(TH1 *&nom, TH1 *&nomsel, std::vector< TH1 * > &ups, std::vector< TH1 * > &dns, std::vector< TH1 * > &upssel, std::vector< TH1 * > &dnssel, TH1 *&heff, std::vector< TH1 * > &effups, std::vector< TH1 * > &effdns, TString outname1, TString outname2, TString outname3, TString outname4, TString outname5, TString outname6, TString outname7, TString outname8, TString outname9, Bool_t printme=false)
std::string date
OStream cout
Definition: OStream.cxx:6
TString outDir2
const double pot
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32
enum BeamMode string
void PlotDeltaSigmaWithSigma ( TH1 *&  nom,
TH1 *&  nomsel,
std::vector< TH1 * > &  ups,
std::vector< TH1 * > &  dns,
std::vector< TH1 * > &  upssel,
std::vector< TH1 * > &  dnssel,
TH1 *&  heff,
std::vector< TH1 * > &  effups,
std::vector< TH1 * > &  effdns,
TString  outname1,
TString  outname2,
TString  outname3,
TString  outname4,
TString  outname5,
TString  outname6,
TString  outname7,
TString  outname8,
TString  outname9,
Bool_t  printme = false 
)

bkg Nsel

Definition at line 155 of file plot_uncertainty.C.

References demo5::c1, demo5::c2, chisquared::c3, chisquared::c4, om::cout, allTimeWatchdog::endl, kRed, NDSimulation(), outDir, SetTextSize(), std::sqrt(), and submit_syst::y.

168 {
169 
170  //Find the bin that has the most events in it.
171  double yMax = nom->GetBinContent(nom->GetMaximumBin());
172 
173 
174  /********************************************************/
175  //Define the pieces needed for the whole background section of the fractional uncertainty.
176 
177  TH1F* hBkg_Stat_Unc = new TH1F("hBkg_Stat_Unc","; Prong CVN Gamma ID Cut; #frac{#sqrt{N_{bkg}}}{N_{sel}-N_{bkg}}", nom->GetNbinsX(), nom->GetXaxis()->GetBinLowEdge(1), nom->GetXaxis()->GetBinUpEdge(nom->GetNbinsX()));
178 
179  TH1F* hBkg_Stat_Unc_num = new TH1F("hBkg_Stat_Unc_num","; Prong CVN Gamma ID Cut value; #sqrt{N_{bkg}}", nom->GetNbinsX(), nom->GetXaxis()->GetBinLowEdge(1), nom->GetXaxis()->GetBinUpEdge(nom->GetNbinsX()));
180 
181  TH1F* hBkg_Stat_Unc_den = new TH1F("hBkg_Stat_Unc_den",";Prong CVN Gamma ID Cut value; N_{sel}-N_{bkg}", nom->GetNbinsX(), nom->GetXaxis()->GetBinLowEdge(1), nom->GetXaxis()->GetBinUpEdge(nom->GetNbinsX()));
182 
183  TH1F* hBkg_Syst_Unc = new TH1F("hBkg_Syst_Unc",";Prong CVN Gamma ID Cut; #frac{#deltaN^{syst}_{bkg}}{N_{sel}-N_{bkg}}", nom->GetNbinsX(), nom->GetXaxis()->GetBinLowEdge(1), nom->GetXaxis()->GetBinUpEdge(nom->GetNbinsX()));
184 
185  /*********************************************************/
186  //Define the pieces needed for the total selection fractional uncertainty.
187 
188  TH1F* hSel_Stat_Unc = new TH1F("hSel_Stat_Unc",";Prong CVN Gamma ID Cut; #frac{#sqrt{N_{sel}}}{N_{sel}-N_{bkg}}", nomsel->GetNbinsX(), nomsel->GetXaxis()->GetBinLowEdge(1), nomsel->GetXaxis()->GetBinUpEdge(nom->GetNbinsX()));
189 
190  TH1F* hSel_Stat_Unc_num = new TH1F("hSel_Stat_Unc_num",";Prong CVN Gamma ID Cut value; #sqrt{N_{sel}}", nomsel->GetNbinsX(), nomsel->GetXaxis()->GetBinLowEdge(1), nomsel->GetXaxis()->GetBinUpEdge(nomsel->GetNbinsX()));
191 
192 //Where is this used in the calculation for cross section uncertainty?
193  TH1F* hnsel_syst = new TH1F("hnsel_syst",";Prong CVN Gamma ID Cut; #frac{#deltaN^{syst}_{sig}}{N_{sel}-N_{bkg}}", nomsel->GetNbinsX(), nomsel->GetXaxis()->GetBinLowEdge(1), nomsel->GetXaxis()->GetBinUpEdge(nom->GetNbinsX()));
194 
195  /********************************************************/
196  //Define the uncertainty in the efficiency and the fractional cross section uncertainty.
197  TH1F* hEpsilon = new TH1F("hEpsilon",";Prong CVN Gamma ID Cut; #frac{#delta#varepsilon}{#varepsilon}", nom->GetNbinsX(), nom->GetXaxis()->GetBinLowEdge(1), nom->GetXaxis()->GetBinUpEdge(nom->GetNbinsX()));
198 
199  TH1F* hSigma = new TH1F("hSigma",";Prong CVN Gamma ID Cut; #frac{#delta#sigma}{#sigma}", nom->GetNbinsX(), nom->GetXaxis()->GetBinLowEdge(1), nom->GetXaxis()->GetBinUpEdge(nom->GetNbinsX()));
200 
201 
202 
203  /*********************************************************/
204  //Loop over all bins to fill objects.
205 
206  for(int binIdx = 1; binIdx < nom->GetNbinsX()-1; ++binIdx)
207  {
208  //Total background events.
209  const double y = nom ->GetBinContent(binIdx);
210 
211  //Total selected events.
212  const double ysel = nomsel ->GetBinContent(binIdx);
213 
214  //Efficiency.
215  const double Neff = heff->GetBinContent(binIdx);
216 
217  double deltaNbkg2 = 0;
218  double deltaNsig2 = 0;
219  double deltaeff2 = 0;
220  double errUp = 0;
221  double errDn = 0;
222  double errUpsig = 0;
223  double errDnsig = 0;
224  double totalbkg = 0;
225  double totalpresel = 0;
226 
227  //Loop over systematic ID values.
228  for(unsigned int systIdx = 0; systIdx < ups.size(); ++systIdx)
229  {
230  double deltaNbkg = (ups[systIdx]->GetBinContent(binIdx)-dns[systIdx]->GetBinContent(binIdx))/2;
231  double deltaNsel = (upssel[systIdx]->GetBinContent(binIdx)-dnssel[systIdx]->GetBinContent(binIdx))/2;
232  double deltaeff = (effups[systIdx]->GetBinContent(binIdx)-effdns[systIdx]->GetBinContent(binIdx))/2;
233 
234  //Uncertainty on the efficiency.
235  deltaeff2 += deltaeff*deltaeff;
236 
237  //Uncertainty on the background.
238  deltaNbkg2 += deltaNbkg*deltaNbkg;
239 
240  //Uncertainty on the selection.
241  deltaNsig2 += deltaNsel*deltaNsel;
242 
243  }
244 
245 
246  /*******************************************************************/
247  //Calculate the pieces of the fractional cross section uncertainty.
248 
249  //Define scaling factor for normalization of uncertainty.
250  const double s = 0.23;
251 
252  totalbkg = y*s + deltaNbkg2; //NBkg + (Systematic Background Uncertainty)^2
253  totalpresel = ysel; //Total number selected.
254  double sel_bkg = ysel - y; //NSel - NBkg
255  double sel_bkg2 = sel_bkg*sel_bkg; //(NSel-NBkg)^2
256  double uncbkg = totalbkg/sel_bkg2; //(NBkg+(Systematic Background Uncertainty)^2)/(NSel-NBkg)^2
257  double uncsel = totalpresel/sel_bkg2; //NSel/(NSel-NBkg)^2
258  double Neff2 = Neff*Neff; //Efficiency^2
259  double unceff = deltaeff2/Neff2; //Uncertainty on selection efficiency.
260  double uncsigma2 = uncbkg + unceff + uncsel;
261 
262  /********************************************************************/
263  //Print out some helpful numbers.
264  if (binIdx==1)
265  {
266  cout << "#########Bin number value for 0.90: "<< nom->GetXaxis()->FindBin(0.90);
267  cout << "#########Bin number value for 0.91: "<< nom->GetXaxis()->FindBin(0.91);
268  cout << "#########Bin number value for 0.92: "<< nom->GetXaxis()->FindBin(0.92);
269  cout << "#########Bin number value for 0.93: "<< nom->GetXaxis()->FindBin(0.93);
270  cout << "#########Bin number value for 0.94: "<< nom->GetXaxis()->FindBin(0.94);
271  cout << "#########Bin number value for 0.95: "<< nom->GetXaxis()->FindBin(0.95);
272  cout << "#########Bin number value for 0.96: "<< nom->GetXaxis()->FindBin(0.96);
273  cout << "#########Bin number value for 0.97: "<< nom->GetXaxis()->FindBin(0.97);
274  cout << "#########Bin number value for 0.98: "<< nom->GetXaxis()->FindBin(0.98);
275  cout << "#########Bin number value for 0.99: "<< nom->GetXaxis()->FindBin(0.99);
276  cout << "#########Bin number value for 1: "<< nom->GetXaxis()->FindBin(1);
277 
278  cout << "*********************** bin number**********************: "<< binIdx <<endl;
279  cout << "Bkg number (from bin content)"<< y <<endl;
280  cout << "Total bkg (sta+sys): "<< totalbkg <<endl;
281  cout << "Selected Sig(denominator): "<< sel_bkg <<endl;
282  cout << "Selected Sig square(denominator): "<< sel_bkg2 <<endl;
283  cout << "Stat unc in bkg "<< sqrt(y)/sqrt(sel_bkg2) <<endl;
284  cout << "Sys unc in bkg "<< sqrt(deltaNbkg2)/sqrt(sel_bkg2) <<endl;
285  cout << "Sys unc in bkg - the numerator" << sqrt(deltaNbkg2)<<endl;
286  cout << "Total unc in bkg "<< uncbkg <<endl;
287 
288  cout << "selected number (from bin content): "<< ysel <<endl;
289  cout << "Total selected events (sta+sys): "<< totalpresel <<endl;
290  cout << "Selected Sig(denominator): "<< sel_bkg <<endl;
291  cout << "Selected Sig square(denominator): "<< sel_bkg2 <<endl;
292  cout << "Stat unc in selected "<< sqrt(ysel)/sqrt(sel_bkg2) <<endl;
293  cout << "Sys unc in selected "<< sqrt(deltaNsig2)/sqrt(sel_bkg2) <<endl;
294  cout << "Total unc in selected "<< uncsel <<endl;
295  cout << "Efficiency bin content (from bin content): "<< Neff <<endl;
296 
297  cout << "Square of Efficiency (from bin content): "<< Neff2 <<endl;
298  cout << "unc Efficiency : "<< unceff <<endl;
299  cout << "sigma uncertainty" << (uncsigma2)<<endl;
300  cout << "square root sigma uncertainty" << sqrt(uncsigma2)<<endl;
301  }
302 
303  /********************************************************************/
304  //Fill uncertainty histograms.
305 
306  //Total background systematic uncertainty.
307  hBkg_Syst_Unc->Fill(nom->GetXaxis()->GetBinCenter(binIdx), sqrt(deltaNbkg2)/sqrt(sel_bkg2));
308 
309  //Total background statistical uncertainty.
310  hBkg_Stat_Unc->Fill(nom->GetXaxis()->GetBinCenter(binIdx), sqrt(y)/sqrt(sel_bkg2));
311 
312  //Statistical background uncertainty numerator.
313  hBkg_Stat_Unc_num->Fill(nom->GetXaxis()->GetBinCenter(binIdx), sqrt(y));
314 
315  //Statistical background uncertainty denominator.
316  hBkg_Stat_Unc_den->Fill(nom->GetXaxis()->GetBinCenter(binIdx), sel_bkg);
317 
318  //Systematic selection uncertainty.
319  hnsel_syst->Fill(nomsel->GetXaxis()->GetBinCenter(binIdx), sqrt(deltaNsig2)/sqrt(sel_bkg2));
320 
321  //Statistical selection uncertainty numerator.
322  hSel_Stat_Unc_num->Fill(nom->GetXaxis()->GetBinCenter(binIdx), sqrt(ysel));
323 
324  //Total selection statistical uncertainty.
325  hSel_Stat_Unc->Fill(nom->GetXaxis()->GetBinCenter(binIdx), sqrt(ysel)/sqrt(sel_bkg2));
326 
327  //Fractional efficiency uncertainty.
328  hEpsilon->Fill(nom->GetXaxis()->GetBinCenter(binIdx), sqrt(deltaeff2)/sqrt(Neff2));
329 
330  //Fractional cross section uncertainty.
331  hSigma->Fill(nom->GetXaxis()->GetBinCenter(binIdx), sqrt(uncsigma2));
332 
333  }
334 
335  /*******************************************************/
336  //Set line colors and label axes for the histograms.
337  hBkg_Syst_Unc->SetLineColor(kRed);
338  hBkg_Stat_Unc->SetLineColor(kRed);
339  hBkg_Stat_Unc_num->SetLineColor(kRed);
340  hBkg_Stat_Unc_den->SetLineColor(kRed);
341 
342  hnsel_syst->SetLineColor(kRed);
343  hSel_Stat_Unc->SetLineColor(kRed);
344  hSel_Stat_Unc_num->SetLineColor(kRed);
345 
346  hEpsilon->SetLineColor(kRed);
347  hSigma->SetLineColor(kRed);
348 
349  hBkg_Syst_Unc->GetXaxis()->CenterTitle();
350  hBkg_Syst_Unc->GetYaxis()->CenterTitle();
351  hBkg_Stat_Unc->GetXaxis()->CenterTitle();
352  hBkg_Stat_Unc->GetYaxis()->CenterTitle();
353  hBkg_Stat_Unc_num->GetXaxis()->CenterTitle();
354  hBkg_Stat_Unc_num->GetYaxis()->CenterTitle();
355  hBkg_Stat_Unc_den->GetXaxis()->CenterTitle();
356  hBkg_Stat_Unc_den->GetYaxis()->CenterTitle();
357 
358  hnsel_syst->GetXaxis()->CenterTitle();
359  hnsel_syst->GetYaxis()->CenterTitle();
360  hSel_Stat_Unc->GetXaxis()->CenterTitle();
361  hSel_Stat_Unc->GetYaxis()->CenterTitle();
362  hSel_Stat_Unc_num->GetXaxis()->CenterTitle();
363  hSel_Stat_Unc_num->GetYaxis()->CenterTitle();
364 
365  hEpsilon->GetXaxis()->CenterTitle();
366  hEpsilon->GetYaxis()->CenterTitle();
367  hSigma->GetXaxis()->CenterTitle();
368  hSigma->GetYaxis()->CenterTitle();
369  gPad->RedrawAxis();
370 
371  /**************************************************************/
372  //Create canvases for the each histogram.
373 
374  //Sigma
375  TCanvas *c1 = new TCanvas("c1","c1");
376  c1->SetLeftMargin(0.15);
377  hSigma->Draw("hist ][");
378  //TLegend * lega = new TLegend(0.6,0.35,0.7,0.4);
379  //lega-> SetTextFont(42);
380  //lega-> SetTextSize(0.05);
381  //lega->SetFillStyle(0);
382  //lega->AddEntry( hSigma, "NC #pi^{0} Signal");
383  //lega->Draw("same");
384  NDSimulation();
385 
386  //Background systematic uncertainty
387  TCanvas *c2 = new TCanvas("c2","c2");
388  c2->SetLeftMargin(0.16);
389  hBkg_Syst_Unc->Draw("hist ][");
390  hBkg_Syst_Unc->GetYaxis()->SetTitleOffset(1.2);
391  TLegend * legb = new TLegend(0.55,0.5,0.65,0.8);
392  legb-> SetTextFont(42);
393  legb-> SetTextSize(0.05);
394  legb->AddEntry(hBkg_Syst_Unc, "NC #pi^{0}");
395  legb->Draw("same");
396  NDSimulation();
397 
398  //Number of selected background. What's this?*********************************************************************
399  TCanvas *c2a = new TCanvas("c2a","c2a"); ///bkg Nsel
400  c2a->SetLeftMargin(0.15);
401  hBkg_Stat_Unc->Draw("hist ][");
402  hBkg_Stat_Unc->GetYaxis()->SetTitleOffset(1.1);
403  TLegend * legc = new TLegend(0.6,0.35,0.7,0.5);
404  legc-> SetTextFont(42);
405  legc-> SetTextSize(0.05);
406  legc->AddEntry( hBkg_Stat_Unc, "NC #pi^{0}");
407  legc->Draw("same");
408  NDSimulation();
409 
410  //Statistical background uncertainty numerator.
411  TCanvas *c2b = new TCanvas("c2b","c2b");
412  c2b->SetLeftMargin(0.15);
413  hBkg_Stat_Unc_num->Draw("hist ][");
414  hBkg_Stat_Unc_num->GetYaxis()->SetTitleOffset(1.1);
415  TLegend * legd = new TLegend(0.55,0.5,0.65,0.8);
416  legd-> SetTextFont(42);
417  legd-> SetTextSize(0.05);
418  legd->AddEntry(hBkg_Stat_Unc_num, "NC #pi^{0}");
419  legd->Draw("same");
420  NDSimulation();
421 
422  //Statistical background uncertainty denominator.
423  TCanvas *c2c = new TCanvas("c2c","c2c");
424  c2c->SetLeftMargin(0.15);
425  hBkg_Stat_Unc_den->Draw("hist ][");
426  hBkg_Stat_Unc_den->GetYaxis()->SetTitleOffset(1.1);
427  TLegend * lege = new TLegend(0.55,0.5,0.65,0.8);
428  lege-> SetTextFont(42);
429  lege-> SetTextSize(0.05);
430  lege->AddEntry(hBkg_Stat_Unc_den, "NC #pi^{0}");
431  lege->Draw("same");
432  NDSimulation();
433 
434  //Systematic signal uncertainty
435  TCanvas *c3 = new TCanvas("c3","c3"); ////Sig syst
436  c3->SetLeftMargin(0.16);
437  hnsel_syst->Draw("hist ][");
438  hnsel_syst->GetYaxis()->SetTitleOffset(1.2);
439  NDSimulation();
440 
441  //Total Statistical signal uncertainty.
442  TCanvas *c3a = new TCanvas("c3a","c3a");
443  c3a->SetLeftMargin(0.15);
444  hSel_Stat_Unc->Draw("hist ][");
445  hSel_Stat_Unc->GetYaxis()->SetTitleOffset(1.1);
446  TLegend * legf = new TLegend(0.6,0.35,0.7,0.5);
447  legf-> SetTextFont(42);
448  legf-> SetTextSize(0.05);
449  legf->SetFillStyle(0);
450  legf->AddEntry(hSel_Stat_Unc, "NC #pi^{0} > 0.3 E");
451  legf->Draw("same");
452  NDSimulation();
453 
454  //Statistical signal uncertainty numerator.
455  TCanvas *c3b = new TCanvas("c3b","c3b");
456  c3b->SetLeftMargin(0.15);
457  hSel_Stat_Unc_num->Draw("hist ][");
458  hSel_Stat_Unc_num->GetYaxis()->SetTitleOffset(1.1);
459  TLegend * legg = new TLegend(0.55,0.5,0.65,0.8);
460  legg-> SetTextFont(42);
461  legg-> SetTextSize(0.05);
462  legg->AddEntry(hSel_Stat_Unc_num, "NC #pi^{0} > 0.3 E");
463  legg->Draw("same");
464  NDSimulation();
465 
466  //Fractional efficiency uncertainty.
467  TCanvas *c4 = new TCanvas("c4", "c4");
468  c4->SetLeftMargin(0.15);
469  hEpsilon->Draw("hist ][");
470  //TLegend * legh = new TLegend(0.6,0.35,0.7,0.4);
471  //legh-> SetTextFont(42);
472  //legh-> SetTextSize(0.05);
473  //legh->SetFillStyle(0);
474  //legh->AddEntry(hEpsilon, "NC #pi^{0} Signal");
475  //legh->Draw("same");
476  NDSimulation();
477 
478 
479  if (printme)
480  {
481  TString outDir = "/nova/app/users/rbowles/tag_releaseS18-01-19/NDAna/ncpi0/Systematics/Plots";
482  c1->SaveAs(outDir+"/"+outname1+CurrentDate[0].date.c_str()+".pdf");
483  c2->SaveAs(outDir+"/"+outname2+CurrentDate[0].date.c_str()+".pdf");
484  c2a->SaveAs(outDir+"/"+outname3+CurrentDate[0].date.c_str()+".pdf");
485  c2b->SaveAs(outDir+"/"+outname4+CurrentDate[0].date.c_str()+".pdf");
486  c2c->SaveAs(outDir+"/"+outname5+CurrentDate[0].date.c_str()+".pdf");
487  c3->SaveAs(outDir+"/"+outname6+CurrentDate[0].date.c_str()+".pdf");
488  c3a->SaveAs(outDir+"/"+outname7+CurrentDate[0].date.c_str()+".pdf");
489  c3b->SaveAs(outDir+"/"+outname8+CurrentDate[0].date.c_str()+".pdf");
490  c4->SaveAs(outDir+"/"+outname9+CurrentDate[0].date.c_str()+".pdf");
491  }
492 }//end of plot with error band
::xsd::cxx::tree::date< char, simple_type > date
Definition: Database.h:186
enum BeamMode kRed
void NDSimulation()
T sqrt(T number)
Definition: d0nt_math.hpp:156
prelim SetTextSize(2/30.)
const DateUp CurrentDate[Date]
std::string outDir
c2
Definition: demo5.py:33
const XML_Char * s
Definition: expat.h:262
OStream cout
Definition: OStream.cxx:6
c1
Definition: demo5.py:24
void PlotWithSystErrorBandWidth ( TH1 *&  nom,
std::vector< TH1 * > &  ups,
std::vector< TH1 * > &  dns,
int  col,
int  errCol,
float  headroom,
bool  newaxis 
)

Definition at line 88 of file plot_uncertainty.C.

References om::cout, allTimeWatchdog::endl, MECModelEnuComparisons::g, hi(), ana::kTotalMCColor, ana::kTotalMCErrorBandColor, lo(), std::sqrt(), std::swap(), w, and submit_syst::y.

93 {
94  //Set up error band colors.
95  if(col == -1)
96  {
98  errCol = kTotalMCErrorBandColor;
99  }
100  //Make the color lighter.
101  else if(errCol == -1) errCol = col-7;
102 
103  nom->SetLineColor(col);
104  nom->GetXaxis()->CenterTitle();
105  nom->GetYaxis()->CenterTitle();
106 
107  //Set the axes up.
108  if(newaxis) nom->Draw("hist ][");
109 
110  double yMax = nom->GetBinContent(nom->GetMaximumBin());
111  cout << nom->GetMaximumBin() << "\t" << yMax << endl;
112  TGraphAsymmErrors* g = new TGraphAsymmErrors;
113 
114  //Loop over bins
115  for(int binIdx = 0; binIdx < nom->GetNbinsX()+2; ++binIdx)
116  {
117  const double y = nom->GetBinContent(binIdx);
118  g->SetPoint(binIdx, nom->GetXaxis()->GetBinCenter(binIdx), y);
119  const double w = nom->GetXaxis()->GetBinWidth(binIdx);
120  double errUp = 0;
121  double errDn = 0;
122 
123  //Loop over Systematic ID values
124  for(unsigned int systIdx = 0; systIdx < ups.size(); ++systIdx)
125  {
126  double hii = (ups[systIdx]->GetBinContent(binIdx)-y)/y;
127  double loo = (y-dns[systIdx]->GetBinContent(binIdx))/y;
128  double hi = (ups[systIdx]->GetBinContent(binIdx)-y);
129  double lo = (y-dns[systIdx]->GetBinContent(binIdx));
130 
131  if(lo <= 0 && hi <= 0) std::swap(lo, hi);
132  errUp += hi*hi;
133  errDn += lo*lo;
134  }
135 
136  g->SetPointError(binIdx, w/2, w/2, sqrt(errDn), sqrt(errUp));
137 
138  } // end for i
139  g->SetFillColor(errCol);
140  g->Draw("e2 same");
141  g->GetYaxis()->SetRangeUser(0.00001, headroom*yMax);
142  nom->GetYaxis()->SetRangeUser(0.0001, headroom*yMax);
143 
144  gPad->RedrawAxis();
145  nom->Draw("hist ][ same");
146 
147 }//end of plotwith error band
TSpline3 lo("lo", xlo, ylo, 12,"0")
T sqrt(T number)
Definition: d0nt_math.hpp:156
const Color_t kTotalMCErrorBandColor
Definition: Style.h:17
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
TSpline3 hi("hi", xhi, yhi, 18,"0")
Int_t col[ntarg]
Definition: Style.C:29
OStream cout
Definition: OStream.cxx:6
const Color_t kTotalMCColor
Definition: Style.h:16
Float_t w
Definition: plot.C:20

Variable Documentation

const DateUp CurrentDate[Date]
Initial value:
=
{
{"_03-20-18"},
}

Definition at line 80 of file plot_uncertainty.C.

const FileUp CurrentFile[File]
Initial value:
= {
{"/Prong__CVN_Gamma_ID_Nbkg_Cuts_0_3_high_optimization_Myfid_cont"},
{"/Prong__CVN_Gamma_ID_NSel_Cuts_0_3_high_optimization_Myfid_cont"},
{"/Prong__CVN_Gamma_ID_NSig_Cuts_0_3_high_optimization_Myfid_cont"},
{"/Prong__CVN_Gamma_ID_NtrueSig_Cuts_0_3_high_optimization_Myfid_cont"},
{"/Prong__CVN_Gamma_ID_Cut_WithErrorBand_Nbkg_Cuts_0_3_high_optimization_Myfid_cont"},
{"/Prong__CVN_Gamma_IDcut_WithErrorBand_NSel_Cuts_0_3_high_optimization_Myfid_cont"},
{"/Prong__CVN_Gamma_IDcut_WithErrorBand_NSig_Cuts_0_3_high_optimization_Myfid_cont"},
{"/Prong__CVN_Gamma_IDcut_WithErrorBand_NtrueSig_Cuts_0_3_high_optimization_Myfid_cont"},
{"/ceff03GEV_Prong__CVN_optimization_Myfid_cont"},
{"/Purity_Prong2_Myfid_cont"}
}

Definition at line 66 of file plot_uncertainty.C.

const int Date = 1

Definition at line 79 of file plot_uncertainty.C.

const int File =10

Definition at line 65 of file plot_uncertainty.C.

TString outDir2 = "/nova/app/users/rbowles/tag_releaseS18-01-19/NDAna/ncpi0/Systematics/Plots"

Definition at line 54 of file plot_uncertainty.C.

const double pot = 8.09e20

Definition at line 37 of file plot_uncertainty.C.