Classes | Namespaces | Enumerations | Functions | Variables
draw_plots_util.h File Reference
#include "CAFAna/Analysis/Exposures.h"
#include "CAFAna/Analysis/Plots.h"
#include "CAFAna/Analysis/Calcs.h"
#include "3FlavorAna/Plotting/NuePlotStyle.h"
#include "CAFAna/Analysis/Style.h"
#include "CAFAna/Core/Binning.h"
#include "CAFAna/Core/HistAxis.h"
#include "CAFAna/Core/LoadFromFile.h"
#include "CAFAna/Core/Utilities.h"
#include "CAFAna/Prediction/IPrediction.h"
#include "CAFAna/Prediction/PredictionInterp.h"
#include "CAFAna/Prediction/PredictionExtrap.h"
#include "CAFAna/Prediction/PredictionNoExtrap.h"
#include "3FlavorAna/Prediction/PredictionExtendToPeripheral.h"
#include "3FlavorAna/Prediction/PredictionSystJoint2018.h"
#include "CAFAna/Vars/FitVars.h"
#include "CAFAna/Decomp/IDecomp.h"
#include "CAFAna/Extrap/IExtrap.h"
#include "CAFAna/Extrap/ModularExtrap.h"
#include "CAFAna/Extrap/ModularExtrapComponent.h"
#include "OscLib/OscCalcDumb.h"
#include "OscLib/IOscCalc.h"
#include "TStyle.h"
#include "TFile.h"
#include "TH1.h"
#include "TCanvas.h"
#include "TGraph.h"
#include "TGraphAsymmErrors.h"
#include "TGaxis.h"
#include "TLatex.h"
#include "TPaveText.h"
#include "TLegend.h"
#include "TLine.h"
#include "TSystem.h"
#include <iostream>
#include <fstream>
#include <iomanip>
#include "tex_tables_util.h"

Go to the source code of this file.

Classes

struct  ana::DataMCComponents
 

Namespaces

 ana
 Cuts and Vars for the 2020 FD DiF Study.
 

Enumerations

enum  AxisType {
  kNue1bin, kNue3bin, kNue4bin, kNumuOpt,
  kNumuOther, kNue1bin, kNue3bin, kNumuOpt,
  kNumuOther, kNue1bin, kNue3bin, kNumuOpt,
  kNumuOther, kNue1bin, kNue3bin, kNueNDbin,
  kNumuOpt, kNumuOther
}
 
enum  ana::EModExtrapComps {
  ana::kEEextrap, ana::kEEAntiextrap, ana::kMMextrap, ana::kMMAntiextrap,
  ana::kMEextrap, ana::kMEAntiextrap, ana::kEMextrap, ana::kEMAntiextrap,
  ana::kNCTotalextrap, ana::kNCextrap, ana::kNCAntiextrap, ana::kMTextrap,
  ana::kMTAntiextrap, ana::kETextrap, ana::kETAntiextrap, ana::kEEextrap,
  ana::kEEAntiextrap, ana::kMMextrap, ana::kMMAntiextrap, ana::kMEextrap,
  ana::kMEAntiextrap, ana::kEMextrap, ana::kEMAntiextrap, ana::kNCTotalextrap,
  ana::kNCextrap, ana::kNCAntiextrap, ana::kMTextrap, ana::kMTAntiextrap,
  ana::kETextrap, ana::kETAntiextrap, ana::kEEextrap, ana::kEEAntiextrap,
  ana::kMMextrap, ana::kMMAntiextrap, ana::kMEextrap, ana::kMEAntiextrap,
  ana::kEMextrap, ana::kEMAntiextrap, ana::kNCTotalextrap, ana::kNCextrap,
  ana::kNCAntiextrap, ana::kMTextrap, ana::kMTAntiextrap, ana::kETextrap,
  ana::kETAntiextrap
}
 

Functions

osc::IOscCalcGetCalculator (bool usingdumb)
 
TH1 * PrettyRatio (TH1 *shi, TH1 *nom, int color, double alpha=1., TString titley="Shift / Nom")
 
double FindLimitY (std::vector< TH1 * > histos, bool doMax=true)
 
void FormatErrorBand (TH1 *hplus, TH1 *hminus, bool signal=false, bool fixbins=false)
 
TH1 * HistNumuOpt (TH1 *orig)
 
void PrettyTag (TString pid, int color, double xndc, double yndc)
 
void PIDTag (TString pid)
 
void HTag (TString hie)
 
TLegend * CustomLegend (std::vector< TH1 * >h, std::vector< TString > titles, std::vector< TString > option, double x1=kLegendDefaultX1, double y1=kLegendDefaultY1, double x2=kLegendDefaultX2, double y2=kLegendDefaultY2)
 
void FixLegend (TLegend *leg, TString opt="default")
 
TGraph * DummyGraph (int color=kBlack, int style=1, int linewidth=2, int markerstyle=kFullCircle)
 
TLegend * DefaultNueLegend (bool sig=true, bool tot=true, bool data=false, double x1=kLegendDefaultX1, double y1=kLegendDefaultY1, double x2=kLegendDefaultX2, double y2=kLegendDefaultY2)
 
TLegend * DefaultNumuLegend (bool sig=true, bool tot=true, bool data=false, double x1=kLegendDefaultX1, double y1=kLegendDefaultY1, double x2=kLegendDefaultX2, double y2=kLegendDefaultY2)
 
void PrintCanvasAll (TCanvas *c, const TString outname, const TString outdir="plots/", const std::vector< TString > exts={"pdf","png","root"})
 
TH1 * RebinToShortAxis (TH1 *h)
 
void NuePID3bin (TH1 *h, TString pidtag, bool binlabels=true)
 
TCanvas * ExPIDPlot (std::vector< TH1 * > topHistos, std::vector< TString > topOption)
 
TCanvas * RatioPlot (std::vector< TH1 * > topHistos, std::vector< TString > topOption, std::vector< TH1 * > bottomHistos, std::vector< TString > bottomOption, TString pidtag, AxisType pidaxis=kNue1bin)
 
void PlotDataMC (std::vector< TH1 * >vnom, std::vector< bool >isdata, TLegend *leg, TString pidtag="", TString htag="", TString out_name="plot_FD", bool ratioplot=false, bool ratioerrors=false, AxisType pidaxis=kNue1bin)
 
void PlotNDDataTotalMCComparison (TH1 *hdata, std::vector< TH1 * > htots, TLegend *leg, TString pidtag="", TString out_name="plot_nd", bool ratioplot=false, AxisType pidaxis=kNue1bin)
 
void PlotMCComponentsComparison (std::vector< TH1 * >vnom, std::vector< TH1 * >vshi, TLegend *leg, TString pidtag="", TString out_name="plot_nd", bool ratioplot=false, bool ratioerrors=false, AxisType pidaxis=kNue1bin)
 
void PlotMCComponentsErrorBand (std::vector< TH1 * >vnom, std::vector< TH1 * >vshi, TLegend *leg, TString pidtag="", TString out_name="plot_nd", bool ratioplot=false, bool ratioerrors=false, AxisType pidaxis=kNue1bin)
 
void ana::DefaultFormatNue (DataMCComponents &comp, int linestyle=1)
 
const DataMCComponents ana::GetNDComponents (const IDecomp *decomp)
 
struct DataMCComponets ana::GetFDMCComponents (osc::IOscCalc *calc, IPrediction *pred_no, TString output_name="nue", int linestyle=1, bool bkgdetails=false)
 
void ana::CompareNDDataOneMC (DataMCComponents h_no, DataMCComponents h_sh, TString plottitle, TString out_name, TString pidtag, AxisType pidaxis, bool printtable=true)
 
void ana::CompareNDDataTwoMC (DataMCComponents hnom, DataMCComponents hplu, DataMCComponents hmin, TString plottitle, TString out_name, TString pidtag, AxisType pidaxis, bool printtable=true)
 
const IDecomp * ana::GetDecomp (IPrediction *prediction, EModExtrapComps modExtrapComp)
 
void ana::CompareNDDataMCFromVector (PredictionSystJoint2018 *predictionSyst, const ISyst *syst, EModExtrapComps modExtrapComp, TString plottitle, TString out_name, TString tag, AxisType pidaxis, bool printtable=true)
 
void ana::CompareOneShiftPred (IPrediction *pred_no, IPrediction *pred_sh, TString plottitle, TString out_name, TString pidtag, bool printtable=true, AxisType pidaxis=kNue1bin, bool PrintParams=false)
 
void ana::CompareTwoShiftPred (IPrediction *pred_no, IPrediction *pred_pl, IPrediction *pred_mi, TString plottitle, TString out_name, TString pidtag, bool printtable=true, AxisType pidaxis=kNue1bin, bool PrintParams=false)
 
void ana::ComparePredictionsFromVector (PredictionSystJoint2018 *predictionSyst, const ISyst *syst, TString plottitle, TString out_name, bool printtable=true, AxisType pidaxis=kNue3bin)
 

Variables

static bool isFHC =true
 
const bool printratioplots =true
 
bool usedumb = false
 
bool mergePeripheral =false
 
const double kLegendDefaultX1 = 0.63
 
const double kLegendDefaultX2 = 0.85
 
const double kLegendDefaultY1 = 0.68
 
const double kLegendDefaultY2 = 0.88
 

Enumeration Type Documentation

enum AxisType
Enumerator
kNue1bin 
kNue3bin 
kNue4bin 
kNumuOpt 
kNumuOther 
kNue1bin 
kNue3bin 
kNumuOpt 
kNumuOther 
kNue1bin 
kNue3bin 
kNumuOpt 
kNumuOther 
kNue1bin 
kNue3bin 
kNueNDbin 
kNumuOpt 
kNumuOther 

Definition at line 50 of file draw_plots_util.h.

Function Documentation

TLegend* CustomLegend ( std::vector< TH1 * >  h,
std::vector< TString >  titles,
std::vector< TString >  option,
double  x1 = kLegendDefaultX1,
double  y1 = kLegendDefaultY1,
double  x2 = kLegendDefaultX2,
double  y2 = kLegendDefaultY2 
)

Definition at line 170 of file draw_plots_util.h.

References MECModelEnuComparisons::leg, registry_explorer::v, x1, submit_syst::x2, y1, and submit_syst::y2.

174 {
175  TLegend* leg = new TLegend(x1, y1, x2, y2);
176  leg->SetFillStyle(0);
177  for (unsigned int v = 0; v < h.size(); ++v)
178  leg->AddEntry(h[v], titles[v], option[v]);
179  leg->SetBit(kCanDelete);
180  return leg;
181 }
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
TLegend* DefaultNueLegend ( bool  sig = true,
bool  tot = true,
bool  data = false,
double  x1 = kLegendDefaultX1,
double  y1 = kLegendDefaultY1,
double  x2 = kLegendDefaultX2,
double  y2 = kLegendDefaultY2 
)

Definition at line 221 of file draw_plots_util.h.

References DummyGraph(), ana::kBeamNueBackgroundColor, ana::kNCBackgroundColor, ana::kNueSignalColor, ana::kNumuBackgroundColor, ana::kTotalMCColor, MECModelEnuComparisons::leg, PandAna.Demos.pi0_spectra::tot, x1, submit_syst::x2, y1, and submit_syst::y2.

225 {
226  TLegend* leg = new TLegend(x1,y1,x2,y2);
227  leg->SetFillStyle(0);
228  if(sig) leg->AddEntry( DummyGraph(kNueSignalColor), "#nu_{e} Signal","l");
229  if(data) leg->AddEntry( DummyGraph(), "ND Data","epl");
230  if(tot) leg->AddEntry( DummyGraph(kTotalMCColor), "Total Bkg","l");
231  leg->AddEntry( DummyGraph(kBeamNueBackgroundColor), "Beam #nu_{e}","l");
232  leg->AddEntry( DummyGraph(kNCBackgroundColor), "NC","l");
233  leg->AddEntry( DummyGraph(kNumuBackgroundColor), "#nu_{#mu} CC","l");
234  leg->SetBit(kCanDelete);
235  return leg;
236 
237 }
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
const Color_t kNumuBackgroundColor
Definition: Style.h:30
const Color_t kNueSignalColor
Definition: Style.h:19
const XML_Char const XML_Char * data
Definition: expat.h:268
const Color_t kBeamNueBackgroundColor
Definition: Style.h:24
TGraph * DummyGraph(int color=kBlack, int style=1, int linewidth=2, int markerstyle=kFullCircle)
const Color_t kTotalMCColor
Definition: Style.h:16
const Color_t kNCBackgroundColor
Definition: Style.h:22
TLegend* DefaultNumuLegend ( bool  sig = true,
bool  tot = true,
bool  data = false,
double  x1 = kLegendDefaultX1,
double  y1 = kLegendDefaultY1,
double  x2 = kLegendDefaultX2,
double  y2 = kLegendDefaultY2 
)

Definition at line 240 of file draw_plots_util.h.

References DummyGraph(), isNumuAna, ana::kBeamNueBackgroundColor, ana::kNCBackgroundColor, ana::kNueSignalColor, ana::kNumuBackgroundColor, ana::kNuTauBackgroundColor, ana::kTotalMCColor, MECModelEnuComparisons::leg, PandAna.Demos.pi0_spectra::tot, x1, submit_syst::x2, y1, and submit_syst::y2.

243 {
244  TLegend* leg = new TLegend(x1,y1,x2,y2);
245  leg->SetFillStyle(0);
246  if(sig) leg->AddEntry( DummyGraph(kNueSignalColor), "#nu_{#mu} Signal","l");
247  if(data) leg->AddEntry( DummyGraph(), "ND Data","epl");
248  if(tot) leg->AddEntry( DummyGraph(kTotalMCColor), "Total Bkg","l");
249  if(isNumuAna) leg->AddEntry( DummyGraph(kNumuBackgroundColor), "#nu_{#mu} app","l");
250  else leg->AddEntry( DummyGraph(kNumuBackgroundColor), "#nu_{#mu} CC" ,"l");
251  leg->AddEntry( DummyGraph(kNCBackgroundColor), "NC","l");
252  leg->AddEntry( DummyGraph(kBeamNueBackgroundColor), "#nu_{e} CC","l");
253  leg->AddEntry( DummyGraph(kNuTauBackgroundColor), "#nu_{#tau} CC","l");
254  leg->SetBit(kCanDelete);
255  return leg;
256 
257 }
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
const Color_t kNumuBackgroundColor
Definition: Style.h:30
const Color_t kNueSignalColor
Definition: Style.h:19
const XML_Char const XML_Char * data
Definition: expat.h:268
const Color_t kNuTauBackgroundColor
Definition: Style.h:26
bool isNumuAna
const Color_t kBeamNueBackgroundColor
Definition: Style.h:24
TGraph * DummyGraph(int color=kBlack, int style=1, int linewidth=2, int markerstyle=kFullCircle)
const Color_t kTotalMCColor
Definition: Style.h:16
const Color_t kNCBackgroundColor
Definition: Style.h:22
TGraph* DummyGraph ( int  color = kBlack,
int  style = 1,
int  linewidth = 2,
int  markerstyle = kFullCircle 
)

Definition at line 209 of file draw_plots_util.h.

References plot_validation_datamc_2018::color.

210 {
211  auto gr = new TGraph();
212  gr->SetLineColor(color);
213  gr->SetLineStyle(style);
214  gr->SetLineWidth(linewidth);
215  gr->SetMarkerStyle(markerstyle);
216  gr->SetMarkerColor(color);
217  return gr;
218 }
TCanvas* ExPIDPlot ( std::vector< TH1 * >  topHistos,
std::vector< TString >  topOption 
)

Definition at line 311 of file draw_plots_util.h.

References plot_validation_datamc::Clone(), Ebins, FindLimitY(), make_syst_table_plots::h, he, calib::j, and pidBins.

313 {
314  TCanvas *cpid = new TCanvas("cpid", "cpid", 410, 850);
315  float Ebins = 10;
316  int pidBins = 3;
317 
318  TPad* p[pidBins];
319  p[0] = new TPad("", "", 0, 0, 1, 1);
320  p[1] = new TPad("", "", 0, 0, 1, 1);
321  p[2] = new TPad("", "", 0, 0, 1, 1);
322  p[0]->SetTopMargin(0.1);
323  p[0]->SetBottomMargin(.634);
324  p[1]->SetTopMargin(.369);
325  p[1]->SetBottomMargin(.369);
326  p[2]->SetTopMargin(.634);
327  p[2]->SetBottomMargin(0.1);
328  p[0]->SetFillStyle(0);
329  p[1]->SetFillStyle(0);
330  p[2]->SetFillStyle(0);
331  p[0]->Draw();
332  p[1]->Draw();
333  p[2]->Draw();
334 
335  TH1* he[pidBins];
336  TH1* h[topHistos.size()][pidBins];
337  for(int k=pidBins-1; k>=0; --k){
338  he[k] = (TH1*) topHistos[0]->Clone();
339  he[k]->GetYaxis()->SetRangeUser(FindLimitY(topHistos,0) ,1.2*FindLimitY(topHistos,1));
340  he[k]->GetXaxis()->SetRangeUser(Ebins*k,Ebins*(k+1));
341  if ( k>0 ) he[k]->GetXaxis()->SetLabelSize(0);
342  p[pidBins-1-k]->cd();
343  he[k]->Draw(topOption[0]);
344  he[k]->GetYaxis()->SetTitleSize(24);
345  he[k]->GetYaxis()->SetTitleFont(43);
346  he[k]->GetYaxis()->SetTitleOffset(1.25);
347  he[k]->GetYaxis()->SetLabelFont(43);
348  he[k]->GetYaxis()->SetLabelSize(14);
349  he[k]->GetXaxis()->SetLabelOffset(-0.008);
350  he[k]->GetXaxis()->SetTitleOffset(0.5);
351  p[pidBins-1-k]->SetGridy();
352  }
353  for(unsigned int ii=0;ii<topHistos.size();ii++){
354  for(int j=pidBins-1; j>=0; --j){
355  h[ii][j] = (TH1*) topHistos[ii]->Clone();
356  h[ii][j]->GetXaxis()->SetRangeUser(Ebins*j,Ebins*(j+1));
357  p[pidBins-1-j]->cd();
358  h[ii][j]->Draw("same "+topOption[ii]);
359  }
360  }
361  for(int h=pidBins-1; h>=0; --h){
362  he[h]->SetStats(0);
363  p[pidBins-1-h]->cd();
364  he[h]->Draw("same "+topOption[0]);
365  }
366  p[0]->RedrawAxis(); //needed for white histograms e.g. beam
367  p[1]->RedrawAxis();
368  p[2]->RedrawAxis();
369  return cpid;
370 }
const int pidBins
const char * p
Definition: xmltok.h:285
double FindLimitY(std::vector< TH1 * > histos, bool doMax=true)
double Ebins[11]
Definition: Xdiff_gwt.C:8
const double j
Definition: BetheBloch.cxx:29
double he
Definition: runWimpSim.h:113
double FindLimitY ( std::vector< TH1 * >  histos,
bool  doMax = true 
)

Definition at line 93 of file draw_plots_util.h.

References make_mec_shifts_plots::GetMaximum(), MECModelEnuComparisons::i, cet::sqlite::max(), and min().

94 {
95  double max = histos[0]->GetMaximum();
96  double min = histos[0]->GetMinimum();
97 
98  for(unsigned int i=0; i<histos.size(); i++){
99  if ( histos[i]->GetMaximum() > max ) max = histos[i]->GetMaximum();
100  if ( histos[i]->GetMinimum() < min ) min = histos[i]->GetMinimum();
101  }
102 
103  if ( doMax ) return max;
104  else return min;
105 }
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
void FixLegend ( TLegend *  leg,
TString  opt = "default" 
)

Definition at line 185 of file draw_plots_util.h.

References kLegendDefaultX1, kLegendDefaultX2, kLegendDefaultY1, kLegendDefaultY2, and MECModelEnuComparisons::opt.

186 {
187  leg->SetFillStyle(0);
188  if(opt=="default")
189  {
190  leg->SetX1(kLegendDefaultX1); leg->SetX2(kLegendDefaultX2);
191  leg->SetY1(kLegendDefaultY1); leg->SetY2(kLegendDefaultY2);
192  }
193  if(opt=="ExPID")
194  {
195  leg->SetX1(0.405); leg->SetX2(0.565);
196  leg->SetY1(0.63); leg->SetY2(0.82);
197  leg->SetBorderSize(0);
198  leg->SetTextSize(0.033);
199  }
200  if(opt=="ExPIDPads")
201  {
202  leg->SetX1(0.55); leg->SetX2(0.89);
203  leg->SetY1(0.75); leg->SetY2(0.89);
204  leg->SetTextSize(0.045);
205  }
206 }
const double kLegendDefaultY2
const double kLegendDefaultY1
const double kLegendDefaultX2
const double kLegendDefaultX1
void FormatErrorBand ( TH1 *  hplus,
TH1 *  hminus,
bool  signal = false,
bool  fixbins = false 
)

Definition at line 108 of file draw_plots_util.h.

References om::cout, allTimeWatchdog::endl, MECModelEnuComparisons::i, kBlue, kRed, ana::kTotalMCErrorBandColor, kViolet, cet::sqlite::max(), and min().

110 {
111  int mccolor = signal ? kViolet -9 : kTotalMCErrorBandColor;
112  std::cout << "hplus: " << hplus->Integral() << std::endl;
113  std::cout << "hminus: " << hminus->Integral() << std::endl;
114  hplus ->SetLineColor(mccolor);
115  hminus->SetLineColor(mccolor);
116  hplus ->SetFillColor(mccolor);
117  hminus->SetFillColor(10);
118  hplus ->SetMarkerColor(kRed-7);
119  hminus->SetMarkerColor(kBlue-7);
120 
121  if (fixbins)
122  {
123  for(int i=1; i <= hplus->GetNbinsX(); i++)
124  {
125  double tplus = hplus->GetBinContent(i);
126  double tminus = hminus->GetBinContent(i);
127  hplus->SetBinContent(i,max(tplus, tminus));
128  hminus->SetBinContent(i,min(tplus,tminus));
129  }
130  }
131 }
enum BeamMode kRed
TH1F * hplus
Definition: Xsec_final.C:75
const Color_t kTotalMCErrorBandColor
Definition: Style.h:17
OStream cout
Definition: OStream.cxx:6
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
TH1F * hminus
Definition: Xsec_final.C:76
enum BeamMode kViolet
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
enum BeamMode kBlue
osc::IOscCalc* GetCalculator ( bool  usingdumb)

Definition at line 55 of file draw_plots_util.h.

References calc, osc::OscCalcDumb::Copy(), osc::_IOscCalc< T >::Copy(), ana::DefaultOscCalc(), dmsq32, ana::kFitDeltaInPiUnits, ana::kFitDmSq32, ana::kFitSinSqTheta23, ana::FitVarWithPrior::SetValue(), ana::ConstrainedFitVarWithPrior::SetValue(), ana::FitDmSq32::SetValue(), and ssth23.

55  {
56  double dCP_Pi = 1.48;
57  double ssth23 = 0.558;
58  double dmsq32 = 2.44e-3;
59 
61  if(usingdumb){
62  osc::OscCalcDumb dumb;
63  calc = dumb.Copy();
64  }
65  else{
66  auto calc2 = DefaultOscCalc();
67  kFitDeltaInPiUnits.SetValue(calc2, dCP_Pi);
68  kFitSinSqTheta23.SetValue(calc2, ssth23);
69  kFitDmSq32.SetValue(calc2, dmsq32);
70  calc = calc2->Copy();
71  }
72  return calc;
73 }
double ssth23
const FitDmSq32 kFitDmSq32
Definition: FitVars.cxx:18
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:177
General interface to oscillation calculators.
Definition: StanTypedefs.h:22
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Forward to wrapped Var&#39;s SetValue()
osc::OscCalcDumb calc
osc::IOscCalcAdjustable * DefaultOscCalc()
Create a new calculator with default assumptions for all parameters.
Definition: Calcs.cxx:49
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Simple oscillation probability calculator that has no solar term or mass hierarchy or delta so it&#39;s s...
Definition: OscCalcDumb.h:16
virtual _IOscCalc * Copy() const =0
double dmsq32
const ConstrainedFitVarWithPrior fitSsqTh23_UniformPriorSsqTh23 & kFitSinSqTheta23
const FitVarWithPrior fitDeltaInPiUnits_UniformPriordCP & kFitDeltaInPiUnits
virtual IOscCalc * Copy() const override
Definition: OscCalcDumb.h:19
TH1* HistNumuOpt ( TH1 *  orig)

Definition at line 134 of file draw_plots_util.h.

References runNovaSAM::ret, and ana::UniqueName().

134  {
135  auto ret = (TH1*) orig->Clone(UniqueName().c_str());
136  ret->Scale(0.1,"width");
137  ret->GetYaxis()->SetTitle("Events / 0.1 GeV");
138  ret->SetBit(kCanDelete);
139  ret->SetDirectory(gROOT);
140  return ret;
141 }
std::string UniqueName()
Return a different string each time, for creating histograms.
Definition: Utilities.cxx:29
void HTag ( TString  hie)

Definition at line 159 of file draw_plots_util.h.

References kOrange, and PrettyTag().

159 { PrettyTag (hie, (hie=="NH")?kAzure+3:kOrange+2, .18, .825);}
enum BeamMode kOrange
void PrettyTag(TString pid, int color, double xndc, double yndc)
void NuePID3bin ( TH1 *  h,
TString  pidtag,
bool  binlabels = true 
)

Definition at line 304 of file draw_plots_util.h.

References ana::Nue2018ThreeBinDivisions(), and ana::Nue2018ThreeBinLabels().

305 {
307  if (binlabels) Nue2018ThreeBinLabels();
308  //if (h) PID2DAxis(h);
309 }
void Nue2018ThreeBinDivisions(bool coreOnly, const int color, const int style)
void Nue2018ThreeBinLabels(const double yNDC, const double textsize, const int color, const bool nd)
void PIDTag ( TString  pid)

Definition at line 158 of file draw_plots_util.h.

References PrettyTag().

158 { PrettyTag (pid, kAzure+3, .83, .92); }
void PrettyTag(TString pid, int color, double xndc, double yndc)
void PlotDataMC ( std::vector< TH1 * >  vnom,
std::vector< bool >  isdata,
TLegend *  leg,
TString  pidtag = "",
TString  htag = "",
TString  out_name = "plot_FD",
bool  ratioplot = false,
bool  ratioerrors = false,
AxisType  pidaxis = kNue1bin 
)

Definition at line 466 of file draw_plots_util.h.

References bin, demo5::c2, FixLegend(), genie::utils::style::Format(), ana::GraphWithPoissonErrors(), HTag(), kNue3bin, ana::Nue2018ThreeBinDivisions(), ana::Nue2018ThreeBinLabels(), submit_concat_project::out_name, PrettyRatio(), PrettyTag(), PrintCanvasAll(), ana::PrintLatexFigure(), RatioPlot(), and registry_explorer::v.

470 {
471  gStyle->SetPadLeftMargin(0.15);
472  gStyle->SetPadTopMargin(0.08);
473 
474  // Fill empty bins with 0 if in range and <0 if out of range
475  for ( int bin = 1; bin<=vnom[0]->GetNbinsX(); ++bin){
476  bool filledbin=false;
477  for ( unsigned int v = 0; v<vnom.size(); ++v){
478  if ( !isdata[v] )
479  if (vnom[v]->GetBinContent(bin) > 0 ) filledbin=true;
480  }
481  for ( uint v = 0; v<vnom.size(); ++v){
482  if (vnom[v]->GetBinContent(bin) == 0 ){
483  if ( !filledbin ) vnom[v]->SetBinContent(bin,-0.01);
484  else vnom[v]->SetBinContent(bin,0.001);
485  }
486  vnom[v]->GetYaxis()->SetTitleOffset(1.05);
487  }
488  }
489 
490  // Draw marker w/error or line when appropriate
491  int datahist=-1;
492  for ( unsigned int v = 0; v<vnom.size(); ++v)
493  if (vnom[v]->GetLineColor() == kBlack ) datahist=v;
494 
495  // Option to make a ratio plot given
496  if(!ratioplot){
497  auto c2 = new TCanvas ("c2","c2",715,500);
498  for ( unsigned int v = 0; v<vnom.size(); ++v){
499  TGraphAsymmErrors* gr = GraphWithPoissonErrors(vnom[v], 0, 1);
500  if ( isdata[v] ){
501  if (v == datahist ) gr->Draw("ep same");
502  else vnom[v]->Draw("p same");
503  }
504  else vnom[v]->Draw("hist same");
505  }
506  gPad->RedrawAxis();
507 
508  // Adjust for ExPID axis
509  if(pidaxis==kNue3bin)
510  {
511  FixLegend(leg);
514  }
515 
516  // pot label
517  PrettyTag(TString::Format("%g#times10^{20} POT equiv.", 8.85).Data(),
518  kBlack, .175, .74);
519  HTag(htag);
520  leg->Draw("same");
521 
522  gPad->SetFillStyle(0);
523  c2->SetFillStyle(0);
524  PrintCanvasAll (c2,out_name+"_datamc","plots/",{"pdf","eps","png","C","root"});
525  PrintLatexFigure(out_name+"_datamc");
526  //removed: prelim tag
527  }
528  else{
529  std::vector<TH1*> vratio;
530  for(unsigned int ii=1;ii<vnom.size();ii++){
531  auto htemp = PrettyRatio (vnom[datahist], vnom[ii], vnom[ii]->GetLineColor(), 1.,
532  "Data / MC");
533  htemp->GetYaxis()->SetRangeUser(0.5,1.5);
534  vratio.push_back(htemp);
535  }
536  std::vector<TString> topOption = {" ","hist"};
537  std::vector<TString> bottomOption (vratio.size(),ratioerrors ?"p":"hist p");
538  auto cratio2= RatioPlot(vnom, topOption,vratio,bottomOption,pidtag,pidaxis);
539  cratio2->cd();
540  leg->Draw("same");
541  HTag(pidtag);
542  PrintCanvasAll(cratio2,out_name+"_datamc_ratio");
543  PrintLatexFigure("/png_"+out_name+"_datamc_ratio");
544  }
545 }
TGraphAsymmErrors * GraphWithPoissonErrors(const TH1 *h, bool noErrorsXaxis, bool drawEmptyBins)
Calculate statistical errors appropriate for small Poisson numbers.
Definition: Plots.cxx:912
void PrettyTag(TString pid, int color, double xndc, double yndc)
c2
Definition: demo5.py:33
void Nue2018ThreeBinDivisions(bool coreOnly, const int color, const int style)
void HTag(TString hie)
float bin[41]
Definition: plottest35.C:14
void PrintLatexFigure(TString name, TString plotdir="plots/")
TH1 * PrettyRatio(TH1 *shi, TH1 *nom, int color, double alpha=1., TString titley="Shift / Nom")
void Nue2018ThreeBinLabels(const double yNDC, const double textsize, const int color, const bool nd)
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
TCanvas * RatioPlot(std::vector< TH1 * > topHistos, std::vector< TString > topOption, std::vector< TH1 * > bottomHistos, std::vector< TString > bottomOption, TString pidtag, AxisType pidaxis=kNue1bin)
void FixLegend(TLegend *leg, TString opt="default")
void PrintCanvasAll(TCanvas *c, const TString outname, const TString outdir="plots/", const std::vector< TString > exts={"pdf","png","root"})
unsigned int uint
void PlotMCComponentsComparison ( std::vector< TH1 * >  vnom,
std::vector< TH1 * >  vshi,
TLegend *  leg,
TString  pidtag = "",
TString  out_name = "plot_nd",
bool  ratioplot = false,
bool  ratioerrors = false,
AxisType  pidaxis = kNue1bin 
)

Definition at line 594 of file draw_plots_util.h.

References demo5::c2, FixLegend(), kNue3bin, NuePID3bin(), submit_concat_project::out_name, PIDTag(), PrettyRatio(), PrintCanvasAll(), ana::PrintLatexFigure(), RatioPlot(), ana::UniqueName(), and registry_explorer::v.

599 {
600  if(pidaxis==kNue3bin) FixLegend(leg);
601 
602  if(!ratioplot)
603  {
604  auto c2 = new TCanvas (UniqueName().c_str(), "c2");
605  for(auto const & v:vnom) v->Draw("hist same");
606  for(auto const & v:vshi) v->Draw("hist same");
607  if(pidaxis==kNue3bin) NuePID3bin (vnom[0],pidtag,true);
608  PIDTag(pidtag);
609  leg->Draw("same");
610  PrintCanvasAll(c2, out_name+"_mccomp");
611  PrintLatexFigure("/png_"+out_name+"_mccomp");
612  c2->Close();
613  }
614  else
615  {
616  std::vector<TH1*> vratio;
617  for(unsigned int ii=0;ii<vshi.size();ii++){
618  auto htemp = PrettyRatio(vshi[ii], vnom[ii],
619  vnom[ii]->GetLineColor(), ii>0 ? 0.4:1.);
620  htemp->GetYaxis()->SetRangeUser(0.5, 1.5);
621  vratio.push_back (htemp);
622  }
623  vnom.insert(vnom.end(),vshi.begin(),vshi.end());
624  std::vector<TString> topOption(vnom.size(), "hist");
625  std::vector<TString> bottomOption(vratio.size(),
626  ratioerrors ? "p":"hist p");
627  auto cratio2= RatioPlot(vnom, topOption, vratio,
628  bottomOption, pidtag, pidaxis);
629  cratio2->cd();
630  leg->Draw("same");
631  PIDTag(pidtag);
632  PrintCanvasAll(cratio2, out_name+"_mccomp_ratio");
633  PrintLatexFigure("/png_"+out_name+"_mccomp_ratio");
634  }
635  //if(pidaxis==kNue3bin) {
636  // vnom.insert(vnom.end(),vshi.begin(),vshi.end());
637  // std::vector<TString> topOption (vnom.size(),"hist");
638  // auto cpads =ExPIDPlot(vnom,topOption);
639  // cpads->cd();
640  // FixLegend(leg,"default");
641  // leg->Draw("same");
642  // PIDTag(pidtag);
643  // PrintCanvasAll(cpads, out_name+"_mccomp_pads");
644  // PrintLatexFigure("/png_"+out_name+"_mccomp_pads");
645  //}
646 }
c2
Definition: demo5.py:33
void PIDTag(TString pid)
void NuePID3bin(TH1 *h, TString pidtag, bool binlabels=true)
void PrintLatexFigure(TString name, TString plotdir="plots/")
TH1 * PrettyRatio(TH1 *shi, TH1 *nom, int color, double alpha=1., TString titley="Shift / Nom")
std::string UniqueName()
Return a different string each time, for creating histograms.
Definition: Utilities.cxx:29
TCanvas * RatioPlot(std::vector< TH1 * > topHistos, std::vector< TString > topOption, std::vector< TH1 * > bottomHistos, std::vector< TString > bottomOption, TString pidtag, AxisType pidaxis=kNue1bin)
void FixLegend(TLegend *leg, TString opt="default")
void PrintCanvasAll(TCanvas *c, const TString outname, const TString outdir="plots/", const std::vector< TString > exts={"pdf","png","root"})
void PlotMCComponentsErrorBand ( std::vector< TH1 * >  vnom,
std::vector< TH1 * >  vshi,
TLegend *  leg,
TString  pidtag = "",
TString  out_name = "plot_nd",
bool  ratioplot = false,
bool  ratioerrors = false,
AxisType  pidaxis = kNue1bin 
)

Definition at line 650 of file draw_plots_util.h.

References ana::DataMCComponents::beam, ana::DataMCComponents::bkg, demo5::c2, ana::CenterTitles(), plot_validation_datamc::Clone(), ana::DataMCComponents::data, ana::DefaultFormatNue(), FixLegend(), FormatErrorBand(), make_mec_shifts_plots::GetMaximum(), ana::kBeamNueBackgroundColor, ana::kNCBackgroundColor, kNue3bin, ana::kNueSignalColor, ana::kNueSignalWSColor, ana::kNumuBackgroundColor, ana::kTotalMCColor, ana::DataMCComponents::nc, NuePID3bin(), ana::DataMCComponents::nuetonumu, ana::DataMCComponents::nuetonutau, ana::DataMCComponents::numu, ana::DataMCComponents::numutonumu, ana::DataMCComponents::numutonutau, submit_concat_project::out_name, PIDTag(), PrettyRatio(), PrintCanvasAll(), ana::PrintLatexFigure(), RatioPlot(), ana::DataMCComponents::sig, ana::DataMCComponents::tau, registry_explorer::v, and ana::DataMCComponents::wrongSign.

654 {
655  auto hplu_plot = (TH1*) vshi[0]->Clone();
656  auto hmin_plot = (TH1*) vshi[1]->Clone();
657  FormatErrorBand(hplu_plot,hmin_plot,out_name.Contains("_sig"),true);
658  std::vector<TH1*>vshi_plot={hplu_plot,hmin_plot};
659 
660  if(pidaxis==kNue3bin)
661  FixLegend(leg);
662 
663  if(!ratioplot){
664  auto c2 = new TCanvas ("c2","c2");
665  vnom[0]->SetMaximum(1.2*vnom[0]->GetMaximum());
666  vnom[0]->Draw("hist");
667  for(auto v:vshi_plot) v->Draw("hist same");
668  for(auto v:vnom) v->Draw("hist same");
669  if(pidaxis==kNue3bin) NuePID3bin (vnom[0],pidtag,true);
670  PIDTag(pidtag);
671  leg->Draw("same");
672  PrintCanvasAll(c2, out_name+"_mccomp");
673  PrintLatexFigure("/png_"+out_name+"_mccomp");
674  c2->Close();
675  }
676  else{
677  std::vector<TH1*> vratio;
678  for(unsigned int ii=0;ii<vshi.size();ii++){
679  auto htemp = PrettyRatio(vshi[ii],vnom[0],vshi[ii]->GetMarkerColor());
680  vratio.push_back(htemp);
681  }
682  vratio[0]->GetYaxis()->SetRangeUser(0.5,1.5);
683  vnom.insert(vnom.begin()+1,vshi_plot.begin(),vshi_plot.end());
684  std::vector<TString> topOption (vnom.size(),"hist");
685  std::vector<TString> bottomOption (vratio.size(),ratioerrors ?"p":"hist p");
686  auto cratio2= RatioPlot(vnom, topOption,vratio,bottomOption,pidtag,pidaxis);
687  cratio2->cd();
688  leg->Draw("same");
689  PIDTag(pidtag);
690  PrintCanvasAll(cratio2, out_name+"_mccomp_ratio");
691  PrintLatexFigure("/png_"+out_name+"_mccomp_ratio");
692  }
693 }
c2
Definition: demo5.py:33
void PIDTag(TString pid)
void FormatErrorBand(TH1 *hplus, TH1 *hminus, bool signal=false, bool fixbins=false)
void NuePID3bin(TH1 *h, TString pidtag, bool binlabels=true)
void PrintLatexFigure(TString name, TString plotdir="plots/")
TH1 * PrettyRatio(TH1 *shi, TH1 *nom, int color, double alpha=1., TString titley="Shift / Nom")
TCanvas * RatioPlot(std::vector< TH1 * > topHistos, std::vector< TString > topOption, std::vector< TH1 * > bottomHistos, std::vector< TString > bottomOption, TString pidtag, AxisType pidaxis=kNue1bin)
void FixLegend(TLegend *leg, TString opt="default")
void PrintCanvasAll(TCanvas *c, const TString outname, const TString outdir="plots/", const std::vector< TString > exts={"pdf","png","root"})
void PlotNDDataTotalMCComparison ( TH1 *  hdata,
std::vector< TH1 * >  htots,
TLegend *  leg,
TString  pidtag = "",
TString  out_name = "plot_nd",
bool  ratioplot = false,
AxisType  pidaxis = kNue1bin 
)

Definition at line 549 of file draw_plots_util.h.

References demo5::c1, FixLegend(), make_mec_shifts_plots::GetMaximum(), make_syst_table_plots::h, kNue3bin, NuePID3bin(), submit_concat_project::out_name, PIDTag(), PrettyRatio(), PrintCanvasAll(), ana::PrintLatexFigure(), PandAna.reco_validation.prod5_pid_validation::ratio(), and RatioPlot().

553 {
554  if(pidaxis==kNue3bin)
555  FixLegend(leg);
556  std::vector<TString> h_opt;
557  for(auto const & h:htots) h_opt.push_back("hist");
558  h_opt.push_back("p");
559 
560  if(!ratioplot)
561  {
562  auto c1 = new TCanvas ("c1","c1");
563  htots[0]->SetMaximum(1.3*htots[0]->GetMaximum());
564  for(auto const & h:htots) h->Draw("hist same");
565  htots[0]->Draw("hist same"); //need to redraw for error bands
566  hdata->Draw("p same");
567  PIDTag(pidtag);
568  if(pidaxis==kNue3bin) NuePID3bin (htots[0],pidtag,true);
569  leg->Draw("same");
570  PrintCanvasAll(c1, out_name+"_datamc");
571  PrintLatexFigure("/png_"+out_name+"_datamc");
572  }
573  else
574  {
575  std::vector<TH1*> ratios;
576  std::vector<TString> r_opt;
577  for(auto const & h:htots){
578  auto ratio = PrettyRatio(hdata,h, h->GetLineColor(), 1., "Data / MC");
579  ratio->GetYaxis()->SetRangeUser(0.5,1.5);
580  ratios.push_back(ratio);
581  r_opt.push_back("e1");
582  }
583  htots.push_back(hdata);
584  auto cratio1 = RatioPlot(htots,h_opt,ratios,r_opt,pidtag,pidaxis);
585  cratio1->cd();
586  leg->Draw("same");
587  PIDTag(pidtag);
588 
589  PrintCanvasAll(cratio1,out_name+"_datamc_ratio");
590  PrintLatexFigure("/png_"+out_name+"_datamc_ratio");
591  }
592 }
def ratio(spec1, spec2, nbins, pot, binrange=(0, 1))
void PIDTag(TString pid)
void NuePID3bin(TH1 *h, TString pidtag, bool binlabels=true)
void PrintLatexFigure(TString name, TString plotdir="plots/")
TH1 * PrettyRatio(TH1 *shi, TH1 *nom, int color, double alpha=1., TString titley="Shift / Nom")
c1
Definition: demo5.py:24
TCanvas * RatioPlot(std::vector< TH1 * > topHistos, std::vector< TString > topOption, std::vector< TH1 * > bottomHistos, std::vector< TString > bottomOption, TString pidtag, AxisType pidaxis=kNue1bin)
void FixLegend(TLegend *leg, TString opt="default")
void PrintCanvasAll(TCanvas *c, const TString outname, const TString outdir="plots/", const std::vector< TString > exts={"pdf","png","root"})
TH1* PrettyRatio ( TH1 *  shi,
TH1 *  nom,
int  color,
double  alpha = 1.,
TString  titley = "Shift / Nom" 
)

Definition at line 80 of file draw_plots_util.h.

References ana::UniqueName().

80  {
81  auto htemp = (TH1*) nom->Clone(ana::UniqueName().c_str());
82  htemp->Divide(shi,nom);
83  htemp->SetMarkerColorAlpha(color,alpha);
84  htemp->SetLineColorAlpha(color,alpha);
85  htemp->SetMarkerStyle(34);
86  htemp->SetMarkerSize(1.4);
87  htemp->GetYaxis()->SetTitle(titley);
88  return htemp;
89 }
std::string UniqueName()
Return a different string each time, for creating histograms.
Definition: Utilities.cxx:29
void PrettyTag ( TString  pid,
int  color,
double  xndc,
double  yndc 
)

Definition at line 147 of file draw_plots_util.h.

References getGoodRuns4SAM::tag.

147  {
148  TLatex* tag = new TLatex(xndc, yndc, pid);
149  tag->SetTextColor(color);
150  tag->SetNDC();
151  tag->SetTextSize(0.04);
152  tag->SetTextFont(42);
153  tag->SetTextAlign(22);
154  tag->Draw();
155  tag->SetBit(kCanDelete);
156 }
void PrintCanvasAll ( TCanvas *  c,
const TString  outname,
const TString  outdir = "plots/",
const std::vector< TString >  exts = {"pdf","png","root"} 
)

Definition at line 260 of file draw_plots_util.h.

References plot_validation_datamc::c, galleryMaker::ext, and outdir.

261  {"pdf","png","root"} )
262 {
263  for(auto const & ext:exts){
264  gSystem -> MakeDirectory( outdir );
265  gSystem -> MakeDirectory( outdir+"rootfiles/" );
266  if(ext=="png") c->SaveAs(outdir+"png_"+outname + "." + ext);
267  else if(ext=="root") c->SaveAs(outdir+"rootfiles/"+outname + "." + ext);
268  else c->SaveAs(outdir+outname + "." + ext);
269  }
270  delete c;
271 }
const std::string outdir
TCanvas* RatioPlot ( std::vector< TH1 * >  topHistos,
std::vector< TString >  topOption,
std::vector< TH1 * >  bottomHistos,
std::vector< TString >  bottomOption,
TString  pidtag,
AxisType  pidaxis = kNue1bin 
)

Definition at line 375 of file draw_plots_util.h.

References plot_validation_datamc::c, plot_validation_datamc::Clone(), FindLimitY(), make_syst_table_plots::h, h1, h3, kNue3bin, cet::sqlite::max(), NuePID3bin(), plot_validation_datamc::p1, and plot_validation_datamc::p2.

381 {
382  gStyle->SetTitleStyle(0);
383  TCanvas *c = new TCanvas("c", "canvas", 600, 700);
384  if(pidaxis == kNue3bin) c->SetCanvasSize(750,650);
385  //define top and bottom pads
386  TPad* p1 = new TPad("", "", 0, 0, 1, 1);
387  TPad* p2 = new TPad("", "", 0, 0, 1, 1);
388  p1->SetBottomMargin(.3);
389  p2->SetTopMargin(.7);
390 
391  for(auto p:{p1,p2}){
392  p->SetFillStyle(0);
393  p->Draw();
394  }
395 
396  // format histograms
397  auto h1 = (TH1*) topHistos[0]->Clone();
398  auto h3 = (TH1*) bottomHistos[0]->Clone();
399 
400  for(auto & h:{h1,h3}){
401  h->SetStats(0);
402 
403  h->GetYaxis()->SetTitleSize(26);
404  h->GetYaxis()->SetTitleFont(43);
405  h->GetYaxis()->SetTitleOffset(1.3);
406  h->GetYaxis()->SetLabelFont(43);
407 
408  h->GetXaxis()->SetTitleOffset(1.2);
409  h->GetXaxis()->SetTitleSize(28);
410  h->GetXaxis()->SetTitleFont(43);
411  h->GetXaxis()->SetLabelFont(43);
412  }
413 
414  h1->GetYaxis()->SetRangeUser(FindLimitY(topHistos,0), 1.2*FindLimitY(topHistos,1));
415  h1->GetYaxis()->SetLabelSize(18);
416 
417  h1->GetXaxis()->SetLabelSize(0);
418  h1->GetXaxis()->SetTitleSize(0);
419 
420  h3->SetTitle("");
421  h3->GetYaxis()->SetRangeUser(max(0.,2-FindLimitY(bottomHistos,1)),
422  1.01*FindLimitY(bottomHistos,1));
423  h3->GetYaxis()->SetLabelSize(15);
424  h3->GetYaxis()->SetDecimals();
425 
426  h3->GetXaxis()->SetTitle(h1->GetXaxis()->GetTitle());
427  h3->GetXaxis()->SetLabelSize(18);
428  h3->GetXaxis()->SetLabelOffset(0.005);
429 
430  p1->cd();
431 
432  h1->Draw(topOption[0]);
433 
434  for(unsigned int ii = 1; ii < topHistos.size(); ++ii) {
435  topHistos[ii]->Draw("same "+topOption[ii]);}
436  h1->Draw("same "+topOption[0]);
437 
438  p1->RedrawAxis(); //white histograms cover axes
439 
440  if(pidaxis==kNue3bin) NuePID3bin(0,pidtag);
441 
442  p2->cd();
443  h3->Draw(bottomOption[0]);
444  for(unsigned int ii = 1; ii < bottomHistos.size(); ++ii){
445  bottomHistos[ii]->Draw("same " + bottomOption[ii]);}
446  h3->Draw("same " + bottomOption[0]);
447 
448  auto lone = new TLine();
449  lone->SetLineStyle(3);
450  lone->SetLineColor(kGray+3);
451  p2->Update();
452  lone->DrawLine(p2->GetUxmin(),1.0,p2->GetUxmax(),1.0);
453  lone->DrawLine(p2->GetUxmin(),1.2,p2->GetUxmax(),1.2);
454  lone->DrawLine(p2->GetUxmin(),0.8,p2->GetUxmax(),0.8);
455  float p2Y = p2->GetUymax()-p2->GetUymin();
456  h3->GetYaxis()->SetRangeUser(p2->GetUymin()-(0.01*p2Y),p2->GetUymax()+(0.01*p2Y));
457  p2->RedrawAxis();
458  if(pidaxis==kNue3bin) NuePID3bin(h3,pidtag, false);
459 
460  return c;
461 }
TH1F * h3
Definition: berger.C:36
const char * p
Definition: xmltok.h:285
double FindLimitY(std::vector< TH1 * > histos, bool doMax=true)
void NuePID3bin(TH1 *h, TString pidtag, bool binlabels=true)
TH1F * h1
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
TH1* RebinToShortAxis ( TH1 *  h)

Definition at line 278 of file draw_plots_util.h.

References it, runNovaSAM::ret, and ana::UniqueName().

279 {
280  TH1* ret = new TH1D(UniqueName().c_str(), h->GetTitle(),
281  18, 0, 18);
282  ret->GetXaxis()->SetTitle(h->GetXaxis()->GetTitle());
283  ret->GetYaxis()->SetTitle(h->GetYaxis()->GetTitle());
284 
285  std::vector<std::pair<int, int>> binMap = {{3, 2},
286  {4, 3},
287  {5, 4},
288  {6, 5}, // end of 1st spectrum
289  {13, 8},
290  {14, 9},
291  {15, 10},
292  {16, 11}, // end of 2nd
293  {23, 14},
294  {24, 15},
295  {25, 16},
296  {26, 17}};
297 
298  for(auto it: binMap) ret->SetBinContent(it.second, h->GetBinContent(it.first));
299 
300  return ret;
301 }
set< int >::iterator it
std::string UniqueName()
Return a different string each time, for creating histograms.
Definition: Utilities.cxx:29

Variable Documentation

bool isFHC =true
static

Definition at line 45 of file draw_plots_util.h.

Referenced by ana::GetNDComponents().

const double kLegendDefaultX1 = 0.63

Definition at line 165 of file draw_plots_util.h.

const double kLegendDefaultX2 = 0.85

Definition at line 166 of file draw_plots_util.h.

const double kLegendDefaultY1 = 0.68

Definition at line 167 of file draw_plots_util.h.

const double kLegendDefaultY2 = 0.88

Definition at line 168 of file draw_plots_util.h.

bool mergePeripheral =false

Definition at line 53 of file draw_plots_util.h.

const bool printratioplots =true

Definition at line 48 of file draw_plots_util.h.

bool usedumb = false

Definition at line 52 of file draw_plots_util.h.