All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PredictionExtrap.cxx
Go to the documentation of this file.
2 
5 
6 #include "TDirectory.h"
7 #include "TObjString.h"
8 #include "TH1D.h"
9 
10 namespace ana
11 {
12  //----------------------------------------------------------------------
14  : fExtrap(extrap)
15  {
16  }
17 
18  //----------------------------------------------------------------------
20  {
21  // delete fExtrap;
22  }
23 
24  //----------------------------------------------------------------------
26  {
27  return PredictComponent(calc,
30  Sign::kBoth);
31  }
32 
33  //----------------------------------------------------------------------
35  Flavors::Flavors_t flav,
36  Current::Current_t curr,
37  Sign::Sign_t sign) const
38  {
39  // Get binning
40  Spectrum ret = fExtrap->NCComponentFromNumu().Oscillated(calc, 14, 0);
41  ret.Clear();
42 
43  if(curr & Current::kCC){
44  if(flav & Flavors::kNuEToNuE && sign & Sign::kNu) {
45  ret += fExtrap->NueSurvComponent(). Oscillated(calc, +12, +12);
46  }
47  if(flav & Flavors::kNuEToNuE && sign & Sign::kAntiNu) ret += fExtrap->AntiNueSurvComponent().Oscillated(calc, -12, -12);
48 
49  if(flav & Flavors::kNuEToNuMu && sign & Sign::kNu) ret += fExtrap->NumuAppComponent(). Oscillated(calc, +12, +14);
50  if(flav & Flavors::kNuEToNuMu && sign & Sign::kAntiNu) ret += fExtrap->AntiNumuAppComponent().Oscillated(calc, -12, -14);
51 
52  if(flav & Flavors::kNuEToNuTau && sign & Sign::kNu) ret += fExtrap->TauFromEComponent(). Oscillated(calc, +12, +16);
53  if(flav & Flavors::kNuEToNuTau && sign & Sign::kAntiNu) ret += fExtrap->AntiTauFromEComponent().Oscillated(calc, -12, -16);
54 
55  if(flav & Flavors::kNuMuToNuE && sign & Sign::kNu) ret += fExtrap->NueAppComponent(). Oscillated(calc, +14, +12);
56  if(flav & Flavors::kNuMuToNuE && sign & Sign::kAntiNu) ret += fExtrap->AntiNueAppComponent().Oscillated(calc, -14, -12);
57 
58  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kNu) ret += fExtrap->NumuSurvComponent(). Oscillated(calc, +14, +14);
59  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kAntiNu) ret += fExtrap->AntiNumuSurvComponent().Oscillated(calc, -14, -14);
60 
61  if(flav & Flavors::kNuMuToNuTau && sign & Sign::kNu) ret += fExtrap->TauFromMuComponent(). Oscillated(calc, +14, +16);
62  if(flav & Flavors::kNuMuToNuTau && sign & Sign::kAntiNu) ret += fExtrap->AntiTauFromMuComponent().Oscillated(calc, -14, -16);
63  }
64  if(curr & Current::kNC){
65  assert(flav == Flavors::kAll); // Don't know how to calculate anything else
66  assert(sign == Sign::kBoth); // Why would you want to split NCs out by sign?
67 
68  ret += fExtrap->NCComponentFromNumu().Oscillated(calc, 14, 0);
69  ret += fExtrap->NCComponentFromNue().Oscillated(calc, 12, 0);
70  }
71 
72  return ret;
73  }
74 
75  //----------------------------------------------------------------------
77  {
78  if(from == +12 && to == +12) return fExtrap->NueSurvComponent();
79  if(from == -12 && to == -12) return fExtrap->AntiNueSurvComponent();
80 
81  if(from == +12 && to == +14) return fExtrap->NumuAppComponent();
82  if(from == -12 && to == -14) return fExtrap->AntiNumuAppComponent();
83 
84  if(from == +12 && to == +16) return fExtrap->TauFromEComponent();
85  if(from == -12 && to == -16) return fExtrap->AntiTauFromEComponent();
86 
87  if(from == +14 && to == +12) return fExtrap->NueAppComponent();
88  if(from == -14 && to == -12) return fExtrap->AntiNueAppComponent();
89 
90  if(from == +14 && to == +14) return fExtrap->NumuSurvComponent();
91  if(from == -14 && to == -14) return fExtrap->AntiNumuSurvComponent();
92 
93  if(from == +14 && to == +16) return fExtrap->TauFromMuComponent();
94  if(from == -14 && to == -16) return fExtrap->AntiTauFromMuComponent();
95 
96  assert(0 && "Not reached");
97  }
98 
99  //----------------------------------------------------------------------
100  // Spectrum PredictionExtrap::ComponentNC() const
101  // {
102  // return fExtrap->NCComponent();
103  // }
104 
105  //----------------------------------------------------------------------
106  void PredictionExtrap::SaveTo(TDirectory* dir) const
107  {
108  TDirectory* tmp = gDirectory;
109 
110  dir->cd();
111 
112  TObjString("PredictionExtrap").Write("type");
113 
114  fExtrap->SaveTo(dir->mkdir("extrap"));
115 
116  tmp->cd();
117  }
118 
119  //----------------------------------------------------------------------
120  std::unique_ptr<PredictionExtrap> PredictionExtrap::LoadFrom(TDirectory* dir)
121  {
122  assert(dir->GetDirectory("extrap"));
123  IExtrap* extrap = ana::LoadFrom<IExtrap>(dir->GetDirectory("extrap")).release();
124 
125  return std::unique_ptr<PredictionExtrap>(new PredictionExtrap(extrap));
126  }
127 }
virtual OscillatableSpectrum AntiNumuAppComponent()=0
Charged current muon antineutrino appearance ( )
virtual void SaveTo(TDirectory *dir) const override
virtual OscillatableSpectrum TauFromMuComponent()=0
Charged current tau neutrino appearance from muon neutrino ( )
Antineutrinos-only.
Definition: IPrediction.h:49
(&#39; appearance&#39;)
Definition: IPrediction.h:17
virtual OscillatableSpectrum NumuAppComponent()=0
Charged current muon neutrino appearance ( )
virtual OscillatableSpectrum AntiNumuSurvComponent()=0
Charged current muon antineutrino survival ( )
(&#39;beam &#39;)
Definition: IPrediction.h:14
std::unique_ptr< IExtrap > LoadFrom< IExtrap >(TDirectory *dir)
Definition: IExtrap.cxx:17
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
virtual OscillatableSpectrum AntiNueSurvComponent()=0
Charged current electron antineutrino survival ( )
virtual OscillatableSpectrum NCComponentFromNue()=0
process_name opflashCryoW ana
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:30
virtual OscillatableSpectrum NueSurvComponent()=0
Charged current electron neutrino survival ( )
Charged-current interactions.
Definition: IPrediction.h:38
Interactions of both types.
Definition: IPrediction.h:41
virtual OscillatableSpectrum AntiNueAppComponent()=0
Charged current electron antineutrino appearance ( )
virtual OscillatableSpectrum TauFromEComponent()=0
Charged current tau neutrino appearance from electron neutrino ( )
virtual OscillatableSpectrum NueAppComponent()=0
Charged current electron neutrino appearance ( )
Neutrinos-only.
Definition: IPrediction.h:48
(&#39; survival&#39;)
Definition: IPrediction.h:18
tuple dir
Definition: dropbox.py:28
int sign(double val)
Definition: UtilFunc.cxx:104
virtual void SaveTo(TDirectory *dir) const
Definition: IExtrap.cxx:31
virtual OscillatableSpectrum AntiTauFromMuComponent()=0
Charged current tau antineutrino appearance from muon antineutrino ( )
Spectrum Oscillated(osc::IOscCalc *calc, int from, int to) const
Interface to extrapolation procedures.
Definition: IExtrap.h:8
virtual OscillatableSpectrum AntiTauFromEComponent()=0
Charged current tau antineutrino appearance from electron antineutrino ( )
OscillatableSpectrum ComponentCC(int from, int to) const override
virtual OscillatableSpectrum NCComponentFromNumu()=0
Neutral currents.
Neutral-current interactions.
Definition: IPrediction.h:39
Both neutrinos and antineutrinos.
Definition: IPrediction.h:51
All neutrinos, any flavor.
Definition: IPrediction.h:25
(&#39; appearance&#39;)
Definition: IPrediction.h:15
static std::unique_ptr< PredictionExtrap > LoadFrom(TDirectory *dir)
Spectrum with true energy information, allowing it to be oscillated
virtual Spectrum Predict(osc::IOscCalc *calc) const override
virtual OscillatableSpectrum NumuSurvComponent()=0
Charged current muon neutrino survival ( )