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

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-09-26/3FlavorAna/Prediction/PredictionAddRock.h"

Inheritance diagram for ana::PredictionAddRock:
ana::IPrediction

Public Member Functions

 PredictionAddRock (IPrediction *predFid, PredictionNoExtrap *predRock)
 Takes ownership of predCore and predNoExtrap. More...
 
virtual ~PredictionAddRock ()
 
virtual Spectrum Predict (osc::IOscCalc *calc) const override
 
virtual Spectrum Predict (osc::IOscCalcStan *calc) const override
 
virtual Spectrum PredictSyst (osc::IOscCalc *calc, const SystShifts &syst) const override
 
virtual Spectrum PredictSyst (osc::IOscCalcStan *calc, const SystShifts &syst) const override
 
virtual Spectrum PredictComponent (osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
 
virtual Spectrum PredictComponent (osc::IOscCalcStan *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
 
virtual Spectrum PredictComponentSyst (osc::IOscCalc *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
 
virtual Spectrum PredictComponentSyst (osc::IOscCalcStan *calc, const SystShifts &syst, 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
 
const IPredictionGetFiducialPred () const
 
const PredictionNoExtrapGetRockPred () const
 
virtual void SaveTo (TDirectory *dir, const std::string &name) const override
 
 PredictionAddRock ()=delete
 
virtual Spectrum PredictUnoscillated () const
 

Static Public Member Functions

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

Protected Member Functions

template<typename T >
Spectrum _PredictComponentSyst (osc::_IOscCalc< T > *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
 
template<typename T >
Spectrum RockComponent (osc::_IOscCalc< T > *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
 

Protected Attributes

IPredictionfPredFid
 
PredictionNoExtrapfPredRock
 

Detailed Description

Definition at line 12 of file PredictionAddRock.h.

Constructor & Destructor Documentation

ana::PredictionAddRock::PredictionAddRock ( IPrediction predFid,
PredictionNoExtrap predRock 
)

Takes ownership of predCore and predNoExtrap.

Definition at line 21 of file PredictionAddRock.cxx.

23  : fPredFid(predFid),
24  fPredRock(predRock)
25  {
26  }
PredictionNoExtrap * fPredRock
ana::PredictionAddRock::~PredictionAddRock ( )
virtual

Definition at line 29 of file PredictionAddRock.cxx.

References fPredFid, and fPredRock.

30  {
31  delete fPredFid;
32  delete fPredRock;
33  }
PredictionNoExtrap * fPredRock
ana::PredictionAddRock::PredictionAddRock ( )
delete

Referenced by GetRockPred(), and LoadFrom().

Member Function Documentation

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

Definition at line 115 of file PredictionAddRock.cxx.

References calc, febshutoff_auto::curr, fPredFid, ana::SystShifts::GetShift(), ana::kRockScaleSyst, ana::IPrediction::PredictComponentSyst(), ana::SystShifts::RemoveShift(), runNovaSAM::ret, rock(), RockComponent(), ana::Spectrum::Scale(), canMan::sign(), and T.

Referenced by GetRockPred(), and PredictComponentSyst().

120  {
121  // Clone the systs
122  SystShifts systClone = syst;
123 
124  // First Check for RockScaleSyst
125  auto systScale = 1 + systClone.GetShift<T>(&kRockScaleSyst);
126  if(systScale < 0) systScale = 0;
127 
128  // the fiducial prediction definitely won't support the rock scale syst
129  systClone.RemoveShift(&kRockScaleSyst);
130 
131  // Strategy: assume PredictComponentSyst is properly implemented for the
132  // fiducial prediction, so start with that. Treat the rock as a series of
133  // delta's to that distribution, all predicted without syst shifts.
134  Spectrum ret = fPredFid->PredictComponentSyst(calc,systClone,
135  flav,curr,sign);
136 
137  if (systScale > 0)
138  {
139  Spectrum rock = RockComponent(calc, flav, curr, sign);
140  rock.Scale(systScale);
141  ret += rock;
142  }
143 
144  return ret;
145  }
Spectrum RockComponent(osc::_IOscCalc< T > *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
virtual Spectrum PredictComponentSyst(osc::IOscCalc *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
std::vector< float > Spectrum
Definition: Constants.h:527
double T
Definition: Xdiff_gwt.C:5
void rock(std::string suffix="full")
Definition: rock.C:28
def sign(x)
Definition: canMan.py:197
const DummyRockScaleSyst kRockScaleSyst
OscillatableSpectrum ana::PredictionAddRock::ComponentCC ( int  from,
int  to 
) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 221 of file PredictionAddRock.cxx.

References ana::PredictionExtrap::ComponentCC(), ana::IPrediction::ComponentCC(), fPredFid, and fPredRock.

222  {
223  return fPredFid->ComponentCC(from, to) + fPredRock->ComponentCC(from, to);
224  }
OscillatableSpectrum ComponentCC(int from, int to) const override
virtual OscillatableSpectrum ComponentCC(int from, int to) const
PredictionNoExtrap * fPredRock
Spectrum ana::PredictionAddRock::ComponentNC ( ) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 233 of file PredictionAddRock.cxx.

References ana::PredictionExtrap::ComponentNC(), ana::IPrediction::ComponentNC(), fPredFid, and fPredRock.

234  {
235  return fPredFid->ComponentNC() + fPredRock->ComponentNC();
236  }
Spectrum ComponentNC() const override
virtual Spectrum ComponentNC() const
PredictionNoExtrap * fPredRock
Spectrum ana::PredictionAddRock::ComponentNCAnti ( ) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 238 of file PredictionAddRock.cxx.

References ana::PredictionExtrap::ComponentNCAnti(), ana::IPrediction::ComponentNCAnti(), fPredFid, and fPredRock.

239  {
241  }
virtual Spectrum ComponentNCAnti() const
PredictionNoExtrap * fPredRock
Spectrum ComponentNCAnti() const override
Spectrum ana::PredictionAddRock::ComponentNCTotal ( ) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 228 of file PredictionAddRock.cxx.

References ana::PredictionExtrap::ComponentNCTotal(), ana::IPrediction::ComponentNCTotal(), fPredFid, and fPredRock.

229  {
231  }
Spectrum ComponentNCTotal() const override
PredictionNoExtrap * fPredRock
virtual Spectrum ComponentNCTotal() const
const IPrediction* ana::PredictionAddRock::GetFiducialPred ( ) const
inline

Definition at line 53 of file PredictionAddRock.h.

References fPredFid.

53 { return fPredFid; }
const PredictionNoExtrap* ana::PredictionAddRock::GetRockPred ( ) const
inline

Definition at line 54 of file PredictionAddRock.h.

References _PredictComponentSyst(), dir, fPredRock, LoadFrom(), PredictionAddRock(), RockComponent(), and SaveTo().

54 { return fPredRock; }
PredictionNoExtrap * fPredRock
std::unique_ptr< PredictionAddRock > ana::PredictionAddRock::LoadFrom ( TDirectory *  dir,
const std::string &  name 
)
static

Definition at line 263 of file PredictionAddRock.cxx.

References ana::assert(), dir, ana::LoadFrom< IPrediction >(), PredictionAddRock(), and runNovaSAM::release.

Referenced by GetRockPred().

264  {
265  dir = dir->GetDirectory(name.c_str()); // switch to subdir
266  assert(dir);
267 
268  auto predFid = ana::LoadFrom<IPrediction>(dir, "predFid").release();
269  auto predRock = ana::LoadFrom<PredictionNoExtrap>(dir, "predRock").release();
270 
271  delete dir;
272 
273  return std::unique_ptr<PredictionAddRock>(new PredictionAddRock(predFid,predRock));
274  }
const XML_Char * name
Definition: expat.h:151
std::unique_ptr< IPrediction > LoadFrom< IPrediction >(TDirectory *dir, const std::string &label)
Definition: IPrediction.cxx:28
TDirectory * dir
Definition: macro.C:5
assert(nhit_max >=nhit_nbins)
Spectrum ana::PredictionAddRock::Predict ( osc::IOscCalc calc) const
overridevirtual

Implements ana::IPrediction.

Definition at line 36 of file PredictionAddRock.cxx.

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

Referenced by bin_composition_pie_chart().

37  {
38  return PredictComponent(calc,
41  Sign::kBoth);
42  }
Interactions of both types.
Definition: IPrediction.h:42
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
Both neutrinos and antineutrinos.
Definition: IPrediction.h:52
All neutrinos, any flavor.
Definition: IPrediction.h:26
Spectrum ana::PredictionAddRock::Predict ( osc::IOscCalcStan calc) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 45 of file PredictionAddRock.cxx.

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

46  {
47  return PredictComponent(calc,
50  Sign::kBoth);
51  }
Interactions of both types.
Definition: IPrediction.h:42
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
Both neutrinos and antineutrinos.
Definition: IPrediction.h:52
All neutrinos, any flavor.
Definition: IPrediction.h:26
Spectrum ana::PredictionAddRock::PredictComponent ( osc::IOscCalc calc,
Flavors::Flavors_t  flav,
Current::Current_t  curr,
Sign::Sign_t  sign 
) const
overridevirtual

Implements ana::IPrediction.

Definition at line 75 of file PredictionAddRock.cxx.

References ana::kNoShift, and PredictComponentSyst().

Referenced by bin_composition_pie_chart(), and Predict().

79  {
80  return PredictComponentSyst(calc,kNoShift,flav,curr,sign);
81  }
virtual Spectrum PredictComponentSyst(osc::IOscCalc *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
const SystShifts kNoShift
Definition: SystShifts.h:115
def sign(x)
Definition: canMan.py:197
Spectrum ana::PredictionAddRock::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 84 of file PredictionAddRock.cxx.

References ana::kNoShift, and PredictComponentSyst().

88  {
89  return PredictComponentSyst(calc,kNoShift,flav,curr,sign);
90  }
virtual Spectrum PredictComponentSyst(osc::IOscCalc *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
const SystShifts kNoShift
Definition: SystShifts.h:115
def sign(x)
Definition: canMan.py:197
Spectrum ana::PredictionAddRock::PredictComponentSyst ( osc::IOscCalc calc,
const SystShifts syst,
Flavors::Flavors_t  flav,
Current::Current_t  curr,
Sign::Sign_t  sign 
) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 93 of file PredictionAddRock.cxx.

References _PredictComponentSyst().

Referenced by PredictComponent(), and PredictSyst().

98  {
99  return _PredictComponentSyst(calc, syst, flav, curr, sign);
100  }
Spectrum _PredictComponentSyst(osc::_IOscCalc< T > *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
def sign(x)
Definition: canMan.py:197
Spectrum ana::PredictionAddRock::PredictComponentSyst ( osc::IOscCalcStan calc,
const SystShifts syst,
Flavors::Flavors_t  flav,
Current::Current_t  curr,
Sign::Sign_t  sign 
) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 103 of file PredictionAddRock.cxx.

References _PredictComponentSyst().

108  {
109  return _PredictComponentSyst(calc, syst, flav, curr, sign);
110  }
Spectrum _PredictComponentSyst(osc::_IOscCalc< T > *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
def sign(x)
Definition: canMan.py:197
Spectrum ana::PredictionAddRock::PredictSyst ( osc::IOscCalc calc,
const SystShifts syst 
) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 54 of file PredictionAddRock.cxx.

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

56  {
57  return PredictComponentSyst(calc, syst,
60  Sign::kBoth);
61  }
virtual Spectrum PredictComponentSyst(osc::IOscCalc *calc, const SystShifts &syst, 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::PredictionAddRock::PredictSyst ( osc::IOscCalcStan calc,
const SystShifts syst 
) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 64 of file PredictionAddRock.cxx.

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

66  {
67  return PredictComponentSyst(calc, syst,
70  Sign::kBoth);
71  }
virtual Spectrum PredictComponentSyst(osc::IOscCalc *calc, const SystShifts &syst, 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::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
template<typename T >
template Spectrum ana::PredictionAddRock::RockComponent ( osc::_IOscCalc< T > *  calc,
Flavors::Flavors_t  flav,
Current::Current_t  curr,
Sign::Sign_t  sign 
) const
protected

Definition at line 160 of file PredictionAddRock.cxx.

References ana::assert(), ana::Spectrum::Clear(), fPredRock, ana::Flavors::kAll, ana::Sign::kBoth, ana::Current::kCC, ana::Current::kNC, ana::Flavors::kNuEToNuE, ana::Flavors::kNuEToNuMu, ana::Flavors::kNuMuToNuE, ana::Flavors::kNuMuToNuMu, ana::PredictionExtrap::PredictComponent(), runNovaSAM::ret, and ana::Spectrum::Uninitialized().

Referenced by _PredictComponentSyst(), and GetRockPred().

164  {
166 
167  if(curr & Current::kNC){
168  assert(flav == Flavors::kAll); // Don't know how to calculate anything else
169 
170  // Predict the NC part
171  ret = fPredRock->PredictComponent(calc, flav, Current::kNC, sign);
172  }
173  else{
174  // Otherwise, still need to calculate something to get a suitably-binned
175  // Spectrum, but shouldn't keep in the total.
176  ret = fPredRock->PredictComponent(calc, Flavors::kAll, Current::kNC, Sign::kBoth);
177  ret.Clear();
178  }
179 
180 
181  if(curr & Current::kCC){
182  if (flav & Flavors::kNuEToNuE){
183  ret += fPredRock->PredictComponent(calc,
184  Flavors::kNuEToNuE,
185  Current::kCC, sign);
186  }
187  if (flav & Flavors::kNuEToNuMu){
188  ret += fPredRock->PredictComponent(calc,
189  Flavors::kNuEToNuMu,
190  Current::kCC, sign);
191  }
192  // If you're astute, you'll realize we don't do anything for tauswap.
193  // We never had tauswap rock files made, so it doesn't make sense to sum
194  // them in.
195 
196  if (flav & Flavors::kNuMuToNuE){
197  ret += fPredRock->PredictComponent(calc,
198  Flavors::kNuMuToNuE,
199  Current::kCC, sign);
200  }
201  if (flav & Flavors::kNuMuToNuMu){
202  ret += fPredRock->PredictComponent(calc,
203  Flavors::kNuMuToNuMu,
204  Current::kCC, sign);
205  }
206  }
207 
208  return ret;
209  }
Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
(&#39; appearance&#39;)
Definition: IPrediction.h:18
(&#39;beam &#39;)
Definition: IPrediction.h:15
Charged-current interactions.
Definition: IPrediction.h:39
static Spectrum Uninitialized()
Definition: Spectrum.h:157
std::vector< float > Spectrum
Definition: Constants.h:527
(&#39; survival&#39;)
Definition: IPrediction.h:19
PredictionNoExtrap * fPredRock
Neutral-current interactions.
Definition: IPrediction.h:40
assert(nhit_max >=nhit_nbins)
Both neutrinos and antineutrinos.
Definition: IPrediction.h:52
All neutrinos, any flavor.
Definition: IPrediction.h:26
(&#39; appearance&#39;)
Definition: IPrediction.h:16
def sign(x)
Definition: canMan.py:197
void ana::PredictionAddRock::SaveTo ( TDirectory *  dir,
const std::string &  name 
) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 244 of file PredictionAddRock.cxx.

References dir, fPredFid, fPredRock, ana::PredictionNoExtrap::SaveTo(), ana::IPrediction::SaveTo(), and tmp.

Referenced by GetRockPred().

245  {
246  TDirectory* tmp = gDirectory;
247 
248  dir = dir->mkdir(name.c_str()); // switch to subdir
249  dir->cd();
250 
251  TObjString("PredictionAddRock").Write("type");
252 
253  fPredFid->SaveTo(dir, "predFid");
254  fPredRock->SaveTo(dir, "predRock");
255 
256  dir->Write();
257  delete dir;
258 
259  tmp->cd();
260  }
const XML_Char * name
Definition: expat.h:151
Float_t tmp
Definition: plot.C:36
virtual void SaveTo(TDirectory *dir, const std::string &name) const
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
PredictionNoExtrap * fPredRock
TDirectory * dir
Definition: macro.C:5

Member Data Documentation

IPrediction* ana::PredictionAddRock::fPredFid
protected
PredictionNoExtrap* ana::PredictionAddRock::fPredRock
protected

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