FDPredictionSterile.cxx
Go to the documentation of this file.
2 
4 #include "CAFAna/Core/Ratio.h"
10 #include "OscLib/IOscCalc.h"
11 #include "OscLib/OscCalcSterile.h"
12 
13 #include "TDirectory.h"
14 #include "TH1.h"
15 #include "TH2.h"
16 #include "TObjString.h"
17 
18 namespace ana
19 {
20  //----------------------------------------------------------------------
22  : fFDExtrap(extrap)
23  {
24  }
25 
26  //----------------------------------------------------------------------
28  {
29  if (fFDExtrap) delete fFDExtrap;
30  }
31 
32  //----------------------------------------------------------------------
34  {
35 
37  if (noosc) {
38  Spectrum ret = fFDExtrap->NueCCSurvComponent() .Oscillated(noosc, +12, +12);
39  ret += fFDExtrap->AntiNueCCSurvComponent() .Oscillated(noosc, -12, -12);
40  ret += fFDExtrap->NumuCCAppComponent() .Oscillated(noosc, +12, +14);
41  ret += fFDExtrap->AntiNumuCCAppComponent() .Oscillated(noosc, -12, -14);
42  ret += fFDExtrap->NumuCCSurvComponent() .Oscillated(noosc, +14, +14);
43  ret += fFDExtrap->AntiNumuCCSurvComponent().Oscillated(noosc, -14, -14);
44  ret += fFDExtrap->NueCCAppComponent() .Oscillated(noosc, +14, +12);
45  ret += fFDExtrap->AntiNueCCAppComponent() .Oscillated(noosc, -14, -12);
46  ret += fFDExtrap->TauCCAppComponent() .Oscillated(noosc, +14, +16);
47  ret += fFDExtrap->AntiTauCCAppComponent() .Oscillated(noosc, -14, -16);
48  ret += fFDExtrap->ETauCCAppComponent() .Oscillated(noosc, +12, +16);
49  ret += fFDExtrap->EAntiTauCCAppComponent() .Oscillated(noosc, -12, -16);
50  ret += fFDExtrap->NueNCComponent() .Oscillated(noosc, +12, 0);
51  ret += fFDExtrap->NumuNCComponent() .Oscillated(noosc, +14, 0);
52  ret += fFDExtrap->TauNCComponent() .Oscillated(noosc, +16, 0);
53  ret += fFDExtrap->AntiNueNCComponent() .Oscillated(noosc, -12, 0);
54  ret += fFDExtrap->AntiNumuNCComponent() .Oscillated(noosc, -14, 0);
55  ret += fFDExtrap->AntiTauNCComponent() .Oscillated(noosc, -16, 0);
56 
57  return ret;
58  }
59 
61 
62  Spectrum ret = fFDExtrap->NueCCSurvComponent() .Oscillated(scalc, +12, +12);
63  ret += fFDExtrap->AntiNueCCSurvComponent() .Oscillated(scalc, -12, -12);
64  ret += fFDExtrap->NumuCCAppComponent() .Oscillated(scalc, +12, +14);
65  ret += fFDExtrap->AntiNumuCCAppComponent() .Oscillated(scalc, -12, -14);
66  ret += fFDExtrap->NumuCCSurvComponent() .Oscillated(scalc, +14, +14);
67  ret += fFDExtrap->AntiNumuCCSurvComponent().Oscillated(scalc, -14, -14);
68  ret += fFDExtrap->NueCCAppComponent() .Oscillated(scalc, +14, +12);
69  ret += fFDExtrap->AntiNueCCAppComponent() .Oscillated(scalc, -14, -12);
70  ret += fFDExtrap->TauCCAppComponent() .Oscillated(scalc, +14, +16);
71  ret += fFDExtrap->AntiTauCCAppComponent() .Oscillated(scalc, -14, -16);
72  ret += fFDExtrap->ETauCCAppComponent() .Oscillated(scalc, +12, +16);
73  ret += fFDExtrap->EAntiTauCCAppComponent() .Oscillated(scalc, -12, -16);
74  ret += fFDExtrap->NueNCComponent() .Oscillated(scalc, +12, 0);
75  ret += fFDExtrap->NumuNCComponent() .Oscillated(scalc, +14, 0);
76  ret += fFDExtrap->TauNCComponent() .Oscillated(scalc, +16, 0);
77  ret += fFDExtrap->AntiNueNCComponent() .Oscillated(scalc, -12, 0);
78  ret += fFDExtrap->AntiNumuNCComponent() .Oscillated(scalc, -14, 0);
79  ret += fFDExtrap->AntiTauNCComponent() .Oscillated(scalc, -16, 0);
80 
81  return ret;
82  }
83 
84  //----------------------------------------------------------------------
86  Flavors::Flavors_t flav,
88  Sign::Sign_t sign) const
89  {
90 
92  ret.Clear();
93 
95  if (noosc) {
96  if(curr & Current::kCC){
97  if(flav & Flavors::kNuEToNuE && sign & Sign::kNu) ret += fFDExtrap->NueCCSurvComponent() .Oscillated(noosc, +12, +12);
98  if(flav & Flavors::kNuEToNuE && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNueCCSurvComponent() .Oscillated(noosc, -12, -12);
99 
100  if(flav & Flavors::kNuEToNuMu && sign & Sign::kNu) ret += fFDExtrap->NumuCCAppComponent() .Oscillated(noosc, +12, +14);
101  if(flav & Flavors::kNuEToNuMu && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNumuCCAppComponent() .Oscillated(noosc, -12, -14);
102 
103  if(flav & Flavors::kNuMuToNuE && sign & Sign::kNu) ret += fFDExtrap->NueCCAppComponent() .Oscillated(noosc, +14, +12);
104  if(flav & Flavors::kNuMuToNuE && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNueCCAppComponent() .Oscillated(noosc, -14, -12);
105 
106  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kNu) ret += fFDExtrap->NumuCCSurvComponent() .Oscillated(noosc, +14, +14);
107  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNumuCCSurvComponent().Oscillated(noosc, -14, -14);
108 
109  if(flav & Flavors::kNuMuToNuTau && sign & Sign::kNu) ret += fFDExtrap->TauCCAppComponent() .Oscillated(noosc, +14, +16);
110  if(flav & Flavors::kNuMuToNuTau && sign & Sign::kAntiNu) ret += fFDExtrap->AntiTauCCAppComponent() .Oscillated(noosc, -14, -16);
111 
112  if(flav & Flavors::kNuEToNuTau && sign & Sign::kNu) ret += fFDExtrap->ETauCCAppComponent() .Oscillated(noosc, +12, +16);
113  if(flav & Flavors::kNuEToNuTau && sign & Sign::kAntiNu) ret += fFDExtrap->EAntiTauCCAppComponent() .Oscillated(noosc, -12, -16);
114  }
115 
116  if(curr & Current::kNC) {
117  ret += fFDExtrap->NueNCComponent() .Oscillated(noosc, +12, 0);
118  ret += fFDExtrap->AntiNueNCComponent() .Oscillated(noosc, -12, 0);
119  ret += fFDExtrap->NumuNCComponent() .Oscillated(noosc, +14, 0);
120  ret += fFDExtrap->AntiNumuNCComponent().Oscillated(noosc, -14, 0);
121  ret += fFDExtrap->TauNCComponent() .Oscillated(noosc, +16, 0);
122  ret += fFDExtrap->AntiTauNCComponent() .Oscillated(noosc, -16, 0);
123  }
124  return ret;
125  }
126 
128  if(scalc) {
129  if(curr & Current::kCC){
130  if(flav & Flavors::kNuEToNuE && sign & Sign::kNu) ret += fFDExtrap->NueCCSurvComponent() .Oscillated(scalc, +12, +12);
131  if(flav & Flavors::kNuEToNuE && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNueCCSurvComponent() .Oscillated(scalc, -12, -12);
132 
133  if(flav & Flavors::kNuEToNuMu && sign & Sign::kNu) ret += fFDExtrap->NumuCCAppComponent() .Oscillated(scalc, +12, +14);
134  if(flav & Flavors::kNuEToNuMu && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNumuCCAppComponent() .Oscillated(scalc, -12, -14);
135 
136  if(flav & Flavors::kNuMuToNuE && sign & Sign::kNu) ret += fFDExtrap->NueCCAppComponent() .Oscillated(scalc, +14, +12);
137  if(flav & Flavors::kNuMuToNuE && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNueCCAppComponent() .Oscillated(scalc, -14, -12);
138 
139  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kNu) ret += fFDExtrap->NumuCCSurvComponent() .Oscillated(scalc, +14, +14);
140  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNumuCCSurvComponent().Oscillated(scalc, -14, -14);
141 
142  if(flav & Flavors::kNuEToNuTau && sign & Sign::kNu) ret += fFDExtrap->ETauCCAppComponent() .Oscillated(scalc, +12, +16);
143  if(flav & Flavors::kNuEToNuTau && sign & Sign::kAntiNu) ret += fFDExtrap->EAntiTauCCAppComponent() .Oscillated(scalc, -12, -16);
144 
145  if(flav & Flavors::kNuMuToNuTau && sign & Sign::kNu) ret += fFDExtrap->TauCCAppComponent() .Oscillated(scalc, +14, +16);
146  if(flav & Flavors::kNuMuToNuTau && sign & Sign::kAntiNu) ret += fFDExtrap->AntiTauCCAppComponent() .Oscillated(scalc, -14, -16);
147  }
148 
149  if(curr & Current::kNC) {
150  if(flav & Flavors::kNuEToNuE && sign & Sign::kNu) ret += fFDExtrap->NueNCComponent() .Oscillated(scalc, +12, 0);
151  if(flav & Flavors::kNuEToNuE && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNueNCComponent() .Oscillated(scalc, -12, 0);
152  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kNu) ret += fFDExtrap->NumuNCComponent() .Oscillated(scalc, +14, 0);
153  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kAntiNu) ret += fFDExtrap->AntiNumuNCComponent().Oscillated(scalc, -14, 0);
154  if(flav & Flavors::kAllNuTau && sign & Sign::kNu) ret += fFDExtrap->TauNCComponent() .Oscillated(scalc, +16, 0);
155  if(flav & Flavors::kAllNuTau && sign & Sign::kAntiNu) ret += fFDExtrap->AntiTauNCComponent() .Oscillated(scalc, -16, 0);
156  }
157  }
158  else {
159  std::cerr << "NDPredExtrap: Input calculator was not of type OscCalcSterile." << std::endl;
160 
161  }
162 
163  return ret;
164  }
165 
166  //----------------------------------------------------------------------
168  {
169  return Predict(calc).FakeData(POT);
170  }
171 
172  //----------------------------------------------------------------------
173  void FDPredictionSterile::SaveTo(TDirectory* dir, const std::string& name) const
174  {
175  TDirectory* tmp = gDirectory;
176 
177  dir = dir->mkdir(name.c_str()); // switch to subdir
178  dir->cd();
179 
180  TObjString("FDPredictionSterile").Write("type");
181  fFDExtrap->SaveTo(dir, "fdextrap");
182 
183  dir->Write();
184  delete dir;
185 
186  tmp->cd();
187  }
188 
189  //----------------------------------------------------------------------
190  std::unique_ptr<FDPredictionSterile> FDPredictionSterile::LoadFrom(TDirectory* dir, const std::string& name)
191  {
192  dir = dir->GetDirectory(name.c_str()); // switch to subdir
193  assert(dir);
194 
195  FDExtrap* extrap = ana::LoadFrom<FDExtrap>(dir, "fdextrap").release();
196 
197  delete dir;
198 
199  return std::unique_ptr<FDPredictionSterile>(new FDPredictionSterile(extrap));
200  }
201 
202 } // 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:40
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
OscillatableSpectrum AntiNumuCCAppComponent()
Definition: FDExtrap.cxx:83
(&#39;beam &#39;)
Definition: IPrediction.h:15
General interface to oscillation calculators.
Definition: StanTypedefs.h:22
OscillatableSpectrum EAntiTauCCAppComponent()
Definition: FDExtrap.cxx:121
Adapt the PMNS_Sterile calculator to standard interface.
OStream cerr
Definition: OStream.cxx:7
void Clear()
Definition: Spectrum.cxx:372
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:40
OscillatableSpectrum AntiNumuNCComponent()
Definition: FDExtrap.cxx:151
Charged-current interactions.
Definition: IPrediction.h:39
OscillatableSpectrum NumuCCSurvComponent()
Definition: FDExtrap.cxx:89
Spectrum FakeData(double pot) const
Fake data is a MC spectrum scaled to the POT expected in the data.
Definition: Spectrum.cxx:341
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)
osc::NoOscillations noosc
Definition: NueSystFuncs.h:44
OscillatableSpectrum NueNCComponent()
Definition: FDExtrap.cxx:131
Neutrinos-only.
Definition: IPrediction.h:49
const OscCalcSterile * DowncastToSterile(const IOscCalc *calc)
(&#39; survival&#39;)
Definition: IPrediction.h:19
std::vector< double > POT
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
Spectrum Oscillated(osc::IOscCalc *calc, int from, int to) const
TDirectory * dir
Definition: macro.C:5
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