3 #include "CAFAna/Core/Binning.h" 13 #include "TDirectory.h" 16 #include "TObjString.h" 27 return sr->
mc.
nu[0].E;
32 if(sr->
mc.
nnu == 0)
return false;
85 fCache->hash = std::make_unique<TMD5>(*rhs.
fCache->hash);
96 fCache->spect = std::move(rhs.fCache->spect);
97 fCache->hash = std::move(rhs.fCache->hash);
100 assert( rhs.fReferences.empty() );
106 if(
this == &rhs)
return *
this;
112 fCache->hash = std::make_unique<TMD5>(*rhs.
fCache->hash);
127 if(
this == &rhs)
return *
this;
131 if(rhs.fCache->hash){
132 fCache->spect = std::move(rhs.fCache->spect);
133 fCache->hash = std::move(rhs.fCache->hash);
139 assert( rhs.fReferences.empty() );
155 const OscCurve curve(calc, from, to);
167 int from,
int to)
const 174 int from,
int to)
const 185 fCache->hash.reset(
nullptr);
204 fCache->hash.reset(
nullptr);
220 _SaveTo(dir, name,
"OscillatableSpectrum");
226 dir = dir->GetDirectory(name.c_str());
231 TObjString*
tag = (TObjString*)dir->Get(
"type");
233 assert(tag->GetString() ==
"OscillatableSpectrum");
236 TH2D* spect = (TH2D*)dir->Get(
"hist");
238 TH1* hPot = (TH1*)dir->Get(
"pot");
240 TH1* hLivetime = (TH1*)dir->Get(
"livetime");
243 std::vector<std::string>
labels;
244 std::vector<Binning>
bins;
246 for(
int i = 0; ; ++
i){
248 TDirectory*
subdir = dir->GetDirectory(subname.c_str());
253 labels.push_back(label ? label->GetString().Data() :
"");
265 typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen:: Dynamic, Eigen::RowMajor> MatRowMajor;
266 ret->fMat = Eigen::Map<MatRowMajor>(spect->GetArray(),
272 ret->fPOT = hPot->Integral(0, -1);
273 ret->fLivetime = hLivetime->Integral(0, -1);
static std::unique_ptr< OscillatableSpectrum > LoadFrom(TDirectory *dir, const std::string &name)
static std::unique_ptr< Binning > LoadFrom(TDirectory *dir, const std::string &name)
ReweightableSpectrum & operator+=(const ReweightableSpectrum &rhs)
_HistAxis< Var > HistAxis
Represent the binning of a Spectrum's x-axis.
Cuts and Vars for the 2020 FD DiF Study.
Simple record of shifts applied to systematic parameters.
Proxy for caf::StandardRecord.
General interface to oscillation calculators.
caf::Proxy< std::vector< caf::SRNeutrino > > nu
ThreadLocal< OscCache > fCache
Spectrum with the value of a second variable, allowing for reweighting
caf::Proxy< short int > nnu
OscillatableSpectrum()
Constructor for Uninitialized()
OscillatableSpectrum & operator-=(const OscillatableSpectrum &rhs)
_Var< caf::SRProxy > Var
Representation of a variable to be retrieved from a caf::StandardRecord object.
Representation of a spectrum in any variable, with associated POT.
const Var kTrueE([](const caf::SRProxy *sr){assert(sr->mc.nnu==1);return sr->mc.nu[0].E;})
ReweightableSpectrum & operator-=(const ReweightableSpectrum &rhs)
Spectrum WeightedBy(const Ratio &weights) const
Reco spectrum with truth weights applied.
_Cut< caf::SRProxy > Cut
Representation of a cut (selection) to be applied to a caf::StandardRecord object.
const Binning kTrueEnergyBins
Default true-energy bin edges.
OscillatableSpectrum & operator+=(const OscillatableSpectrum &rhs)
OscillatableSpectrum operator+(const OscillatableSpectrum &rhs) const
virtual TMD5 * GetParamsHash() const
Use to check two calculators are in the same state.
Base class for the various types of spectrum loader.
caf::Proxy< caf::SRTruthBranch > mc
std::set< ReweightableSpectrum ** > fReferences
Transition probability for any one channel as a function of energy.
void _SaveTo(TDirectory *dir, const std::string &name, const std::string &type) const
Spectrum Oscillated(osc::IOscCalc *calc, int from, int to) const
ReweightableSpectrum & operator=(const ReweightableSpectrum &rhs)
const Cut kHasNu([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return true;})
assert(nhit_max >=nhit_nbins)
Spectrum _Oscillated(osc::_IOscCalc< T > *calc, int from, int to) const
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
OscillatableSpectrum & operator=(const OscillatableSpectrum &rhs)
Assignment operator.
Prevent histograms being added to the current directory.
Spectrum with true energy information, allowing it to be oscillated
OscillatableSpectrum operator-(const OscillatableSpectrum &rhs) const
const Cut kNoCut
The simplest possible cut: pass everything, used as a default.
void SaveTo(TDirectory *dir, const std::string &name) const
static NullLoader kNullLoader
Dummy loader that doesn't load any files.