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

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/3FlavorAna/Prediction/PredictionExtendToPeripheral.h"

Inheritance diagram for ana::PredictionExtendToPeripheral:
ana::IPrediction ana::PredictExtendOwning

Public Member Functions

 PredictionExtendToPeripheral (IPrediction *predCore, PredictionNoExtrap *predNoExtrap, bool mergePeripheral=true, int nbins=3)
 Takes ownership of predCore and predNoExtrap. More...
 
 PredictionExtendToPeripheral (IPrediction *predCore, PredictionNoExtrap *predNoExtrap, const ana::Binning &bins, bool mergePeripheral=true, int nbins=3)
 
virtual ~PredictionExtendToPeripheral ()
 
virtual Spectrum Predict (osc::IOscCalc *calc) const override
 
virtual Spectrum Predict (osc::IOscCalcStan *calc) 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
 
OscillatableSpectrum ComponentCC (int from, int to) const override
 
Spectrum ComponentNCTotal () const override
 
Spectrum ComponentNC () const override
 
Spectrum ComponentNCAnti () const override
 
void Reduce ()
 
virtual void SaveTo (TDirectory *dir, const std::string &name) const override
 
 PredictionExtendToPeripheral ()=delete
 
IPredictionGetCore ()
 
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< PredictionExtendToPeripheralLoadFrom (TDirectory *dir, const std::string &name)
 

Protected Member Functions

OscillatableSpectrum ReduceHelper (const OscillatableSpectrum &s) const
 
template<typename T >
Spectrum _PredictComponent (osc::_IOscCalc< T > *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
 
Spectrum ReduceHelperNC (const Spectrum &s) const
 
Spectrum MergePeripheral (const Spectrum &s) const
 
OscillatableSpectrum MergePeripheralOsc (const OscillatableSpectrum &s) const
 
Spectrum ExtendRecoWeight (const Spectrum &Core, const Spectrum &NoExtrap) const
 
OscillatableSpectrum ExtendRecoWeightOscillatable (const OscillatableSpectrum &Core, OscillatableSpectrum NoExtrap) const
 

Protected Attributes

IPredictionfPredCore
 
PredictionNoExtrapfPredNoExtrap
 
Binning fBins
 
bool fMergePeripheral
 
int fNPIDBin
 
const int fNBinsI = fBins.NBins()
 
const int fEnergyBins = fNBinsI/fNPIDBin
 
const int fPeriNum = int(fEnergyBins/2)
 
const int fNBinsO = fNBinsI-fPeriNum
 
const int fNCore = (fNPIDBin-1)*fEnergyBins
 
const int fPeriBin = fNCore+int((fEnergyBins-fPeriNum)/2)+1
 
const int fReduceBin = fNBinsI - 2* fNPIDBin - fEnergyBins +1
 
const Binning ReduceBinning = Binning::Simple(fReduceBin, 0, fReduceBin)
 
OscillatableSpectrum fNuEToNuE
 
OscillatableSpectrum fAntiNuEToAntiNuE
 
OscillatableSpectrum fNuEToNuMu
 
OscillatableSpectrum fAntiNuEToAntiNuMu
 
OscillatableSpectrum fNuEToNuTau
 
OscillatableSpectrum fAntiNuEToAntiNuTau
 
OscillatableSpectrum fNuMuToNuE
 
OscillatableSpectrum fAntiNuMuToAntiNuE
 
OscillatableSpectrum fNuMuToNuMu
 
OscillatableSpectrum fAntiNuMuToAntiNuMu
 
OscillatableSpectrum fNuMuToNuTau
 
OscillatableSpectrum fAntiNuMuToAntiNuTau
 
Spectrum fNCTot
 
Spectrum fNC
 
Spectrum fNCAnti
 
bool fIsMerged
 

Detailed Description

Combines two extrapolations, one with extrapolated predictions of the core bins (and nominal peripheral) and one with all nominal predictions, to apply the correct weights to the peripheral sample (copying the high PID bin).

Definition at line 14 of file PredictionExtendToPeripheral.h.

Constructor & Destructor Documentation

ana::PredictionExtendToPeripheral::PredictionExtendToPeripheral ( IPrediction predCore,
PredictionNoExtrap predNoExtrap,
bool  mergePeripheral = true,
int  nbins = 3 
)

Takes ownership of predCore and predNoExtrap.

Definition at line 24 of file PredictionExtendToPeripheral.cxx.

25  : PredictionExtendToPeripheral(predCore, predNoExtrap, Binning::Simple(27,0,27), mergePeripheral, nbins)
26  {
27  }
bool mergePeripheral
const int nbins
Definition: cellShifts.C:15
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
ana::PredictionExtendToPeripheral::PredictionExtendToPeripheral ( IPrediction predCore,
PredictionNoExtrap predNoExtrap,
const ana::Binning bins,
bool  mergePeripheral = true,
int  nbins = 3 
)

Definition at line 30 of file PredictionExtendToPeripheral.cxx.

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

31  : fPredCore(predCore),
32  fPredNoExtrap(predNoExtrap),
33  fBins(bins),
35  fNPIDBin(nbins),
51  fIsMerged(false)
52  {
53 
54  if(!fMergePeripheral) std::cout << "WARNING: Not merging peripheral. Check inputs." << std::endl;
55  }
OscillatableSpectrum ComponentCC(int from, int to) const override
Spectrum ComponentNC() const override
virtual Spectrum ComponentNCAnti() const
Spectrum ComponentNCTotal() const override
bool mergePeripheral
virtual Spectrum ComponentNC() const
const int nbins
Definition: cellShifts.C:15
virtual OscillatableSpectrum ComponentCC(int from, int to) const
OStream cout
Definition: OStream.cxx:6
virtual Spectrum ComponentNCTotal() const
Spectrum ComponentNCAnti() const override
OscillatableSpectrum ExtendRecoWeightOscillatable(const OscillatableSpectrum &Core, OscillatableSpectrum NoExtrap) const
Spectrum ExtendRecoWeight(const Spectrum &Core, const Spectrum &NoExtrap) const
ana::PredictionExtendToPeripheral::~PredictionExtendToPeripheral ( )
virtual

Definition at line 58 of file PredictionExtendToPeripheral.cxx.

59  {
60  // We don't necessarily own the predictions, leave them alone
61  }
ana::PredictionExtendToPeripheral::PredictionExtendToPeripheral ( )
delete

Referenced by LoadFrom().

Member Function Documentation

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

Definition at line 298 of file PredictionExtendToPeripheral.cxx.

References ana::assert(), calc, ana::Spectrum::Clear(), ComponentNC(), ComponentNCAnti(), febshutoff_auto::curr, fAntiNuEToAntiNuE, fAntiNuEToAntiNuMu, fAntiNuEToAntiNuTau, fAntiNuMuToAntiNuE, fAntiNuMuToAntiNuMu, fAntiNuMuToAntiNuTau, fNCTot, fNuEToNuE, fNuEToNuMu, fNuEToNuTau, fNuMuToNuE, fNuMuToNuMu, fNuMuToNuTau, 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, ana::OscillatableSpectrum::Oscillated(), runNovaSAM::ret, and canMan::sign().

Referenced by GetCore(), and PredictComponent().

302  {
303  Spectrum ret = fNCTot;
304 
305  ret.Clear();
306 
307  if(curr & Current::kCC){
308 
309  if(flav & Flavors::kNuEToNuE && sign & Sign::kNu)
310  ret += fNuEToNuE.Oscillated(calc, +12, +12);
311  if(flav & Flavors::kNuEToNuE && sign & Sign::kAntiNu)
312  ret += fAntiNuEToAntiNuE.Oscillated(calc, -12, -12);
313  if(flav & Flavors::kNuEToNuMu && sign & Sign::kNu)
314  ret += fNuEToNuMu.Oscillated(calc, +12, +14);
315  if(flav & Flavors::kNuEToNuMu && sign & Sign::kAntiNu)
316  ret += fAntiNuEToAntiNuMu.Oscillated(calc, -12, -14);
317  if(flav & Flavors::kNuEToNuTau && sign & Sign::kNu)
318  ret += fNuEToNuTau.Oscillated(calc, +12, +16);
319  if(flav & Flavors::kNuEToNuTau && sign & Sign::kAntiNu)
320  ret += fAntiNuEToAntiNuTau.Oscillated(calc, -12, -16);
321 
322  if(flav & Flavors::kNuMuToNuE && sign & Sign::kNu)
323  ret += fNuMuToNuE.Oscillated(calc, +14, +12);
324  if(flav & Flavors::kNuMuToNuE && sign & Sign::kAntiNu)
325  ret += fAntiNuMuToAntiNuE.Oscillated(calc, -14, -12);
326  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kNu)
327  ret += fNuMuToNuMu.Oscillated(calc, +14, +14);
328  if(flav & Flavors::kNuMuToNuMu && sign & Sign::kAntiNu)
329  ret += fAntiNuMuToAntiNuMu.Oscillated(calc, -14, -14);
330  if(flav & Flavors::kNuMuToNuTau && sign & Sign::kNu)
331  ret += fNuMuToNuTau.Oscillated(calc, +14, +16);
332  if(flav & Flavors::kNuMuToNuTau && sign & Sign::kAntiNu)
333  ret += fAntiNuMuToAntiNuTau.Oscillated(calc, -14, -16);
334 
335  }
336 
337  if(curr & Current::kNC){
338  assert(flav == Flavors::kAll); // Don't know how to calculate anything else
339 
340  if(sign & Sign::kNu) ret += this->ComponentNC();
341  if(sign & Sign::kAntiNu) ret += this->ComponentNCAnti();
342 
343  }
344 
345  return ret;
346  }
Antineutrinos-only.
Definition: IPrediction.h:50
(&#39; appearance&#39;)
Definition: IPrediction.h:18
(&#39;beam &#39;)
Definition: IPrediction.h:15
void Clear()
Definition: Spectrum.cxx:361
Charged-current interactions.
Definition: IPrediction.h:39
std::vector< float > Spectrum
Definition: Constants.h:610
Neutrinos-only.
Definition: IPrediction.h:49
(&#39; survival&#39;)
Definition: IPrediction.h:19
Spectrum Oscillated(osc::IOscCalc *calc, int from, int to) const
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::PredictionExtendToPeripheral::ComponentCC ( int  from,
int  to 
) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 381 of file PredictionExtendToPeripheral.cxx.

References ana::assert(), fAntiNuEToAntiNuE, fAntiNuEToAntiNuMu, fAntiNuEToAntiNuTau, fAntiNuMuToAntiNuE, fAntiNuMuToAntiNuMu, fAntiNuMuToAntiNuTau, fNuEToNuE, fNuEToNuMu, fNuEToNuTau, fNuMuToNuE, fNuMuToNuMu, and fNuMuToNuTau.

382  {
383  // beam nues and numu survival come from extending the effect on the high
384  // CVN bin into the peripheral sample
385  if (from == +12 && to == +12) return fNuEToNuE;
386  if (from == +12 && to == +14) return fNuEToNuMu;
387  if (from == +12 && to == +16) return fNuEToNuTau;
388 
389  if (from == +14 && to == +12) return fNuMuToNuE;
390  if (from == +14 && to == +14) return fNuMuToNuMu;
391  if (from == +14 && to == +16) return fNuMuToNuTau;
392 
393  if (from == -12 && to == -12) return fAntiNuEToAntiNuE;
394  if (from == -12 && to == -14) return fAntiNuEToAntiNuMu;
395  if (from == -12 && to == -16) return fAntiNuEToAntiNuTau;
396 
397  if (from == -14 && to == -12) return fAntiNuMuToAntiNuE;
398  if (from == -14 && to == -14) return fAntiNuMuToAntiNuMu;
399  if (from == -14 && to == -16) return fAntiNuMuToAntiNuTau;
400 
401  assert(0 && "Not reached");
402  }
assert(nhit_max >=nhit_nbins)
Spectrum ana::PredictionExtendToPeripheral::ComponentNC ( ) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 410 of file PredictionExtendToPeripheral.cxx.

References fNC.

Referenced by _PredictComponent().

411  {
412  return fNC;
413  }
Spectrum ana::PredictionExtendToPeripheral::ComponentNCAnti ( ) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 414 of file PredictionExtendToPeripheral.cxx.

References fNCAnti.

Referenced by _PredictComponent().

415  {
416  return fNCAnti;
417  }
Spectrum ana::PredictionExtendToPeripheral::ComponentNCTotal ( ) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 406 of file PredictionExtendToPeripheral.cxx.

References fNCTot.

407  {
408  return fNCTot;
409  }
Spectrum ana::PredictionExtendToPeripheral::ExtendRecoWeight ( const Spectrum Core,
const Spectrum NoExtrap 
) const
protected

Definition at line 232 of file PredictionExtendToPeripheral.cxx.

References bin, fEnergyBins, fMergePeripheral, fNBinsI, fNCore, ana::Spectrum::GetBinnings(), ana::Ratio::GetEigen(), ana::Spectrum::GetLabels(), and MergePeripheral().

Referenced by GetCore().

234  {
235  // NoExtrap has the nominal FD prediction in it, while Core has the
236  // our decomposed prediction. We want to copy over the decomp weights,
237  // which will just be the Core / NoExtrap bin content. That covers
238  // extrapolation in energy bins.
239  Eigen::ArrayXd arat = Ratio(Core,NoExtrap).GetEigen();
240 
241  const int FirstPeripheralBin = fNCore+1;
242  const int LastPeripheralBin = fNBinsI;
243  const int EBinsPerSelBin = fEnergyBins;
244 
245  for (int bin = FirstPeripheralBin; bin<= LastPeripheralBin; bin++){
246  // Copy decomp ratio from high CVN bin to peripheral bin
247  arat[bin] = arat[bin-EBinsPerSelBin];
248  }
249  Ratio rat(std::move(arat), Core.GetLabels(), Core.GetBinnings());
250 
251  Spectrum extrap = NoExtrap*rat;
252 
253  // Done if we don't want to collapse energy spectrum in peripheral sample
254  if (!fMergePeripheral) return extrap;
255 
256  // Now, we have to merge all energy bins in the peripheral sample
257  // This is only applicable to the Nue2017 result, so assume 28 bins
258  return MergePeripheral(extrap);
259  }
Spectrum MergePeripheral(const Spectrum &s) const
float bin[41]
Definition: plottest35.C:14
std::vector< float > Spectrum
Definition: Constants.h:610
void NoExtrap(std::string InputString, bool RunProd4Cuts=true, bool RunAllCuts=false, bool Debug=false)
Definition: NoExtrap.C:36
OscillatableSpectrum ana::PredictionExtendToPeripheral::ExtendRecoWeightOscillatable ( const OscillatableSpectrum Core,
OscillatableSpectrum  NoExtrap 
) const
protected

Definition at line 263 of file PredictionExtendToPeripheral.cxx.

References bin, fEnergyBins, fMergePeripheral, fNBinsO, fNCore, ana::Spectrum::GetBinnings(), ana::Ratio::GetEigen(), ana::Spectrum::GetLabels(), MergePeripheralOsc(), NoExtrap(), ana::ReweightableSpectrum::ReweightToRecoSpectrum(), and ana::OscillatableSpectrum::Unoscillated().

Referenced by GetCore().

265  {
266  // NoExtrap has the nominal FD prediction in it, while Core has the
267  // our decomposed prediction. We want to copy over the decomp weights,
268  // which will just be the Core / NoExtrap bin content
269 
270  // Calling Unoscillated() will project down to the predicted reco spectra
271 
272  Spectrum recoCore = Core.Unoscillated();
273 
274  Spectrum recoNoExtrap = NoExtrap.Unoscillated();
275  Eigen::ArrayXd arat = Ratio(recoCore,recoNoExtrap).GetEigen();
276 
277  const int FirstPeripheralBin = fNCore+1;
278  const int LastPeripheralBin = fNBinsO;
279 
280  const int EBinsPerSelBin = fEnergyBins;
281  for (int bin = FirstPeripheralBin; bin<= LastPeripheralBin; bin++){
282  // Copy decomp ratio from high CVN bin to peripheral bin
283  arat[bin] = arat[bin-EBinsPerSelBin];
284  }
285  Ratio rat(std::move(arat), recoCore.GetLabels(), recoCore.GetBinnings());
286  NoExtrap.ReweightToRecoSpectrum(rat*recoNoExtrap);
287 
288  // We're done if we don't want to merge peripheral sample energy dist
289  if (!fMergePeripheral) return NoExtrap;
290 
292  }
OscillatableSpectrum MergePeripheralOsc(const OscillatableSpectrum &s) const
float bin[41]
Definition: plottest35.C:14
std::vector< float > Spectrum
Definition: Constants.h:610
void NoExtrap(std::string InputString, bool RunProd4Cuts=true, bool RunAllCuts=false, bool Debug=false)
Definition: NoExtrap.C:36
IPrediction* ana::PredictionExtendToPeripheral::GetCore ( )
inline
std::unique_ptr< PredictionExtendToPeripheral > ana::PredictionExtendToPeripheral::LoadFrom ( TDirectory *  dir,
const std::string name 
)
static

Definition at line 445 of file PredictionExtendToPeripheral.cxx.

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

446  {
447  dir = dir->GetDirectory(name.c_str()); // switch to subdir
448  assert(dir);
449 
450  auto predCore = ana::LoadFrom<IPrediction>(dir, "predCore").release();
451  PredictionNoExtrap* predNoExtrap = ana::LoadFrom<PredictionNoExtrap>(dir, "predNoExtrap").release();
452 
453  Binning bins= *Binning::LoadFrom(dir, "bins");
454 
455  bool mergeperipheral = true; // default
456 
457  TVectorD* vMergePeripheral = (TVectorD*)dir->Get("mergePeripheral");
458  // An attempt to be backwards compatable to already generated files
459  if (vMergePeripheral){
460  assert(vMergePeripheral->GetNrows() == 1);
461  mergeperipheral = bool((*vMergePeripheral)[0]);
462  }
463 
464  delete dir;
465 
466  return std::unique_ptr<PredictionExtendToPeripheral>(new PredictionExtendToPeripheral(predCore, predNoExtrap, bins, mergeperipheral));
467  }
static std::unique_ptr< Binning > LoadFrom(TDirectory *dir, const std::string &name)
Definition: Binning.cxx:230
const XML_Char * name
Definition: expat.h:151
std::unique_ptr< IPrediction > LoadFrom< IPrediction >(TDirectory *dir, const std::string &label)
Definition: IPrediction.cxx:18
const Binning bins
Definition: NumuCC_CPiBin.h:8
TDirectory * dir
Definition: macro.C:5
assert(nhit_max >=nhit_nbins)
Spectrum ana::PredictionExtendToPeripheral::MergePeripheral ( const Spectrum s) const
protected

Definition at line 187 of file PredictionExtendToPeripheral.cxx.

References a, fNBinsI, fNBinsO, fNCore, fPeriBin, ana::Spectrum::GetEigen(), ana::Spectrum::GetLabels(), MECModelEnuComparisons::i, ana::Spectrum::Livetime(), ana::Spectrum::POT(), and ana::Binning::Simple().

Referenced by ExtendRecoWeight(), and GetCore().

188  {
189  Eigen::ArrayXd a = s.GetEigen(s.POT());
190  Eigen::ArrayXd aret(fNBinsO+2);
191  aret.setZero();
192  for (int i = 1; i <= fNCore; i++){
193  aret[i] = a[i]; // Copy Core
194  }
195 
196  // Merge peripheral
197  for(int i = 0; i <= 8; ++i) aret[fPeriBin] += a[fNBinsI-i];
198 
199  return Spectrum(std::move(aret),
200  HistAxis(s.GetLabels(), {Binning::Simple(fNBinsO, 0, fNBinsO)}),
201  s.POT(),
202  s.Livetime());
203  }
_HistAxis< Var > HistAxis
Definition: HistAxis.h:103
const XML_Char * s
Definition: expat.h:262
const double a
std::vector< float > Spectrum
Definition: Constants.h:610
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
OscillatableSpectrum ana::PredictionExtendToPeripheral::MergePeripheralOsc ( const OscillatableSpectrum s) const
protected

Definition at line 206 of file PredictionExtendToPeripheral.cxx.

References fNBinsI, fNBinsO, fNCore, fPeriBin, ana::ReweightableSpectrum::GetEigen(), ana::ReweightableSpectrum::GetLabels(), ana::kTrueEnergyBins, ana::ReweightableSpectrum::Livetime(), ana::Binning::NBins(), ana::ReweightableSpectrum::POT(), and ana::Binning::Simple().

Referenced by ExtendRecoWeightOscillatable(), and GetCore().

207  {
208  Eigen::MatrixXd aret(kTrueEnergyBins.NBins()+2, fNBinsO+2);
209  aret.setZero();
210  Eigen::MatrixXd aextrap = s.GetEigen(s.POT());
211 
212  for (int binX = 1; binX <= fNCore; binX++){
213  for (int binY = 1; binY <= kTrueEnergyBins.NBins(); binY++){
214  aret(binY, binX) = aextrap(binY, binX);
215  }
216  }
217  // Now, project all the bins in columns 28+ down to the 28th
218  for (int binX = fNCore+1; binX <= fNBinsI; binX++){
219  for (int binY = 1; binY <= kTrueEnergyBins.NBins(); binY++){
220  aret(binY, fPeriBin) += aextrap(binY, binX);
221  }
222  }
223 
224  return OscillatableSpectrum(std::move(aret),
225  HistAxis(s.GetLabels(), {Binning::Simple(fNBinsO, 0, fNBinsO)}),
226  s.POT(),
227  s.Livetime());
228  }
_HistAxis< Var > HistAxis
Definition: HistAxis.h:103
const XML_Char * s
Definition: expat.h:262
const Binning kTrueEnergyBins
Default true-energy bin edges.
Definition: Binning.h:14
int NBins() const
Definition: Binning.h:29
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
Spectrum ana::PredictionExtendToPeripheral::Predict ( osc::IOscCalc calc) const
overridevirtual

Implements ana::IPrediction.

Definition at line 169 of file PredictionExtendToPeripheral.cxx.

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

Referenced by test_nue2017Prediction().

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

Reimplemented from ana::IPrediction.

Definition at line 178 of file PredictionExtendToPeripheral.cxx.

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

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

Implements ana::IPrediction.

Definition at line 361 of file PredictionExtendToPeripheral.cxx.

References _PredictComponent().

Referenced by Predict(), and test_nue2017Prediction().

365  {
366  return _PredictComponent(calc, flav, curr, sign);
367  }
Spectrum _PredictComponent(osc::_IOscCalc< T > *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
def sign(x)
Definition: canMan.py:197
Spectrum ana::PredictionExtendToPeripheral::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 371 of file PredictionExtendToPeripheral.cxx.

References _PredictComponent().

375  {
376  return _PredictComponent(calc, flav, curr, sign);
377  }
Spectrum _PredictComponent(osc::_IOscCalc< T > *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
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 79 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().

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 PredictComponent(calc, flav, curr, sign);
89  }
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 93 of file IPrediction.cxx.

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

98  {
99  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
100 
101  // Default implementation: no treatment of systematics
102  return PredictComponent(calc, flav, curr, sign);
103  }
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 49 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().

51  {
52  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
53 
54  // Default implementation: no treatment of systematics
55  return Predict(calc);
56  }
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 59 of file IPrediction.cxx.

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

61  {
62  assert(syst.IsNominal() && "This Prediction doesn't support PredictSyst(). Did you just mean Predict()?");
63 
64  // Default implementation: no treatment of systematics
65  return Predict(calc);
66  }
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 33 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().

34  {
35  // Default implementation
37  return Predict(&noosc);
38  }
Pass neutrinos through unchanged.
Definition: IOscCalc.h:45
virtual Spectrum Predict(osc::IOscCalc *calc) const =0
osc::NoOscillations noosc
Definition: NueSystFuncs.h:44
void ana::PredictionExtendToPeripheral::Reduce ( )

Definition at line 146 of file PredictionExtendToPeripheral.cxx.

References ana::assert(), fAntiNuEToAntiNuE, fAntiNuEToAntiNuMu, fAntiNuEToAntiNuTau, fAntiNuMuToAntiNuE, fAntiNuMuToAntiNuMu, fAntiNuMuToAntiNuTau, fIsMerged, fNC, fNCAnti, fNCTot, fNuEToNuE, fNuEToNuMu, fNuEToNuTau, fNuMuToNuE, fNuMuToNuMu, fNuMuToNuTau, ReduceHelper(), and ReduceHelperNC().

147  {
148  assert(!fIsMerged && "Can't call Reduce() twice");
149 
162 
164 
165  fIsMerged = true; // dont collapse the whole universe...
166  }
Spectrum ReduceHelperNC(const Spectrum &s) const
OscillatableSpectrum ReduceHelper(const OscillatableSpectrum &s) const
assert(nhit_max >=nhit_nbins)
OscillatableSpectrum ana::PredictionExtendToPeripheral::ReduceHelper ( const OscillatableSpectrum s) const
protected

Definition at line 65 of file PredictionExtendToPeripheral.cxx.

References ana::assert(), ana::bins, fNBinsO, fNCore, fNPIDBin, ana::ReweightableSpectrum::GetBinnings(), ana::ReweightableSpectrum::GetEigen(), ana::ReweightableSpectrum::GetLabels(), MECModelEnuComparisons::i, calib::j, ana::kTrueEnergyBins, PandAna.Demos.pi0_spectra::labels, livetime, ana::ReweightableSpectrum::Livetime(), ana::Binning::NBins(), pot, ana::ReweightableSpectrum::POT(), ReduceBinning, and submit_syst::x.

Referenced by GetCore(), and Reduce().

66  {
67  std::vector<std::string> labels = s.GetLabels();
68  std::vector<Binning> bins = s.GetBinnings();
69  double pot = s.POT();
70  double livetime = s.Livetime();
71 
72  std::vector<int> Bins;
73 
74  for(int i = 1; i < fNBinsO+1; i++){ Bins.push_back(i); }
75  int iter = fNPIDBin;
76 
77  Bins.erase(Bins.end()-2, Bins.end()); // bye peripheral
78  Bins.erase(Bins.begin()+(fNCore),Bins.begin()+(fNCore+2));
79 
80  while(iter-1){ // peripheral is done
81  for(int j: {9, 2, 1}){
82  Bins.erase(Bins.begin() +((iter-2)* 9+j-1));
83  }
84  --iter;
85  }
86 
87  Eigen::MatrixXd ain = s.GetEigen(s.POT());
88  assert(s.GetBinnings()[0].NBins() == fNBinsO && "Merge Peripheral Before Reduce!");
89  Eigen::MatrixXd aout(kTrueEnergyBins.NBins()+2, ReduceBinning.NBins()+2);
90  aout.setZero();
91 
92  int i = 0;
93  for(int x: Bins){
94  ++i;
95  for(int j = 0; j < ain.size(); ++j){
96  aout(j, i) = ain(j, x);
97  }
98  }
99 
100  return OscillatableSpectrum(std::move(aout),
101  HistAxis(labels, bins),
102  pot, livetime);
103 
104  }
_HistAxis< Var > HistAxis
Definition: HistAxis.h:103
const XML_Char * s
Definition: expat.h:262
#define pot
const double j
Definition: BetheBloch.cxx:29
const Binning kTrueEnergyBins
Default true-energy bin edges.
Definition: Binning.h:14
const Binning bins
Definition: NumuCC_CPiBin.h:8
double livetime
Definition: saveFDMCHists.C:21
int NBins() const
Definition: Binning.h:29
assert(nhit_max >=nhit_nbins)
Spectrum ana::PredictionExtendToPeripheral::ReduceHelperNC ( const Spectrum s) const
protected

Definition at line 108 of file PredictionExtendToPeripheral.cxx.

References ana::assert(), ana::bins, fNBinsO, fNCore, fNPIDBin, fReduceBin, ana::Spectrum::GetBinnings(), ana::Spectrum::GetEigen(), ana::Spectrum::GetLabels(), MECModelEnuComparisons::i, calib::j, PandAna.Demos.pi0_spectra::labels, ana::Spectrum::Livetime(), ana::Binning::NBins(), pot, ana::Spectrum::POT(), ReduceBinning, and submit_syst::x.

Referenced by GetCore(), and Reduce().

109  {
110  std::vector<std::string> labels = s.GetLabels();
111  std::vector<Binning> bins = s.GetBinnings();
112  double pot = s.POT();
113 
114  std::vector<int> Bins;
115 
116  for(int i = 1; i < fNBinsO+1; i++){ Bins.push_back(i); }
117  int iter = fNPIDBin;
118 
119  Bins.erase(Bins.end()-2, Bins.end()); // bye peripheral
120  Bins.erase(Bins.begin()+(fNCore),Bins.begin()+fNCore+2);
121 
122  while(iter-1){ // peripheral is done
123  for(int j: {9, 2, 1}){
124  Bins.erase(Bins.begin() + ((iter-2)* 9+j-1));
125  }
126  --iter;
127  }
128 
129  Eigen::ArrayXd ain = s.GetEigen(pot);
130  assert( ain.size()-2 == fNBinsO && "Merge Peripheral Before Reduce!");
131  Eigen::ArrayXd aout(ReduceBinning.NBins()+2);
132  aout.setZero();
133 
134  for(int x = 0; x < fReduceBin+2; ++x){
135  aout[x]= ain[Bins[x-1]];
136  }
137 
138  std::vector<Binning> tmp_bin = {ReduceBinning};
139  return Spectrum(std::move(aout),
140  HistAxis(s.GetLabels(), tmp_bin),
141  s.POT(), s.Livetime());
142  }
_HistAxis< Var > HistAxis
Definition: HistAxis.h:103
const XML_Char * s
Definition: expat.h:262
#define pot
const double j
Definition: BetheBloch.cxx:29
std::vector< float > Spectrum
Definition: Constants.h:610
const Binning bins
Definition: NumuCC_CPiBin.h:8
int NBins() const
Definition: Binning.h:29
assert(nhit_max >=nhit_nbins)
void ana::PredictionExtendToPeripheral::SaveTo ( TDirectory *  dir,
const std::string name 
) const
overridevirtual

Reimplemented from ana::IPrediction.

Definition at line 420 of file PredictionExtendToPeripheral.cxx.

References dir, fBins, fMergePeripheral, fPredCore, fPredNoExtrap, ana::Binning::SaveTo(), ana::PredictionNoExtrap::SaveTo(), ana::IPrediction::SaveTo(), and tmp.

Referenced by make_nueFDprediction_kinematics_FHC(), make_nueFDprediction_kinematics_FHC_REW(), make_nueFDprediction_kinematics_RHC(), and make_nueFDprediction_kinematics_RHC_REW().

421  {
422  TDirectory* tmp = gDirectory;
423 
424  dir = dir->mkdir(name.c_str()); // switch to subdir
425  dir->cd();
426 
427  TObjString("PredictionExtendToPeripheral").Write("type");
428 
429  fPredCore->SaveTo(dir, "predCore");
430  fPredNoExtrap->SaveTo(dir, "predNoExtrap");
431 
432  fBins.SaveTo(dir, "bins");
433 
434  TVectorD vMergePeripheral(1);
435  vMergePeripheral[0] = fMergePeripheral;
436  vMergePeripheral.Write("mergePeripheral");
437 
438  dir->Write();
439  delete dir;
440 
441  tmp->cd();
442  }
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
TDirectory * dir
Definition: macro.C:5
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Binning.cxx:193

Member Data Documentation

OscillatableSpectrum ana::PredictionExtendToPeripheral::fAntiNuEToAntiNuE
protected

Definition at line 112 of file PredictionExtendToPeripheral.h.

Referenced by _PredictComponent(), ComponentCC(), and Reduce().

OscillatableSpectrum ana::PredictionExtendToPeripheral::fAntiNuEToAntiNuMu
protected

Definition at line 114 of file PredictionExtendToPeripheral.h.

Referenced by _PredictComponent(), ComponentCC(), and Reduce().

OscillatableSpectrum ana::PredictionExtendToPeripheral::fAntiNuEToAntiNuTau
protected

Definition at line 116 of file PredictionExtendToPeripheral.h.

Referenced by _PredictComponent(), ComponentCC(), and Reduce().

OscillatableSpectrum ana::PredictionExtendToPeripheral::fAntiNuMuToAntiNuE
protected

Definition at line 119 of file PredictionExtendToPeripheral.h.

Referenced by _PredictComponent(), ComponentCC(), and Reduce().

OscillatableSpectrum ana::PredictionExtendToPeripheral::fAntiNuMuToAntiNuMu
protected

Definition at line 121 of file PredictionExtendToPeripheral.h.

Referenced by _PredictComponent(), ComponentCC(), and Reduce().

OscillatableSpectrum ana::PredictionExtendToPeripheral::fAntiNuMuToAntiNuTau
protected

Definition at line 123 of file PredictionExtendToPeripheral.h.

Referenced by _PredictComponent(), ComponentCC(), and Reduce().

Binning ana::PredictionExtendToPeripheral::fBins
protected

Definition at line 90 of file PredictionExtendToPeripheral.h.

Referenced by SaveTo().

const int ana::PredictionExtendToPeripheral::fEnergyBins = fNBinsI/fNPIDBin
protected
bool ana::PredictionExtendToPeripheral::fIsMerged
protected

Definition at line 130 of file PredictionExtendToPeripheral.h.

Referenced by Reduce().

bool ana::PredictionExtendToPeripheral::fMergePeripheral
protected
const int ana::PredictionExtendToPeripheral::fNBinsI = fBins.NBins()
protected
const int ana::PredictionExtendToPeripheral::fNBinsO = fNBinsI-fPeriNum
protected
Spectrum ana::PredictionExtendToPeripheral::fNC
protected

Definition at line 126 of file PredictionExtendToPeripheral.h.

Referenced by ComponentNC(), and Reduce().

Spectrum ana::PredictionExtendToPeripheral::fNCAnti
protected

Definition at line 127 of file PredictionExtendToPeripheral.h.

Referenced by ComponentNCAnti(), and Reduce().

const int ana::PredictionExtendToPeripheral::fNCore = (fNPIDBin-1)*fEnergyBins
protected
Spectrum ana::PredictionExtendToPeripheral::fNCTot
protected

Definition at line 125 of file PredictionExtendToPeripheral.h.

Referenced by _PredictComponent(), ComponentNCTotal(), and Reduce().

int ana::PredictionExtendToPeripheral::fNPIDBin
protected

Definition at line 92 of file PredictionExtendToPeripheral.h.

Referenced by ReduceHelper(), and ReduceHelperNC().

OscillatableSpectrum ana::PredictionExtendToPeripheral::fNuEToNuE
protected

Definition at line 111 of file PredictionExtendToPeripheral.h.

Referenced by _PredictComponent(), ComponentCC(), and Reduce().

OscillatableSpectrum ana::PredictionExtendToPeripheral::fNuEToNuMu
protected

Definition at line 113 of file PredictionExtendToPeripheral.h.

Referenced by _PredictComponent(), ComponentCC(), and Reduce().

OscillatableSpectrum ana::PredictionExtendToPeripheral::fNuEToNuTau
protected

Definition at line 115 of file PredictionExtendToPeripheral.h.

Referenced by _PredictComponent(), ComponentCC(), and Reduce().

OscillatableSpectrum ana::PredictionExtendToPeripheral::fNuMuToNuE
protected

Definition at line 118 of file PredictionExtendToPeripheral.h.

Referenced by _PredictComponent(), ComponentCC(), and Reduce().

OscillatableSpectrum ana::PredictionExtendToPeripheral::fNuMuToNuMu
protected

Definition at line 120 of file PredictionExtendToPeripheral.h.

Referenced by _PredictComponent(), ComponentCC(), and Reduce().

OscillatableSpectrum ana::PredictionExtendToPeripheral::fNuMuToNuTau
protected

Definition at line 122 of file PredictionExtendToPeripheral.h.

Referenced by _PredictComponent(), ComponentCC(), and Reduce().

const int ana::PredictionExtendToPeripheral::fPeriBin = fNCore+int((fEnergyBins-fPeriNum)/2)+1
protected

Definition at line 101 of file PredictionExtendToPeripheral.h.

Referenced by MergePeripheral(), and MergePeripheralOsc().

const int ana::PredictionExtendToPeripheral::fPeriNum = int(fEnergyBins/2)
protected

Definition at line 97 of file PredictionExtendToPeripheral.h.

IPrediction* ana::PredictionExtendToPeripheral::fPredCore
protected
PredictionNoExtrap* ana::PredictionExtendToPeripheral::fPredNoExtrap
protected
const int ana::PredictionExtendToPeripheral::fReduceBin = fNBinsI - 2* fNPIDBin - fEnergyBins +1
protected

Definition at line 108 of file PredictionExtendToPeripheral.h.

Referenced by ReduceHelperNC().

const Binning ana::PredictionExtendToPeripheral::ReduceBinning = Binning::Simple(fReduceBin, 0, fReduceBin)
protected

Definition at line 109 of file PredictionExtendToPeripheral.h.

Referenced by ReduceHelper(), and ReduceHelperNC().


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