All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IPrediction.cxx
Go to the documentation of this file.
2 
4 
5 #include "OscLib/IOscCalc.h"
6 
7 #include <cassert>
8 #include <iostream>
9 
10 #include "TDirectory.h"
11 #include "TObjString.h"
12 
13 // To implement LoadFrom()
21 
22 namespace ana
23 {
24  //----------------------------------------------------------------------
25  // Definition to satisfy declaration in Core/LoadFromFile.h
26  template<> std::unique_ptr<IPrediction> LoadFrom<IPrediction>(TDirectory* dir)
27  {
28  TObjString* ptag = (TObjString*)dir->Get("type");
29  assert(ptag);
30 
31  const TString tag = ptag->GetString();
32 
33  if(tag == "PredictionNoExtrap") return PredictionNoExtrap::LoadFrom(dir);
34 
35  // Backwards compatibility
36  if(tag == "PredictionInterp" ||
37  tag == "PredictionInterp2") return PredictionInterp::LoadFrom(dir);
38 
39  // if(tag == "PredictionLinFit") return PredictionLinFit::LoadFrom(dir);
40 
41  if(tag == "PredictionNoOsc") return PredictionNoOsc::LoadFrom(dir);
42 
43  if(tag == "PredictionScaleComp") return PredictionScaleComp::LoadFrom(dir);
44 
45  if(tag == "PredictionIncDirt") return PredictionIncDirt::LoadFrom(dir);
46 
47  if(tag == "PredictionSBNExtrap") return PredictionSBNExtrap::LoadFrom(dir);
48 
49  std::cerr << "Unknown Prediction type '" << tag << "'" << std::endl;
50  abort();
51  }
52 
53  //----------------------------------------------------------------------
55  {
56  // Default implementation
57  osc::NoOscillations noosc;
58  return Predict(&noosc);
59  }
60 
61  //----------------------------------------------------------------------
63  const SystShifts& syst) const
64  {
65  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
66 
67  // Default implementation: no treatment of systematics
68  return Predict(calc);
69  }
70 
71  //----------------------------------------------------------------------
73  const SystShifts& syst,
74  Flavors::Flavors_t flav,
75  Current::Current_t curr,
76  Sign::Sign_t sign) const
77  {
78  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
79 
80  // Default implementation: no treatment of systematics
81  return PredictComponent(calc, flav, curr, sign);
82  }
83 
84  //----------------------------------------------------------------------
85  void IPrediction::SaveTo(TDirectory* dir) const
86  {
87  assert(0 && "Not implemented");
88  }
89 }
static std::unique_ptr< PredictionScaleComp > LoadFrom(TDirectory *dir)
BEGIN_PROLOG could also be cerr
bool IsNominal() const
Definition: SystShifts.h:26
virtual void SaveTo(TDirectory *dir) const
Definition: IPrediction.cxx:85
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:16
static std::unique_ptr< PredictionSBNExtrap > LoadFrom(TDirectory *dir)
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:72
virtual Spectrum PredictUnoscillated() const
Definition: IPrediction.cxx:54
static std::unique_ptr< PredictionIncDirt > LoadFrom(TDirectory *dir)
static std::unique_ptr< PredictionNoExtrap > LoadFrom(TDirectory *dir)
process_name opflashCryoW ana
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:30
virtual Spectrum Predict(osc::IOscCalc *calc) const =0
static std::unique_ptr< PredictionNoOsc > LoadFrom(TDirectory *dir)
virtual Spectrum PredictSyst(osc::IOscCalc *calc, const SystShifts &syst) const
Definition: IPrediction.cxx:62
static std::unique_ptr< PredictionInterp > LoadFrom(TDirectory *dir)
tuple dir
Definition: dropbox.py:28
int sign(double val)
Definition: UtilFunc.cxx:104
std::unique_ptr< IPrediction > LoadFrom< IPrediction >(TDirectory *dir)
Definition: IPrediction.cxx:26
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0