SystsDecompAna.C
Go to the documentation of this file.
4 
5 using namespace ana;
6 
7 void BinErrors(TH1* nom, TH1* nc, TH1* numu, TH1* nueup, TH1* nuedn);
8 
9 void PlotComp(IDecomp* nom, IDecomp* shifts,
10  TDirectory* out, FILE* text, strings strs,
11  double POT);
12 
13 void PlotComp(IPrediction* nom, IPrediction* shifts,
14  TDirectory* out, FILE* text, strings strs,
15  double POT);
16 
17 void PlotSysts(TH1* nom, TH1* hNC, TH1* hNM, TH1* hEU, TH1* hED,
18  TDirectory* rootOUT, FILE* textOFS,
19  strings strs);
20 
22 {
23  TH1::AddDirectory(0);
24 
25  // A map of systematic labels
26  std::map<std::string, std::string> shiftlabels;
27  shiftlabels["NC"] = "Data/MC Diff to NC Component";
28  shiftlabels["Numu"] = "Data/MC Diff to #nu_{#mu} CC Component";
29  shiftlabels["NueUp"] = "#nu_{e} CC Component Up 100%";
30  shiftlabels["NueDn"] = "#nu_{e} CC Component Down 100%";
31 
32  std::string labelRecoE = "Calorimetric Energy (GeV)";
33  std::vector<std::string> cut_samples;
34  cut_samples.push_back("Ana01");
35 
36  // Set up maps to the decompositions/predictions (each flavor component)
37  // Nominal maps are indexed purely by sample label
38  // Shifted maps are indexed by sample label, systematic label, then sigma of the shift
39  std::map<std::string, IDecomp*> decomps_nominal;
40  std::map<std::string, std::map<std::string, std::map<int, IDecomp*> > > decomps_shifted;
41  std::map<std::string, PredictionNoExtrap*> predsNE_nominal;
42  std::map<std::string, std::map<std::string, std::map<int, PredictionNoExtrap*> > > predsNE_shifted;
43  std::map<std::string, PredictionSterile*> predsSt_nominal;
44  std::map<std::string, std::map<std::string, std::map<int, PredictionSterile*> > > predsSt_shifted;
45 
46  std::string folder = "/nova/ana/steriles/Ana01/Systematics/";
47  std::string filenm = "SystsDecomp";
48 
49  std::string loadLocation = folder + filenm + ".root";
50  std::string saveLocation = folder + filenm + "Ana.root";
51  std::string textLocation = folder + filenm + "Ana.txt";
52 
53  TFile* rootL = new TFile(loadLocation.c_str(), "READ");
54  LoadMaps(rootL, &decomps_nominal, &decomps_shifted);
55  LoadMaps(rootL, &predsNE_nominal, &predsNE_shifted);
56  LoadMaps(rootL, &predsSt_nominal, &predsSt_shifted);
57  rootL->Close();
58 
59  TFile* rootF = new TFile(saveLocation.c_str(), "RECREATE");
60  FILE* textF;
61  textF = fopen(textLocation.c_str(), "w");
62 
63  for(const auto& sample : cut_samples) {
64  strings strs;
65  strs.fComponent = "NC";
66  strs.fDet = "ND";
68  strs.fSample = sample;
69  strs.fSystType = "Decomp";
70  strs.fXLabel = labelRecoE;
71 
72  InitializeSystText(textF, strs);
73 
74  TH1* hNomNC_decomp = GetNC(decomps_nominal[sample], NCSCALE);
75  TH1* hNomBG_decomp = GetBG(decomps_nominal[sample], NCSCALE);
76 
77  TH1* hNomNC_predNE = GetNC(predsNE_nominal[sample], NCSCALE);
78  TH1* hNomBG_predNE = GetBG(predsNE_nominal[sample], NCSCALE);
79 
80  TH1* hNomNC_predSt = GetNC(predsSt_nominal[sample], NCSCALE);
81  TH1* hNomBG_predSt = GetBG(predsSt_nominal[sample], NCSCALE);
82 
83  for(const auto& shifts : shiftlabels) {
84  strs.fSystS = shifts.first;
85  strs.fSystL = shifts.second;
86 
87  strs.fComponent = "NC";
88  strs.fDet = "ND";
89  PlotSyst(hNomNC_decomp,
90  decomps_shifted[sample][shifts.first][1],
91  rootF, textF, strs, NCSCALE, true, true);
92 
93  strs.fComponent = "BG";
94  PlotSyst(hNomBG_decomp,
95  decomps_shifted[sample][shifts.first][1],
96  rootF, textF, strs, NCSCALE, false, true);
97 
98  PlotComp(decomps_nominal[sample],
99  decomps_shifted[sample][shifts.first][1],
100  rootF, textF, strs, NCSCALE);
101 
102  strs.fComponent = "NC";
103  strs.fDet = "FD";
104  PlotSyst(hNomNC_predNE,
105  predsNE_shifted[sample][shifts.first][1],
106  rootF, textF, strs, NCSCALE, true, true);
107 
108  strs.fComponent = "BG";
109  PlotSyst(hNomBG_predNE,
110  predsNE_shifted[sample][shifts.first][1],
111  rootF, textF, strs, NCSCALE, false, true);
112 
113  PlotComp(predsNE_nominal[sample],
114  predsNE_shifted[sample][shifts.first][1],
115  rootF, textF, strs, NCSCALE);
116 
117  strs.fComponent = "NC";
118  strs.fDet = "EX";
119  PlotSyst(hNomNC_predSt,
120  predsSt_shifted[sample][shifts.first][1],
121  rootF, textF, strs, NCSCALE, true, true);
122 
123  strs.fComponent = "BG";
124  PlotSyst(hNomBG_predSt,
125  predsSt_shifted[sample][shifts.first][1],
126  rootF, textF, strs, NCSCALE, false, true);
127 
128  PlotComp(predsSt_nominal[sample],
129  predsSt_shifted[sample][shifts.first][1],
130  rootF, textF, strs, NCSCALE);
131  }
132 
133  TH1* hSftNC_NCCmp_decomp = GetNC(decomps_shifted[sample]["NC"][1], NCSCALE);
134  TH1* hSftBG_NCCmp_decomp = GetBG(decomps_shifted[sample]["NC"][1], NCSCALE);
135  TH1* hSftNC_NMCmp_decomp = GetNC(decomps_shifted[sample]["Numu"][1], NCSCALE);
136  TH1* hSftBG_NMCmp_decomp = GetBG(decomps_shifted[sample]["Numu"][1], NCSCALE);
137  TH1* hSftNC_NueDn_decomp = GetNC(decomps_shifted[sample]["NueDn"][1], NCSCALE);
138  TH1* hSftBG_NueDn_decomp = GetBG(decomps_shifted[sample]["NueDn"][1], NCSCALE);
139  TH1* hSftNC_NueUp_decomp = GetNC(decomps_shifted[sample]["NueUp"][1], NCSCALE);
140  TH1* hSftBG_NueUp_decomp = GetBG(decomps_shifted[sample]["NueUp"][1], NCSCALE);
141 
142  TH1* hSftNC_NCCmp_predNE = GetNC(predsNE_shifted[sample]["NC"][1], NCSCALE);
143  TH1* hSftBG_NCCmp_predNE = GetBG(predsNE_shifted[sample]["NC"][1], NCSCALE);
144  TH1* hSftNC_NMCmp_predNE = GetNC(predsNE_shifted[sample]["Numu"][1], NCSCALE);
145  TH1* hSftBG_NMCmp_predNE = GetBG(predsNE_shifted[sample]["Numu"][1], NCSCALE);
146  TH1* hSftNC_NueDn_predNE = GetNC(predsNE_shifted[sample]["NueDn"][1], NCSCALE);
147  TH1* hSftBG_NueDn_predNE = GetBG(predsNE_shifted[sample]["NueDn"][1], NCSCALE);
148  TH1* hSftNC_NueUp_predNE = GetNC(predsNE_shifted[sample]["NueUp"][1], NCSCALE);
149  TH1* hSftBG_NueUp_predNE = GetBG(predsNE_shifted[sample]["NueUp"][1], NCSCALE);
150 
151  TH1* hSftNC_NCCmp_predSt = GetNC(predsSt_shifted[sample]["NC"][1], NCSCALE);
152  TH1* hSftBG_NCCmp_predSt = GetBG(predsSt_shifted[sample]["NC"][1], NCSCALE);
153  TH1* hSftNC_NMCmp_predSt = GetNC(predsSt_shifted[sample]["Numu"][1], NCSCALE);
154  TH1* hSftBG_NMCmp_predSt = GetBG(predsSt_shifted[sample]["Numu"][1], NCSCALE);
155  TH1* hSftNC_NueDn_predSt = GetNC(predsSt_shifted[sample]["NueDn"][1], NCSCALE);
156  TH1* hSftBG_NueDn_predSt = GetBG(predsSt_shifted[sample]["NueDn"][1], NCSCALE);
157  TH1* hSftNC_NueUp_predSt = GetNC(predsSt_shifted[sample]["NueUp"][1], NCSCALE);
158  TH1* hSftBG_NueUp_predSt = GetBG(predsSt_shifted[sample]["NueUp"][1], NCSCALE);
159 
160  strs.fComponent = "NC";
161  strs.fDet = "ND";
162  PlotSysts(hNomNC_decomp,
163  hSftNC_NCCmp_decomp, hSftNC_NMCmp_decomp,
164  hSftNC_NueUp_decomp, hSftNC_NueDn_decomp,
165  rootF, textF, strs);
166 
167  strs.fComponent = "BG";
168  PlotSysts(hNomBG_decomp,
169  hSftBG_NCCmp_decomp, hSftBG_NMCmp_decomp,
170  hSftBG_NueUp_decomp, hSftBG_NueDn_decomp,
171  rootF, textF, strs);
172 
173  strs.fComponent = "NC";
174  strs.fDet = "FD";
175  PlotSysts(hNomNC_predNE,
176  hSftNC_NCCmp_predNE, hSftNC_NMCmp_predNE,
177  hSftNC_NueUp_predNE, hSftNC_NueDn_predNE,
178  rootF, textF, strs);
179 
180  strs.fComponent = "BG";
181  PlotSysts(hNomBG_predNE,
182  hSftBG_NCCmp_predNE, hSftBG_NMCmp_predNE,
183  hSftBG_NueUp_predNE, hSftBG_NueDn_predNE,
184  rootF, textF, strs);
185 
186  strs.fComponent = "NC";
187  strs.fDet = "EX";
188  PlotSysts(hNomNC_predSt,
189  hSftNC_NCCmp_predSt, hSftNC_NMCmp_predSt,
190  hSftNC_NueUp_predSt, hSftNC_NueDn_predSt,
191  rootF, textF, strs);
192 
193  strs.fComponent = "BG";
194  PlotSysts(hNomBG_predSt,
195  hSftBG_NCCmp_predSt, hSftBG_NMCmp_predSt,
196  hSftBG_NueUp_predSt, hSftBG_NueDn_predSt,
197  rootF, textF, strs);
198  }
199 
200  fclose(textF);
201  rootF->Close();
202 
203  std::cout << "Finished. Ctrl+Z should be safe if the macro didn't quit." << std::endl;
204 }
205 
206 void BinErrors(TH1* nom, TH1* nc, TH1* numu, TH1* nueup, TH1* nuedn)
207 {
208  double nomEvents = nom ->Integral(); std::cout << "Nom: " << nomEvents << std::endl;
209  double ncEvents = nc ->Integral(); std::cout << "NC Comp: " << ncEvents << std::endl;
210  double numuEvents = numu ->Integral(); std::cout << "NuMu Comp: " << numuEvents << std::endl;
211  double nueupEvents = nueup->Integral(); std::cout << "NueUp: " << nueupEvents << std::endl;
212  double nuednEvents = nuedn->Integral(); std::cout << "NueDown: " << nuednEvents << std::endl;
213 
214  TH1* hDataMC = (TH1*)nom->Clone();
215  TH1* hNueDif = (TH1*)nom->Clone();
216 
217  if(std::abs(ncEvents - nomEvents) > std::abs(numuEvents - nomEvents)) {
218  std::cout << "NC Comp Greater, ";
219  hDataMC->Add(nc, -1);
220  }
221  else {
222  std::cout << "Numu Comp Greater, ";
223  hDataMC->Add(numu, -1);
224  }
225 
226  if(std::abs(nueupEvents - nomEvents) > std::abs(nuednEvents - nomEvents)) {
227  std::cout << "NueUp Greater" << std::endl;
228  hNueDif->Add(nueup, -1);
229  }
230  else {
231  std::cout << "NueDn Greater" << std::endl;
232  hNueDif->Add(nuedn, -1);
233  }
234 
235  for(int i = 0, n = nom->GetNbinsX(); i <= n+1; ++i) {
236  double datamc = hDataMC->GetBinContent(i);
237  double nuedif = hNueDif->GetBinContent(i);
238  nom->SetBinError(i, datamc*datamc + nuedif*nuedif);
239  }
240 
241  return;
242 }
243 
244 void PlotComp(IDecomp* nom, IDecomp* shifts,
245  TDirectory* out, FILE* text, strings strs,
246  double POT)
247 {
248  std::vector<TH1*> hNoms;
249  std::vector<TH1*> hSfts;
250  hNoms.push_back(nom ->NCTotalComponent().ToTH1(POT));
251  hSfts.push_back(shifts->NCTotalComponent().ToTH1(POT));
252 
253  Spectrum sNomNue = nom ->NueComponent() + nom ->AntiNueComponent();
254  Spectrum sSftNue = shifts->NueComponent() + shifts->AntiNueComponent();
255  Spectrum sNomNumu = nom ->NumuComponent() + nom ->AntiNumuComponent();
256  Spectrum sSftNumu = shifts->NumuComponent() + shifts->AntiNumuComponent();
257 
258  hNoms.push_back(sNomNue.ToTH1(POT));
259  hSfts.push_back(sSftNue.ToTH1(POT));
260  hNoms.push_back(sNomNumu.ToTH1(POT));
261  hSfts.push_back(sSftNumu.ToTH1(POT));
262 
263  std::string curComp = strs.fComponent;
264 
265  std::vector<std::string> comps;
266  comps.push_back("NCComp");
267  comps.push_back("NueComp");
268  comps.push_back("NumuComp");
269 
270  for(int i = 0, n = 3; i < n; ++i) {
271  strs.fComponent = comps[i];
272  PlotSyst(hNoms[i], hSfts[i], out, text, strs);
273  }
274 
275  strs.fComponent = curComp;
276  return;
277 }
278 
279 void PlotComp(IPrediction* nom, IPrediction* shifts,
280  TDirectory* out, FILE* text, strings strs,
281  double POT)
282 {
284 
285  std::vector<TH1*> hNoms;
286  std::vector<TH1*> hSfts;
287  hNoms.push_back(
288  nom->PredictComponent(
290  ).ToTH1(POT)
291  );
292  hSfts.push_back(
293  shifts->PredictComponent(
295  ).ToTH1(POT)
296  );
297 
298  hNoms.push_back(
299  nom->PredictComponent(
301  ).ToTH1(POT)
302  );
303  hSfts.push_back(
304  shifts->PredictComponent(
306  ).ToTH1(POT)
307  );
308 
309  hNoms.push_back(
310  nom->PredictComponent(
312  ).ToTH1(POT)
313  );
314  hSfts.push_back(
315  shifts->PredictComponent(
317  ).ToTH1(POT)
318  );
319 
320  std::string curComp = strs.fComponent;
321 
322  std::vector<std::string> comps;
323  comps.push_back("NCComp");
324  comps.push_back("NueComp");
325  comps.push_back("NumuComp");
326 
327  for(int i = 0, n = 3; i < n; ++i) {
328  strs.fComponent = comps[i];
329  PlotSyst(hNoms[i], hSfts[i], out, text, strs);
330  }
331 
332  strs.fComponent = curComp;
333  return;
334 }
335 
336 void PlotSysts(TH1* nom, TH1* hNC, TH1* hNM, TH1* hEU, TH1* hED,
337  TDirectory* rootOUT, FILE* textOFS,
338  strings strs)
339 {
340  BinErrors(nom, hNC, hNM, hEU, hED);
341 
342  double nNom = nom->Integral();
343  double nNC = hNC->Integral();
344  double nNM = hNM->Integral();
345  double nNEU = hEU->Integral();
346  double nNED = hED->Integral();
347 
348  fprintf(textOFS, "\nEvent counts for %.2s %.2s %s Systs:\n",
349  strs.fDet.c_str(), strs.fComponent.c_str(), strs.fSystType.c_str());
350  fprintf(textOFS, "Nom: %6.2f, NC Shift: %6.2f, NuMu Shift: %6.2f, NuE Up: %6.2f, NuE Down: %6.2f\n",
351  nNom, nNC, nNM, nNEU, nNED);
352  fprintf(textOFS, "NC Diff: %6.2f, NuMu Diff: %6.2f, NuE Up Diff: %6.2f, NuE Down Diff: %6.2f",
353  100.*std::abs(nNC/nNom - 1.), 100.*std::abs(nNM/nNom - 1.),
354  100.*std::abs(nNEU/nNom - 1.), 100.*std::abs(nNED/nNom - 1.));
355 
356  std::string xlabel = strs.fXLabel;
357  std::string ylabel = "Events / " + strs.fPOT + " / 0.25 GeV";
358  std::string title = strs.fDet + " " + strs.fComponent +
359  " Errors for All " + strs.fSystType + " Systematics";
360 // std::string fullTitle = title + ";" + xlabel + ";" + ylabel;
361  std::string fullTitle = ";" + xlabel + ";" + ylabel;
362  std::string name = "c" + strs.fComponent + strs.fDet +
363  strs.fSystType + "SystsAll" + strs.fSample;
364  std::string ylabelRat = "Shifted / Nominal";
365  std::string fullTitleRat = ";" + xlabel + ";" + ylabelRat;
366 
367  TH1* hRat = (TH1*)nom->Clone();
368  TH1* hNCRat = (TH1*)hNC->Clone();
369  TH1* hNMRat = (TH1*)hNM->Clone();
370  TH1* hEURat = (TH1*)hEU->Clone();
371  TH1* hEDRat = (TH1*)hED->Clone();
372 
373  int nBins = nom->GetNbinsX();
374  for(int i = 0; i <= nBins+1; ++i) {
375  hRat->SetBinContent(i, 1.);
376  }
377  hNCRat->Divide(nom);
378  hNMRat->Divide(nom);
379  hEURat->Divide(nom);
380  hEDRat->Divide(nom);
381 
382  double maxval = nom->GetBinContent(nom->GetMaximumBin());
383  maxval = std::max(maxval, hNC->GetBinContent(hNC->GetMaximumBin()));
384  maxval = std::max(maxval, hNM->GetBinContent(hNM->GetMaximumBin()));
385  maxval = std::max(maxval, hEU->GetBinContent(hEU->GetMaximumBin()));
386  maxval = std::max(maxval, hED->GetBinContent(hED->GetMaximumBin()));
387 
388  double minval = nom->GetBinContent(nom->GetMinimumBin());
389  minval = std::min(minval, hNC->GetBinContent(hNC->GetMinimumBin()));
390  minval = std::min(minval, hNM->GetBinContent(hNM->GetMinimumBin()));
391  minval = std::min(minval, hEU->GetBinContent(hEU->GetMinimumBin()));
392  minval = std::min(minval, hED->GetBinContent(hED->GetMinimumBin()));
393 
394  if(maxval < minval) { std::swap(maxval, minval); }
395 
396  double maxvalRat = hRat->GetBinContent(hRat->GetMaximumBin());
397  maxvalRat = std::max(maxvalRat, hNCRat->GetBinContent(hNCRat->GetMaximumBin()));
398  maxvalRat = std::max(maxvalRat, hNMRat->GetBinContent(hNMRat->GetMaximumBin()));
399  maxvalRat = std::max(maxvalRat, hEURat->GetBinContent(hEURat->GetMaximumBin()));
400  maxvalRat = std::max(maxvalRat, hEDRat->GetBinContent(hEDRat->GetMaximumBin()));
401 
402  double minvalRat = hRat->GetBinContent(hRat->GetMinimumBin());
403  for(int i = 1; i <= nBins; ++i) {
404  if(hNCRat->GetBinContent(i) > 0.) {
405  minvalRat = std::min(minvalRat, hNCRat->GetBinContent(i));
406  }
407  if(hNMRat->GetBinContent(i) > 0.) {
408  minvalRat = std::min(minvalRat, hNMRat->GetBinContent(i));
409  }
410  if(hEURat->GetBinContent(i) > 0.) {
411  minvalRat = std::min(minvalRat, hEURat->GetBinContent(i));
412  }
413  if(hEDRat->GetBinContent(i) > 0.) {
414  minvalRat = std::min(minvalRat, hEDRat->GetBinContent(i));
415  }
416  }
417 
418  if(std::abs(maxvalRat - 1.) > std::abs(1. - minvalRat)) {
419  minvalRat = 1 - std::abs(maxvalRat - 1.);
420  maxvalRat = 1 + std::abs(maxvalRat - 1.);
421  }
422  else {
423  minvalRat = 1 - std::abs(1. - minvalRat);
424  maxvalRat = 1 + std::abs(1. - minvalRat);
425  }
426 
427  CenterTitles(nom);
428  nom->SetLineColor(kBlack);
429  nom->SetMaximum(1.1*maxval);
430  nom->SetMinimum(0);
431  nom->SetTitle(fullTitle.c_str());
432 
433  CenterTitles(hNC);
434  hNC->SetLineColor(kRed);
435  hNC->SetLineStyle(2);
436  hNC->SetMaximum(1.1*maxval);
437  hNC->SetMinimum(0);
438  hNC->SetTitle(fullTitle.c_str());
439 
440  CenterTitles(hNM);
441  hNM->SetLineColor(kBlue);
442  hNM->SetLineStyle(2);
443  hNM->SetMaximum(1.1*maxval);
444  hNM->SetMinimum(0);
445  hNM->SetTitle(fullTitle.c_str());
446 
447  CenterTitles(hEU);
448  hEU->SetLineColor(kGreen+2);
449  hEU->SetLineStyle(2);
450  hEU->SetMaximum(1.1*maxval);
451  hEU->SetMinimum(0);
452  hEU->SetTitle(fullTitle.c_str());
453 
454  CenterTitles(hED);
455  hED->SetLineColor(kGreen+2);
456  hED->SetLineStyle(2);
457  hED->SetMaximum(1.1*maxval);
458  hED->SetMinimum(0);
459  hED->SetTitle(fullTitle.c_str());
460 
461  CenterTitles(hRat);
462  hRat->SetLineColor(kBlack);
463  hRat->SetMaximum(1.1*maxvalRat);
464  hRat->SetMinimum(0.9*minvalRat);
465  hRat->SetTitle(fullTitleRat.c_str());
466 
467  CenterTitles(hNCRat);
468  hNCRat->SetLineColor(kRed);
469  hNCRat->SetLineStyle(2);
470  hNCRat->SetMaximum(1.1*maxvalRat);
471  hNCRat->SetMinimum(0.9*minvalRat);
472  hNCRat->SetTitle(fullTitleRat.c_str());
473 
474  CenterTitles(hNMRat);
475  hNMRat->SetLineColor(kBlue);
476  hNMRat->SetLineStyle(2);
477  hNMRat->SetMaximum(1.1*maxvalRat);
478  hNMRat->SetMinimum(0.9*minvalRat);
479  hNMRat->SetTitle(fullTitleRat.c_str());
480 
481  CenterTitles(hEURat);
482  hEURat->SetLineColor(kGreen+2);
483  hEURat->SetLineStyle(2);
484  hEURat->SetMaximum(1.1*maxvalRat);
485  hEURat->SetMinimum(0.9*minvalRat);
486  hEURat->SetTitle(fullTitleRat.c_str());
487 
488  CenterTitles(hEDRat);
489  hEDRat->SetLineColor(kGreen+2);
490  hEDRat->SetLineStyle(2);
491  hEDRat->SetMaximum(1.1*maxvalRat);
492  hEDRat->SetMinimum(0.9*minvalRat);
493  hEDRat->SetTitle(fullTitleRat.c_str());
494 
495  double xL = 0.6, xR = 0.85;
496  double yB = 0.6, yT = 0.85;
497  TLegend* leg = new TLegend(xL, yB, xR, yT);
498  leg->AddEntry(nom, "Nominal", "l");
499  leg->AddEntry(hNC, "Data/MC Diff to NC Comp", "l");
500  leg->AddEntry(hNM, "Data/MC Diff to #nu_{#mu} Comp", "l");
501  leg->AddEntry(hEU, "#nu_{e} Comp Shifted", "l");
502 
503  TCanvas* c = new TCanvas(name.c_str(), title.c_str(), 800, 800);
504  TPad* pSpecs = new TPad("pSpecs", "", 0., 0.375, 1., 1.);
505  TPad* pRatio = new TPad("pRatio", "", 0., 0., 1., 0.375);
506  pSpecs->Draw();
507  pRatio->Draw();
508 
509  pSpecs->cd();
510  nom->Draw("hist");
511  hNC->Draw("hist same");
512  hNM->Draw("hist same");
513  hEU->Draw("hist same");
514  if(strs.fComponent.compare("BG") == 0) {
515  hED->Draw("hist same");
516  }
517  leg->Draw();
518  Simulation();
519 
520  pRatio->cd();
521  hRat->Draw("hist");
522  hNCRat->Draw("hist same");
523  hNMRat->Draw("hist same");
524  hEURat->Draw("hist same");
525  hEDRat->Draw("hist same");
526 
527  c->Update();
528  rootOUT->WriteTObject(c);
529  return;
530 }
void Simulation()
Definition: tools.h:16
T max(const caf::Proxy< T > &a, T b)
const XML_Char * name
Definition: expat.h:151
int nBins
Definition: plotROC.py:16
std::string fDet
Definition: PPFXHelper.h:104
void PlotSysts(TH1 *nom, TH1 *hNC, TH1 *hNM, TH1 *hEU, TH1 *hED, TDirectory *rootOUT, FILE *textOFS, strings strs)
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
virtual Spectrum AntiNueComponent() const =0
std::string fComponent
Definition: PPFXHelper.h:103
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:209
virtual Spectrum NumuComponent() const =0
void PlotSyst(TH1 *h, TH1 *hp1, TH1 *hm1, TH1 *hp2, TH1 *hm2, TDirectory *out, FILE *text, strings strs)
Definition: PPFXHelper.h:662
void CenterTitles(TH1 *histo)
Definition: Plots.cxx:1481
osc::OscCalcDumb calc
osc::IOscCalcAdjustable * DefaultOscCalc()
Create a new calculator with default assumptions for all parameters.
Definition: Calcs.cxx:49
float abs(float number)
Definition: d0nt_math.hpp:39
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:33
bool datamc
Definition: fnexvscaf.C:20
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
TH1 * GetNC(IDecomp *specs, double POT)
Definition: PPFXHelper.h:211
fclose(fg1)
Charged-current interactions.
Definition: IPrediction.h:39
Optimized version of OscCalcPMNS.
Definition: StanTypedefs.h:31
void InitializeSystText(FILE *text, strings strs)
Print some initial text about a systematic – the systematic type and sample.
Definition: PPFXHelper.h:263
std::string fSystL
Definition: PPFXHelper.h:109
std::vector< std::string > comps
std::string fPOT
Definition: PPFXHelper.h:105
virtual Spectrum AntiNumuComponent() const =0
OStream cout
Definition: OStream.cxx:6
std::vector< double > POT
std::string fXLabel
Definition: PPFXHelper.h:110
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
virtual Spectrum NCTotalComponent() const
Definition: IDecomp.h:18
std::string fSystType
Definition: PPFXHelper.h:107
Standard interface to all decomposition techniques.
Definition: IDecomp.h:13
Neutral-current interactions.
Definition: IPrediction.h:40
Both neutrinos and antineutrinos.
Definition: IPrediction.h:52
Standard interface to all prediction techniques.
Definition: IPrediction.h:57
std::string fSystS
Definition: PPFXHelper.h:108
void LoadMaps(TDirectory *dir, std::map< std::string, IDecomp * > *nominal, std::map< std::string, std::map< std::string, std::map< int, IDecomp * > > > *shifted)
Definition: PPFXHelper.h:273
static double NCSCALE
T min(const caf::Proxy< T > &a, T b)
All neutrinos, any flavor.
Definition: IPrediction.h:26
TH1 * GetBG(IDecomp *specs, double POT)
Definition: PPFXHelper.h:236
void SystsDecompAna()
std::string StringFromDouble(double pot)
Definition: PPFXHelper.h:128
void BinErrors(TH1 *nom, TH1 *nc, TH1 *numu, TH1 *nueup, TH1 *nuedn)
virtual Spectrum NueComponent() const =0
A helper structure to contain a group of string for plotting.
Definition: PPFXHelper.h:101
std::string fSample
Definition: PPFXHelper.h:106
void PlotComp(IDecomp *nom, IDecomp *shifts, TDirectory *out, FILE *text, strings strs, double POT)