PredictionNoExtrap.cxx
Go to the documentation of this file.
2 
4 
5 namespace ana
6 {
7  REGISTER_LOADFROM("PredictionNoExtrap", IPrediction, PredictionNoExtrap);
8 
9  //----------------------------------------------------------------------
10  PredictionNoExtrap::PredictionNoExtrap(std::unique_ptr<TrivialExtrap>&& extrap)
11  : PredictionExtrap(std::move(extrap))
12  {
13  }
14 
15  //----------------------------------------------------------------------
17  const std::string &label,
18  const Binning &bins,
19  const Var &var,
20  const Cut &cut,
21  const SystShifts &shift,
22  const Var &wei)
23  : PredictionNoExtrap(loaders, HistAxis(label, bins, var), cut, shift, wei)
24  {
25  }
26 
27  //----------------------------------------------------------------------
29  const HistAxis &axis,
30  const Cut &cut,
31  const SystShifts &shift,
32  const Var &wei)
33  : PredictionExtrap(std::make_unique<TrivialExtrap>(loaders, axis, cut, shift, wei))
34  {
35  }
36 
37  //----------------------------------------------------------------------
40  SpectrumLoaderBase &loaderTau,
41  const HistAxis &axis,
42  const Cut &cut,
43  const SystShifts &shift,
44  const Var &wei)
45  : PredictionExtrap(std::make_unique<TrivialExtrap>(loader, loaderSwap, loaderTau, axis, cut, shift, wei))
46  {
47  }
48 
49  //----------------------------------------------------------------------
52  SpectrumLoaderBase &loaderTau,
53  const std::string &label,
54  const Binning &bins,
55  const Var &var,
56  const Cut &cut,
57  const SystShifts &shift,
58  const Var &wei)
59  : PredictionExtrap(std::make_unique<TrivialExtrap>(loader, loaderSwap, loaderTau,
60  label, bins, var, cut, shift, wei))
61  {
62  }
63 
64  //----------------------------------------------------------------------
67  const std::string &label,
68  const Binning &bins,
69  const Var &var,
70  const Cut &cut,
71  const SystShifts &shift,
72  const Var &wei)
73  : PredictionNoExtrap(loader, loaderSwap, kNullLoader,
74  label, bins, var, cut, shift, wei)
75  {
76  }
77 
78  //----------------------------------------------------------------------
79  void PredictionNoExtrap::SaveTo(TDirectory *dir, const std::string& name) const
80  {
81  TDirectory* tmp = gDirectory;
82 
83  dir = dir->mkdir(name.c_str()); // switch to subdir
84  dir->cd();
85 
86  TObjString("PredictionNoExtrap").Write("type");
87 
88  fExtrap->SaveTo(dir, "extrap");
89 
90  dir->Write();
91  delete dir;
92 
93  tmp->cd();
94  }
95 
96 
97  //----------------------------------------------------------------------
98  std::unique_ptr<PredictionNoExtrap> PredictionNoExtrap::LoadFrom(TDirectory* dir, const std::string& name)
99  {
100  dir = dir->GetDirectory(name.c_str()); // switch to subdir
101  assert(dir);
102 
103  auto ret = std::make_unique<PredictionNoExtrap>(ana::LoadFrom<TrivialExtrap>(dir, "extrap"));
104 
105  delete dir;
106 
107  return ret;
108  }
109 
110 
111  //----------------------------------------------------------------------
113  {
114  // We created this in the constructor so it's our responsibility
115  // delete fExtrap;
116  }
117 }
const XML_Char * name
Definition: expat.h:151
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:16
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
Float_t tmp
Definition: plot.C:36
"Extrapolation" that simply returns the FD MC prediction
Definition: TrivialExtrap.h:10
const char * label
PredictionNoExtrap(std::unique_ptr< TrivialExtrap > &&extrap)
loader
Definition: demo0.py:10
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
Base class for the various types of spectrum loader.
const Binning bins
Definition: NumuCC_CPiBin.h:8
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
const Cut cut
Definition: exporter_fd.C:30
std::unique_ptr< IExtrap > fExtrap
TDirectory * dir
Definition: macro.C:5
REGISTER_LOADFROM("BENDecomp", IDecomp, BENDecomp)
std::vector< Loaders * > loaders
Definition: syst_header.h:386
assert(nhit_max >=nhit_nbins)
Prediction that just uses FD MC, with no extrapolation.
Take the output of an extrapolation and oscillate it as required.
loaderSwap
Definition: demo4.py:9
static std::unique_ptr< PredictionNoExtrap > LoadFrom(TDirectory *dir, const std::string &name)
static NullLoader kNullLoader
Dummy loader that doesn&#39;t load any files.