All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ana::PredictionScaleComp Class Reference

Prediction broken down into arbitrary components whose scales can be varied independently. More...

#include <PredictionScaleComp.h>

Inheritance diagram for ana::PredictionScaleComp:
ana::IPrediction

Public Member Functions

 PredictionScaleComp (SpectrumLoaderBase &loader, const HistAxis &axis, SpillCut spillcut, Cut cut, const std::vector< const SystComponentScale * > &systs, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted)
 
 PredictionScaleComp (SpectrumLoaderBase &loader, const HistAxis &axis1, const HistAxis &axis2, SpillCut spillcut, Cut cut, const std::vector< const SystComponentScale * > &systs, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted)
 Constructor to take two HistAxis's to weight 2D spectra. More...
 
 PredictionScaleComp (SpectrumLoaderBase &loaderNonswap, SpectrumLoaderBase &loaderNue, SpectrumLoaderBase &loaderNuTau, SpectrumLoaderBase &loaderIntrinsic, const HistAxis &axis, SpillCut spillcut, Cut cut, const std::vector< const SystComponentScale * > &systs, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted)
 This is for the FD via PredictionNoExtrap. More...
 
virtual ~PredictionScaleComp ()
 
virtual Spectrum Predict (osc::IOscCalc *osc) const override
 
virtual Spectrum PredictSyst (osc::IOscCalc *osc, 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 PredictComponentSyst (osc::IOscCalc *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
 
Spectrum PredictCategory (osc::IOscCalc *osc, const SystComponentScale *syst) const
 
virtual void SaveTo (TDirectory *dir) const override
 
- Public Member Functions inherited from ana::IPrediction
virtual ~IPrediction ()
 
virtual Spectrum PredictUnoscillated () const
 
virtual OscillatableSpectrum ComponentCC (int from, int to) const
 

Static Public Member Functions

static std::unique_ptr
< PredictionScaleComp
LoadFrom (TDirectory *dir)
 

Protected Member Functions

 PredictionScaleComp (const IPrediction *total, const std::vector< const IPrediction * > &preds, const std::vector< const SystComponentScale * > &systs)
 

Protected Attributes

std::vector< const
SystComponentScale * > 
fSysts
 
std::vector< const IPrediction * > fPreds
 
const IPredictionfTotal
 

Detailed Description

Prediction broken down into arbitrary components whose scales can be varied independently.

Definition at line 14 of file PredictionScaleComp.h.

Constructor & Destructor Documentation

ana::PredictionScaleComp::PredictionScaleComp ( SpectrumLoaderBase loader,
const HistAxis axis,
SpillCut  spillcut,
Cut  cut,
const std::vector< const SystComponentScale * > &  systs,
const SystShifts shift = kNoShift,
const Var wei = kUnweighted 
)
Parameters
cutCut applied to all histograms
truthcutsPrediction will be broken down into N components following these cuts.

Definition at line 20 of file PredictionScaleComp.cxx.

27  : fSysts(systs)
28  {
29  Cut complementCut = kNoCut;
30 
31  assert(!systs.empty() && "Please give at least one systematic.");
32  for(const SystComponentScale* syst: systs){
33  fPreds.push_back(new PredictionNoOsc(loader, axis,
34  spillcut, cut && syst->GetCut(), shift, wei));
35  }
36 
37  fTotal = new PredictionNoOsc(loader, axis, spillcut, cut, shift, wei);
38  }
const Cut kNoCut([](const caf::SRSliceProxy *){return true;})
The simplest possible cut: pass everything, used as a default.
tuple loader
Definition: demo.py:7
shift
Definition: fcl_checks.sh:26
std::vector< const SystComponentScale * > fSysts
_Cut< caf::SRSliceProxy > Cut
Definition: Cut.h:95
const IPrediction * fTotal
std::vector< const IPrediction * > fPreds
ana::PredictionScaleComp::PredictionScaleComp ( SpectrumLoaderBase loader,
const HistAxis axis1,
const HistAxis axis2,
SpillCut  spillcut,
Cut  cut,
const std::vector< const SystComponentScale * > &  systs,
const SystShifts shift = kNoShift,
const Var wei = kUnweighted 
)

Constructor to take two HistAxis's to weight 2D spectra.

Definition at line 66 of file PredictionScaleComp.cxx.

74  {
75  assert(0 && "unimplemented");
76 
77  // TODO TODO TODO
78  /*
79  assert(truthcuts.size()>0 && "Please give at least one truth selection.");
80  for(unsigned int i = 0; i < truthcuts.size(); ++i){
81  fPreds.push_back(new PredictionNoOsc(loader, axis1, axis2,
82  cut && truthcuts[i], shift, wei));
83  fSysts.push_back(new DummyScaleCompSyst(i));
84  fComplementCut = fComplementCut && !truthcuts[i];
85  }
86 
87  // The idea is that if truthcuts are exhaustive, this Spectrum should wind
88  // up empty
89  fComplement = new Spectrum(loader, axis1, axis2,
90  cut && fComplementCut, shift, wei);
91  */
92  }
ana::PredictionScaleComp::PredictionScaleComp ( SpectrumLoaderBase loaderNonswap,
SpectrumLoaderBase loaderNue,
SpectrumLoaderBase loaderNuTau,
SpectrumLoaderBase loaderIntrinsic,
const HistAxis axis,
SpillCut  spillcut,
Cut  cut,
const std::vector< const SystComponentScale * > &  systs,
const SystShifts shift = kNoShift,
const Var wei = kUnweighted 
)

This is for the FD via PredictionNoExtrap.

Definition at line 42 of file PredictionScaleComp.cxx.

52  : fSysts(systs)
53  {
54  assert(!systs.empty() && "Please give at least one systematic.");
55  for(const SystComponentScale* syst: systs){
56  fPreds.push_back(new PredictionNoExtrap(loaderNonswap, loaderNue, loaderNuTau, loaderIntrinsic,
57  axis, spillcut, cut && syst->GetCut(), shift, wei));
58  }
59 
60  fTotal = new PredictionNoExtrap(loaderNonswap, loaderNue, loaderNuTau, loaderIntrinsic,
61  axis, spillcut, cut, shift, wei);
62  }
shift
Definition: fcl_checks.sh:26
std::vector< const SystComponentScale * > fSysts
const IPrediction * fTotal
std::vector< const IPrediction * > fPreds
ana::PredictionScaleComp::~PredictionScaleComp ( )
virtual

Definition at line 106 of file PredictionScaleComp.cxx.

107  {
108  for(const IPrediction* p: fPreds) delete p;
109  delete fTotal;
110  }
pdgs p
Definition: selectors.fcl:22
const IPrediction * fTotal
std::vector< const IPrediction * > fPreds
ana::PredictionScaleComp::PredictionScaleComp ( const IPrediction total,
const std::vector< const IPrediction * > &  preds,
const std::vector< const SystComponentScale * > &  systs 
)
protected

Definition at line 96 of file PredictionScaleComp.cxx.

99  : fSysts(systs),
100  fPreds(preds),
101  fTotal(total)
102  {
103  }
std::vector< const SystComponentScale * > fSysts
const IPrediction * fTotal
std::vector< const IPrediction * > fPreds

Member Function Documentation

std::unique_ptr< PredictionScaleComp > ana::PredictionScaleComp::LoadFrom ( TDirectory *  dir)
static

Definition at line 176 of file PredictionScaleComp.cxx.

177  {
178  IPrediction* total = ana::LoadFrom<IPrediction>(dir->GetDirectory("total")).release();
179 
180  std::vector<const IPrediction*> preds;
181  for(unsigned int i = 0; ; ++i){
182  TDirectory* di = dir->GetDirectory(("pred"+std::to_string(i)).c_str());
183  if(!di) break; // We got all the predictions
184 
185  preds.push_back(ana::LoadFrom<IPrediction>(di).release());
186  }
187 
188  std::vector<const SystComponentScale*> systs;
189  for(unsigned int i = 0; ; ++i){
190  TDirectory* si = dir->GetDirectory(("syst"+std::to_string(i)).c_str());
191  if(!si) break; // We got all the predictions
192 
193  systs.push_back(ana::LoadFrom<SystComponentScale>(si).release());
194  }
195 
196  return std::unique_ptr<PredictionScaleComp>(new PredictionScaleComp(total, preds, systs));
197  }
PredictionScaleComp(SpectrumLoaderBase &loader, const HistAxis &axis, SpillCut spillcut, Cut cut, const std::vector< const SystComponentScale * > &systs, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted)
tuple dir
Definition: dropbox.py:28
std::unique_ptr< IPrediction > LoadFrom< IPrediction >(TDirectory *dir)
Definition: IPrediction.cxx:26
std::string to_string(WindowPattern const &pattern)
virtual Spectrum ana::PredictionScaleComp::Predict ( osc::IOscCalc osc) const
inlineoverridevirtual

Implements ana::IPrediction.

Definition at line 51 of file PredictionScaleComp.h.

52  {
53  return fTotal->Predict(osc);
54  }
virtual Spectrum Predict(osc::IOscCalc *calc) const =0
const IPrediction * fTotal
Spectrum ana::PredictionScaleComp::PredictCategory ( osc::IOscCalc osc,
const SystComponentScale syst 
) const

Definition at line 143 of file PredictionScaleComp.cxx.

145  {
146  for(unsigned int i = 0; i < fSysts.size(); ++i){
147  if(fSysts[i] == syst) return fPreds[i]->Predict(osc);
148  }
149 
150  std::cout << "PredictionScaleComp::PredictCategory(): Unknown systematic " << syst->ShortName() << std::endl;
151  abort();
152  }
std::vector< const SystComponentScale * > fSysts
std::vector< const IPrediction * > fPreds
BEGIN_PROLOG could also be cout
virtual Spectrum ana::PredictionScaleComp::PredictComponent ( osc::IOscCalc calc,
Flavors::Flavors_t  flav,
Current::Current_t  curr,
Sign::Sign_t  sign 
) const
inlineoverridevirtual

Implements ana::IPrediction.

Definition at line 63 of file PredictionScaleComp.h.

67  {
68  return fTotal->PredictComponent(calc, flav, curr, sign);
69  }
int sign(double val)
Definition: UtilFunc.cxx:104
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
const IPrediction * fTotal
Spectrum ana::PredictionScaleComp::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 113 of file PredictionScaleComp.cxx.

118  {
119  SystShifts shiftClean = shift;
120  for(const ISyst* s: fSysts) shiftClean.SetShift(s, 0);
121 
122  // Starting with the total and adding in the differences for components
123  // that need to change is faster if most of the knobs are set to zero.
124  Spectrum ret = fTotal->PredictSyst(calc, shiftClean);
125 
126  for(unsigned int i = 0; i < fPreds.size(); ++i){
127  const double x = shift.GetShift(fSysts[i]);
128  if(x == 0) continue; // Nominal, can skip
129 
130  Spectrum si = fPreds[i]->PredictComponentSyst(calc, shiftClean,
131  flav, curr, sign);
132 
133  si.Scale(pow(1+fSysts[i]->OneSigmaScale(), x) - 1);
134 
135  ret += si;
136  }
137 
138  return ret;
139  }
process_name opflash particleana ie x
shift
Definition: fcl_checks.sh:26
std::vector< const SystComponentScale * > fSysts
virtual Spectrum PredictSyst(osc::IOscCalc *calc, const SystShifts &syst) const
Definition: IPrediction.cxx:62
int sign(double val)
Definition: UtilFunc.cxx:104
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
const IPrediction * fTotal
std::vector< const IPrediction * > fPreds
virtual Spectrum ana::PredictionScaleComp::PredictSyst ( osc::IOscCalc osc,
const SystShifts syst 
) const
inlineoverridevirtual

Reimplemented from ana::IPrediction.

Definition at line 56 of file PredictionScaleComp.h.

58  {
59  return PredictComponentSyst(osc, syst,
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:41
Both neutrinos and antineutrinos.
Definition: IPrediction.h:51
All neutrinos, any flavor.
Definition: IPrediction.h:25
void ana::PredictionScaleComp::SaveTo ( TDirectory *  dir) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 155 of file PredictionScaleComp.cxx.

156  {
157  TDirectory* tmp = gDirectory;
158  dir->cd();
159 
160  TObjString("PredictionScaleComp").Write("type");
161 
162  fTotal->SaveTo(dir->mkdir("total"));
163 
164  for(unsigned int i = 0; i < fPreds.size(); ++i){
165  fPreds[i]->SaveTo(dir->mkdir(("pred"+std::to_string(i)).c_str()));
166  }
167 
168  for(unsigned int i = 0; i < fSysts.size(); ++i){
169  fSysts[i]->SaveTo(dir->mkdir(("syst"+std::to_string(i)).c_str()));
170  }
171 
172  tmp->cd();
173  }
virtual void SaveTo(TDirectory *dir) const
Definition: IPrediction.cxx:85
std::vector< const SystComponentScale * > fSysts
tuple dir
Definition: dropbox.py:28
std::string to_string(WindowPattern const &pattern)
const IPrediction * fTotal
std::vector< const IPrediction * > fPreds

Member Data Documentation

std::vector<const IPrediction*> ana::PredictionScaleComp::fPreds
protected

Definition at line 89 of file PredictionScaleComp.h.

std::vector<const SystComponentScale*> ana::PredictionScaleComp::fSysts
protected

Definition at line 88 of file PredictionScaleComp.h.

const IPrediction* ana::PredictionScaleComp::fTotal
protected

Definition at line 91 of file PredictionScaleComp.h.


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