PredictionSyst3Flavor2020.cxx
Go to the documentation of this file.
5 #include "3FlavorAna/Cuts/NueCuts2020.h" // kNue2020Binning
8 #include "3FlavorAna/Systs/DummySystStorage.h" // norm systs
9 #include "3FlavorAna/Systs/NueAcceptSysts.h" // accept syst to be execluded from numu
10 #include "3FlavorAna/Systs/MichelTaggingSyst.h" // michel tagging only for nue FHC
11 #include "3FlavorAna/Systs/AngleSysts.h" // lepton angle systs
12 #include "OscLib/IOscCalc.h"
13 
14 #include "TObjString.h"
15 #include "TROOT.h"
16 
17 #include <iostream>
18 #include <unistd.h>
19 
20 namespace ana
21 {
22 
23  REGISTER_LOADFROM("PredictionSyst3Flavor2020", IPrediction, PredictionSyst3Flavor2020);
24 
25  //----------------------------------------------------------------------
26  // Nue constructor
29  const std::vector<const ISyst*>& systs,
31  bool isFakeData,
32  bool mergePeripheral,
33  const std::string fname,
34  bool minimizeMemory,
35  bool NERSC
36  )
37  : fBeam(beam)
38  {
39  gROOT->SetMustClean(false);
40 
41  fOscOrigin = osc->Copy();
42 
43  fSplitBySign = IsFHC();
44 
45  const bool isPtExtrap = extrap == ENu2020ExtrapType::kComboPtExtrap || extrap == ENu2020ExtrapType::kPropPtExtrap;
46 
47  std::cout << "mergePeripheral is "
48  << (mergePeripheral ? "true" : "false") << std::endl;
49 
50  std::cout << "use FakeNDData predictions is "
51  << (isFakeData ? "true" : "false") << std::endl;
52  std::string extrapStr = "pred_";
53  if (extrap == ENu2020ExtrapType::kProportional) extrapStr += "xp_prop";
54  if (extrap == ENu2020ExtrapType::kCombo) extrapStr += "xp_combo";
55  if (extrap == ENu2020ExtrapType::kNoExtrap) extrapStr += "nxp";
56 
57  if (extrap == ENu2020ExtrapType::kFake) extrapStr += "xp_prop";
58 
59  extrapStr += "_";
60 
61  std::cout << "Loading nominals..." << std::endl;
62 
63  IPrediction *nom;
64 
65  std::string fnameSyst;
66 
67  if (fname != "") {
68  std::cout << "Loading predictions from unofficial file..." << std::endl;
69  std::cout << "\t--> " << fname << std::endl;
70  fnameSyst = fname;
71  } else {
72  // --- Set some defaults. These aren't final, so they need to be updated, but that's better than nothing.
73  std::string FileDir = "/cvmfs/nova.osgstorage.org/analysis/3flavor/Predictions/";
74  if(NERSC) {
75  FileDir = std::string(std::getenv("FCHELPERANA2020_LIB_PATH")) + "/Predictions/";
76  }
77  if ( isPtExtrap ) {
78  std::cout << "\t Loading the Pt Extrap files." << std::endl;
79  if ( IsFHC() && !isFakeData) { fnameSyst = FileDir + "pred_xp_nue_combo_Nue2020Axis_full_FHCAllSysts_PtQuants3_nueconcat_realNDData_20200427.root";
80  } else if (!IsFHC() && !isFakeData) { fnameSyst = FileDir + "pred_xp_nue_prop_Nue2020Axis_full_RHCAllSysts_PtQuants3_nueconcat_realNDData_20200427.root";
81  } else if ( IsFHC() && isFakeData) { fnameSyst = FileDir + "pred_xp_nue_combo_Nue2020Axis_full_FHCAllSysts_PtQuants3_nueconcat_fakeNDData_20200427.root";
82  } else if (!IsFHC() && isFakeData) { fnameSyst = FileDir + "pred_xp_nue_prop_Nue2020Axis_full_RHCAllSysts_PtQuants3_nueconcat_fakeNDData_20200427.root";
83  }
84  } else {
85  std::cout << "\t Loading the Non Pt Extrap files." << std::endl;
86  if ( IsFHC() && !isFakeData) { fnameSyst = FileDir + "pred_Nue2020Axis_full_FHCAllSysts_nueconcat_20200428.root";
87  } else if (!IsFHC() && !isFakeData) { fnameSyst = FileDir + "pred_Nue2020Axis_full_RHCAllSysts_nueconcat_20200428.root";
88  } else if ( IsFHC() && isFakeData) { fnameSyst = FileDir + "pred_xp_nue_combo_Nue2020Axis_full_FHCAllSysts_nueconcat_fakeNDData_20200427.root";
89  } else if (!IsFHC() && isFakeData) { fnameSyst = FileDir + "pred_xp_nue_prop_Nue2020Axis_full_RHCAllSysts_nueconcat_fakeNDData_20200427.root";
90  }
91  }
92  std::cout << "Loading the predictions from official file..." << std::endl;
93  std::cout << "\t--> " << fnameSyst << std::endl;
94  }
95 
96  TFile* fSyst = TFile::Open(fnameSyst.c_str(), "read");
97  if(fSyst->IsZombie())
98  {
99  std::cout << "Couldn't open " << fnameSyst << std::endl;
100  abort();
101  }
102 
103  std::string varname ="/nue_pred_Nue2020Axis";
104 
105  // make PredictionExtendOwning
106 
107  IPrediction* nomCore;
108  if ( isPtExtrap ) {
109  //std::cout << "In the isPtExtrap loading loop." << std::endl;
110  nomCore = LoadNuePtExtrapPred( fSyst, extrap, "Nominal", "noShift" );
111  } else {
112  //std::cout << "In the non-PtExtrap loading loop." << std::endl;
113  nomCore = ana::LoadFrom<IPrediction>(fSyst, extrapStr + "Nominal/noShift" + varname).release();
114  }
115  PredictionNoExtrap* nomNoExtrap = ana::LoadFrom<PredictionNoExtrap>(fSyst, "pred_nxp_Nominal/noShift" + varname).release();
116 
117  fPredNom = std::make_unique<PredictExtendOwning>(nomCore, nomNoExtrap, kNue2020Binning, true);
118  nom = new PredictExtendOwning(nomCore, nomNoExtrap, kNue2020Binning, true);
119 
120  for(const ISyst* syst: systs)
121  {
122  if(syst == &kAna2020NormFHC ||
123  syst == &kAna2020NormRHC ||
124  syst == &kAna2020NormHornCorr) continue;
125 
126  // michel tagging only for FHC
127  if(!IsFHC() && syst == &kMichelTaggingSyst2020) continue;
128 
129  // lepton angle syst only for PtExtrap
130  if(!isPtExtrap &&
131  (syst == &kLeptonAngleSystNDXZ2020 ||
132  syst == &kLeptonAngleSystNDYZ2020 ||
133  syst == &kLeptonAngleSystFDXZ2020 ||
134  syst == &kLeptonAngleSystFDYZ2020)) continue;
135 
136  std::string systName = syst->ShortName();
137 
138  std::cout << "Loading " << systName << "..." << std::endl;
139 
140  ShiftedPreds sp;
141  sp.systName = systName;
142 
143  for(int sigma: GetDummyShifts(syst))
144  {
145  sp.shifts.push_back(sigma);
146 
147  if (sigma == 0) {sp.preds.push_back(nom); continue;}
148 
149  // Treat Cherenkov And CalibDrift as one sided by
150  // fixing negative shifts to the nominal
151  if((syst == &kAnaCherenkovSyst || syst == &kAnaCalibDriftSyst) && (sigma == -1 || sigma == -2))
152  {
153  sp.preds.push_back(nom);
154  continue;
155  }
156 
157  const std::string sigmaStr = "/"+SigmaToString(sigma);
158 
159  IPrediction* shCore;
160  if ( isPtExtrap ) {
161  //std::cout << "In the isPtExtrap loading loop." << std::endl;
162  shCore = LoadNuePtExtrapPred( fSyst, extrap, systName, SigmaToString( sigma ) );
163  } else {
164  //std::cout << "In the non-PtExtrap loading loop." << std::endl;
165  shCore = ana::LoadFrom<IPrediction>(fSyst, extrapStr + systName + sigmaStr +varname).release();
166  }
167  PredictionNoExtrap* shNoExtrap = ana::LoadFrom<PredictionNoExtrap>(fSyst, "pred_nxp_" + systName + sigmaStr +varname).release();
168 
169  sp.preds.push_back(new PredictExtendOwning(shCore, shNoExtrap, kNue2020Binning, true));
170  } // end for sigma
171  // std::cout<<" test find "<<systName<<" "<<syst->find(systName)<<std::endl;
172  fPreds.emplace(syst, sp);
173  } // end for syst
174 
175  // Calculate all the ratios etc
176  InitFits();
177 
178  AddNormSysts(systs, extrap);
179 
180  // Clean up. Don't use if you need to make debug plots
181  if(minimizeMemory)
182  {
183  MinimizeMemory();
184  }
185 
186  delete fSyst;
187  }
188 
189  //----------------------------------------------------------------------
190  // Numu constructor
193  const std::string beam,
194  const int EhadFracQuant,
195  const std::vector<const ISyst*>& systs,
196  bool isFakeData,
197  const std::string fname,
198  bool minimizeMemory,
199  bool NERSC)
200  : fBeam(beam)
201  {
202  gROOT->SetMustClean(false);
203 
204  fOscOrigin = osc->Copy();
205 
206  fSplitBySign = IsFHC();
207 
208  const bool isPtExtrap = extrap == ENu2020ExtrapType::kNuMuPtExtrap;
209 
210  std::cout << "use FakeNDData predictions is "
211  << (isFakeData ? "true" : "false") << std::endl;
212 
213  std::string extrapStr = "pred_";
214  if (extrap == ENu2020ExtrapType::kNuMu) extrapStr += "xp_numu";
215  if (extrap == ENu2020ExtrapType::kNuMuNoExtrap) extrapStr += "nxp";
216  extrapStr += "_";
217 
218  std::string VarName = "numu_pred_NumuEnergy_EhadFracQuant"+std::to_string(EhadFracQuant);
219  if (EhadFracQuant == -1) VarName = "numu_pred_NumuEnergy";
220 
221  std::cout << "\nLooking at VarName " << VarName << " --> Loading nominals now..." << std::endl;
222 
223  std::string fnameSyst = fname;
224  if (fname != "") {
225  std::cout << "Loading predictions from unofficial file..." << std::endl;
226  std::cout << "\t--> " << fnameSyst << std::endl;
227  } else {
228  // --- Set some defaults. These aren't final, so they need to be updated, but that's better than nothing.
229  std::string FileDir = "/cvmfs/nova.osgstorage.org/analysis/3flavor/Predictions/";
230  if(NERSC) {
231  FileDir = std::string(std::getenv("FCHELPERANA2020_LIB_PATH")) + "/Predictions/";
232  }
233  if ( isPtExtrap ) {
234  std::cout << "\t Loading the Pt Extrap files." << std::endl;
235  if ( IsFHC() && !isFakeData ) { fnameSyst = FileDir + "pred_xp_numu_NumuEnergy_AllQuantiles_full_FHCAllSysts_PtQuants3_numuconcat_realNDData_20200427.root";
236  } else if ( !IsFHC() && !isFakeData ) { fnameSyst = FileDir + "pred_xp_numu_NumuEnergy_AllQuantiles_full_RHCAllSysts_PtQuants3_numuconcat_realNDData_20200427.root";
237  } else if ( IsFHC() && isFakeData ) { fnameSyst = FileDir + "pred_xp_numu_NumuEnergy_AllQuantiles_full_FHCAllSysts_PtQuants3_numuconcat_fakeNDData_20200427.root";
238  } else if ( !IsFHC() && isFakeData ) { fnameSyst = FileDir + "pred_xp_numu_NumuEnergy_AllQuantiles_full_RHCAllSysts_PtQuants3_numuconcat_fakeNDData_20200427.root";
239  }
240  } else {
241  std::cout << "\t Loading the Non-Pt Extrap files." << std::endl;
242  if ( IsFHC() && !isFakeData ) { fnameSyst = FileDir + "pred_NumuEnergy_AllQuantiles_full_FHCAllSysts_numuconcat_20200428.root";
243  } else if ( !IsFHC() && !isFakeData ) { fnameSyst = FileDir + "pred_NumuEnergy_AllQuantiles_full_RHCAllSysts_numuconcat_20200428.root";
244  } else if ( IsFHC() && isFakeData ) { fnameSyst = FileDir + "pred_xp_numu_NumuEnergy_AllQuantiles_full_FHCAllSysts_numuconcat_fakeNDData_20200427.root";
245  } else if ( !IsFHC() && isFakeData ) { fnameSyst = FileDir + "pred_xp_numu_NumuEnergy_AllQuantiles_full_RHCAllSysts_numuconcat_fakeNDData_20200427.root";
246  }
247  }
248  std::cout << "Loading the predictions from official file..." << std::endl;
249  std::cout << "\t--> " << fnameSyst << std::endl;
250  }
251 
252  TFile* fin = TFile::Open(fnameSyst.c_str(), "read");
253 
254  IPrediction *nom;
255  if ( isPtExtrap )
256  {
257  fPredNom = std::unique_ptr<IPrediction>( LoadNumuPtExtrapPred( fin, EhadFracQuant, "Nominal", "noShift" ) );
258  nom = LoadNumuPtExtrapPred( fin, EhadFracQuant, "Nominal", "noShift" );
259  }
260  else
261  {
262  std::string NomVar = extrapStr+"Nominal/noShift/"+VarName;
264  nom = ana::LoadFrom<IPrediction>(fin, NomVar).release();
265  }
266 
267  for(const ISyst* syst: systs){
268 
269  if(syst == &kAna2020NormFHC ||
270  syst == &kAna2020NormRHC ||
271  syst == &kAna2020NormHornCorr ||
272  // nue specific systs are not in numu files
277  syst == &kMichelTaggingSyst2020) continue;
278 
279  // lepton angle syst only for PtExtrap
280  if(!isPtExtrap &&
281  (syst == &kLeptonAngleSystNDXZ2020 ||
282  syst == &kLeptonAngleSystNDYZ2020 ||
283  syst == &kLeptonAngleSystFDXZ2020 ||
284  syst == &kLeptonAngleSystFDYZ2020)) continue;
285 
286  std::string systName = syst->ShortName();
287 
288  std::cout << "Loading " << systName << "..." << std::endl;
289 
290  ShiftedPreds sp;
291  sp.systName = systName;
292 
293  for(int sigma: GetDummyShifts(syst))
294  {
295  sp.shifts.push_back(sigma);
296 
297  if (sigma == 0) {sp.preds.push_back(nom);continue;}
298 
299  // Treat Cherenkov And CalibDrift as one sided by
300  // fixing negative shifts to the nominal
301  if((syst == &kAnaCherenkovSyst || syst == &kAnaCalibDriftSyst) &&
302  (sigma == -1 || sigma == -2))
303  {
304  sp.preds.push_back(nom);
305  continue;
306  }
307 
308  const std::string sigmaStr = "/"+SigmaToString(sigma)+"/";
309 
310  IPrediction* shCore;
311  if ( isPtExtrap ) shCore = LoadNumuPtExtrapPred( fin, EhadFracQuant, systName, SigmaToString( sigma ) );
312  else shCore = ana::LoadFrom<PredictionExtrap> (fin, extrapStr + systName + sigmaStr +VarName).release();
313  sp.preds.push_back(shCore);
314 
315  } // end for sigma
316  fPreds.emplace(syst, sp);
317  } // end for syst
318 
319  // Calculate all the ratios etc
320  InitFits();
321 
322  AddNormSysts(systs, extrap);
323 
324  if(minimizeMemory){
325  MinimizeMemory();
326  }
327 
328  delete fin;
329  }
330 
331  //----------------------------------------------------------------------
333  {
334  }
335 
336  //----------------------------------------------------------------------
338  AddNormSysts(const std::vector<const ISyst*>& systs, ENu2020ExtrapType extrap)
339  {
340  // Normalisation systematic consists of 6 pieces
341  // 4 horn-currents uncorrelated
342  // e.g. FHC norm applies shift to fhc,
343  // no shift to rhc, and vice versa
344  // POT = 0.55% (docdb-42952)
345  // Overlay (docdb-43838):
346  // numu = 0.21%/0.48% (FHC/RHC)
347  // nue = 0.41%/0.53% (FHC/RHC)
348  // overlay 'numu' applies to numu signal and nue signal
349  // overlay 'nue' applies to nue bkg
350  // FHC
351  const double kNormNumuFHC = 0.0059;
352  const double kNormNueFHC = 0.0069;
353  // RHC
354  const double kNormNumuRHC = 0.0073;
355  const double kNormNueRHC = 0.0076;
356 
357  // FD fully-uncorrelated mass uncertainty
358  // mass = 0.19% (docdb-20816)
359  // gg mismatch
360  // (Genie-Geant mismatch of the primary particle list)
361  // gg_mismatch = 0.8% (docdb-?????)
362  // both horn-current correlated
363  // Mass + gg_mismatch
364  const double kNormHornCorr = 0.0082;
365 
366  // Remember: none of these normalization systematics will affect the nue rock component
367  // final nue pred = rock prediction + fiducial prediction with systematics (this class)
368  // That final nue pred is calculated at analysis time, not here
369  // (see GetNuePrediction2020 in joint_fit_2020_loader_tools.h)
370 
371  // Include horn-correlated norm
372  AddNormSyst(&kAna2020NormHornCorr, systs, kNormHornCorr, kNormHornCorr);
373 
374  // Include syst for wrong beam type to keep the fit happy, but set it to
375  // zero magnitude
376  if(IsFHC())
377  {
378  // Are we in numu? => keep only one kNormNumu
380  {
381  AddNormSyst(&kAna2020NormFHC, systs, kNormNumuFHC, kNormNumuFHC);
382  AddNormSyst(&kAna2020NormRHC, systs, .0, .0);
383  }
384  // Are we in nue? => pass both kNormNumu and kNormNue
385  else
386  {
387  AddNormSyst(&kAna2020NormFHC, systs, kNormNumuFHC, kNormNueFHC);
388  AddNormSyst(&kAna2020NormRHC, systs, .0, .0);
389  }
390  }
391  else
392  {
393  // Are we in numu? => keep only one kNormNumu
395  {
396  AddNormSyst(&kAna2020NormFHC, systs, .0, .0);
397  AddNormSyst(&kAna2020NormRHC, systs, kNormNumuRHC, kNormNumuRHC);
398  }
399  // Are we in nue? => pass both kNormNumu and kNormNue
400  else
401  {
402  AddNormSyst(&kAna2020NormFHC, systs, .0, .0);
403  AddNormSyst(&kAna2020NormRHC, systs, kNormNumuRHC, kNormNueRHC);
404  }
405  }
406  }
407  //----------------------------------------------------------------------
409  AddNormSyst(const ISyst* syst,
410  const std::vector<const ISyst*>& systs,
411  double fracNueApp, double fracOthers)
412  {
413  // Bail out if we're not actually requested to include this systematic
414  if(std::find(systs.begin(), systs.end(), syst) == systs.end()) return;
415 
416  TH1D* h = Predict(fOscOrigin).ToTH1(1);
417  const int nBins = h->GetNbinsX();
418  delete h;
419 
420  ShiftedPreds normsp;
421  normsp.systName = syst->ShortName();
422  normsp.shifts = {0};
423  normsp.preds = {fPredNom.get()};
424  normsp.fits.resize(kNCoeffTypes);
425  if(fSplitBySign) normsp.fitsNubar.resize(kNCoeffTypes);
426 
427  // The first fits coeff is for nue signal, the rest are for nue bkg and numu
428  normsp.fits[CoeffsType::kNueApp].resize(nBins+2);
429  if(fSplitBySign) normsp.fitsNubar[CoeffsType::kNueApp].resize(nBins+2);
430  for(int binIdx = 0; binIdx < nBins+2; ++binIdx){
431  normsp.fits[CoeffsType::kNueApp][binIdx].emplace_back(0, 0, fracNueApp, 1);
432  if(fSplitBySign) normsp.fitsNubar[CoeffsType::kNueApp][binIdx].emplace_back(0, 0, fracNueApp, 1);
433  }
434 
435  for(int coeff = 1; coeff < kNCoeffTypes; ++coeff){
436  normsp.fits[coeff].resize(nBins+2);
437  if(fSplitBySign) normsp.fitsNubar[coeff].resize(nBins+2);
438  for(int binIdx = 0; binIdx < nBins+2; ++binIdx){
439  normsp.fits[coeff][binIdx].emplace_back(0, 0, fracOthers, 1);
440  if(fSplitBySign) normsp.fitsNubar[coeff][binIdx].emplace_back(0, 0, fracOthers, 1);
441  }
442  }
443 
444  normsp.FillRemaps();
445  normsp.nCoeffs = 1;
446  fPreds.emplace(syst, normsp);
447  }
448 
449  //----------------------------------------------------------------------
450  std::unique_ptr<PredictionSyst3Flavor2020> PredictionSyst3Flavor2020::LoadFrom(TDirectory* dir, const std::string& name)
451  {
452  std::cout << "PredictionSyst3Flavor2020::LoadFrom() not implemented" << std::endl;
453  abort();
454 
455  // TODO: implement with correct Norm syst and PtExtrap loading
456  /*
457  TObjString* tag = (TObjString*)dir->Get("type");
458  assert(tag);
459 
460  assert(tag->GetString() == "PredictionSyst3Flavor2020");
461 
462  std::unique_ptr<PredictionSyst3Flavor2020> ret(new PredictionSyst3Flavor2020);
463  LoadFromBody(dir, ret.get(), {&kAna2020NormFHC, &kAna2020NormRHC});
464 
465  const TObjString* beam = (TObjString*)dir->Get("beam");
466  assert(beam);
467  ret->fBeam = beam->GetString();
468 
469  ret->fSplitBySign = ret->IsFHC();
470 
471  // Just enable all norm systs unconditionally. Way too hard to do otherwise
472  // NB fBeam was set above. That's necessary for correctness.
473  ret->AddNormSysts({&kAna2020NormFHC, &kAna2020NormRHC});
474 
475  return ret;
476  */
477  }
478 
479  //----------------------------------------------------------------------
480  void PredictionSyst3Flavor2020::SaveTo(TDirectory* dir, const std::string& name) const
481  {
482  std::cout << "PredictionSyst3Flavor2020::SaveTo() not implemented" << std::endl;
483  abort();
484 
485  // TODO: implement with correct Norm syst (and PtExtrap) saving
486  /*
487  PredictionInterp::SaveTo(dir);
488 
489  TDirectory* tmp = gDirectory;
490 
491  dir->cd();
492  // Overwrite "IPrediction"
493  TObjString("PredictionSyst3Flavor2020").Write("type");
494 
495  TObjString(fBeam.c_str()).Write("beam");
496 
497  tmp->cd();
498  */
499  }
500 
501  //----------------------------------------------------------------------
503  {
504  if(sigma == -2) return "minusTwo";
505  if(sigma == -1) return "minusOne";
506  if(sigma == 0) return "";
507  if(sigma == +1) return "plusOne";
508  if(sigma == +2) return "plusTwo";
509 
510  std::cout << "PredictionSyst3Flavor2020: unknown sigma " << sigma << std::endl;
511  abort();
512  }
513 
514  //----------------------------------------------------------------------
516  {
517  std::string signal_str = "pred_xp_nue_signal";
518 
519  std::string bkgd_str = "pred_xp_nue_bkgd_";
520  if ( extrap == ENu2020ExtrapType::kComboPtExtrap ) bkgd_str += "combo";
521  else if ( extrap == ENu2020ExtrapType::kPropPtExtrap ) bkgd_str += "prop";
522  else
523  {
524  std::cout << "ENu2020ExtrapType must be kComboPtExtrap or kPropPtExtrap" << std::endl;
525  abort();
526  }
527 
528  std::string var = "nue_pred_Nue2020Axis";
529 
530  std::vector<std::string> pred_paths;
531 
532  // Path for background prediction
533  pred_paths.push_back( Form( "%s_%s/%s/%s", bkgd_str.c_str(), syst_name.c_str(), sigma_str.c_str(), var.c_str() ) );
534 
535  // Paths for signal Pt quantile predictions
536  int NPtQuants = 3;
537  for ( int ptQuant = 1; ptQuant <= NPtQuants; ++ptQuant )
538  {
539  std::string signal_path = Form( "%s_%s/%s/%s_Signal_PtQuant%d", signal_str.c_str(), syst_name.c_str(), sigma_str.c_str(), var.c_str(), ptQuant );
540  pred_paths.push_back( signal_path );
541  }
542 
543  return new PredictionExtrapSum( file, pred_paths );
544  }
545 
546  //----------------------------------------------------------------------
548  {
549  if ( EhadFracQuant < 1 || EhadFracQuant > 4 )
550  {
551  std::cout << "Pt extrap requires 1 <= EhadFracQuant >= 4" << std::endl;
552  abort();
553  }
554 
555  std::string base_path = Form( "pred_xp_numu_%s/%s/numu_pred_NumuEnergy_EhadFracQuant%d", syst_name.c_str(), sigma_str.c_str(), EhadFracQuant );
556 
557  int NPtQuants = 3;
558  std::vector<std::string> pred_paths;
559  for ( int ptQuant = 1; ptQuant <= NPtQuants; ++ptQuant )
560  {
561  pred_paths.push_back( base_path + Form( "_PtQuant%dof%d", ptQuant, NPtQuants ) );
562  }
563 
564  return new PredictionExtrapSum( file, pred_paths );
565  }
566 
567  //----------------------------------------------------------------------
569  {
570  if(fBeam == "fhc" ) return true;
571  if(fBeam == "rhc") return false;
572 
573  std::cout << "PredictionSyst3Flavor2020: Bad beam string: "
574  << fBeam << std::endl;
575  abort();
576  }
577 } // namespace
TString fin
Definition: Style.C:24
const XML_Char * name
Definition: expat.h:151
int nBins
Definition: plotROC.py:16
static std::unique_ptr< PredictionSyst3Flavor2020 > LoadFrom(TDirectory *dir, const std::string &name)
const DummyAnaSyst kAna2020NormFHC("NormFHC2020","FHC. Norm.")
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
bool mergePeripheral
std::string systName
What systematic we&#39;re interpolating.
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:209
virtual const std::string & ShortName() const final
The name printed out to the screen.
Definition: ISyst.h:27
std::vector< std::vector< std::vector< Coeffs > > > fitsNubar
Will be filled if signs are separated, otherwise not.
IPrediction * LoadNuePtExtrapPred(TFile *file, ENu2020ExtrapType extrap, std::string syst_name, std::string sigma_str) const
const DummyAnaSyst kAna2020NormHornCorr("NormHornCorr","HornCorr Norm.")
std::vector< int > GetDummyShifts(const ISyst *s)
const DummyAnaSyst kAna2020NormRHC("NormRHC2020","RHC. Norm.")
const NueAcceptSystSignalKin2020FHC kNueAcceptSystSignalKin2020FHC
Encapsulate code to systematically shift a caf::SRProxy.
Definition: ISyst.h:14
bool IsFHC() const
Interprets fBeam.
const LeptonAngleSyst kLeptonAngleSystNDYZ2020("LeptonAngleSystNDYZ2020","Lepton Angle Syst ND YZ", caf::kNEARDET, kAngleShiftYZ, 0.010)
Definition: AngleSysts.h:35
void SaveTo(TDirectory *dir, const std::string &name) const override
const LeptonAngleSyst kLeptonAngleSystNDXZ2020("LeptonAngleSystNDXZ2020","Lepton Angle Syst ND XZ", caf::kNEARDET, kAngleShiftXZ, 0.010)
Definition: AngleSysts.h:34
std::unique_ptr< IPrediction > fPredNom
The nominal prediction.
const LeptonAngleSyst kLeptonAngleSystFDXZ2020("LeptonAngleSystFDXZ2020","Lepton Angle Syst FD XZ", caf::kFARDET, kAngleShiftXZ, 0.010)
Definition: AngleSysts.h:36
const DummyAnaSyst kAnaCherenkovSyst("Cherenkov","Cherenkov")
const Binning kNue2020Binning
Class to sum a set of PredictionExtraps.
std::vector< double > shifts
Shift values sampled.
IPrediction * LoadNumuPtExtrapPred(TFile *file, int EhadFracQuant, std::string syst_name, std::string sigma_str) const
void AddNormSyst(const ISyst *syst, const std::vector< const ISyst * > &systs, double fracNueApp, double fracOthers)
std::string getenv(std::string const &name)
void AddNormSysts(const std::vector< const ISyst * > &systs, ENu2020ExtrapType extrap)
Must set fBeam first.
std::vector< IPrediction * > preds
const NueAcceptSystSignalKin2020FHC kNueAcceptSystSignalKinPtExtrap2020FHC(ana::kExtrapPt,"accept_signalkin_pTextrap_FHC_2020")
std::string SigmaToString(int sigma) const
std::unique_ptr< IPrediction > LoadFrom< IPrediction >(TDirectory *dir, const std::string &label)
Definition: IPrediction.cxx:28
double coeff(double W, int m, int l, bool real)
Oscillation probability calculators.
Definition: Calcs.h:5
double sigma(TH1F *hist, double percentile)
const MichelTaggingSyst2020 kMichelTaggingSyst2020
OStream cout
Definition: OStream.cxx:6
virtual _IOscCalc * Copy() const =0
Spectrum Predict(osc::IOscCalc *calc) const override
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
TDirectory * dir
Definition: macro.C:5
REGISTER_LOADFROM("BENDecomp", IDecomp, BENDecomp)
TFile * file
Definition: cellShifts.C:17
Standard interface to all prediction techniques.
Definition: IPrediction.h:57
Prediction that just uses FD MC, with no extrapolation.
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32
std::unordered_map< const ISyst *, ShiftedPreds > fPreds
osc::IOscCalc * fOscOrigin
The oscillation values we assume when evaluating the coefficients.
const DummyAnaSyst kAnaCalibDriftSyst("CalibDrift","CalibDrift")
const LeptonAngleSyst kLeptonAngleSystFDYZ2020("LeptonAngleSystFDYZ2020","Lepton Angle Syst FD YZ", caf::kFARDET, kAngleShiftYZ, 0.010)
Definition: AngleSysts.h:37
const NueAcceptSystSignalKin2020RHC kNueAcceptSystSignalKinPtExtrap2020RHC(ana::kExtrapPt,"accept_signalkin_pTextrap_RHC_2020")
std::vector< std::vector< std::vector< Coeffs > > > fits
Indices: [type][histogram bin][shift bin].
const NueAcceptSystSignalKin2020RHC kNueAcceptSystSignalKin2020RHC