FDPredictionSterile.cxx
Go to the documentation of this file.
2 
5 #include "CAFAna/Core/Ratio.h"
11 #include "OscLib/IOscCalcSterile.h"
12 
13 #include "TDirectory.h"
14 #include "TH1.h"
15 #include "TH2.h"
16 #include "TObjString.h"
17 
18 namespace ana
19 {
20  REGISTER_LOADFROM("FDPredictionSterile", IPrediction, FDPredictionSterile);
21 
22  //----------------------------------------------------------------------
24  : fFDExtrap(extrap)
25  {
26  }
27 
28  //----------------------------------------------------------------------
30  {
31  if (fFDExtrap) delete fFDExtrap;
32  }
33 
34  //----------------------------------------------------------------------
36  {
37 
39  if (noosc) {
40  Spectrum ret = fFDExtrap->NueCCSurvComponent() .Oscillated(noosc, +12, +12);
41  ret += fFDExtrap->AntiNueCCSurvComponent() .Oscillated(noosc, -12, -12);
42  ret += fFDExtrap->NumuCCAppComponent() .Oscillated(noosc, +12, +14);
43  ret += fFDExtrap->AntiNumuCCAppComponent() .Oscillated(noosc, -12, -14);
44  ret += fFDExtrap->NumuCCSurvComponent() .Oscillated(noosc, +14, +14);
45  ret += fFDExtrap->AntiNumuCCSurvComponent().Oscillated(noosc, -14, -14);
46  ret += fFDExtrap->NueCCAppComponent() .Oscillated(noosc, +14, +12);
47  ret += fFDExtrap->AntiNueCCAppComponent() .Oscillated(noosc, -14, -12);
48  ret += fFDExtrap->TauCCAppComponent() .Oscillated(noosc, +14, +16);
49  ret += fFDExtrap->AntiTauCCAppComponent() .Oscillated(noosc, -14, -16);
50  ret += fFDExtrap->ETauCCAppComponent() .Oscillated(noosc, +12, +16);
51  ret += fFDExtrap->EAntiTauCCAppComponent() .Oscillated(noosc, -12, -16);
52  ret += fFDExtrap->NueNCComponent() .Oscillated(noosc, +12, 0);
53  ret += fFDExtrap->NumuNCComponent() .Oscillated(noosc, +14, 0);
54  ret += fFDExtrap->TauNCComponent() .Oscillated(noosc, +16, 0);
55  ret += fFDExtrap->AntiNueNCComponent() .Oscillated(noosc, -12, 0);
56  ret += fFDExtrap->AntiNumuNCComponent() .Oscillated(noosc, -14, 0);
57  ret += fFDExtrap->AntiTauNCComponent() .Oscillated(noosc, -16, 0);
58 
59  return ret;
60  }
61 
63 
64  Spectrum ret = fFDExtrap->NueCCSurvComponent() .Oscillated(scalc, +12, +12);
65  ret += fFDExtrap->AntiNueCCSurvComponent() .Oscillated(scalc, -12, -12);
66  ret += fFDExtrap->NumuCCAppComponent() .Oscillated(scalc, +12, +14);
67  ret += fFDExtrap->AntiNumuCCAppComponent() .Oscillated(scalc, -12, -14);
68  ret += fFDExtrap->NumuCCSurvComponent() .Oscillated(scalc, +14, +14);
69  ret += fFDExtrap->AntiNumuCCSurvComponent().Oscillated(scalc, -14, -14);
70  ret += fFDExtrap->NueCCAppComponent() .Oscillated(scalc, +14, +12);
71  ret += fFDExtrap->AntiNueCCAppComponent() .Oscillated(scalc, -14, -12);
72  ret += fFDExtrap->TauCCAppComponent() .Oscillated(scalc, +14, +16);
73  ret += fFDExtrap->AntiTauCCAppComponent() .Oscillated(scalc, -14, -16);
74  ret += fFDExtrap->ETauCCAppComponent() .Oscillated(scalc, +12, +16);
75  ret += fFDExtrap->EAntiTauCCAppComponent() .Oscillated(scalc, -12, -16);
76  ret += fFDExtrap->NueNCComponent() .Oscillated(scalc, +12, 0);
77  ret += fFDExtrap->NumuNCComponent() .Oscillated(scalc, +14, 0);
78  ret += fFDExtrap->TauNCComponent() .Oscillated(scalc, +16, 0);
79  ret += fFDExtrap->AntiNueNCComponent() .Oscillated(scalc, -12, 0);
80  ret += fFDExtrap->AntiNumuNCComponent() .Oscillated(scalc, -14, 0);
81  ret += fFDExtrap->AntiTauNCComponent() .Oscillated(scalc, -16, 0);
82 
83  return ret;
84  }
85 
86  //----------------------------------------------------------------------
88  Flavors::Flavors_t flav,
90  Sign::Sign_t sign) const
91  {
92 
94  ret.Clear();
95 
97  if (noosc) {
98  if(curr & Current::kCC){
99  if(flav & Flavors::kNuEToNuE && sign & Sign::kNu) ret += fFDExtrap->NueCCSurvComponent() .Oscillated(noosc, +12, +12);
100  if(flav & Flavors::kNuEToNuE && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNueCCSurvComponent() .Oscillated(noosc, -12, -12);
101 
102  if(flav & Flavors::kNuEToNuMu && sign & Sign::kNu) ret += fFDExtrap->NumuCCAppComponent() .Oscillated(noosc, +12, +14);
103  if(flav & Flavors::kNuEToNuMu && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNumuCCAppComponent() .Oscillated(noosc, -12, -14);
104 
105  if(flav & Flavors::kNuMuToNuE && sign & Sign::kNu) ret += fFDExtrap->NueCCAppComponent() .Oscillated(noosc, +14, +12);
106  if(flav & Flavors::kNuMuToNuE && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNueCCAppComponent() .Oscillated(noosc, -14, -12);
107 
108  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kNu) ret += fFDExtrap->NumuCCSurvComponent() .Oscillated(noosc, +14, +14);
109  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNumuCCSurvComponent().Oscillated(noosc, -14, -14);
110 
111  if(flav & Flavors::kNuMuToNuTau && sign & Sign::kNu) ret += fFDExtrap->TauCCAppComponent() .Oscillated(noosc, +14, +16);
112  if(flav & Flavors::kNuMuToNuTau && sign & Sign::kAntiNu) ret += fFDExtrap->AntiTauCCAppComponent() .Oscillated(noosc, -14, -16);
113 
114  if(flav & Flavors::kNuEToNuTau && sign & Sign::kNu) ret += fFDExtrap->ETauCCAppComponent() .Oscillated(noosc, +12, +16);
115  if(flav & Flavors::kNuEToNuTau && sign & Sign::kAntiNu) ret += fFDExtrap->EAntiTauCCAppComponent() .Oscillated(noosc, -12, -16);
116  }
117 
118  if(curr & Current::kNC) {
119  ret += fFDExtrap->NueNCComponent() .Oscillated(noosc, +12, 0);
120  ret += fFDExtrap->AntiNueNCComponent() .Oscillated(noosc, -12, 0);
121  ret += fFDExtrap->NumuNCComponent() .Oscillated(noosc, +14, 0);
122  ret += fFDExtrap->AntiNumuNCComponent().Oscillated(noosc, -14, 0);
123  ret += fFDExtrap->TauNCComponent() .Oscillated(noosc, +16, 0);
124  ret += fFDExtrap->AntiTauNCComponent() .Oscillated(noosc, -16, 0);
125  }
126  return ret;
127  }
128 
130  if(scalc) {
131  if(curr & Current::kCC){
132  if(flav & Flavors::kNuEToNuE && sign & Sign::kNu) ret += fFDExtrap->NueCCSurvComponent() .Oscillated(scalc, +12, +12);
133  if(flav & Flavors::kNuEToNuE && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNueCCSurvComponent() .Oscillated(scalc, -12, -12);
134 
135  if(flav & Flavors::kNuEToNuMu && sign & Sign::kNu) ret += fFDExtrap->NumuCCAppComponent() .Oscillated(scalc, +12, +14);
136  if(flav & Flavors::kNuEToNuMu && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNumuCCAppComponent() .Oscillated(scalc, -12, -14);
137 
138  if(flav & Flavors::kNuMuToNuE && sign & Sign::kNu) ret += fFDExtrap->NueCCAppComponent() .Oscillated(scalc, +14, +12);
139  if(flav & Flavors::kNuMuToNuE && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNueCCAppComponent() .Oscillated(scalc, -14, -12);
140 
141  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kNu) ret += fFDExtrap->NumuCCSurvComponent() .Oscillated(scalc, +14, +14);
142  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNumuCCSurvComponent().Oscillated(scalc, -14, -14);
143 
144  if(flav & Flavors::kNuEToNuTau && sign & Sign::kNu) ret += fFDExtrap->ETauCCAppComponent() .Oscillated(scalc, +12, +16);
145  if(flav & Flavors::kNuEToNuTau && sign & Sign::kAntiNu) ret += fFDExtrap->EAntiTauCCAppComponent() .Oscillated(scalc, -12, -16);
146 
147  if(flav & Flavors::kNuMuToNuTau && sign & Sign::kNu) ret += fFDExtrap->TauCCAppComponent() .Oscillated(scalc, +14, +16);
148  if(flav & Flavors::kNuMuToNuTau && sign & Sign::kAntiNu) ret += fFDExtrap->AntiTauCCAppComponent() .Oscillated(scalc, -14, -16);
149  }
150 
151  if(curr & Current::kNC) {
152  if(flav & Flavors::kNuEToNuE && sign & Sign::kNu) ret += fFDExtrap->NueNCComponent() .Oscillated(scalc, +12, 0);
153  if(flav & Flavors::kNuEToNuE && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNueNCComponent() .Oscillated(scalc, -12, 0);
154  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kNu) ret += fFDExtrap->NumuNCComponent() .Oscillated(scalc, +14, 0);
155  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNumuNCComponent().Oscillated(scalc, -14, 0);
156  if(flav & Flavors::kAllNuTau && sign & Sign::kNu) ret += fFDExtrap->TauNCComponent() .Oscillated(scalc, +16, 0);
157  if(flav & Flavors::kAllNuTau && sign & Sign::kAntiNu) ret += fFDExtrap->AntiTauNCComponent() .Oscillated(scalc, -16, 0);
158  }
159  }
160  else {
161  std::cerr << "NDPredExtrap: Input calculator was not of type IOscCalcSterile." << std::endl;
162  }
163 
164  return ret;
165  }
166 
167  //----------------------------------------------------------------------
169  {
170  return Predict(calc).FakeData(POT);
171  }
172 
173  //----------------------------------------------------------------------
174  void FDPredictionSterile::SaveTo(TDirectory* dir, const std::string& name) const
175  {
176  TDirectory* tmp = gDirectory;
177 
178  dir = dir->mkdir(name.c_str()); // switch to subdir
179  dir->cd();
180 
181  TObjString("FDPredictionSterile").Write("type");
182  fFDExtrap->SaveTo(dir, "fdextrap");
183 
184  dir->Write();
185  delete dir;
186 
187  tmp->cd();
188  }
189 
190  //----------------------------------------------------------------------
191  std::unique_ptr<FDPredictionSterile> FDPredictionSterile::LoadFrom(TDirectory* dir, const std::string& name)
192  {
193  dir = dir->GetDirectory(name.c_str()); // switch to subdir
194  assert(dir);
195 
196  FDExtrap* extrap = ana::LoadFrom<FDExtrap>(dir, "fdextrap").release();
197 
198  delete dir;
199 
200  return std::unique_ptr<FDPredictionSterile>(new FDPredictionSterile(extrap));
201  }
202 
203 } // end of namespace
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
const XML_Char * name
Definition: expat.h:151
Pass neutrinos through unchanged.
Definition: IOscCalc.h:45
OscillatableSpectrum TauNCComponent()
Definition: FDExtrap.cxx:141
static std::unique_ptr< FDPredictionSterile > LoadFrom(TDirectory *dir, const std::string &name)
Spectrum NCComponent()
Definition: FDExtrap.cxx:59
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
Antineutrinos-only.
Definition: IPrediction.h:50
OscillatableSpectrum AntiTauCCAppComponent()
Definition: FDExtrap.cxx:111
(&#39; appearance&#39;)
Definition: IPrediction.h:18
OscillatableSpectrum NueCCSurvComponent()
Definition: FDExtrap.cxx:65
const IOscCalcSterile * DowncastToSterile(const IOscCalc *calc, bool quiet)
OscillatableSpectrum AntiNumuCCAppComponent()
Definition: FDExtrap.cxx:83
(&#39;beam &#39;)
Definition: IPrediction.h:15
OscillatableSpectrum EAntiTauCCAppComponent()
Definition: FDExtrap.cxx:121
OStream cerr
Definition: OStream.cxx:7
void Clear()
Definition: Spectrum.cxx:389
Float_t tmp
Definition: plot.C:36
OscillatableSpectrum AntiNumuCCSurvComponent()
Definition: FDExtrap.cxx:95
osc::OscCalcDumb calc
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:39
OscillatableSpectrum AntiNumuNCComponent()
Definition: FDExtrap.cxx:151
Charged-current interactions.
Definition: IPrediction.h:39
OscillatableSpectrum NumuCCSurvComponent()
Definition: FDExtrap.cxx:89
Spectrum FakeData(double pot) const
Synonymous with AsimovData(). Retained for compatibility.
Definition: Spectrum.cxx:377
OscillatableSpectrum TauCCAppComponent()
Definition: FDExtrap.cxx:106
virtual void SaveTo(TDirectory *dir, const std::string &name) const
Definition: FDExtrap.cxx:196
OscillatableSpectrum NumuCCAppComponent()
Definition: FDExtrap.cxx:77
OscillatableSpectrum AntiNueNCComponent()
Definition: FDExtrap.cxx:146
OscillatableSpectrum AntiNueCCSurvComponent()
Definition: FDExtrap.cxx:71
virtual Spectrum FakeData(osc::IOscCalc *calc, double POT)
base class for sterile oscillation calculators In the context of a sterile oscillation calculator...
osc::NoOscillations noosc
Definition: NueSystFuncs.h:44
OscillatableSpectrum NueNCComponent()
Definition: FDExtrap.cxx:131
Neutrinos-only.
Definition: IPrediction.h:49
(&#39; survival&#39;)
Definition: IPrediction.h:19
std::vector< double > POT
Spectrum Oscillated(osc::IOscCalc *calc, int from, int to) const
TDirectory * dir
Definition: macro.C:5
REGISTER_LOADFROM("BENDecomp", IDecomp, BENDecomp)
OscillatableSpectrum ETauCCAppComponent()
Definition: FDExtrap.cxx:116
OscillatableSpectrum AntiNueCCAppComponent()
Definition: FDExtrap.cxx:126
Neutral-current interactions.
Definition: IPrediction.h:40
assert(nhit_max >=nhit_nbins)
OscillatableSpectrum NueCCAppComponent()
Definition: FDExtrap.cxx:101
(&#39; appearance&#39;)
Definition: IPrediction.h:16
virtual Spectrum Predict(osc::IOscCalc *calc) const override
OscillatableSpectrum NumuNCComponent()
Definition: FDExtrap.cxx:136
def sign(x)
Definition: canMan.py:197
OscillatableSpectrum AntiTauNCComponent()
Definition: FDExtrap.cxx:156
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
enum BeamMode string