plot_quantile_boundaries_2020.C
Go to the documentation of this file.
3 #include "Utilities/rootlogon.C"
4 
5 #include "TCanvas.h"
6 #include "TColor.h"
7 #include "TFile.h"
8 #include "TH2.h"
9 #include "TLegend.h"
10 #include "TStyle.h"
11 
12 #include <iostream>
13 
14 using namespace ana;
15 
16 void plot_quantile_boundaries_2020(bool isFHC, std::string CVNType="LoosePTP"){
17 
18  const int nBins= 19;
19  const int nQuant= 4;
20 
23 
24  int color_pal = kFuchsia;
25  Style_t line = kSolid;
26  Color_t color;
27 
28  if(isFHC){
29  horn = "fhc", name = "FHC";
30  color = kBlue-7;
31  } else {
32  horn = "rhc", name = "RHC";
33  color = kMagenta+1;
34  }
35 
36  std::string filename = (std::string)std::getenv("NUMUDATA_DIR")+"lib/ana2020/Quantiles/quantiles_"+horn+"_full_numu2020.root";
37  //std::string filename = "/nova/ana/users/karlwarb/Analysis2020/MakeQuantiles/quantiles_"+horn+"_full_numu2020.root";
38  std::cout << "Loading " << filename << std::endl;
39  TFile* infile = TFile::Open( filename.c_str() );
40  TH2* quanthist = (TH2*)infile->Get( "FDSpec2D" );
41  new TCanvas;
42  quanthist->Draw();
43  std::vector< std::vector<double> > QuantBounds = GetQuantileBins(quanthist, kNumuCCOptimisedAxis, kHadEFracAxis, nQuant, 1);
44 
45  std::vector< TH1* > hist_bound;
46  for(int thisQuant = 0; thisQuant < nQuant; thisQuant++){
47  TH1* h_temp = quanthist->ProjectionX();
48  h_temp -> Clear();
49  for(int bin = 1; bin <= nBins; bin++){
50  double bound = QuantBounds[bin][thisQuant];
51  h_temp -> SetBinContent(bin, bound);
52  }
53  hist_bound.push_back(h_temp);
54  }
55 
56  gStyle->SetPalette(color_pal);
57  gStyle->SetPadRightMargin(0.11);
58 
59  new TCanvas("canvas");
60  gPad->SetFillStyle(0);
61  quanthist -> Scale(0.1,"width");
62  quanthist -> Draw("colz");
63  quanthist -> SetTitle("");
64  quanthist -> GetYaxis() -> SetTitle("E_{had} / E_{#nu}");
65  quanthist -> GetXaxis() -> CenterTitle();
66  quanthist -> GetYaxis() -> CenterTitle();
67  for(int thisQuant = 1; thisQuant < nQuant; thisQuant++){
68  hist_bound[thisQuant] -> SetLineColor(color);
69  hist_bound[thisQuant] -> Draw("histsame][");
70  }
71  if (isFHC ) CornerLabel( "Neutrino beam" );
72  else CornerLabel( "Antineutrino beam" );
73  Simulation();
74  TLegend *legend = new TLegend(0.15,0.70,0.30,0.85);
75  legend->AddEntry(hist_bound[1], Form("%s", name.c_str()),"l");
76  legend->SetTextSize(0.05); //no border for legend
77  legend->SetBorderSize(0); //no border for legend
78  legend->SetFillStyle(0); //fill colour is transparent
79  //legend->Draw();
80  gPad ->Update();
81 
82  TString outname = "quantiles_"+horn+"_full_numu2020";
83  gPad-> Print(outname + ".pdf");
84  gPad-> Print(outname + ".png");
85 
86 }
void Simulation()
Definition: tools.h:16
const XML_Char * name
Definition: expat.h:151
tree Draw("slc.nhit")
int nBins
Definition: plotROC.py:16
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
correl_xv GetYaxis() -> SetDecimals()
void CornerLabel(std::string &s)
Definition: numu_tools.h:145
const HistAxis kHadEFracAxis("E_{had.} / E_{#nu}", Binning::Simple(200, 0, 1), kHadEFrac)
HistAxis that implements Hadronic Energy fraction binning used by L.Vinton to derive Hadronic Energy ...
Definition: HistAxes.h:30
void plot_quantile_boundaries_2020(bool isFHC, std::string CVNType="LoosePTP")
std::vector< std::vector< double > > GetQuantileBins(TH2 *quantileHist, const HistAxis &independentAxis, const HistAxis &quantileAxis, const unsigned int &numQuantiles, const bool verbose)
Returns a 2D vector First index is the independentAxis bin number Second index is the high bin edge f...
string filename
Definition: shutoffs.py:106
gargamelle SetTitle("Gargamelle #nu_{e} CC data")
string infile
correl_xv GetXaxis() -> SetDecimals()
std::string getenv(std::string const &name)
hmean SetLineColor(4)
float bin[41]
Definition: plottest35.C:14
const HistAxis kNumuCCOptimisedAxis("Reconstructed Neutrino Energy (GeV)", kNumuCCEOptimisedBinning, kCCE)
HistAxis that implements optimised numuCCE from L. Vinton. See docdb 16332. This was close to &#39;custC&#39;...
Definition: HistAxes.h:24
static bool isFHC
OStream cout
Definition: OStream.cxx:6
cout<< "--"<< endl;for(Int_t iP=1;iP<=hyz->GetNbinsX();iP++){for(Int_t iC=1;iC<=hyz->GetNbinsY();iC++){if(hyv->GetBinContent(iP, iC)>-999){goal_hyv-> SetBinContent(iP, iC,-(dy[iP-1][iC-1]))
void Print(std::string prefix, std::string name, std::string suffix="")
Definition: nue_pid_effs.C:68
const int nQuant
Definition: varsandcuts.h:4
enum BeamMode kBlue
simulatedPeak Scale(1/simulationNormalisationFactor)
enum BeamMode string