All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PredictionSBNExtrap.cxx
Go to the documentation of this file.
2 
5 
7 
8 #include "OscLib/IOscCalc.h"
9 
10 #include "TDirectory.h"
11 #include "TObjString.h"
12 #include "TH1D.h"
13 
14 namespace ana
15 {
16  //----------------------------------------------------------------------
18  Loaders& loadersFD,
19  const HistAxis& axis,
20  const SpillCut& spillcut,
21  const Cut& cut,
22  const SystShifts& shift_mc,
23  const Var& wei_mc,
24  const SystShifts& shift_data,
25  const Var& wei_data)
26  : fPredND(loadersND, axis, spillcut, cut, shift_mc, wei_mc),
27  fPredFD(loadersFD, axis, spillcut, cut, shift_mc, wei_mc),
28  // TODO how on earth do fake ND oscillations get in here?
29  fDataND(loadersND.GetLoader(Loaders::kData), axis, spillcut, cut, shift_data, wei_data)
30  {
31  }
32 
33  //----------------------------------------------------------------------
35  {
36  }
37 
38  //----------------------------------------------------------------------
40  {
41  return PredictComponent(calc,
44  Sign::kBoth);
45  }
46 
47  //----------------------------------------------------------------------
49  Flavors::Flavors_t flav,
50  Current::Current_t curr,
51  Sign::Sign_t sign) const
52  {
53  ((osc::IOscCalcAdjustable*)calc)->SetL(kBaselineSBND);
54  const Ratio r = fDataND / fPredND.Predict(calc);
56  return r * fPredFD.PredictComponent(calc, flav, curr, sign);
57  }
58 
59  //----------------------------------------------------------------------
61  {
62  /*
63  if(from == +12 && to == +12) return fSBNExtrap->NueSurvComponent();
64  if(from == -12 && to == -12) return fSBNExtrap->AntiNueSurvComponent();
65 
66  if(from == +12 && to == +14) return fSBNExtrap->NumuAppComponent();
67  if(from == -12 && to == -14) return fSBNExtrap->AntiNumuAppComponent();
68 
69  if(from == +12 && to == +16) return fSBNExtrap->TauFromEComponent();
70  if(from == -12 && to == -16) return fSBNExtrap->AntiTauFromEComponent();
71 
72  if(from == +14 && to == +12) return fSBNExtrap->NueAppComponent();
73  if(from == -14 && to == -12) return fSBNExtrap->AntiNueAppComponent();
74 
75  if(from == +14 && to == +14) return fSBNExtrap->NumuSurvComponent();
76  if(from == -14 && to == -14) return fSBNExtrap->AntiNumuSurvComponent();
77 
78  if(from == +14 && to == +16) return fSBNExtrap->TauFromMuComponent();
79  if(from == -14 && to == -16) return fSBNExtrap->AntiTauFromMuComponent();
80  */
81  assert(0 && "Not reached");
82  }
83 
84  //----------------------------------------------------------------------
85  // Spectrum PredictionSBNExtrap::ComponentNC() const
86  // {
87  // return fSBNExtrap->NCComponent();
88  // }
89 
90  //----------------------------------------------------------------------
91  void PredictionSBNExtrap::SaveTo(TDirectory* dir) const
92  {
93  TDirectory* tmp = gDirectory;
94 
95  dir->cd();
96 
97  TObjString("PredictionSBNExtrap").Write("type");
98 
99  fPredND.SaveTo(dir->mkdir("predND"));
100  fPredFD.SaveTo(dir->mkdir("predFD"));
101  fDataND.SaveTo(dir->mkdir("dataND"));
102 
103  tmp->cd();
104  }
105 
106  //----------------------------------------------------------------------
107  std::unique_ptr<PredictionSBNExtrap> PredictionSBNExtrap::LoadFrom(TDirectory* dir)
108  {
109  assert(dir->GetDirectory("predND"));
110  assert(dir->GetDirectory("predFD"));
111  assert(dir->GetDirectory("dataND"));
112 
113  // TODO are these leaks?
114  return std::unique_ptr<PredictionSBNExtrap>(new PredictionSBNExtrap(
115  *ana::LoadFrom<PredictionNoExtrap>(dir->GetDirectory("predND")).release(),
116  *ana::LoadFrom<PredictionNoExtrap>(dir->GetDirectory("predFD")).release(),
117  *ana::LoadFrom<Spectrum>(dir->GetDirectory("dataND")).release()));
118  }
119 
120  //----------------------------------------------------------------------
122  const HistAxis& ax,
123  const SpillCut& spillcut,
124  const Cut& cut,
125  const Var& wei_mc,
126  const SystShifts& shift_data,
127  const Var& wei_data)
128  : fLoadersND(loaders_nd), fAxis(ax), fSpillCut(spillcut), fCut(cut), fWeightMC(wei_mc),
129  fShiftData(shift_data), fWeightData(wei_data)
130  {
131  }
132 
133  //----------------------------------------------------------------------
134  std::unique_ptr<IPrediction> SBNExtrapGenerator::Generate(Loaders& loaders_fd,
135  const SystShifts& shiftMC) const
136  {
137  // No data shifts or weights
138  return std::unique_ptr<IPrediction>(new PredictionSBNExtrap(fLoadersND, loaders_fd, fAxis, fSpillCut, fCut, shiftMC, fWeightMC, fShiftData, fWeightData));
139  }
140 }
OscillatableSpectrum ComponentCC(int from, int to) const override
PredictionNoExtrap fPredND
virtual void SaveTo(TDirectory *dir) const override
const double kBaselineIcarus
Definition: ExpInfo.h:10
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:16
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:12
static std::unique_ptr< PredictionSBNExtrap > LoadFrom(TDirectory *dir)
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
virtual Spectrum Predict(osc::IOscCalc *calc) const override
process_name opflashCryoW ana
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:30
Interactions of both types.
Definition: IPrediction.h:41
std::unique_ptr< IPrediction > Generate(Loaders &loaders_fd, const SystShifts &shiftMC=kNoShift) const override
PredictionNoExtrap fPredFD
SBNExtrapGenerator(Loaders &loaders_nd, const HistAxis &ax, const SpillCut &spillcut, const Cut &cut, const Var &wei_mc, const SystShifts &shift_data=kNoShift, const Var &wei_data=kUnweighted)
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
Represent the ratio between two spectra.
Definition: Ratio.h:8
tuple dir
Definition: dropbox.py:28
int sign(double val)
Definition: UtilFunc.cxx:104
Both neutrinos and antineutrinos.
Definition: IPrediction.h:51
All neutrinos, any flavor.
Definition: IPrediction.h:25
Spectrum with true energy information, allowing it to be oscillated
virtual Spectrum Predict(osc::IOscCalc *calc) const override
esac echo uname r
virtual void SaveTo(TDirectory *dir) const override
void SaveTo(TDirectory *dir) const
const double kBaselineSBND
Definition: ExpInfo.h:8