8 #include "CAFAna/Cuts/NueCutsFirstAna.h" 32 #include "TMultiGraph.h" 46 TH1*& hSig, TH1*& hNue, TH1*& hCC, TH1*& hTau, TH1*& hTotBkg)
71 hTau->SetLineColor(kMagenta);
73 hTotBkg = (TH1*)hNue->Clone(
UniqueName().c_str());
80 TH2*& hSig, TH2*&hTotBkg)
102 hTotBkg = (TH2*)hNue->Clone(
UniqueName().c_str());
115 const double cos_scaling,
117 bool savePlots=
false)
122 for(
int iv = 0; iv <
nvars; iv++){
123 for(
int ic = 0; ic <
ncuts; ic++){
128 sprintf(name,
"%s_%s_%s",
129 pred_basename.c_str(),
130 cutnames[ic].c_str(),
136 sprintf(name,
"%s_%s_%s",
137 spec_basename.c_str(),
138 cutnames[ic].c_str(),
144 TH1 *sighist, *nuehist, *numuhist, *nutauhist, *bghist;
145 GetSpectra(pred, osc, sighist, nuehist, numuhist, nutauhist, bghist);
146 TH1* coshist = spec->ToTH1(cos_scaling, kBlack, kSolid,
153 <<sighist->Integral()<<
" & " 154 <<numuhist->Integral()<<
" & " 155 <<nuehist->Integral()<<
" & " 156 <<nutauhist->Integral()<<
" & " 157 <<bghist->Integral()<<
" & " 158 <<coshist->Integral()<<
" & " 159 <<sighist->Integral()/
sqrt(sighist->Integral() +
166 const Color_t kCosmicBkgdColor =
kOrange+7;
169 gPad->SetFillStyle(0);
172 sighist->GetMaximum());
176 coshist->SetLineColor(kCosmicBkgdColor);
178 if(cutnames[ic].find(
"nocut") != std::string::npos) gPad->SetLogy();
179 if(cutnames[ic].find(
"cvnnc") != std::string::npos) gPad->SetLogy();
180 if(cutnames[ic].find(
"eq17") != std::string::npos) gPad->SetLogy();
184 coshist->GetXaxis()->SetRangeUser(0,12);
185 bghist->GetXaxis()->SetRangeUser(0,12);
186 sighist->GetXaxis()->SetRangeUser(0,12);
189 if(coshist->Integral() > sighist->Integral()){
190 coshist->Draw(
"hist");
191 sighist->Draw(
"hist same");
192 bghist->Draw(
"hist same");
193 coshist->GetYaxis()->SetTitle(
"Events / 8.85 #times 10^{20} POT");
197 else if((bghist->Integral() > sighist->Integral()) &&
198 (bghist->Integral() > coshist->Integral())){
199 bghist->Draw(
"hist");
200 sighist->Draw(
"hist same");
201 coshist->Draw(
"hist same");
202 bghist->GetYaxis()->SetTitle(
"Events / 8.85 #times 10^{20} POT");
207 sighist->Draw(
"hist");
208 bghist->Draw(
"hist same");
209 coshist->Draw(
"hist same");
210 sighist->GetYaxis()->SetTitle(
"Events / 8.85 #times 10^{20} POT");
216 if(
axisarray_names[iv] ==
"nusE") leg =
new TLegend(0.5, 0.65, 0.8, 0.85);
217 if(
axisarray_names[iv] ==
"cvn") leg =
new TLegend(0.3, 0.65, 0.7, 0.85);
218 if(
axisarray_names[iv] ==
"hits") leg =
new TLegend(0.5, 0.65, 0.85, 0.85);
219 else leg =
new TLegend(0.5, 0.65, 0.8, 0.85);
220 leg->SetBorderSize(0);
221 leg->SetFillColor(kWhite);
222 leg->SetFillStyle(0);
223 leg->SetFillStyle(0);
224 leg->SetTextFont(42);
225 leg->SetTextSize(0.037);
226 leg->AddEntry(sighist,
"NC Signal",
"l");
227 leg->AddEntry(bghist,
"CC Background",
"l");
228 leg->AddEntry(coshist,
"Cosmic Background",
"l");
233 gPad->SaveAs((
"plots/final_"+spec_basename+cutnames[ic]+
"_"+
axisarray_names[iv]+
".png").c_str());
234 gPad->SaveAs((
"plots/final_"+spec_basename+cutnames[ic]+
"_"+
axisarray_names[iv]+
".pdf").c_str());
235 gPad->SaveAs((
"plots/final_"+spec_basename+cutnames[ic]+
"_"+
axisarray_names[iv]+
".eps").c_str());
240 gPad->SetFillStyle(0);
242 if(cutnames[ic].find(
"nocut") != std::string::npos) gPad->SetLogy();
243 if(cutnames[ic].find(
"cvnnc") != std::string::npos) gPad->SetLogy();
245 TH1 *cosclone, *bgclone, *sigclone;
246 if(sighist->Integral() > coshist->Integral()){
247 cosclone = (TH1*)coshist->Clone();
248 bgclone = (TH1*)cosclone->Clone();
249 bgclone->Add(bghist);
250 sigclone = (TH1*)bgclone->Clone();
251 sigclone->Add(sighist);
254 bgclone = (TH1*)bghist->Clone();
255 sigclone = (TH1*)bgclone->Clone();
256 sigclone->Add(sighist);
257 cosclone = (TH1*)sigclone->Clone();
258 cosclone->Add(coshist);
268 cosclone->SetLineColor(kCosmicBkgdColor);
269 cosclone->SetFillColor(kCosmicBkgdColor);
273 cosclone->GetXaxis()->SetRangeUser(0,12);
274 bgclone->GetXaxis()->SetRangeUser(0,12);
275 sigclone->GetXaxis()->SetRangeUser(0,12);
278 if(sighist->Integral() > coshist->Integral()){
279 sigclone->Draw(
"hist");
280 bgclone->Draw(
"hist same");
281 cosclone->Draw(
"hist same");
282 sigclone->Draw(
"histsameaxis");
283 cosclone->GetYaxis()->SetTitle(
"Events / 8.85 #times 10^{20} POT");
285 sigclone->GetYaxis()->SetTitle(
"Events / 8.85 #times 10^{20} POT");
287 bgclone->GetYaxis()->SetTitle(
"Events / 8.85 #times 10^{20} POT");
295 cosclone->Draw(
"hist");
296 sigclone->Draw(
"hist same");
297 bgclone->Draw(
"hist same");
298 sigclone->GetYaxis()->SetTitle(
"Events / 8.85 #times 10^{20} POT");
300 bgclone->GetYaxis()->SetTitle(
"Events / 8.85 #times 10^{20} POT");
302 cosclone->GetYaxis()->SetTitle(
"Events / 8.85 #times 10^{20} POT");
310 if(
axisarray_names[iv] ==
"nusE") legStack =
new TLegend(0.5, 0.65, 0.8, 0.85);
311 if(
axisarray_names[iv] ==
"cvn") legStack =
new TLegend(0.3, 0.65, 0.7, 0.85);
312 if(
axisarray_names[iv] ==
"hits") legStack =
new TLegend(0.5, 0.65, 0.85, 0.85);
313 else legStack =
new TLegend(0.5, 0.65, 0.8, 0.85);
314 legStack->SetBorderSize(0);
315 legStack->SetFillColor(kWhite);
316 legStack->SetFillStyle(0);
317 legStack->SetFillStyle(0);
318 legStack->SetTextFont(42);
319 legStack->SetTextSize(0.037);
321 legStack->AddEntry(sigclone,
"NC Signal",
"f");
322 legStack->AddEntry(bgclone,
"CC Background",
"f");
323 legStack->AddEntry(cosclone,
"Cosmic Background",
"f");
329 gPad->SaveAs((
"plots/final_stack_"+spec_basename+cutnames[ic]+
"_"+
axisarray_names[iv]+
".png").c_str());
330 gPad->SaveAs((
"plots/final_stack_"+spec_basename+cutnames[ic]+
"_"+
axisarray_names[iv]+
".root").c_str());
331 gPad->SaveAs((
"plots/final_stack_"+spec_basename+cutnames[ic]+
"_"+
axisarray_names[iv]+
".pdf").c_str());
387 std::string fname =
"/nova/ana/users/gsdavies/nus/nus17/nus17FDCutTablePlots.root";
391 TFile
fin(fname.c_str());
398 TH1D*
time = (TH1D*)gDirectory->Get(
"time_cos");
404 std::cout<<
"\n--------------------------------------" 405 <<
"\n---------------N-1 Table -------------\n";
412 std::cout<<
"\n------------------------------------------" 413 <<
"\n--------------Cut Flow Table -------------\n";
418 fname, scaling,
ncuts, savePlots);
T max(const caf::Proxy< T > &a, T b)
TH2 * ToTH2(double exposure, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Spectrum must be 2D to obtain TH2.
Cuts and Vars for the 2020 FD DiF Study.
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
const std::string axisarray_names_opt[nvars]
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.
General interface to oscillation calculators.
Adapt the PMNS_Sterile calculator to standard interface.
void CenterTitles(TH1 *histo)
void print_nus17_fd_cut_tables(bool savePlots=false)
const Color_t kNumuBackgroundColor
Representation of a spectrum in any variable, with associated POT.
const Color_t kNueSignalColor
void scaling(TH1D *hIn, const double shape_scale)
Charged-current interactions.
osc::OscCalcSterile * DefaultSterileCalc(int nflavors)
Create a sterile calculator with default assumptions for all parameters.
const double kAna2017Livetime
const std::string cutnames[ncuts]
void GetSpectra2D(IPrediction *pred, osc::IOscCalc *calc, TH2 *&hSig, TH2 *&hTotBkg)
const std::string cutnames_nminus1[ncuts_nminus1]
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)
Oscillation probability calculators.
void GetSpectra(IPrediction *pred, osc::IOscCalc *calc, TH1 *&hSig, TH1 *&hNue, TH1 *&hCC, TH1 *&hTau, TH1 *&hTotBkg)
Neutral-current interactions.
Both neutrinos and antineutrinos.
Standard interface to all prediction techniques.
const Color_t kTotalMCColor
All neutrinos, any flavor.
const Color_t kNCBackgroundColor
std::string UniqueName()
Return a different string each time, for creating histograms.
void FillWithDimColor(TH1 *h, bool usealpha, float dim)
const std::string axisarray_names[nvars]
const std::string axisarray_names_xaxis[nvars]