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

Transition probability for any one channel as a function of energy. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-10-23/CAFAna/Core/OscCurve.h"

Inheritance diagram for ana::OscCurve:
ana::Ratio

Public Member Functions

 OscCurve (osc::IOscCalc *calc, int from, int to)
 
 OscCurve (osc::IOscCalcStan *calc, int from, int to)
 
virtual ~OscCurve ()
 
 OscCurve (const OscCurve &rhs)=default
 
OscCurveoperator= (const OscCurve &rhs)=default
 
TH1D * ToTH1 (bool title=false) const
 
Ratiooperator*= (const Ratio &rhs)
 
Ratio operator* (const Ratio &rhs) const
 
Ratiooperator/= (const Ratio &rhs)
 
Ratio operator/ (const Ratio &rhs) const
 
TH1D * ToTH1 (Color_t col=kBlack, Style_t style=kSolid) const
 
TH2 * ToTH2 () const
 
bool HasStan () const
 
const Eigen::ArrayXd & GetEigen () const
 
const Eigen::ArrayXstanGetEigenStan () const
 

Protected Attributes

int fFrom
 
int fTo
 
Hist fHist
 
std::vector< BinningfBins
 
std::vector< std::string > fLabels
 

Detailed Description

Transition probability for any one channel as a function of energy.

Definition at line 11 of file OscCurve.h.

Constructor & Destructor Documentation

ana::OscCurve::OscCurve ( osc::IOscCalc calc,
int  from,
int  to 
)

Definition at line 36 of file OscCurve.cxx.

37  : Ratio(Hist::Adopt(ToEigen(calc, from, to)),
38  std::vector<Binning>(1, kTrueEnergyBins),
39  std::vector<std::string>(1, "True Energy (GeV)")),
40  fFrom(from), fTo(to)
41  {
42  }
Eigen::ArrayXd ToEigen(osc::IOscCalc *calc, int from, int to)
Helper for constructors.
Definition: NDOscCurve.cxx:17
Ratio(const Spectrum &num, const Spectrum &denom, bool purOrEffErrs=false)
Definition: Ratio.cxx:11
const Binning kTrueEnergyBins
Default true-energy bin edges.
Definition: Binning.h:14
static Hist Adopt(Eigen::ArrayXd &&v)
Definition: Hist.cxx:149
ana::OscCurve::OscCurve ( osc::IOscCalcStan calc,
int  from,
int  to 
)

Definition at line 45 of file OscCurve.cxx.

46  : Ratio(Hist::AdoptStan(ToEigen(calc, from, to)),
47  std::vector<Binning>(1, kTrueEnergyBins),
48  std::vector<std::string>(1, "True Energy (GeV)")),
49  fFrom(from), fTo(to)
50  {
51  }
Eigen::ArrayXd ToEigen(osc::IOscCalc *calc, int from, int to)
Helper for constructors.
Definition: NDOscCurve.cxx:17
Ratio(const Spectrum &num, const Spectrum &denom, bool purOrEffErrs=false)
Definition: Ratio.cxx:11
const Binning kTrueEnergyBins
Default true-energy bin edges.
Definition: Binning.h:14
static Hist AdoptStan(Eigen::ArrayXstan &&v)
Definition: Hist.cxx:140
ana::OscCurve::~OscCurve ( )
virtual

Definition at line 54 of file OscCurve.cxx.

55  {
56  }
ana::OscCurve::OscCurve ( const OscCurve rhs)
default

Member Function Documentation

const Eigen::ArrayXd& ana::Ratio::GetEigen ( ) const
inlineinherited
const Eigen::ArrayXstan& ana::Ratio::GetEigenStan ( ) const
inlineinherited

Definition at line 45 of file Ratio.h.

References ana::Ratio::fHist, and ana::Hist::GetEigenStan().

Referenced by ana::ReweightableSpectrum::WeightedBy().

45 {return fHist.GetEigenStan();}
Hist fHist
Definition: Ratio.h:56
const Eigen::ArrayXstan & GetEigenStan() const
Definition: Hist.h:54
bool ana::Ratio::HasStan ( ) const
inlineinherited

Definition at line 43 of file Ratio.h.

References ana::Ratio::fHist, and ana::Hist::HasStan().

Referenced by ana::ReweightableSpectrum::WeightedBy().

43 {return fHist.HasStan();}
Hist fHist
Definition: Ratio.h:56
bool HasStan() const
Definition: Hist.h:52
Ratio ana::Ratio::operator* ( const Ratio rhs) const
inherited

Definition at line 44 of file Ratio.cxx.

References runNovaSAM::ret.

Referenced by ana::Ratio::Ratio().

45  {
46  Ratio ret = *this;
47  ret *= rhs;
48  return ret;
49  }
Ratio(const Spectrum &num, const Spectrum &denom, bool purOrEffErrs=false)
Definition: Ratio.cxx:11
Ratio & ana::Ratio::operator*= ( const Ratio rhs)
inherited

Definition at line 37 of file Ratio.cxx.

References ana::Ratio::fHist, and ana::Hist::Multiply().

Referenced by ana::Ratio::Ratio().

38  {
39  fHist.Multiply(rhs.fHist);
40  return *this;
41  }
Hist fHist
Definition: Ratio.h:56
void Multiply(const Hist &rhs)
Definition: Hist.cxx:479
Ratio ana::Ratio::operator/ ( const Ratio rhs) const
inherited

Definition at line 59 of file Ratio.cxx.

References runNovaSAM::ret.

Referenced by ana::Ratio::Ratio().

60  {
61  Ratio ret = *this;
62  ret /= rhs;
63  return ret;
64  }
Ratio(const Spectrum &num, const Spectrum &denom, bool purOrEffErrs=false)
Definition: Ratio.cxx:11
Ratio & ana::Ratio::operator/= ( const Ratio rhs)
inherited

Definition at line 52 of file Ratio.cxx.

References ana::Hist::Divide(), and ana::Ratio::fHist.

Referenced by ana::Ratio::Ratio().

53  {
54  fHist.Divide(rhs.fHist);
55  return *this;
56  }
void Divide(const Hist &rhs)
Definition: Hist.cxx:531
Hist fHist
Definition: Ratio.h:56
OscCurve& ana::OscCurve::operator= ( const OscCurve rhs)
default
TH1D * ana::OscCurve::ToTH1 ( bool  title = false) const

Definition at line 59 of file OscCurve.cxx.

References fFrom, fTo, runNovaSAM::ret, and ana::Ratio::ToTH1().

Referenced by make_extrap_figure_hists(), and test_ana().

60  {
61  // Could have a file temporarily open
62  DontAddDirectory guard;
63 
64  TH1D* ret = Ratio::ToTH1();
65  ret->GetYaxis()->SetTitle("Probability");
66 
67  if(title){
68  // Don't do this work unless it's explicitly requested
69  std::map<int, std::string> nus;
70  nus[12] = nus[-12] = "e";
71  nus[14] = nus[-14] = "#mu";
72  nus[16] = nus[-16] = "#tau";
73  nus[0] = "active";
74  const std::string nu = (fFrom > 0) ? "#nu" : "#bar#nu";
75 
76  ret->SetTitle((nu+"_{"+nus[fFrom]+"}#rightarrow"+nu+"_{"+nus[fTo]+"}").c_str());
77  }
78 
79  return ret;
80  }
TH1D * ToTH1(Color_t col=kBlack, Style_t style=kSolid) const
Definition: Ratio.cxx:67
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
TH1D * ana::Ratio::ToTH1 ( Color_t  col = kBlack,
Style_t  style = kSolid 
) const
inherited
TH2 * ana::Ratio::ToTH2 ( ) const
inherited

Definition at line 78 of file Ratio.cxx.

References om::cout, allTimeWatchdog::endl, ana::Ratio::fBins, ana::Ratio::fLabels, runNovaSAM::ret, ana::Ratio::ToTH1(), and ana::ToTH2Helper().

Referenced by ana::SingleNucAnalysis::PlotEfficiency2D(), ana::NumuCC2p2hAnalysis::PlotEfficiency2D(), and ana::Ratio::Ratio().

79  {
80  if(fBins.size() != 2){
81  std::cout << "Error: This Ratio does not appear to be 2D." << std::endl;
82  abort();
83  }
84 
85  TH2* ret = ana::ToTH2Helper(std::unique_ptr<TH1>(ToTH1()), fBins[0], fBins[1]);
86 
87  ret->GetXaxis()->SetTitle(fLabels[0].c_str());
88  ret->GetYaxis()->SetTitle(fLabels[1].c_str());
89 
90  // Allow GetMean() and friends to work even if this histogram never had any
91  // explicit Fill() calls made.
92  if(ret->GetEntries() == 0) ret->SetEntries(1);
93 
94  return ret;
95  }
TH1D * ToTH1(Color_t col=kBlack, Style_t style=kSolid) const
Definition: Ratio.cxx:67
std::vector< std::string > fLabels
Definition: Ratio.h:58
std::vector< Binning > fBins
Definition: Ratio.h:57
OStream cout
Definition: OStream.cxx:6
TH2 * ToTH2Helper(std::unique_ptr< TH1 > h1, const Binning &binsx, const Binning &binsy, ana::EBinType bintype)
Helper for ana::ToTH2.
Definition: UtilsExt.cxx:135

Member Data Documentation

std::vector<Binning> ana::Ratio::fBins
protectedinherited

Definition at line 57 of file Ratio.h.

Referenced by ana::Ratio::ToTH1(), and ana::Ratio::ToTH2().

int ana::OscCurve::fFrom
protected

Definition at line 24 of file OscCurve.h.

Referenced by ToTH1().

Hist ana::Ratio::fHist
protectedinherited
std::vector<std::string> ana::Ratio::fLabels
protectedinherited

Definition at line 58 of file Ratio.h.

Referenced by ana::Ratio::ToTH1(), and ana::Ratio::ToTH2().

int ana::OscCurve::fTo
protected

Definition at line 24 of file OscCurve.h.

Referenced by ToTH1().


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