Functions
plot_michel_final.C File Reference
#include "CAFAna/Analysis/Calcs.h"
#include "CAFAna/Analysis/Exposures.h"
#include "3FlavorAna/Plotting/NuePlotStyle.h"
#include "CAFAna/Analysis/Plots.h"
#include "CAFAna/Analysis/Style.h"
#include "CAFAna/Core/LoadFromFile.h"
#include "CAFAna/Core/Spectrum.h"
#include "3FlavorAna/Decomp/MichelDecomp.h"
#include "CAFAna/Decomp/ProportionalDecomp.h"
#include "3FlavorAna/Vars/NueVars.h"
#include "CAFAna/Prediction/IPrediction.h"
#include "3FlavorAna/Prediction/PredictionExtendToPeripheral.h"
#include "3FlavorAna/Prediction/PredictionAddRock.h"
#include "3FlavorAna/Ana2017/nue/joint_fit_2017_tools.h"
#include "OscLib/IOscCalc.h"
#include "TFile.h"
#include "TH1.h"
#include "THStack.h"
#include "TCanvas.h"
#include "TGaxis.h"
#include "TGraph.h"
#include "TLatex.h"
#include "TLegend.h"
#include "TLine.h"
#include "TSystem.h"
#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstddef>

Go to the source code of this file.

Functions

void SetAxis (TH1 *h, bool visible, int color, int style=1, bool scale=true)
 
double DerivePowScale (TH1 *h)
 
void Legend (TH1 *h_to_clone)
 
void plot_michel_final ()
 

Function Documentation

double DerivePowScale ( TH1 *  h)

Definition at line 129 of file plot_michel_final.C.

References makeTrainCVSamples::int, and std::log10().

Referenced by SetAxis().

129  {
130  return 3*(int(log10(h->GetMaximum())))/3;
131 }
T log10(T number)
Definition: d0nt_math.hpp:120
void Legend ( TH1 *  h_to_clone)

Definition at line 133 of file plot_michel_final.C.

References make_syst_table_plots::h, MECModelEnuComparisons::i, makeTrainCVSamples::int, kGreen, MECModelEnuComparisons::leg, and moon_position_table_new3::second.

Referenced by plot_michel_final().

133  {
134  std::vector <std::pair<int, TString>> entries = {{kBlack, "ND data"},
135  {kAzure, "NC"},
136  {kGreen+2, "#nu_{#mu} CC"},
137  {kMagenta, "#nu_{e} CC"},
138  };
139  TLegend* leg = new TLegend(.65, .5, .85, .8);
140  leg->SetFillStyle(0);
141  TH1* h = (TH1F*)h_to_clone->Clone();
142  leg->SetTextSize(0.75*h->GetXaxis()->GetTitleSize());
143  h->SetLineStyle(1);
144  h->SetLineColor(kBlack);
145  h->SetMarkerStyle(kFullCircle);
146  leg->AddEntry(h, entries[0].second, "lep");
147  for(int i = 1; i < (int) entries.size(); i++){
148  h->SetLineColor(entries[i].first);
149  if(i == 7) h->SetLineStyle(7); // Uncorr MC
150  else h->SetLineStyle(1);
151  if(i == 8){
152  h->SetMarkerColor(entries[i].first); // Ratio to Uncorr MC
153  h->SetMarkerStyle(kFullCircle);
154  leg->AddEntry(h->Clone(), entries[i].second, "lep");
155  continue;
156  }
157  if(i == 9) {
158  h->SetMarkerColor(entries[i].first);
159  h->SetMarkerStyle(kFullCircle);
160  leg->AddEntry(h->Clone(), entries[i].second, "lep");
161  continue;
162  }
163  leg->AddEntry(h->Clone(), entries[i].second, "l");
164  }
165  h->SetLineColor(kBlack);
166  leg->Draw();
167 
168 }
enum BeamMode kGreen
void plot_michel_final ( )

Definition at line 42 of file plot_michel_final.C.

References allTimeWatchdog::can, cc(), plot_validation_datamc::Clone(), colors, om::cout, plot_validation_datamc_2018::fdecomp, MECModelEnuComparisons::i, kGreen, kRed, PandAna.Demos.pi0_spectra::labels, Legend(), nc, potmc, SetAxis(), and ana::UniqueName().

42  {
43 
44  TFile* fdecomp = new TFile(("nue_dcmp.root"), "READ");
45  if(fdecomp->IsZombie()) {std::cout << "MC Decomp File not found"; return; }
46 
47  TH2F *da2D = (TH2F*)fdecomp->Get("nue_decomps/michelbenDCMP/TempData/hist");
48  TH2F *cc2D = (TH2F*)fdecomp->Get("nue_decomps/michelbenDCMP/TempNumu/hist");
49  TH2F *nc2D = (TH2F*)fdecomp->Get("nue_decomps/michelbenDCMP/TempNC/hist");
50  TH2F *ne2D = (TH2F*)fdecomp->Get("nue_decomps/michelbenDCMP/TempNue/hist");
51 
52  TH1D *potda = (TH1D*)(fdecomp->Get(("nue_decomps/michelbenDCMP/TempData/pot")))->Clone(UniqueName().c_str());
53  TH1D *potmc = (TH1D*)(fdecomp->Get(("nue_decomps/michelbenDCMP/TempNumu/pot")))->Clone(UniqueName().c_str());
54 
55  TH1D *da = (TH1D*)da2D->ProjectionY();
56  TH1D *cc = (TH1D*)cc2D->ProjectionY();
57  TH1D *nc = (TH1D*)nc2D->ProjectionY();
58  TH1D *ne = (TH1D*)ne2D->ProjectionY();
59 
60  da->Scale(0.001);
61  cc->Scale(0.001*potda->Integral()/potmc->Integral());
62  ne->Scale(0.001*potda->Integral()/potmc->Integral());
63  nc->Scale(0.001*potda->Integral()/potmc->Integral());
64 
65  THStack *st = new THStack(UniqueName().c_str(),"");
66  ne->SetLineColor(kMagenta);
67  ne->SetLineWidth(2);
68  ne->SetFillStyle(1001);
69 
70  st->Add(ne);
71  nc->SetLineColor(kAzure);
72  nc->SetLineWidth(2);
73  nc->SetFillStyle(1001);
74 
75  st->Add(nc);
76 
77  cc->SetLineColor(kGreen+2);
78  cc->SetLineWidth(2);
79  cc->SetFillStyle(1001);
80 
81  st->Add(cc);
82 
83  TCanvas* can = new TCanvas("c");
84 
85  std::vector <int> colors = {kMagenta,
86  kGreen+2,
87  kAzure,
88  kMagenta-2,
89  kGreen-3,
90  kRed};
91  std::vector<std::string> labels = {"#nu_{e} CC",
92  "#nu_{#mu} CC",
93  "NC",
94  "#bar{#nu_{e}} CC",
95  "#bar{#nu_{#mu}} CC"};
96 
97  da->GetXaxis()->SetTitle("Number of Michel Electrons");
98  da->GetXaxis()->CenterTitle();
99  da->GetYaxis()->SetTitle("10^{3} Events");
100 
101  da->GetYaxis()->CenterTitle();
102  da->SetMarkerStyle(kFullCircle);
103 
104  for (int i = 1; i <= 3; i++) da->SetBinError(i,da->GetBinContent(i)/1000);
105 
106  SetAxis(da, true, 5);
107 
108  da->Draw("E");
109  Legend(da);
110 
111  st->Draw("hist same");
112  da->Draw("same E1");
113  gPad->RedrawAxis();
114 
115  can->SaveAs("nue2018_michel_NME.pdf");
116  can->SaveAs("nue2018_michel_NME.png");
117  can->SaveAs("nue2018_michel_NME.eps");
118  can->SaveAs("nue2018_michel_NME.gif");
119 }
enum BeamMode kRed
void Legend(TH1 *h_to_clone)
void SetAxis(TH1 *h, bool visible, int color, int style=1, bool scale=true)
int colors[6]
Definition: tools.h:1
OStream cout
Definition: OStream.cxx:6
void cc()
Definition: test_ana.C:28
enum BeamMode nc
enum BeamMode kGreen
std::string UniqueName()
Return a different string each time, for creating histograms.
Definition: Utilities.cxx:29
const double potmc
void SetAxis ( TH1 *  h,
bool  visible,
int  color,
int  style = 1,
bool  scale = true 
)

Definition at line 121 of file plot_michel_final.C.

References DerivePowScale(), and norm.

Referenced by MakeCosmicSpectra(), MakeNumuCovMx(), MakePrediction(), MakePredictionNoOsc_FHC_FD(), MakePredictionNoOsc_FHC_ND(), MakePredictionNoOsc_RHC_FD(), MakePredictionNoOsc_RHC_ND(), MakeSurfaceBinningStudy(), and plot_michel_final().

121  {
122  if(!visible){
123  h->SetTickLength(0.);
124  h->SetLabelSize(0.);
125  }
126  double norm = DerivePowScale(h);
127 }
Float_t norm
double DerivePowScale(TH1 *h)