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

Take the output of an extrapolation and oscillate it as required. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-09-26/CAFAna/Prediction/PredictionExtrap.h"

Inheritance diagram for ana::PredictionExtrap:
ana::IPrediction ana::PredictionNoExtrap ana::PredictionSterile

Public Member Functions

 PredictionExtrap (std::unique_ptr< IExtrap > &&extrap)
 Takes ownership of extrap. More...
 
 PredictionExtrap ()=delete
 
Spectrum Predict (osc::IOscCalc *calc) const override
 
Spectrum Predict (osc::IOscCalcStan *calc) const override
 
Spectrum PredictComponent (osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
 
Spectrum PredictComponent (osc::IOscCalcStan *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
 
OscillatableSpectrum ComponentCC (int from, int to) const override
 
Spectrum ComponentNCTotal () const override
 
Spectrum ComponentNC () const override
 
Spectrum ComponentNCAnti () const override
 
virtual void SaveTo (TDirectory *dir, const std::string &name) const override
 
const IExtrapGetExtrap () const
 
virtual Spectrum PredictUnoscillated () const
 
virtual Spectrum PredictSyst (osc::IOscCalc *calc, const SystShifts &syst) const
 
virtual Spectrum PredictSyst (osc::IOscCalcStan *calc, const SystShifts &syst) const
 
virtual Spectrum PredictComponentSyst (osc::IOscCalc *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
 
virtual Spectrum PredictComponentSyst (osc::IOscCalcStan *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
 

Static Public Member Functions

static std::unique_ptr< PredictionExtrapLoadFrom (TDirectory *dir, const std::string &name)
 

Protected Member Functions

template<typename T >
Spectrum _PredictComponent (osc::_IOscCalc< T > *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
 Templated helper function called by the non-templated versions. More...
 

Protected Attributes

std::unique_ptr< IExtrapfExtrap
 

Detailed Description

Take the output of an extrapolation and oscillate it as required.

Definition at line 12 of file PredictionExtrap.h.

Constructor & Destructor Documentation

ana::PredictionExtrap::PredictionExtrap ( std::unique_ptr< IExtrap > &&  extrap)

Takes ownership of extrap.

Definition at line 14 of file PredictionExtrap.cxx.

15  : fExtrap(std::move(extrap))
16  {
17  }
std::unique_ptr< IExtrap > fExtrap
ana::PredictionExtrap::PredictionExtrap ( )
delete

Referenced by LoadFrom().

Member Function Documentation

template<typename T >
Spectrum ana::PredictionExtrap::_PredictComponent ( osc::_IOscCalc< T > *  calc,
Flavors::Flavors_t  flav,
Current::Current_t  curr,
Sign::Sign_t  sign 
) const
protected

Templated helper function called by the non-templated versions.

Definition at line 40 of file PredictionExtrap.cxx.

References ana::assert(), ana::Spectrum::Clear(), fExtrap, ana::Flavors::kAll, ana::Sign::kAntiNu, ana::Current::kCC, ana::Current::kNC, ana::Sign::kNu, ana::Flavors::kNuEToNuE, ana::Flavors::kNuEToNuMu, ana::Flavors::kNuEToNuTau, ana::Flavors::kNuMuToNuE, ana::Flavors::kNuMuToNuMu, ana::Flavors::kNuMuToNuTau, and runNovaSAM::ret.

Referenced by GetExtrap(), and PredictComponent().

44  {
45  Spectrum ret = fExtrap->NCTotalComponent(); // Get binning
46  ret.Clear();
47 
48  if(curr & Current::kCC){
49  if(flav & Flavors::kNuEToNuE && sign & Sign::kNu) ret += fExtrap->NueSurvComponent(). Oscillated(calc, +12, +12);
50  if(flav & Flavors::kNuEToNuE && sign & Sign::kAntiNu) ret += fExtrap->AntiNueSurvComponent().Oscillated(calc, -12, -12);
51 
52  if(flav & Flavors::kNuEToNuMu && sign & Sign::kNu) ret += fExtrap->NumuAppComponent(). Oscillated(calc, +12, +14);
53  if(flav & Flavors::kNuEToNuMu && sign & Sign::kAntiNu) ret += fExtrap->AntiNumuAppComponent().Oscillated(calc, -12, -14);
54 
55  if(flav & Flavors::kNuEToNuTau && sign & Sign::kNu) ret += fExtrap->TauFromEComponent(). Oscillated(calc, +12, +16);
56  if(flav & Flavors::kNuEToNuTau && sign & Sign::kAntiNu) ret += fExtrap->AntiTauFromEComponent().Oscillated(calc, -12, -16);
57 
58  if(flav & Flavors::kNuMuToNuE && sign & Sign::kNu) ret += fExtrap->NueAppComponent(). Oscillated(calc, +14, +12);
59  if(flav & Flavors::kNuMuToNuE && sign & Sign::kAntiNu) ret += fExtrap->AntiNueAppComponent().Oscillated(calc, -14, -12);
60 
61  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kNu) ret += fExtrap->NumuSurvComponent(). Oscillated(calc, +14, +14);
62  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kAntiNu) ret += fExtrap->AntiNumuSurvComponent().Oscillated(calc, -14, -14);
63 
64  if(flav & Flavors::kNuMuToNuTau && sign & Sign::kNu) ret += fExtrap->TauFromMuComponent(). Oscillated(calc, +14, +16);
65  if(flav & Flavors::kNuMuToNuTau && sign & Sign::kAntiNu) ret += fExtrap->AntiTauFromMuComponent().Oscillated(calc, -14, -16);
66  }
67  if(curr & Current::kNC){
68  assert(flav == Flavors::kAll); // Don't know how to calculate anything else
69 
70  if(sign & Sign::kNu) ret += fExtrap->NCComponent();
71  if(sign & Sign::kAntiNu) ret += fExtrap->NCAntiComponent();
72  }
73 
74  return ret;
75  }
Antineutrinos-only.
Definition: IPrediction.h:50
(&#39; appearance&#39;)
Definition: IPrediction.h:18
(&#39;beam &#39;)
Definition: IPrediction.h:15
Charged-current interactions.
Definition: IPrediction.h:39
std::vector< float > Spectrum
Definition: Constants.h:527
Neutrinos-only.
Definition: IPrediction.h:49
(&#39; survival&#39;)
Definition: IPrediction.h:19
std::unique_ptr< IExtrap > fExtrap
Neutral-current interactions.
Definition: IPrediction.h:40
assert(nhit_max >=nhit_nbins)
All neutrinos, any flavor.
Definition: IPrediction.h:26
(&#39; appearance&#39;)
Definition: IPrediction.h:16
def sign(x)
Definition: canMan.py:197
OscillatableSpectrum ana::PredictionExtrap::ComponentCC ( int  from,
int  to 
) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 98 of file PredictionExtrap.cxx.

References ana::assert(), and fExtrap.

Referenced by ana::PredictionAddRock::ComponentCC(), and nue_decomp_scales().

99  {
100  if(from == +12 && to == +12) return fExtrap->NueSurvComponent();
101  if(from == -12 && to == -12) return fExtrap->AntiNueSurvComponent();
102 
103  if(from == +12 && to == +14) return fExtrap->NumuAppComponent();
104  if(from == -12 && to == -14) return fExtrap->AntiNumuAppComponent();
105 
106  if(from == +12 && to == +16) return fExtrap->TauFromEComponent();
107  if(from == -12 && to == -16) return fExtrap->AntiTauFromEComponent();
108 
109  if(from == +14 && to == +12) return fExtrap->NueAppComponent();
110  if(from == -14 && to == -12) return fExtrap->AntiNueAppComponent();
111 
112  if(from == +14 && to == +14) return fExtrap->NumuSurvComponent();
113  if(from == -14 && to == -14) return fExtrap->AntiNumuSurvComponent();
114 
115  if(from == +14 && to == +16) return fExtrap->TauFromMuComponent();
116  if(from == -14 && to == -16) return fExtrap->AntiTauFromMuComponent();
117 
118  assert(0 && "Not reached");
119  }
std::unique_ptr< IExtrap > fExtrap
assert(nhit_max >=nhit_nbins)
Spectrum ana::PredictionExtrap::ComponentNC ( ) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 127 of file PredictionExtrap.cxx.

References fExtrap.

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

128  {
129  return fExtrap->NCComponent();
130  }
std::unique_ptr< IExtrap > fExtrap
Spectrum ana::PredictionExtrap::ComponentNCAnti ( ) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 131 of file PredictionExtrap.cxx.

References fExtrap.

Referenced by ana::PredictionAddRock::ComponentNCAnti().

132  {
133  return fExtrap->NCAntiComponent();
134  }
std::unique_ptr< IExtrap > fExtrap
Spectrum ana::PredictionExtrap::ComponentNCTotal ( ) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 123 of file PredictionExtrap.cxx.

References fExtrap.

Referenced by ana::PredictionAddRock::ComponentNCTotal().

124  {
125  return fExtrap->NCTotalComponent();
126  }
std::unique_ptr< IExtrap > fExtrap
const IExtrap* ana::PredictionExtrap::GetExtrap ( ) const
inline

Definition at line 43 of file PredictionExtrap.h.

References _PredictComponent(), and fExtrap.

Referenced by ana::GetDecomp(), and make_files_for_decomp_plots().

43 {return fExtrap.get();}
std::unique_ptr< IExtrap > fExtrap
std::unique_ptr< PredictionExtrap > ana::PredictionExtrap::LoadFrom ( TDirectory *  dir,
const std::string &  name 
)
static

Definition at line 155 of file PredictionExtrap.cxx.

References ana::assert(), dir, ana::LoadFrom< IExtrap >(), PredictionExtrap(), and runNovaSAM::ret.

Referenced by BlessedPlotsAna(), ana::ComparePredictionsPeripheralFromVector(), ana::PredictionSterile::LoadFrom(), ana::LoadFrom< IPrediction >(), ana::LoadMaps(), PlotNus17Prediction(), resolution2018(), and test_stanfit_statsonly().

156  {
157  dir = dir->GetDirectory(name.c_str()); // switch to subdir
158  assert(dir);
159 
160  std::unique_ptr<PredictionExtrap> ret(new PredictionExtrap(ana::LoadFrom<IExtrap>(dir, "extrap")));
161 
162  delete dir;
163 
164  return ret;
165  }
const XML_Char * name
Definition: expat.h:151
std::unique_ptr< IExtrap > LoadFrom< IExtrap >(TDirectory *dir, const std::string &label)
Definition: IExtrap.cxx:20
TDirectory * dir
Definition: macro.C:5
assert(nhit_max >=nhit_nbins)
Spectrum ana::PredictionExtrap::Predict ( osc::IOscCalc calc) const
overridevirtual
Spectrum ana::PredictionExtrap::Predict ( osc::IOscCalcStan calc) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 29 of file PredictionExtrap.cxx.

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

30  {
31  return PredictComponent(calc,
34  Sign::kBoth);
35  }
Spectrum PredictComponent(osc::IOscCalc *calc, 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
Spectrum ana::PredictionExtrap::PredictComponent ( osc::IOscCalc calc,
Flavors::Flavors_t  flav,
Current::Current_t  curr,
Sign::Sign_t  sign 
) const
overridevirtual

Implements ana::IPrediction.

Reimplemented in ana::PredictionSterile.

Definition at line 79 of file PredictionExtrap.cxx.

References _PredictComponent().

Referenced by BackPredict(), CompareMCCompPrediction(), CVNCuts(), GetExtrap(), getTimePeakPlots(), MakePeriCutPlot(), MCCompPredictionTable(), MichelDecompTest(), nue_pid_effs(), nue_pid_effs_miniprod(), nue_pid_effs_paper_numu_neweff(), PeripheralCuts(), Predict(), ana::PredictionSterile::PredictComponent(), ana::PredictionAddRock::RockComponent(), and test_saloaders().

83  {
84  return _PredictComponent(calc, flav, curr, sign);
85  }
Spectrum _PredictComponent(osc::_IOscCalc< T > *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
Templated helper function called by the non-templated versions.
def sign(x)
Definition: canMan.py:197
Spectrum ana::PredictionExtrap::PredictComponent ( osc::IOscCalcStan calc,
Flavors::Flavors_t  flav,
Current::Current_t  curr,
Sign::Sign_t  sign 
) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 89 of file PredictionExtrap.cxx.

References _PredictComponent().

93  {
94  return _PredictComponent(calc, flav, curr, sign);
95  }
Spectrum _PredictComponent(osc::_IOscCalc< T > *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
Templated helper function called by the non-templated versions.
def sign(x)
Definition: canMan.py:197
Spectrum ana::IPrediction::PredictComponentSyst ( osc::IOscCalc calc,
const SystShifts syst,
Flavors::Flavors_t  flav,
Current::Current_t  curr,
Sign::Sign_t  sign 
) const
virtualinherited

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

Definition at line 102 of file IPrediction.cxx.

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

Referenced by ana::PredictionAddRock::_PredictComponentSyst(), ana::CovMxManager::AddSystematic(), ana::GetBFSystBands(), ana::GetSystBands(), PlotSysts(), ana::PredictionCombinePeriods::PredictComponentSyst(), systematics_extrap_comp_from_pred_interp(), systematics_summary_from_pred_interp(), and systematics_table_from_pred_interp().

107  {
108  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
109 
110  // Default implementation: no treatment of systematics
111  return PredictComponent(calc, flav, curr, sign);
112  }
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
assert(nhit_max >=nhit_nbins)
def sign(x)
Definition: canMan.py:197
Spectrum ana::IPrediction::PredictComponentSyst ( osc::IOscCalcStan calc,
const SystShifts syst,
Flavors::Flavors_t  flav,
Current::Current_t  curr,
Sign::Sign_t  sign 
) const
virtualinherited

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

Definition at line 116 of file IPrediction.cxx.

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

121  {
122  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
123 
124  // Default implementation: no treatment of systematics
125  return PredictComponent(calc, flav, curr, sign);
126  }
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
assert(nhit_max >=nhit_nbins)
def sign(x)
Definition: canMan.py:197
Spectrum ana::IPrediction::PredictSyst ( osc::IOscCalc calc,
const SystShifts syst 
) const
virtualinherited

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

Definition at line 72 of file IPrediction.cxx.

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

Referenced by BicountEllipse_dCP(), ana::CountingExperiment::ChiSq(), ana::DataMCComparison(), demo_nueNumuSysts(), DrawBins(), DrawPulls(), fill_col(), joint_fit_2017_make_fc_slice(), joint_fit_2017_make_fc_surf(), MakeFakeData(), ana::PlotWithAreaSystErrorBand(), ana::PlotWithSystErrorBand(), ana::PlotWithSystErrorBand_Quant(), ana::SingleSampleExperiment::PredHistIncCosmics(), and ana::PredictionScaleComp::~PredictionScaleComp().

74  {
75  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
76 
77  // Default implementation: no treatment of systematics
78  return Predict(calc);
79  }
virtual Spectrum Predict(osc::IOscCalc *calc) const =0
assert(nhit_max >=nhit_nbins)
Spectrum ana::IPrediction::PredictSyst ( osc::IOscCalcStan calc,
const SystShifts syst 
) const
virtualinherited

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

Definition at line 82 of file IPrediction.cxx.

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

84  {
85  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
86 
87  // Default implementation: no treatment of systematics
88  return Predict(calc);
89  }
virtual Spectrum Predict(osc::IOscCalc *calc) const =0
assert(nhit_max >=nhit_nbins)
Spectrum ana::IPrediction::PredictUnoscillated ( ) const
virtualinherited

Reimplemented in ana::PredictionSterile.

Definition at line 56 of file IPrediction.cxx.

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

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

57  {
58  // Default implementation
60  return Predict(&noosc);
61  }
Pass neutrinos through unchanged.
Definition: IOscCalc.h:40
virtual Spectrum Predict(osc::IOscCalc *calc) const =0
osc::NoOscillations noosc
Definition: NueSystFuncs.h:44
void ana::PredictionExtrap::SaveTo ( TDirectory *  dir,
const std::string &  name 
) const
overridevirtual

Reimplemented from ana::IPrediction.

Reimplemented in ana::PredictionNoExtrap, and ana::PredictionSterile.

Definition at line 137 of file PredictionExtrap.cxx.

References dir, fExtrap, and tmp.

Referenced by make_nue_filesyst_pred(), make_nueFDprediction_kinematics(), make_nueFDprediction_kinematics_FHC(), make_nueFDprediction_kinematics_FHC_REW(), make_nueFDprediction_kinematics_REW(), make_nueFDprediction_kinematics_RHC(), make_nueFDprediction_kinematics_RHC_REW(), modularextrap_demo_numu(), and ana::PredictionSterile::SaveTo().

138  {
139  TDirectory* tmp = gDirectory;
140 
141  dir = dir->mkdir(name.c_str()); // switch to subdir
142  dir->cd();
143 
144  TObjString("PredictionExtrap").Write("type");
145 
146  fExtrap->SaveTo(dir, "extrap");
147 
148  dir->Write();
149  delete dir;
150 
151  tmp->cd();
152  }
const XML_Char * name
Definition: expat.h:151
Float_t tmp
Definition: plot.C:36
std::unique_ptr< IExtrap > fExtrap
TDirectory * dir
Definition: macro.C:5

Member Data Documentation

std::unique_ptr<IExtrap> ana::PredictionExtrap::fExtrap
protected

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