All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PredictionNoOsc.cxx
Go to the documentation of this file.
2 
5 
8 
10 
11 #include "TDirectory.h"
12 #include "TObjString.h"
13 
14 
15 namespace ana
16 {
17  //----------------------------------------------------------------------
19  const std::string& label,
20  const Binning& bins,
21  const Var& var,
22  const SpillCut& spillcut,
23  const Cut& cut,
24  const SystShifts& shift,
25  const Var& wei)
26  : PredictionNoOsc(loader, HistAxis(label, bins, var), spillcut, cut, shift, wei)
27  {
28  }
29 
30  //----------------------------------------------------------------------
32  const HistAxis& axis,
33  const SpillCut& spillcut,
34  const Cut& cut,
35  const SystShifts& shift,
36  const Var& wei)
37  : fSpectrum( loader, axis, spillcut, cut, shift, wei),
38  fSpectrumNC( loader, axis, spillcut, cut && kIsNC, shift, wei),
39  fSpectrumNumu( loader, axis, spillcut, cut && !kIsNC && kIsNumuCC && !kIsAntiNu, shift, wei),
40  fSpectrumNumubar(loader, axis, spillcut, cut && !kIsNC && kIsNumuCC && kIsAntiNu, shift, wei),
41  fSpectrumNue( loader, axis, spillcut, cut && !kIsNC && kIsBeamNue && !kIsAntiNu, shift, wei),
42  fSpectrumNuebar( loader, axis, spillcut, cut && !kIsNC && kIsBeamNue && kIsAntiNu, shift, wei)
43  {
44  }
45 
46  //----------------------------------------------------------------------
48  Flavors::Flavors_t flav,
49  Current::Current_t curr,
50  Sign::Sign_t sign) const
51  {
52  if(flav == Flavors::kAll &&
53  curr == Current::kBoth &&
54  sign == Sign::kBoth)
55  return Predict(0); // Faster
56 
57  if(curr & Current::kNC){
58  // We don't have NC broken down by sign or flavour
59  assert(flav & Flavors::kAll && sign & Sign::kBoth);
60  return fSpectrumNC;
61  }
62 
63  assert(curr == Current::kCC);
64 
65  using namespace Flavors;
66  using namespace Current;
67  using namespace Sign;
68 
69  Spectrum ret = fSpectrum;
70  ret.Clear();
71 
72  // Safe to assume by this point that it's 100% CC
73  if(flav & kNuMuToNuMu && sign & kNu) ret += fSpectrumNumu;
74  if(flav & kNuMuToNuMu && sign & kAntiNu) ret += fSpectrumNumubar;
75  if(flav & kNuEToNuE && sign & kNu) ret += fSpectrumNue;
76  if(flav & kNuEToNuE && sign & kAntiNu) ret += fSpectrumNuebar;
77 
78  return ret;
79  }
80 
81  //----------------------------------------------------------------------
82  void PredictionNoOsc::SaveTo(TDirectory* dir) const
83  {
84  TDirectory* tmp = gDirectory;
85 
86  dir->cd();
87 
88  TObjString("PredictionNoOsc").Write("type");
89 
90  fSpectrum.SaveTo(dir->mkdir("spect"));
91  fSpectrumNC.SaveTo(dir->mkdir("spect_nc"));
92  fSpectrumNumu.SaveTo(dir->mkdir("spect_numu"));
93  fSpectrumNumubar.SaveTo(dir->mkdir("spect_numubar"));
94  fSpectrumNue.SaveTo(dir->mkdir("spect_nue"));
95  fSpectrumNuebar.SaveTo(dir->mkdir("spect_nuebar"));
96 
97  tmp->cd();
98  }
99 
100  //----------------------------------------------------------------------
101  std::unique_ptr<PredictionNoOsc> PredictionNoOsc::LoadFrom(TDirectory* dir)
102  {
103  PredictionNoOsc* ret = new PredictionNoOsc(
104  *ana::LoadFrom<Spectrum>(dir->GetDirectory("spect")),
105  *ana::LoadFrom<Spectrum>(dir->GetDirectory("spect_nc")),
106  *ana::LoadFrom<Spectrum>(dir->GetDirectory("spect_numu")),
107  *ana::LoadFrom<Spectrum>(dir->GetDirectory("spect_numubar")),
108  *ana::LoadFrom<Spectrum>(dir->GetDirectory("spect_nue")),
109  *ana::LoadFrom<Spectrum>(dir->GetDirectory("spect_nuebar")));
110 
111  // Can't use make_unique because constructor is protected
112  return std::unique_ptr<PredictionNoOsc>(ret);
113  }
114 }
const Cut kIsNumuCC(CCFlavSel(14, 14))
Select CC .
const Cut kIsNC([](const caf::SRSliceProxy *slc){return kHasMatchedNu(slc)&&slc->truth.isnc;})
Is this a Neutral Current event?
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:18
Antineutrinos-only.
Definition: IPrediction.h:49
tuple loader
Definition: demo.py:7
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:16
(&#39;beam &#39;)
Definition: IPrediction.h:14
const Cut kIsBeamNue(CCFlavSel(12, 12))
Select CC .
process_name opflashCryoW ana
shift
Definition: fcl_checks.sh:26
virtual void SaveTo(TDirectory *dir) const override
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:30
static std::unique_ptr< PredictionNoOsc > LoadFrom(TDirectory *dir)
Charged-current interactions.
Definition: IPrediction.h:38
Interactions of both types.
Definition: IPrediction.h:41
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 *) const override
Neutrinos-only.
Definition: IPrediction.h:48
(&#39; survival&#39;)
Definition: IPrediction.h:18
tuple dir
Definition: dropbox.py:28
Base class for the various types of spectrum loader.
int sign(double val)
Definition: UtilFunc.cxx:104
PredictionNoOsc(SpectrumLoaderBase &loader, const HistAxis &axis, const SpillCut &spillcut, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted)
Neutral-current interactions.
Definition: IPrediction.h:39
Both neutrinos and antineutrinos.
Definition: IPrediction.h:51
All neutrinos, any flavor.
Definition: IPrediction.h:25
const Cut kIsAntiNu([](const caf::SRSliceProxy *slc){return kHasMatchedNu(slc)&&slc->truth.pdg< 0;})
Is this truly an antineutrino?
Prediction that wraps a simple Spectrum.
void SaveTo(TDirectory *dir) const