NDPredictionSterile.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  : fNDExtrap(extrap)
23  {
24  }
25 
26  //----------------------------------------------------------------------
28  {
29  if (fNDExtrap) delete fNDExtrap;
30  }
31 
32  //----------------------------------------------------------------------
34  {
35 
37  if (noosc) {
38  Spectrum ret = fNDExtrap->NueCCSurvComponent().Oscillated(noosc, +12, +12);
39  ret += fNDExtrap->AntiNueCCSurvComponent() .Oscillated(noosc, -12, -12);
40  Spectrum temp = ((NDOscillatableSpectrum)fNDExtrap->NumuCCAppComponent()).Oscillated(noosc, +12, +14);
41  if (temp.POT() > 0) ret += temp;
42  temp = ((NDOscillatableSpectrum)fNDExtrap->AntiNumuCCAppComponent()).Oscillated(noosc, -12, -14);
43  if (temp.POT() > 0) ret += temp;
44  ret += fNDExtrap->NumuCCSurvComponent() .Oscillated(noosc, +14, +14);
45  ret += fNDExtrap->AntiNumuCCSurvComponent() .Oscillated(noosc, -14, -14);
46  temp = ((NDOscillatableSpectrum)fNDExtrap->NueCCAppComponent()).Oscillated(noosc, +14, +12);
47  if (temp.POT() > 0) ret += temp;
48  temp = ((NDOscillatableSpectrum)fNDExtrap->AntiNueCCAppComponent()).Oscillated(noosc, -14, -12);
49  if (temp.POT() > 0) ret += temp;
50 
51  ret += fNDExtrap->NueNCComponent() .Oscillated(noosc, +12, 0);
52  ret += fNDExtrap->NumuNCComponent() .Oscillated(noosc, +14, 0);
53  ret += fNDExtrap->AntiNueNCComponent() .Oscillated(noosc, -12, 0);
54  ret += fNDExtrap->AntiNumuNCComponent().Oscillated(noosc, -14, 0);
55 
56  return ret;
57  }
58 
60 
61  Spectrum ret = fNDExtrap->NueCCSurvComponent().Oscillated(scalc, +12, +12);
62  ret += fNDExtrap->AntiNueCCSurvComponent() .Oscillated(scalc, -12, -12);
63 
64  Spectrum temp = ((NDOscillatableSpectrum)fNDExtrap->NumuCCAppComponent()).Oscillated(scalc, +12, +14);
65  if (temp.POT() > 0) ret += temp;
66 
67  temp = ((NDOscillatableSpectrum)fNDExtrap->AntiNumuCCAppComponent()).Oscillated(scalc, -12, -14);
68  if (temp.POT() > 0) ret += temp;
69 
70  ret += fNDExtrap->NumuCCSurvComponent() .Oscillated(scalc, +14, +14);
71  ret += fNDExtrap->AntiNumuCCSurvComponent() .Oscillated(scalc, -14, -14);
72 
73  temp = ((NDOscillatableSpectrum)fNDExtrap->NueCCAppComponent()).Oscillated(scalc, +14, +12);
74  if (temp.POT() > 0) ret += temp;
75 
76  temp = ((NDOscillatableSpectrum)fNDExtrap->AntiNueCCAppComponent()).Oscillated(scalc, -14, -12);
77  if (temp.POT() > 0) ret += temp;
78 
79  ret += fNDExtrap->NueNCComponent() .Oscillated(scalc, +12, 0);
80  ret += fNDExtrap->NumuNCComponent() .Oscillated(scalc, +14, 0);
81  ret += fNDExtrap->AntiNueNCComponent() .Oscillated(scalc, -12, 0);
82  ret += fNDExtrap->AntiNumuNCComponent().Oscillated(scalc, -14, 0);
83 
84  return ret;
85  }
86 
87  //----------------------------------------------------------------------
89  Flavors::Flavors_t flav,
91  Sign::Sign_t sign) const
92  {
93 
95  ret.Clear();
96 
98  if (noosc) {
99  if(curr & Current::kCC){
100  if(flav & Flavors::kNuEToNuE && sign & Sign::kNu) ret += fNDExtrap->NueCCSurvComponent() .Oscillated(noosc, +12, +12);
101  if(flav & Flavors::kNuEToNuE && sign & Sign::kAntiNu) ret += fNDExtrap->AntiNueCCSurvComponent() .Oscillated(noosc, -12, -12);
102 
103  if(flav & Flavors::kNuEToNuMu && sign & Sign::kNu) {
104  Spectrum temp = ((NDOscillatableSpectrum)fNDExtrap->NumuCCAppComponent()).Oscillated(noosc, +12, +14);
105  if (temp.POT() > 0) ret += temp;
106  }
107  if(flav & Flavors::kNuEToNuMu && sign & Sign::kAntiNu) {
108  Spectrum temp = ((NDOscillatableSpectrum)fNDExtrap->AntiNumuCCAppComponent()).Oscillated(noosc, -12, -14);
109  if (temp.POT() > 0) ret += temp;
110  }
111 
112  if(flav & Flavors::kNuMuToNuE && sign & Sign::kNu) {
113  Spectrum temp = ((NDOscillatableSpectrum)fNDExtrap->NueCCAppComponent()).Oscillated(noosc, +14, +12);
114  if (temp.POT() > 0) ret += temp;
115  }
116  if(flav & Flavors::kNuMuToNuE && sign & Sign::kAntiNu) {
117  Spectrum temp = ((NDOscillatableSpectrum)fNDExtrap->AntiNueCCAppComponent()).Oscillated(noosc, -14, -12);
118  if (temp.POT() > 0) ret += temp;
119  }
120 
121  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kNu) ret += fNDExtrap->NumuCCSurvComponent() .Oscillated(noosc, +14, +14);
122  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kAntiNu) ret += fNDExtrap->AntiNumuCCSurvComponent().Oscillated(noosc, -14, -14);
123  }
124 
125  if(curr & Current::kNC) {
126  ret += fNDExtrap->NueNCComponent() .Oscillated(noosc, +12, 0);
127  ret += fNDExtrap->AntiNueNCComponent() .Oscillated(noosc, -12, 0);
128  ret += fNDExtrap->NumuNCComponent() .Oscillated(noosc, +14, 0);
129  ret += fNDExtrap->AntiNumuNCComponent().Oscillated(noosc, -14, 0);
130  }
131  return ret;
132  }
133 
135  if(scalc) {
136  if(curr & Current::kCC){
137 
138  if(flav & Flavors::kNuEToNuE && sign & Sign::kNu) ret += fNDExtrap->NueCCSurvComponent() .Oscillated(scalc, +12, +12);
139  if(flav & Flavors::kNuEToNuE && sign & Sign::kAntiNu) ret += fNDExtrap->AntiNueCCSurvComponent() .Oscillated(scalc, -12, -12);
140 
141  if(flav & Flavors::kNuEToNuMu && sign & Sign::kNu) {
142  Spectrum temp = ((NDOscillatableSpectrum)fNDExtrap->NumuCCAppComponent()).Oscillated(scalc, +12, +14);
143  if (temp.POT() > 0) ret += temp;
144  }
145  if(flav & Flavors::kNuEToNuMu && sign & Sign::kAntiNu) {
146  Spectrum temp = ((NDOscillatableSpectrum)fNDExtrap->AntiNumuCCAppComponent()).Oscillated(scalc, -12, -14);
147  if (temp.POT() > 0) ret += temp;
148  }
149 
150  if(flav & Flavors::kNuMuToNuE && sign & Sign::kNu) {
151  Spectrum temp = ((NDOscillatableSpectrum)fNDExtrap->NueCCAppComponent()).Oscillated(scalc, +14, +12);
152  if (temp.POT() > 0) ret += temp;
153  }
154  if(flav & Flavors::kNuMuToNuE && sign & Sign::kAntiNu) {
155  Spectrum temp = ((NDOscillatableSpectrum)fNDExtrap->AntiNueCCAppComponent()).Oscillated(scalc, -14, -12);
156  if (temp.POT() > 0) ret += temp;
157  }
158 
159  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kNu) ret += fNDExtrap->NumuCCSurvComponent() .Oscillated(scalc, +14, +14);
160  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kAntiNu) ret += fNDExtrap->AntiNumuCCSurvComponent() .Oscillated(scalc, -14, -14);
161  }
162 
163  if(curr & Current::kNC) {
164 
165  if(flav & Flavors::kNuEToNuE && sign & Sign::kNu) ret += fNDExtrap->NueNCComponent() .Oscillated(scalc, +12, 0);
166  if(flav & Flavors::kNuEToNuE && sign & Sign::kAntiNu) ret += fNDExtrap->AntiNueNCComponent() .Oscillated(scalc, -12, 0);
167 
168  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kNu) ret += fNDExtrap->NumuNCComponent() .Oscillated(scalc, +14, 0);
169  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kAntiNu) ret += fNDExtrap->AntiNumuNCComponent().Oscillated(scalc, -14, 0);
170  }
171  }
172  else {
173  std::cerr << "NDPredExtrap: Input calculator was not of type OscCalcSterile." << std::endl;
174  }
175 
176  return ret;
177  }
178 
179  //----------------------------------------------------------------------
181  {
182  return Predict(calc).FakeData(POT);
183  }
184 
185  //----------------------------------------------------------------------
186  void NDPredictionSterile::SaveTo(TDirectory* dir, const std::string& name) const
187  {
188  TDirectory* tmp = gDirectory;
189 
190  dir = dir->mkdir(name.c_str()); // switch to subdir
191  dir->cd();
192 
193  TObjString("NDPredictionSterile").Write("type");
194  fNDExtrap->SaveTo(dir, "ndextrap");
195 
196  dir->Write();
197  delete dir;
198 
199  tmp->cd();
200  }
201 
202  //----------------------------------------------------------------------
203  std::unique_ptr<NDPredictionSterile> NDPredictionSterile::LoadFrom(TDirectory* dir, const std::string& name)
204  {
205  dir = dir->GetDirectory(name.c_str()); // switch to subdir
206  assert(dir);
207 
208  NDExtrap* extrap = ana::LoadFrom<NDExtrap>(dir, "ndextrap").release();
209 
210  delete dir;
211 
212  return std::unique_ptr<NDPredictionSterile>(new NDPredictionSterile(extrap));
213  }
214 
215 } // end of namespace
const XML_Char * name
Definition: expat.h:151
Pass neutrinos through unchanged.
Definition: IOscCalc.h:40
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
(&#39;beam &#39;)
Definition: IPrediction.h:15
General interface to oscillation calculators.
Definition: StanTypedefs.h:22
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
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
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:40
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
Fake data is a MC spectrum scaled to the POT expected in the data.
Definition: Spectrum.cxx:341
osc::NoOscillations noosc
Definition: NueSystFuncs.h:44
NDOscillatableSpectrum NueCCAppComponent()
Definition: NDExtrap.cxx:110
double POT() const
Definition: Spectrum.h:219
NDOscillatableSpectrum AntiNueNCComponent()
Definition: NDExtrap.cxx:134
NDOscillatableSpectrum AntiNumuCCSurvComponent()
Definition: NDExtrap.cxx:104
Neutrinos-only.
Definition: IPrediction.h:49
const OscCalcSterile * DowncastToSterile(const IOscCalc *calc)
(&#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
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
virtual Spectrum FakeData(osc::IOscCalc *calc, double POT)
TDirectory * dir
Definition: macro.C:5
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