Functions
DrawCovMx.C File Reference
#include "TH2.h"
#include "TLine.h"
#include "TLatex.h"
#include "CAFAna/Core/LoadFromFile.h"
#include "CAFAna/Prediction/PredictionConcat.h"
#include "CAFAna/Prediction/CovarianceMatrix.h"
#include "NuXAna/Systs/Nus18Systs.h"
#include "CAFAna/Analysis/Exposures.h"
#include "NuXAna/macros/Nus18/Nus18Utilities.h"

Go to the source code of this file.

Functions

void DrawCovMx (bool rhc=false)
 

Function Documentation

void DrawCovMx ( bool  rhc = false)

Definition at line 34 of file DrawCovMx.C.

References spectra_to_pyobj::bin_edges(), plot_validation_datamc::c, calc, ana::DefaultSterileCalc(), FormatCanvas(), FormatFullCovMxPlot(), GetComponents(), MECModelEnuComparisons::i, ana::kAna2018FHCLivetime, ana::kAna2018FHCPOT, ana::kAna2018RHCLivetime, ana::kAna2018RHCPOT, ana::kAna2018SensitivityFHCNDPOT, ana::kAna2018SensitivityRHCNDPOT, MiscText(), nbins, Preliminary(), SetAngles(), and string.

Referenced by MakePlots().

35 {
36  DontAddDirectory guard;
37  FormatCanvas();
38 
39  std::string polarity = rhc? "RHC" : "FHC";
40 
41  // Set the total POT and livetime
43  double fd_pot = rhc? kAna2018RHCPOT : kAna2018FHCPOT;
44  double fd_livetime = rhc? kAna2018RHCLivetime : kAna2018FHCLivetime;
45 
46  // Get simulation
47  PredictionConcat* sim = GetDefaultSimulation();
48 
49  // Define oscillation calculator
51  SetAngles(calc);
52 
53  // Get matrix
54  CovarianceMatrix* mx = GetFullCovMx(sim, calc, fd_pot);
55 
56  // Draw some plots
57  TCanvas* c = new TCanvas();
58 
59  // First up, a bunch of covariance matrices
60  auto components = GetComponents();
61 
62  TFile* plotfile = new TFile(Form("plots/covmx/%sPlots.root",polarity.c_str()),"recreate");
63 
64  //
65  // Full covariance matrix
66  //
67 
68  TH2D* h_full = mx->GetFullCovMxTH2();
69  FormatFullCovMxPlot(h_full, sim);
70 
71  c->Write(Form("CovMx%sFull",polarity.c_str()));
72  c->SaveAs(Form("plots/covmx/CovMx%sFull.png",polarity.c_str()));
73  c->SaveAs(Form("plots/covmx/CovMx%sFull.pdf",polarity.c_str()));
74  c->Clear();
75 
76  //
77  // Absolute covariance matrix
78  //
79 
80  std::vector<double> bin_edges = sim->GetBinEdges();
81 
82  TH2D* h_osc_abs = mx->GetCovMxAbsoluteTH2();
83  h_osc_abs->Draw("colz");
84  c->Write(Form("CovMx%sOscAbs",polarity.c_str()));
85  c->SaveAs(Form("plots/covmx/CovMx%sOscAbs.png",polarity.c_str()));
86  c->SaveAs(Form("plots/covmx/CovMx%sOscAbs.pdf",polarity.c_str()));
87  c->Clear();
88 
89  //
90  // Relative covariance matrix
91  //
92 
93  auto nominal = sim->Predict(calc).ToTH1(fd_pot);
94  int nbins = nominal->GetNbinsX();
95  TVectorD v_pred(nbins);
96  for (int i = 0; i < nbins; ++i)
97  v_pred(i) = nominal->GetBinContent(i+1);
98  TH2D* h_osc_rel = mx->GetCovMxRelativeTH2(v_pred);
99  h_osc_rel->Draw("colz");
100  h_osc_rel->GetYaxis()->SetTitle("");
101  h_osc_rel->GetXaxis()->SetTitle("Deposited energy bins");
102  h_osc_rel->GetXaxis()->CenterTitle();
103 
104  Preliminary();
105 
106  double max_e = 20;
107 
108  TLine lx(0, max_e, 2 * max_e, max_e);
109  lx.Draw();
110  TLine ly(max_e, 0, max_e, 2 * max_e);
111  ly.Draw();
112  MiscText(0.32,0.88,0.06,"ND");
113  MiscText(0.68,0.88,0.06,"FD");
114  MiscText(0.04,0.3,0.06,"ND");
115  MiscText(0.04,0.7,0.06,"FD");
116  c->Write(Form("CovMx%sRelative",polarity.c_str()));
117  c->SaveAs(Form("plots/covmx/CovMx%sOscRel.png",polarity.c_str()));
118  c->SaveAs(Form("plots/covmx/CovMx%sOscRel.pdf",polarity.c_str()));
119  c->Clear();
120 
121  plotfile->Close();
122 
123  delete sim;
124 }
std::vector< std::tuple< ana::Flavors::Flavors_t, ana::Current::Current_t, ana::Sign::Sign_t > > GetComponents()
void FormatFullCovMxPlot(TH2D *h, PredictionConcat *sim)
Adapt the PMNS_Sterile calculator to standard interface.
TLatex * MiscText(float x, float y, float size, TString text)
const double kAna2018SensitivityFHCNDPOT
Definition: Exposures.h:210
osc::OscCalcDumb calc
void FormatCanvas()
Canvas formatting utility.
void SetAngles(osc::OscCalcSterile *calc)
const double kAna2018RHCPOT
Definition: Exposures.h:208
const int nbins
Definition: cellShifts.C:15
osc::OscCalcSterile * DefaultSterileCalc(int nflavors)
Create a sterile calculator with default assumptions for all parameters.
Definition: Calcs.cxx:97
Example routine for calculating the "ultimate e-m mother" of a particle in a simulated event...
Definition: FillTruth.h:16
void Preliminary()
const double kAna2018SensitivityRHCNDPOT
Definition: Exposures.h:211
const double kAna2018FHCPOT
Definition: Exposures.h:207
Prevent histograms being added to the current directory.
Definition: UtilsExt.h:46
const double kAna2018FHCLivetime
Definition: Exposures.h:213
const double kAna2018RHCLivetime
Definition: Exposures.h:214
enum BeamMode string