Functions | Variables
print_nus17_fd_cut_tables2D.C File Reference
#include "CAFAna/Analysis/Calcs.h"
#include "CAFAna/Cuts/Cuts.h"
#include "CAFAna/Cuts/SpillCuts.h"
#include "CAFAna/Cuts/NueCutsFirstAna.h"
#include "CAFAna/Core/Utilities.h"
#include "CAFAna/Core/SpectrumLoader.h"
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Vars/Vars.h"
#include "CAFAna/Cuts/TimingCuts.h"
#include "CAFAna/Analysis/Plots.h"
#include "CAFAna/Analysis/Style.h"
#include "3FlavorAna/Plotting/NuePlotStyle.h"
#include "CAFAna/Core/LoadFromFile.h"
#include "OscLib/OscCalcDumb.h"
#include "OscLib/OscCalcSterile.h"
#include "CAFAna/Prediction/PredictionNoExtrap.h"
#include "NuXAna/Prediction/PredictionSterile.h"
#include "NuXAna/macros/Nus17/nus17_fd_arrays.h"
#include "TH1D.h"
#include "TH2.h"
#include "TCanvas.h"
#include "TColor.h"
#include "TGraph.h"
#include "THStack.h"
#include "TMultiGraph.h"
#include "TLine.h"
#include "TLegend.h"
#include "TString.h"
#include "Utilities/rootlogon.C"

Go to the source code of this file.

Functions

void GetSpectra (IPrediction *pred, osc::IOscCalc *calc, TH1 *&hSig, TH1 *&hNue, TH1 *&hCC, TH1 *&hTau, TH1 *&hTotBkg)
 
void GetSpectra2D (IPrediction *pred, osc::IOscCalc *calc, TH2 *&hSig, TH2 *&hTotBkg)
 
void print_tables (const std::string *cutnames, const std::string pred_basename, const std::string spec_basename, const std::string fname, const double cos_scaling, const int ncuts, bool savePlots=false)
 
void print_nus17_fd_cut_tables2D (bool savePlots=false)
 

Variables

const double pot_val = 9.0e20
 
const double livetime = 440.
 

Function Documentation

void GetSpectra ( IPrediction pred,
osc::IOscCalc calc,
TH1 *&  hSig,
TH1 *&  hNue,
TH1 *&  hCC,
TH1 *&  hTau,
TH1 *&  hTotBkg 
)

Definition at line 44 of file print_nus17_fd_cut_tables2D.C.

References ana::Flavors::kAll, ana::Flavors::kAllNuE, ana::Flavors::kAllNuMu, ana::Flavors::kAllNuTau, ana::Sign::kBoth, ana::Current::kCC, ana::Current::kNC, ana::kNCBackgroundColor, ana::kNueSignalColor, ana::kNumuBackgroundColor, ana::kTotalMCColor, pot_val, ana::IPrediction::PredictComponent(), ana::Spectrum::ToTH1(), and ana::UniqueName().

46 {
47  hSig = pred->PredictComponent(calc,
51  hSig->SetLineColor(kNCBackgroundColor);
52 
53 
54  hNue = pred->PredictComponent(calc,
58  hNue->SetLineColor(kNueSignalColor);
59 
60  hCC = pred->PredictComponent(calc,
64  hCC->SetLineColor(kNumuBackgroundColor);
65 
66  hTau = pred->PredictComponent(calc,
70  hTau->SetLineColor(kMagenta);
71 
72  hTotBkg = (TH1*)hNue->Clone(UniqueName().c_str());
73  hTotBkg->Add(hCC);
74  hTotBkg->Add(hTau);
75 
76  hTotBkg->SetLineColor(kTotalMCColor);
77 }
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
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:149
const Color_t kNumuBackgroundColor
Definition: Style.h:30
const Color_t kNueSignalColor
Definition: Style.h:19
Charged-current interactions.
Definition: IPrediction.h:39
const Color_t kTotalMCColor
Definition: Style.h:16
All neutrinos, any flavor.
Definition: IPrediction.h:26
const Color_t kNCBackgroundColor
Definition: Style.h:22
std::string UniqueName()
Return a different string each time, for creating histograms.
Definition: Utilities.cxx:28
void GetSpectra2D ( IPrediction pred,
osc::IOscCalc calc,
TH2 *&  hSig,
TH2 *&  hTotBkg 
)

Definition at line 78 of file print_nus17_fd_cut_tables2D.C.

References ana::Flavors::kAll, ana::Flavors::kAllNuMu, ana::Sign::kBoth, ana::Current::kCC, ana::Current::kNC, ana::Flavors::kNuEToNuE, ana::Flavors::kNuMuToNuE, pot_val, ana::IPrediction::PredictComponent(), ana::Spectrum::ToTH2(), and ana::UniqueName().

Referenced by print_tables().

80 {
81  hSig = pred->PredictComponent(calc,
85 
86  TH1* hNue = pred->PredictComponent(calc,
90 
91  TH1* hCC = pred->PredictComponent(calc,
95 
96  TH1* hBeam = pred->PredictComponent(calc,
100 
101  hTotBkg = (TH2*)hNue->Clone(UniqueName().c_str());
102  hTotBkg->Add(hCC);
103  hTotBkg->Add(hBeam);
104 
105 }
TH2 * ToTH2(double exposure, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Spectrum must be 2D to obtain TH2.
Definition: Spectrum.cxx:166
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
(' appearance')
Definition: IPrediction.h:18
('beam ')
Definition: IPrediction.h:15
Charged-current interactions.
Definition: IPrediction.h:39
All neutrinos, any flavor.
Definition: IPrediction.h:26
std::string UniqueName()
Return a different string each time, for creating histograms.
Definition: Utilities.cxx:28
void print_nus17_fd_cut_tables2D ( bool  savePlots = false)

Definition at line 196 of file print_nus17_fd_cut_tables2D.C.

References om::cerr, om::cout, cutnames_nminus1, allTimeWatchdog::endl, exit(), fin, plot_validation_datamc::fname, ncuts_nminus1, print_tables(), scaling(), and string.

197 {
198 
199  //std::string fname = "/nova/ana/users/gsdavies/nus/nus17/FD_cutTable_extendedE.root";
200  std::string fname = "/nova/ana/users/gsdavies/nus/nus17/mcv1_2D_cut_tables_v2.root";
201  //std::string fname = "mcv1_cutTable.root";
202 
203  // cosmic livetime scaling
204  TFile fin(fname.c_str());
205  if(fin.IsZombie()){
206  std::cerr << "File: " << fname << " does not exist. Check the name." << std::endl;
207  exit(0);
208  }
209 
210 
211  TH1D* time = (TH1D*)gDirectory->Get("time_cos");
212  double scaling = 440.;
213 
214  char name[15];
215 
216 
217  std::cout<<"\n--------------------------------------"
218  <<"\n---------------N-1 Table -------------\n";
219 
221  "pred_nminus1",
222  "spec_nminus1",
223  fname, scaling, ncuts_nminus1, savePlots);
224 
225  std::cout<<"\n------------------------------------------"
226  <<"\n--------------Cut Flow Table -------------\n";
227 
228  // print_tables(cutnames,
229  // "pred",
230  // "spec",
231  // fname, scaling, ncuts, savePlots);
232 
233 }
TString fin
Definition: Style.C:24
const XML_Char * name
Definition: expat.h:151
OStream cerr
Definition: OStream.cxx:7
void scaling(TH1D *hIn, const double shape_scale)
const std::string cutnames_nminus1[ncuts_nminus1]
OStream cout
Definition: OStream.cxx:6
const int ncuts_nminus1
exit(0)
enum BeamMode string
void print_tables ( const std::string cutnames,
const std::string  pred_basename,
const std::string  spec_basename,
const std::string  fname,
const double  cos_scaling,
const int  ncuts,
bool  savePlots = false 
)

coshist->SetTitle("Cosmic Data");

gStyle->SetTitleAlign(11);

Definition at line 110 of file print_nus17_fd_cut_tables2D.C.

References om::cout, cutnames_nminus1, ana::DefaultSterileCalc(), allTimeWatchdog::endl, plot_validation_datamc::fname, GetSpectra2D(), ana::kLivetime, ncuts_nminus1, plot_validation_datamc::pred, Preliminary(), runNovaSAM::release, and ana::Spectrum::ToTH2().

Referenced by print_nus17_fd_cut_tables2D().

117 {
119 
120 
121 
122  for(int ic = 7; ic < ncuts_nminus1; ic++){
123 
124  char name[50];
125 
126  sprintf(name, "%s_%s_%s",
127  pred_basename.c_str(),
128  cutnames_nminus1[ic].c_str(),
129  "2Dtime");
130 
131  std::cout << "name: "<< name << std::endl;
132  IPrediction* pred =
133  LoadFromFile<IPrediction>(fname, name).release();
134 
135  sprintf(name, "%s_%s_%s",
136  spec_basename.c_str(),
137  cutnames_nminus1[ic].c_str(),
138  "2Dtime");
139  std::cout << "name: "<< name << std::endl;
140  Spectrum* spec =
141  LoadFromFile<Spectrum>(fname, name).release();
142 
143  TH2 *sighist, *bghist;
144  GetSpectra2D(pred, osc, sighist, bghist);
145  std::cout << "here: "<< std::endl;
146  TH2* coshist = spec->ToTH2(cos_scaling,
148 
149  new TCanvas;
150 
151  //coshist->RebinX(3);
152  //coshist->RebinY(2);
153  ///coshist->SetTitle("Cosmic Data");
154  // coshist->GetXaxis()->SetTitle("Shower Maximum Y coordinate (cm)");
155  //coshist->GetYaxis()->SetTitle("p_{T}/p");
156  coshist->GetXaxis()->CenterTitle();
157  coshist->GetYaxis()->CenterTitle();
158 
159  coshist->Draw("colz");
160  Preliminary();
161  gPad->SaveAs(("plots2D/time_"+spec_basename+cutnames_nminus1[ic]+"2Dcos.png").c_str());
162  gPad->SaveAs(("plots2D/time_"+spec_basename+cutnames_nminus1[ic]+"2Dcos.eps").c_str());
163  gPad->SaveAs(("plots2D/time_"+spec_basename+cutnames_nminus1[ic]+"2Dcos.pdf").c_str());
164  gPad->SaveAs(("plots2D/time_"+spec_basename+cutnames_nminus1[ic]+"2Dcos.root").c_str());
165 
166  new TCanvas;
167  ///gStyle->SetTitleAlign(11);
168  //sighist->RebinX(3);
169  //sighist->RebinY(2);
170  //sighist->SetTitle("NC Signal");
171  //sighist->GetXaxis()->SetTitle("Shower Maximum Y coordinate (cm)");
172  //sighist->GetYaxis()->SetTitle("p_{T}/p");
173  sighist->GetXaxis()->CenterTitle();
174  sighist->GetYaxis()->CenterTitle();
175  sighist->Draw("colz");
176  Preliminary();
177  gPad->SaveAs(("plots2D/time_"+spec_basename+cutnames_nminus1[ic]+"2Dsig.png").c_str());
178  gPad->SaveAs(("plots2D/time_"+spec_basename+cutnames_nminus1[ic]+"2Dsig.eps").c_str());
179  gPad->SaveAs(("plots2D/time_"+spec_basename+cutnames_nminus1[ic]+"2Dsig.pdf").c_str());
180  gPad->SaveAs(("plots2D/time_"+spec_basename+cutnames_nminus1[ic]+"2Dsig.root").c_str());
181 
182 
183  new TCanvas;
184  bghist->Draw("colz");
185  gPad->SaveAs(("plots2D/time_"+spec_basename+cutnames_nminus1[ic]+"2Dbg.png").c_str());
186  gPad->SaveAs(("plots2D/time_"+spec_basename+cutnames_nminus1[ic]+"2Dbg.eps").c_str());
187  gPad->SaveAs(("plots2D/time_"+spec_basename+cutnames_nminus1[ic]+"2Dbg.pdf").c_str());
188  gPad->SaveAs(("plots2D/time_"+spec_basename+cutnames_nminus1[ic]+"2Dbg.root").c_str());
189 
190  }
191 
192 }
const XML_Char * name
Definition: expat.h:151
TH2 * ToTH2(double exposure, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Spectrum must be 2D to obtain TH2.
Definition: Spectrum.cxx:166
Adapt the PMNS_Sterile calculator to standard interface.
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
osc::OscCalcSterile * DefaultSterileCalc(int nflavors)
Create a sterile calculator with default assumptions for all parameters.
Definition: Calcs.cxx:97
const std::string cutnames_nminus1[ncuts_nminus1]
Oscillation probability calculators.
Definition: Calcs.h:5
void Preliminary()
OStream cout
Definition: OStream.cxx:6
const int ncuts_nminus1
Standard interface to all prediction techniques.
Definition: IPrediction.h:57

Variable Documentation

const double livetime = 440.

Definition at line 41 of file print_nus17_fd_cut_tables2D.C.

const double pot_val = 9.0e20

Definition at line 40 of file print_nus17_fd_cut_tables2D.C.

Referenced by GetSpectra(), and GetSpectra2D().