IPrediction.cxx
Go to the documentation of this file.
2 
5 
6 #include "OscLib/IOscCalc.h"
7 
8 #include <cassert>
9 #include <iostream>
10 
11 #include "TDirectory.h"
12 #include "TObjString.h"
13 
14 namespace ana
15 {
16  //----------------------------------------------------------------------
17  // Definition to satisfy declaration in Core/LoadFromFile.h
18  template<> std::unique_ptr<IPrediction> LoadFrom<IPrediction>(TDirectory* dir, const std::string& name)
19  {
20  TObjString* ptag = (TObjString*)dir->Get((name+"/type").c_str());
21  assert(ptag);
22  const TString tag = ptag->GetString();
23  delete ptag;
24 
25  const auto func = LoadFromRegistry<IPrediction>::Get(tag.Data());
26  if(func) return func(dir, name);
27 
28  std::cerr << "Unknown Prediction type '" << tag << "'" << std::endl;
29  abort();
30  }
31 
32  //----------------------------------------------------------------------
34  {
35  // Default implementation
37  return Predict(&noosc);
38  }
39 
40 
41  //----------------------------------------------------------------------
42  // placeholder method that should be overridden by Stan-aware concrete Prediction classes
44  {
45  assert(0 && "This Prediction hasn't implemented a Stan-aware Predict()!");
46  }
47 
48  //----------------------------------------------------------------------
50  const SystShifts& syst) const
51  {
52  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
53 
54  // Default implementation: no treatment of systematics
55  return Predict(calc);
56  }
57 
58  //----------------------------------------------------------------------
60  const SystShifts& syst) const
61  {
62  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
63 
64  // Default implementation: no treatment of systematics
65  return Predict(calc);
66  }
67 
68  //----------------------------------------------------------------------
69  // placeholder method that should be overridden by Stan-aware concrete Prediction classes
71  Flavors::Flavors_t flav,
73  Sign::Sign_t sign) const
74  {
75  assert(0 && "This Prediction hasn't implemented a Stan-aware PredictComponent()!");
76  }
77 
78  //----------------------------------------------------------------------
80  const SystShifts& syst,
81  Flavors::Flavors_t flav,
83  Sign::Sign_t sign) const
84  {
85  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
86 
87  // Default implementation: no treatment of systematics
88  return PredictComponent(calc, flav, curr, sign);
89  }
90 
91 
92  //----------------------------------------------------------------------
94  const SystShifts& syst,
95  Flavors::Flavors_t flav,
97  Sign::Sign_t sign) const
98  {
99  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
100 
101  // Default implementation: no treatment of systematics
102  return PredictComponent(calc, flav, curr, sign);
103  }
104 
106  {
107  std::cout << "WARNING! ComponentCC is unimplemented in IPrediction" << std::endl; abort();
108  }
109 
111  {
112  std::cout << "WARNING! ComponentNCTotal is unimplemented in IPrediction" << std::endl; abort();
113  }
114 
116  {
117  std::cout << "WARNING! ComponentNC is unimplemented in IPrediction" << std::endl; abort();
118  }
119 
121  {
122  std::cout << "WARNING! ComponentNCAnti is unimplemented in IPrediction" << std::endl; abort();
123  }
124 
125  //----------------------------------------------------------------------
126  void IPrediction::SaveTo(TDirectory*, const std::string&) const
127  {
128  assert(0 && "Not implemented");
129  }
130 }
const XML_Char * name
Definition: expat.h:151
Pass neutrinos through unchanged.
Definition: IOscCalc.h:40
virtual Spectrum ComponentNCAnti() const
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
bool IsNominal() const
Definition: SystShifts.h:43
virtual Spectrum Predict(osc::IOscCalc *calc) const =0
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
General interface to oscillation calculators.
Definition: StanTypedefs.h:22
virtual Spectrum PredictComponentSyst(osc::IOscCalc *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
Definition: IPrediction.cxx:79
virtual Spectrum PredictUnoscillated() const
Definition: IPrediction.cxx:33
OStream cerr
Definition: OStream.cxx:7
virtual void SaveTo(TDirectory *dir, const std::string &name) const
osc::OscCalcDumb calc
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
static Func_t Get(const std::string &tag)
virtual Spectrum ComponentNC() const
virtual Spectrum PredictSyst(osc::IOscCalc *calc, const SystShifts &syst) const
Definition: IPrediction.cxx:49
double func(double x, double y)
virtual OscillatableSpectrum ComponentCC(int from, int to) const
std::unique_ptr< IPrediction > LoadFrom< IPrediction >(TDirectory *dir, const std::string &label)
Definition: IPrediction.cxx:18
osc::NoOscillations noosc
Definition: NueSystFuncs.h:44
OStream cout
Definition: OStream.cxx:6
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
TDirectory * dir
Definition: macro.C:5
virtual Spectrum ComponentNCTotal() const
assert(nhit_max >=nhit_nbins)
Spectrum with true energy information, allowing it to be oscillated
def sign(x)
Definition: canMan.py:197