Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ana::PredictionNumuFAHadE Class Reference

WARNING! Experts only. For numu FA final result contours. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-02-16/CAFAna/Prediction/PredictionNumuFAHadE.h"

Inheritance diagram for ana::PredictionNumuFAHadE:
ana::IPrediction

Public Member Functions

 PredictionNumuFAHadE (std::vector< const ISyst * > systs, osc::IOscCalculator *osc, const IPredictionGenerator &predGen, Loaders &loaders)
 
virtual ~PredictionNumuFAHadE ()
 
virtual Spectrum Predict (osc::IOscCalculator *calc) const override
 
virtual Spectrum PredictSyst (osc::IOscCalculator *calc, const SystShifts &shift) const override
 
virtual Spectrum PredictComponent (osc::IOscCalculator *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
 
virtual Spectrum PredictComponentSyst (osc::IOscCalculator *calc, const SystShifts &shift, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
 
virtual void SaveTo (TDirectory *dir) const override
 
virtual Spectrum PredictUnoscillated () const
 
virtual SpectrumStan Predict (osc::IOscCalculatorStan *calc) const
 
virtual SpectrumStan PredictSyst (osc::IOscCalculatorStan *calc, const SystShifts &syst) const
 
virtual SpectrumStan PredictComponent (osc::IOscCalculatorStan *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
 
virtual SpectrumStan PredictComponentSyst (osc::IOscCalculatorStan *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
 
virtual void Derivative (osc::IOscCalculator *calc, const SystShifts &shift, double pot, std::unordered_map< const ISyst *, std::vector< double >> &dchi) const
 
virtual OscillatableSpectrum ComponentCC (int from, int to) const
 
virtual Spectrum ComponentNCTotal () const
 
virtual Spectrum ComponentNC () const
 
virtual Spectrum ComponentNCAnti () const
 

Static Public Member Functions

static std::unique_ptr< PredictionNumuFAHadELoadFrom (TDirectory *dir)
 

Protected Member Functions

 PredictionNumuFAHadE ()
 

Protected Attributes

IPredictionfHadEs [13]
 

Detailed Description

WARNING! Experts only. For numu FA final result contours.

Definition at line 9 of file PredictionNumuFAHadE.h.

Constructor & Destructor Documentation

ana::PredictionNumuFAHadE::PredictionNumuFAHadE ( std::vector< const ISyst * >  systs,
osc::IOscCalculator osc,
const IPredictionGenerator predGen,
Loaders loaders 
)
Parameters
systsWhat systematics we should be capable of interpolating
oscThe oscillation point to expand around
predGenConstruct an IPrediction from the following information.
loadersThe loaders to be passed on to the underlying prediction

Definition at line 93 of file PredictionNumuFAHadE.cxx.

References fHadEs, MECModelEnuComparisons::i, ana::kHadEnergyScaleSyst, plotSysts::shift, and plotSysts::syst.

97  {
98  // Doesn't matter if user passes that syst or not, we always handle it
99  // ourselves
100  std::vector<const ISyst*> cleanedSysts;
101  for(const ISyst* syst: systs){
102  if(syst->ShortName() != "AbsHadEScale") cleanedSysts.push_back(syst);
103  }
104 
105  for(int i = 0; i < 13; ++i){
106  const double hadEshift = -3+i*.5;
107 
108  SystShifts shift(&kHadEnergyScaleSyst, hadEshift);
109  fHadEs[i] = new PredictionInterp(cleanedSysts, osc, predGen, loaders, shift);
110  }
111  }
std::vector< SystGroupDef > systs
Definition: syst_header.h:384
const HadEnergyScaleSyst kHadEnergyScaleSyst(.05)
Definition: EnergySysts.h:35
std::vector< Loaders * > loaders
Definition: syst_header.h:385
string syst
Definition: plotSysts.py:176
ana::PredictionNumuFAHadE::~PredictionNumuFAHadE ( )
virtual

Definition at line 114 of file PredictionNumuFAHadE.cxx.

References fHadEs, and MECModelEnuComparisons::i.

115  {
116  for(int i = 0; i < 13; ++i) delete fHadEs[i];
117  }
ana::PredictionNumuFAHadE::PredictionNumuFAHadE ( )
inlineprotected

Definition at line 48 of file PredictionNumuFAHadE.h.

48 {}

Member Function Documentation

virtual OscillatableSpectrum ana::IPrediction::ComponentCC ( int  from,
int  to 
) const
inlinevirtualinherited
virtual Spectrum ana::IPrediction::ComponentNC ( ) const
inlinevirtualinherited

Reimplemented in ana::PredictionExtendToPeripheral, ana::PredictionAddRock, ana::PredictionCombinePeriods, and ana::PredictionExtrap.

Definition at line 111 of file IPrediction.h.

References om::cout, and allTimeWatchdog::endl.

Referenced by ana::PredictionAddRock::ComponentNC(), and ana::PredictionExtendToPeripheral::PredictionExtendToPeripheral().

112  {std::cout << "WARNING! ComponentNC is unimplemented in IPrediction" << std::endl; abort();}
OStream cout
Definition: OStream.cxx:6
virtual Spectrum ana::IPrediction::ComponentNCAnti ( ) const
inlinevirtualinherited

Reimplemented in ana::PredictionExtendToPeripheral, ana::PredictionAddRock, ana::PredictionCombinePeriods, and ana::PredictionExtrap.

Definition at line 113 of file IPrediction.h.

References om::cout, dir, allTimeWatchdog::endl, and ana::SaveTo().

Referenced by ana::PredictionAddRock::ComponentNCAnti(), and ana::PredictionExtendToPeripheral::PredictionExtendToPeripheral().

114  {std::cout << "WARNING! ComponentNCAnti is unimplemented in IPrediction" << std::endl; abort();}
OStream cout
Definition: OStream.cxx:6
virtual Spectrum ana::IPrediction::ComponentNCTotal ( ) const
inlinevirtualinherited

Reimplemented in ana::PredictionExtendToPeripheral, ana::PredictionAddRock, ana::PredictionCombinePeriods, and ana::PredictionExtrap.

Definition at line 109 of file IPrediction.h.

References om::cout, and allTimeWatchdog::endl.

Referenced by ana::PredictionAddRock::ComponentNCTotal(), and ana::PredictionExtendToPeripheral::PredictionExtendToPeripheral().

110  {std::cout << "WARNING! ComponentNCTotal is unimplemented in IPrediction" << std::endl; abort();}
OStream cout
Definition: OStream.cxx:6
virtual void ana::IPrediction::Derivative ( osc::IOscCalculator calc,
const SystShifts shift,
double  pot,
std::unordered_map< const ISyst *, std::vector< double >> &  dchi 
) const
inlinevirtualinherited

Reimplemented in ana::PredictionInterp, and ana::PredictionAddRock.

Definition at line 92 of file IPrediction.h.

Referenced by ana::PredictionAddRock::Derivative(), and ana::SingleSampleExperiment::Derivative().

96  {
97  // Implementing this function is optional. If you don't implement it,
98  // this default implementation will be used, which signals to callers
99  // that your Prediction doesn't implement this feature.
100  dchi.clear();
101  }
std::unique_ptr< PredictionNumuFAHadE > ana::PredictionNumuFAHadE::LoadFrom ( TDirectory *  dir)
static

Definition at line 230 of file PredictionNumuFAHadE.cxx.

References genie::utils::style::Format(), MECModelEnuComparisons::i, ana::LoadFrom< IPrediction >(), runNovaSAM::release, runNovaSAM::ret, and getGoodRuns4SAM::tag.

Referenced by ana::LoadFrom< IPrediction >(), make_fc_points(), and plot_fa_results().

231  {
232  TObjString* tag = (TObjString*)dir->Get("type");
233  assert(tag);
234  assert(tag->GetString() == "PredictionNumuFAHadE");
235 
236  std::unique_ptr<PredictionNumuFAHadE> ret(new PredictionNumuFAHadE);
237 
238  for(int i = 0; i < 13; ++i){
239  ret->fHadEs[i] = ana::LoadFrom<IPrediction>(dir->GetDirectory(TString::Format("p%d", i))).release();
240  }
241 
242  return ret;
243  }
std::unique_ptr< IPrediction > LoadFrom< IPrediction >(TDirectory *dir)
Definition: IPrediction.cxx:38
TDirectory * dir
Definition: macro.C:5
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
Spectrum ana::PredictionNumuFAHadE::Predict ( osc::IOscCalculator calc) const
overridevirtual

Implements ana::IPrediction.

Definition at line 120 of file PredictionNumuFAHadE.cxx.

References fHadEs, and ana::IPrediction::Predict().

Referenced by fa_numuContours(), and make_fa_pred().

121  {
122  // No systs
123  return fHadEs[6]->Predict(calc);
124  }
virtual Spectrum Predict(osc::IOscCalculator *calc) const =0
SpectrumStan ana::IPrediction::Predict ( osc::IOscCalculatorStan calc) const
virtualinherited

Reimplemented in ana::PredictionInterp, and ana::PredictionExtrap.

Definition at line 92 of file IPrediction.cxx.

93  {
94  assert(0 && "This Prediction hasn't implemented a Stan-aware Predict()!");
95  }
Spectrum ana::PredictionNumuFAHadE::PredictComponent ( osc::IOscCalculator calc,
Flavors::Flavors_t  flav,
Current::Current_t  curr,
Sign::Sign_t  sign 
) const
overridevirtual

Implements ana::IPrediction.

Definition at line 127 of file PredictionNumuFAHadE.cxx.

References fHadEs, and ana::IPrediction::PredictComponent().

131  {
132  // No systs
133  return fHadEs[6]->PredictComponent(calc, flav, curr, sign);
134  }
virtual Spectrum PredictComponent(osc::IOscCalculator *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
def sign(x)
Definition: canMan.py:204
SpectrumStan ana::IPrediction::PredictComponent ( osc::IOscCalculatorStan calc,
Flavors::Flavors_t  flav,
Current::Current_t  curr,
Sign::Sign_t  sign 
) const
virtualinherited

Reimplemented in ana::PredictionInterp, and ana::PredictionExtrap.

Definition at line 119 of file IPrediction.cxx.

123  {
124  assert(0 && "This Prediction hasn't implemented a Stan-aware PredictComponent()!");
125  }
Spectrum ana::PredictionNumuFAHadE::PredictComponentSyst ( osc::IOscCalculator calc,
const SystShifts shift,
Flavors::Flavors_t  flav,
Current::Current_t  curr,
Sign::Sign_t  sign 
) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 147 of file PredictionNumuFAHadE.cxx.

References ana::CubicInterp(), ana::CubicInterpLeftEdge(), ana::CubicInterpRightEdge(), ana::HistCache::Delete(), fHadEs, ana::Spectrum::GetBinnings(), ana::Spectrum::GetLabels(), ana::SystShifts::GetShift(), h1, h2, h3, MECModelEnuComparisons::i, makeTrainCVSamples::int, ana::kHadEnergyScaleSyst, ana::Spectrum::Livetime(), ana::Spectrum::POT(), ana::IPrediction::PredictComponentSyst(), ana::SystShifts::SetShift(), plotSysts::shift, ana::Spectrum::ToTH1(), submit_syst::x, x1, submit_syst::x2, submit_syst::y, y1, and submit_syst::y2.

Referenced by PredictSyst().

152  {
153  if(shift.GetShift(&kHadEnergyScaleSyst) == 0){
154  return fHadEs[6]->PredictComponentSyst(calc, shift, flav, curr, sign);
155  }
156 
157  SystShifts cleanedShift = shift;
158  cleanedShift.SetShift(&kHadEnergyScaleSyst, 0);
159 
160  // Convert hadE scale to our indexing, find the closest neighbours
161  const double x = shift.GetShift(&kHadEnergyScaleSyst)*2 + 6;
162 
163  int x1 = int(x);
164  if(x1 < 0) x1 = 0; // ensure x1 is valid
165  if(x1 > 11) x1 = 11; // ensure x1 and x2 are valid
166  const int x2 = x1+1;
167  const int x0 = x1-1; // no guarantees on x0
168  const int x3 = x1+2; // or x3
169 
170  const Spectrum s1 = fHadEs[x1]->PredictComponentSyst(calc, cleanedShift, flav, curr, sign);
171  const Spectrum s2 = fHadEs[x2]->PredictComponentSyst(calc, cleanedShift, flav, curr, sign);
172 
173  std::unique_ptr<TH1D> h0((x0 >= 0) ? fHadEs[x0]->PredictComponentSyst(calc, cleanedShift, flav, curr, sign).ToTH1(s1.POT()) : 0);
174  std::unique_ptr<TH1D> h1(s1.ToTH1(s1.POT()));
175  std::unique_ptr<TH1D> h2(s2.ToTH1(s1.POT()));
176  std::unique_ptr<TH1D> h3((x3 <= 12) ? fHadEs[x3]->PredictComponentSyst(calc, cleanedShift, flav, curr, sign).ToTH1(s1.POT()) : 0);
177 
178  for(int i = 0; i < h1->GetNbinsX()+2; ++i){
179  const double y0 = h0 ? h0->GetBinContent(i) : 0;
180  const double y1 = h1->GetBinContent(i);
181  const double y2 = h2->GetBinContent(i);
182  const double y3 = h3 ? h3->GetBinContent(i) : 0;
183 
184  double y = -1;
185  if(h0 && h3){
186  y = CubicInterp(x, x1, y0, y1, y2, y3);
187  }
188  if(!h0){
189  y = CubicInterpLeftEdge(x, x1, y1, y2, y3);
190  }
191  if(!h3){
192  y = CubicInterpRightEdge(x, x1, y0, y1, y2);
193  }
194  if(!h0 && !h3) assert(0 && "Not reached");
195 
196  // Result is written into h1
197  h1->SetBinContent(i, y);
198  } // end for i
199 
200  TH1D* todel = h2.release();
201  HistCache::Delete(todel);
202  if(h0){
203  todel = h0.release();
204  HistCache::Delete(todel);
205  }
206  if(h3){
207  todel = h3.release();
208  HistCache::Delete(todel);
209  }
210 
211  return Spectrum(std::move(h1), s1.GetLabels(), s1.GetBinnings(), s1.POT(), s1.Livetime());
212  }
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
TH1F * h3
Definition: berger.C:36
virtual Spectrum PredictComponentSyst(osc::IOscCalculator *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
virtual Spectrum PredictComponentSyst(osc::IOscCalculator *calc, const SystShifts &shift, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
double CubicInterp(double x, double x1, double y0, double y1, double y2, double y3)
Cubic interpolation.
static void Delete(TH1D *&h)
Definition: HistCache.cxx:215
double CubicInterpRightEdge(double x, double x1, double y0, double y1, double y2)
Cubic interpolation when there is no y3 point.
def sign(x)
Definition: canMan.py:204
TH1F * h2
Definition: plot.C:45
const HadEnergyScaleSyst kHadEnergyScaleSyst(.05)
Definition: EnergySysts.h:35
double CubicInterpLeftEdge(double x, double x1, double y1, double y2, double y3)
Cubic interpolation when there is no y0 point.
TH1F * h1
SpectrumStan ana::IPrediction::PredictComponentSyst ( osc::IOscCalculatorStan calc,
const SystShifts syst,
Flavors::Flavors_t  flav,
Current::Current_t  curr,
Sign::Sign_t  sign 
) const
virtualinherited

Reimplemented in ana::PredictionInterp.

Definition at line 142 of file IPrediction.cxx.

References ana::SystShifts::IsNominal(), and ana::IPrediction::PredictComponent().

147  {
148  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
149 
150  // Default implementation: no treatment of systematics
151  return PredictComponent(calc, flav, curr, sign);
152  }
virtual Spectrum PredictComponent(osc::IOscCalculator *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
def sign(x)
Definition: canMan.py:204
string syst
Definition: plotSysts.py:176
Spectrum ana::PredictionNumuFAHadE::PredictSyst ( osc::IOscCalculator calc,
const SystShifts shift 
) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 137 of file PredictionNumuFAHadE.cxx.

References ana::Flavors::kAll, ana::Current::kBoth, ana::Sign::kBoth, and PredictComponentSyst().

139  {
140  return PredictComponentSyst(calc, shift,
143  Sign::kBoth);
144  }
virtual Spectrum PredictComponentSyst(osc::IOscCalculator *calc, const SystShifts &shift, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
Interactions of both types.
Definition: IPrediction.h:42
Both neutrinos and antineutrinos.
Definition: IPrediction.h:52
All neutrinos, any flavor.
Definition: IPrediction.h:26
SpectrumStan ana::IPrediction::PredictSyst ( osc::IOscCalculatorStan calc,
const SystShifts syst 
) const
virtualinherited

Reimplemented in ana::PredictionInterp.

Definition at line 108 of file IPrediction.cxx.

References ana::SystShifts::IsNominal(), and ana::IPrediction::Predict().

110  {
111  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
112 
113  // Default implementation: no treatment of systematics
114  return Predict(calc);
115  }
virtual Spectrum Predict(osc::IOscCalculator *calc) const =0
string syst
Definition: plotSysts.py:176
Spectrum ana::IPrediction::PredictUnoscillated ( ) const
virtualinherited

Reimplemented in ana::PredictionSterile.

Definition at line 82 of file IPrediction.cxx.

References noosc, and ana::IPrediction::Predict().

Referenced by cc(), demo5(), demo::DrawUpDownRatioCanvas(), Efficiency(), efficiency(), efficiencySA(), fa_fd_data_mc_systs(), GetSpectra(), numu_demo_split_plot(), plot_nd_data_mc(), template_basic(), and test_ana().

83  {
84  // Default implementation
86  return Predict(&noosc);
87  }
Pass neutrinos through unchanged.
virtual Spectrum Predict(osc::IOscCalculator *calc) const =0
osc::NoOscillations noosc
Definition: NueSystFuncs.h:44
void ana::PredictionNumuFAHadE::SaveTo ( TDirectory *  dir) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 215 of file PredictionNumuFAHadE.cxx.

References fHadEs, genie::utils::style::Format(), MECModelEnuComparisons::i, ana::IPrediction::SaveTo(), and tmp.

Referenced by fa_numuContours(), and make_fa_pred().

216  {
217  TDirectory* tmp = gDirectory;
218 
219  dir->cd();
220  TObjString("PredictionNumuFAHadE").Write("type");
221 
222  for(int i = 0; i < 13; ++i){
223  fHadEs[i]->SaveTo(dir->mkdir(TString::Format("p%d", i)));
224  }
225 
226  tmp->cd();
227  }
virtual void SaveTo(TDirectory *dir) const
Float_t tmp
Definition: plot.C:36
TDirectory * dir
Definition: macro.C:5
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154

Member Data Documentation

IPrediction* ana::PredictionNumuFAHadE::fHadEs[13]
protected

The documentation for this class was generated from the following files: