check_predinterp.C
Go to the documentation of this file.
3 #include "CAFAna/Fit/Fit.h"
11 #include "CAFAna/FC/FCSurface.h"
14 #include "CAFAna/Vars/FitVars.h"
15 
16 #include "Utilities/rootlogon.C"
17 #include "OscLib/IOscCalc.h"
18 
19 #include "TCanvas.h"
20 #include "TBox.h"
21 #include "TColor.h"
22 #include "TGraph.h"
23 #include "TVectorD.h"
24 #include "TF1.h"
25 #include "TLegend.h"
26 #include "TLine.h"
27 #include "TMarker.h"
28 #include "TStyle.h"
29 #include "TSystem.h"
30 #include "TGaxis.h"
31 
32 #include <algorithm>
33 #include <string>
34 
35 using namespace ana;
36 
38 {
39  TString outdir = "/nova/ana/users/ecatanom/Ana2017/nue_predinterp_debug/"+decomp+"/";
40 
42  if(decomp == "noextrap") extrap = kNoExtrap;
43  if(decomp == "prop") extrap = kProportional;
44  if(decomp == "combo") extrap = kCombo;
45 
46  auto mysyst = kNue2017Systs;
47  for (auto s:mysyst){
48  std::cout << s->ShortName() << ",";
49  }
51 
52  auto calc = DefaultOscCalc();
53 
55  pred.DebugPlots(calc, (outdir+"plot_debug_predinterp_nue2017_%s.pdf").Data());
56 // pred.DebugPlots(DefaultOscCalc(), "debug/plot_debug_predinterp_nueSA_sig_%s.pdf",Flavors::kNuMuToNuE,Current::kCC);
57 // pred.DebugPlots(DefaultOscCalc(), "debug/plot_debug_predinterp_nueSA_beam_%s.pdf",Flavors::kNuEToNuE,Current::kCC);
58 // pred.DebugPlots(DefaultOscCalc(), "debug/plot_debug_predinterp_nueSA_nc_%s.pdf",Flavors::kAll,Current::kNC);
59 // pred.DebugPlots(DefaultOscCalc(), "debug/plot_debug_predinterp_nueSA_numu_%s.pdf",Flavors::kAllNuMu,Current::kCC);
60 
61 struct prettyshift{
62  int sigma;
63  TString name;
64  int color;
65  int style;
66  };
67 
68  std::vector <prettyshift> prettyshifts= {{+3,"+3 #sigma",kYellow+1,3},
69  {-3,"-3 #sigma",kGreen+1,3},
70  {+2,"+2 #sigma",kOrange,9},
71  {-2,"-2 #sigma",kAzure+10,7},
72  {+1,"+1 #sigma",kRed,1},
73  {-1,"-1 #sigma",kAzure,1},
74  {0,"Nominal ",kBlack,1}};
75  auto systs = kNue2017Systs;
76 
77  double fdpot = kSecondAnaPOT;
78  for (int i=0; i<1/*5*/; ++i){
79  std::string pname ="";
80  TString plotname = "Nue 2017 - total prediction";
81  switch(i){
82  case 1: pname = "_sig"; plotname = "Nue2017 - signal ";break;
83  case 2: pname = "_beam"; plotname = "Nue2017 - Beam Nue CC"; break;
84  case 3: pname = "_nc"; plotname = "Nue2017 - NC"; break;
85  case 4: pname = "_numu"; plotname ="Nue2017 - NumuCC"; break;
86  }
87  for (auto const & syst:systs){
88  new TCanvas;
89  auto leg = new TLegend(0.1,0.65,0.5,0.89);
90  leg->SetNColumns(2);
91  for(auto const & sh:prettyshifts){
92  TH1 * h1;
93  SystShifts shift(syst,sh.sigma);
94  if (i==0) h1 = pred.PredictSyst(calc,shift).ToTH1(fdpot,sh.color, sh.style);
95  if (i==1) h1 = pred.PredictComponentSyst(calc,shift,Flavors::kNuMuToNuE,Current::kCC,Sign::kBoth).ToTH1(fdpot,sh.color, sh.style);
96  if (i==2) h1 = pred.PredictComponentSyst(calc,shift,Flavors::kNuEToNuE,Current::kCC,Sign::kBoth).ToTH1(fdpot,sh.color, sh.style);
97  if (i==3) h1 = pred.PredictComponentSyst(calc,shift,Flavors::kAll,Current::kNC,Sign::kBoth).ToTH1(fdpot,sh.color, sh.style);
98  if (i==4) h1 = pred.PredictComponentSyst(calc,shift,Flavors::kAllNuMu,Current::kCC,Sign::kBoth).ToTH1(fdpot,sh.color, sh.style);
99  h1->SetTitle(plotname);
100  if(i==0) h1->GetYaxis()->SetRangeUser(0,14);
101  h1->Draw("hist same");
102  leg->AddEntry(h1,sh.name,"l");
103  }
104  leg->SetHeader((syst->LatexName()).c_str());
105  leg->SetFillStyle(0);
106  leg->SetTextSize(0.06);
107  leg->Draw();
108  gPad->Print((outdir+"plot_debug_predinterp_nue2017_spec"+pname+"_"+syst->ShortName()+"_calc.pdf"));
109  }
110  }
111 
112 
113 
114 }
const XML_Char * name
Definition: expat.h:151
enum BeamMode kOrange
enum BeamMode kRed
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
(&#39; appearance&#39;)
Definition: IPrediction.h:18
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:176
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
(&#39;beam &#39;)
Definition: IPrediction.h:15
Spectrum PredictSyst(osc::IOscCalc *calc, const SystShifts &shift) const override
osc::OscCalcDumb calc
osc::IOscCalcAdjustable * DefaultOscCalc()
Create a new calculator with default assumptions for all parameters.
Definition: Calcs.cxx:49
const std::vector< const DummyNue2017Syst * > kNue2017Systs
const XML_Char * s
Definition: expat.h:262
Loads shifted spectra from files.
Charged-current interactions.
Definition: IPrediction.h:39
Spectrum PredictComponentSyst(osc::IOscCalc *calc, const SystShifts &shift, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
string pname
Definition: eplot.py:33
double sigma(TH1F *hist, double percentile)
void DebugPlots(osc::IOscCalc *calc, const std::string &savePattern="", Flavors::Flavors_t flav=Flavors::kAll, Current::Current_t curr=Current::kBoth, Sign::Sign_t sign=Sign::kBoth) const
OStream cout
Definition: OStream.cxx:6
TH1F * h1
Neutral-current interactions.
Definition: IPrediction.h:40
void check_predinterp(std::string decomp="prop")
Both neutrinos and antineutrinos.
Definition: IPrediction.h:52
All neutrinos, any flavor.
Definition: IPrediction.h:26
const double kSecondAnaPOT
Definition: Exposures.h:87
enum BeamMode kGreen
const std::string outdir
enum BeamMode string