8 throw std::runtime_error(
"You must run in compiled mode.");
47 PredictionConcat*
sim = GetDefaultSimulation(rhc);
50 std::map<const ISyst*, CovarianceMatrix*>
m;
52 CovarianceMatrix* gen =
LoadCovMx(
"covmx_fhc_xsec",
"CovMx_Both_" + syst->ShortName());
53 m.insert(std::pair<const ISyst*, CovarianceMatrix*>(syst, gen));
56 CovarianceMatrix* gen =
LoadCovMx(
"covmx_fhc_nonxsec",
"CovMx_Both_" + syst->ShortName());
57 m.insert(std::pair<const ISyst*, CovarianceMatrix*>(syst, gen));
59 CovarianceMatrix* gen =
LoadCovMx(
"covmx_fhc_ppfx",
"CovMx_Both_PPFX");
60 m.insert(std::pair<const ISyst*, CovarianceMatrix*>(
nullptr, gen));
61 CovarianceMatrix* matrix_combined =
new CovarianceMatrix(sim, calc_trivial, {}, fd_pot, 10);
66 TCanvas*
c =
new TCanvas();
68 TFile* plotfile =
new TFile(filename.c_str(),
"recreate");
73 TH2D* h_full =
matrix.second->GetFullCovMxTH2();
74 int nbins = h_full->GetNbinsX();
75 double last_edge = sim->GetBinEdges().back();
76 double max = 13. * last_edge;
79 for (
int i = 1;
i < 13; ++
i) {
80 double pos =
i * last_edge;
81 TLine* lx =
new TLine(0, pos, max, pos);
83 TLine* ly =
new TLine(pos, 0, pos, max);
87 for (
int i = 0;
i < 13; ++
i) {
88 double pos = 0.16 + (0.72*(
i/13.));
95 h_full->SetNdivisions(0,
"X");
96 h_full->SetNdivisions(0,
"Y");
100 std::string plot_path =
"plots/covmx/" + plot_name +
".png";
101 c->Write(plot_name.c_str());
102 c->SaveAs(plot_path.c_str());
106 TH1D* nominal = sim->Predict(calc).ToTH1(fd_pot);
107 nbins = nominal->GetNbinsX();
110 v_pred(
i) = nominal->GetBinContent(
i+1);
111 TH2D* h_osc =
matrix.second->GetCovMxRelativeTH2(v_pred);
113 h_osc->GetYaxis()->SetTitle(
"");
114 h_osc->GetXaxis()->SetTitle(
"Deposited energy bins");
115 h_osc->GetXaxis()->CenterTitle();
121 TLine lx(0,max_e,2*max_e,max_e);
123 TLine ly(max_e,0,max_e,2*max_e);
129 plot_name =
"CovMx_" + polarity +
"_" + syst_name +
"_Oscillated";
130 plot_path =
"plots/covmx/" + plot_name +
".png";
131 c->Write(plot_name.c_str());
132 c->SaveAs(plot_path.c_str());
141 std::vector<const ISyst*>
systs;
142 std::vector<std::string> syst_types = {
"xsec",
"nonxsec" };
145 systs.insert(systs.end(), s.begin(), s.end());
149 for (
const ISyst* syst : systs) {
152 CovarianceMatrix* mx =
new CovarianceMatrix(sim, calc_trivial, {}, fd_pot, 10);
159 if (syst->ShortName() ==
syst_name)
continue;
162 mx->AddMatrix(
matrix.second);
166 mx->PredictCovMx(sim, calc);
169 auto nominal = sim->Predict(calc).ToTH1(fd_pot);
170 double nbins = nominal->GetNbinsX();
173 v_pred(
i) = nominal->GetBinContent(
i+1);
174 TH2D* h_osc_rel = mx->GetCovMxRelativeTH2(v_pred);
175 h_osc_rel->Draw(
"colz");
176 h_osc_rel->GetYaxis()->SetTitle(
"");
177 h_osc_rel->GetXaxis()->SetTitle(
"Deposited energy bins");
178 h_osc_rel->GetXaxis()->CenterTitle();
184 TLine lx(0, max_e, 2 * max_e, max_e);
186 TLine ly(max_e, 0, max_e, 2 * max_e);
192 c->SaveAs(Form(
"plots/covmx/CovMxWithout%sOscRel.png",syst->ShortName().c_str()));
193 c->SaveAs(Form(
"plots/covmx/CovMxWithout%sOscRel.pdf",syst->ShortName().c_str()));
200 for (
int i = 0;
i < 21; ++
i) {
210 TLatex *
l =
new TLatex(x, y, text);
212 l->SetTextSize(size);
213 l->SetTextColor(kBlack);
220 if (i==0)
return std::string(
"#nu_{e} #rightarrow #nu_{e}");
221 else if (i==1)
return std::string(
"#bar{#nu}_{e} #rightarrow #bar{#nu}_{e}");
222 else if (i==2)
return std::string(
"#nu_{e} #rightarrow #nu_{#mu}");
223 else if (i==3)
return std::string(
"#bar{#nu}_{e} #rightarrow #bar{#nu}_{#mu}");
224 else if (i==4)
return std::string(
"#nu_{e} #rightarrow #nu_{#tau}");
225 else if (i==5)
return std::string(
"#bar{#nu}_{e} #rightarrow #bar{#nu}_{#tau}");
226 else if (i==6)
return std::string(
"#nu_{#mu} #rightarrow #nu_{e}");
227 else if (i==7)
return std::string(
"#bar{#nu}_{#mu} #rightarrow #bar{#nu}_{e}");
228 else if (i==8)
return std::string(
"#nu_{#mu} #rightarrow #nu_{#mu}");
229 else if (i==9)
return std::string(
"#bar{#nu}_{#mu} #rightarrow #bar{#nu}_{#mu}");
230 else if (i==10)
return std::string(
"#nu_{#mu} #rightarrow #nu_{#tau}");
231 else if (i==11)
return std::string(
"#bar{#nu}_{#mu} #rightarrow #bar{#nu}_{#tau}");
void MatrixValidation(bool rhc=false)
Cuts and Vars for the 2020 FD DiF Study.
Simple record of shifts applied to systematic parameters.
Adapt the PMNS_Sterile calculator to standard interface.
Version of OscCalcSterile that always returns probability of 1.
const double kAna2018SensitivityFHCNDPOT
void FormatCanvas()
Canvas formatting utility.
void SetAngles(osc::OscCalcSterile *calc)
Encapsulate code to systematically shift a caf::SRProxy.
const double kAna2018RHCPOT
CovarianceMatrix * LoadCovMx(std::string file, std::string name)
Function to load covariance matrix.
osc::OscCalcSterile * DefaultSterileCalc(int nflavors)
Create a sterile calculator with default assumptions for all parameters.
std::string GetName(int i)
TLatex * MiscText(double x, double y, double size, TString text)
Example routine for calculating the "ultimate e-m mother" of a particle in a simulated event...
const double kAna2018SensitivityRHCNDPOT
const double kAna2018FHCPOT
Prevent histograms being added to the current directory.
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
void SetShift(const ISyst *syst, double shift, bool force=false)
std::vector< const ISyst * > GetNus18Systs(bool rhc, std::string det_type, std::string syst_type)
const double kAna2018FHCLivetime
const double kAna2018RHCLivetime
void CombineMatrices(CovarianceMatrix *gen, std::map< const ISyst *, CovarianceMatrix * > m, std::vector< IPrediction * > preds, std::vector< double > pot, osc::IOscCalcAdjustable *calc)
Function to combine covariance matrices.