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