44 job = std::stoi(job_env);
63 if (syst_type ==
"ppfx") {
70 PredictionConcat* pc_nd =
new PredictionConcat({nd_pred},
72 pc_nd->SetSysts(
new SystConcat({}, {polarity+
"_ND"}));
76 PredictionConcat* pc_fd =
new PredictionConcat({fd_pred},
77 {fd_pot}, {fd_livetime});
78 pc_fd->SetSysts(
new SystConcat({}, {polarity+
"_FD"}));
82 PredictionConcat* pc_both =
new PredictionConcat({nd_pred, fd_pred},
83 {nd_pot, fd_pot}, {0, fd_livetime});
84 pc_both->SetSysts(
new SystConcat({}, {polarity+
"_ND", polarity+
"_FD"}));
88 std::vector<std::vector<TH1D*>> ppfx_nd;
89 std::vector<std::vector<TH1D*>> ppfx_fd;
90 std::vector<std::vector<TH1D*>> ppfx_both;
94 for (
int i = 0;
i < 100; ++
i) {
98 std::vector<TH1D*>
hists;
105 assert(nd_ppfx_pred && fd_ppfx_pred);
108 PredictionConcat* pc_ppfx_nd =
new PredictionConcat(
109 {nd_ppfx_pred}, {nd_pot}, {0});
112 TH1D* nom = pc_nd->PredictComponent(calc,
113 std::get<0>(comp), std::get<1>(comp), std::get<2>(comp)).ToTH1(nd_pot);
114 TH1D* shift = pc_ppfx_nd->PredictComponent(calc,
115 std::get<0>(comp), std::get<1>(comp), std::get<2>(comp)).ToTH1(nd_pot);
116 for (
int b = 1;
b <= nom->GetNbinsX(); ++
b) {
117 if (nom->GetBinContent(
b) > 0)
118 shift->SetBinContent(
b, shift->GetBinContent(
b) / nom->GetBinContent(
b));
120 shift->SetBinContent(
b, 1);
122 hists.push_back(shift);
125 ppfx_nd.push_back(hists);
130 PredictionConcat* pc_ppfx_fd =
new PredictionConcat(
131 {fd_ppfx_pred}, {fd_pot}, {fd_livetime});
134 TH1D* nom = pc_fd->PredictComponent(calc,
135 std::get<0>(comp), std::get<1>(comp), std::get<2>(comp)).ToTH1(fd_pot);
136 TH1D* shift = pc_ppfx_fd->PredictComponent(calc,
137 std::get<0>(comp), std::get<1>(comp), std::get<2>(comp)).ToTH1(fd_pot);
138 for (
int b = 1;
b <= nom->GetNbinsX(); ++
b) {
139 if (nom->GetBinContent(
b) > 0)
140 shift->SetBinContent(
b, shift->GetBinContent(
b) / nom->GetBinContent(
b));
142 shift->SetBinContent(
b, 1);
144 hists.push_back(shift);
147 ppfx_fd.push_back(hists);
152 PredictionConcat* pc_ppfx_both =
new PredictionConcat(
153 {nd_ppfx_pred, fd_ppfx_pred}, {nd_pot, fd_pot}, {0, fd_livetime});
156 TH1D* nom = pc_both->PredictComponent(calc,
157 std::get<0>(comp), std::get<1>(comp), std::get<2>(comp)).ToTH1(fd_pot);
158 TH1D* shift = pc_ppfx_both->PredictComponent(calc,
159 std::get<0>(comp), std::get<1>(comp), std::get<2>(comp)).ToTH1(fd_pot);
160 for (
int b = 1;
b <= nom->GetNbinsX(); ++
b) {
161 if (nom->GetBinContent(
b) > 0)
162 shift->SetBinContent(
b, shift->GetBinContent(
b) / nom->GetBinContent(
b));
164 shift->SetBinContent(
b, 1);
166 hists.push_back(shift);
169 ppfx_both.push_back(hists);
180 int n_universes = 1e5;
184 TFile*
f =
new TFile(filename.c_str(),
"recreate");
187 CovarianceMatrix gen_nd(pc_nd, calc_trivial, {}, nd_pot, n_universes, ppfx_nd);
188 gen_nd.PredictCovMx(pc_nd, calc);
189 gen_nd.SaveTo(f,
"CovMx_ND_PPFX");
192 CovarianceMatrix gen_fd(pc_fd, calc_trivial, {}, fd_pot, n_universes, ppfx_fd);
193 gen_fd.PredictCovMx(pc_fd, calc);
194 gen_fd.SaveTo(f,
"CovMx_FD_PPFX");
197 CovarianceMatrix gen_both(pc_both, calc_trivial, {}, fd_pot, n_universes, ppfx_both);
198 gen_both.PredictCovMx(pc_both, calc);
199 gen_both.SaveTo(f,
"CovMx_Both_PPFX");
213 PredictionConcat* pc_nd =
new PredictionConcat({nd_pred},
215 pc_nd->SetSysts(
new SystConcat(systs, {polarity +
"_ND"}));
219 PredictionConcat* pc_fd =
new PredictionConcat({fd_pred},
220 {fd_pot}, {fd_livetime});
221 pc_fd->SetSysts(
new SystConcat(systs, {polarity +
"_FD"}));
225 PredictionConcat* pc_both =
new PredictionConcat({nd_pred, fd_pred},
226 {nd_pot, fd_pot}, {0., fd_livetime});
227 pc_both->SetSysts(
new SystConcat(systs,
228 {polarity +
"_ND", polarity +
"_FD"}));
234 std::string filename =
"covmx/covmx_" + polarity +
"_" + syst_type +
".root";
235 TFile* f =
new TFile(filename.c_str(),
"recreate");
242 for (
auto syst : systs) {
245 std::cout <<
"Producing " << syst->ShortName()
246 <<
" matrix for near detector..." <<
std::endl;
247 CovarianceMatrix gen_nd(pc_nd, calc_trivial, {syst}, nd_pot, 1e5);
248 gen_nd.PredictCovMx(pc_nd, calc);
249 std::string matrix_name =
"CovMx_ND_" + syst->ShortName();
250 gen_nd.SaveTo(f, matrix_name.c_str());
253 std::cout <<
"Producing " << syst->ShortName()
254 <<
" matrix for far detector..." <<
std::endl;
255 CovarianceMatrix gen_fd(pc_fd, calc_trivial, {syst}, fd_pot, 1e5);
256 gen_fd.PredictCovMx(pc_fd, calc);
257 matrix_name =
"CovMx_FD_" + syst->ShortName();
258 gen_fd.SaveTo(f, matrix_name.c_str());
261 std::cout <<
"Producing " << syst->ShortName()
262 <<
" matrix for both detectors..." <<
std::endl;
263 CovarianceMatrix gen_both(pc_both, calc_trivial, {syst}, fd_pot, 1e5);
264 gen_both.PredictCovMx(pc_both, calc);
265 matrix_name =
"CovMx_Both_" + syst->ShortName();
266 gen_both.SaveTo(f, matrix_name.c_str());
269 std::cout << std::endl <<
"Processed " << n_done <<
" of " << systs.size()
284 TFile* f =
new TFile(filename.c_str(),
"recreate");
291 <<
" matrix for near detector..." <<
std::endl;
292 CovarianceMatrix gen_nd(pc_nd, calc_trivial, {syst}, nd_pot, 1e5);
293 gen_nd.PredictCovMx(pc_nd, calc);
295 gen_nd.SaveTo(f, matrix_name.c_str());
299 <<
" matrix for far detector..." <<
std::endl;
300 CovarianceMatrix gen_fd(pc_fd, calc_trivial, {syst}, fd_pot, 1e5);
301 gen_fd.PredictCovMx(pc_fd, calc);
302 matrix_name =
"CovMx_FD_" + syst->
ShortName();
303 gen_fd.SaveTo(f, matrix_name.c_str());
307 <<
" matrix for both detectors..." <<
std::endl;
308 CovarianceMatrix gen_both(pc_both, calc_trivial, {syst}, fd_pot, 1e5);
309 gen_both.PredictCovMx(pc_both, calc);
310 matrix_name =
"CovMx_Both_" + syst->
ShortName();
311 gen_both.SaveTo(f, matrix_name.c_str());
std::vector< std::tuple< ana::Flavors::Flavors_t, ana::Current::Current_t, ana::Sign::Sign_t > > GetComponents()
virtual const std::string & ShortName() const final
The name printed out to the screen.
Simple record of shifts applied to systematic parameters.
Adapt the PMNS_Sterile calculator to standard interface.
bool progress
Insert implicit nodes #####.
Version of OscCalcSterile that always returns probability of 1.
const double kAna2018SensitivityFHCNDPOT
void SetAngles(osc::OscCalcSterile *calc)
Encapsulate code to systematically shift a caf::SRProxy.
const double kAna2018RHCPOT
osc::OscCalcSterile * DefaultSterileCalc(int nflavors)
Create a sterile calculator with default assumptions for all parameters.
std::string getenv(std::string const &name)
IPrediction * LoadPPFX(std::string detector, int universe)
Function to load PPFX universe simulations.
std::string GetPPFXWeightsDir()
Function to get location of PPFX weights.
std::vector< Binning > GetNus18Binning(bool rhc, std::string detector)
IPrediction * LoadPrediction(std::string detector, bool rhc=false, std::string syst_type="all")
Function to load prediction object.
const double kAna2018SensitivityRHCNDPOT
assert(nhit_max >=nhit_nbins)
A simple ascii-art progress bar.
Standard interface to all prediction techniques.
const double kAna2018FHCPOT
Prevent histograms being added to the current directory.
std::vector< const ISyst * > GetNus18Systs(bool rhc, std::string det_type, std::string syst_type)
const double kAna2018FHCLivetime
const double kAna2018RHCLivetime