7 #include "OscLib/IOscCalc.h"
9 #include "TDirectory.h"
10 #include "TObjString.h"
20 : fMC(pred), fData(data), fCosmicInTime(cosmicInTime), fCosmicOutOfTime(cosmicOutOfTime), fMask(0)
22 if(cosmicInTime.
POT() > 0){
23 std::cout <<
"SingleSampleExperiment: in-time cosmics have nonzero POT. "
24 <<
"Did you confuse the two cosmics arguments?"
53 const double intimeLivetime =
fData.
Livetime() - beamLivetime;
64 assert(hpred->GetNbinsX() ==
fMask->GetNbinsX());
65 assert(hdata->GetNbinsX() ==
fMask->GetNbinsX());
67 for(
int i = 0; i <
fMask->GetNbinsX()+2; ++i){
68 if (
fMask->GetBinContent(i+1) == 1)
continue;
69 hpred->SetBinContent(i+1, 0);
70 hdata->SetBinContent(i+1, 0);
85 TDirectory* tmp =
dir;
88 TObjString(
"SingleSampleExperiment").Write(
"type");
101 TObjString* ptag = (TObjString*)dir->Get(
"type");
103 assert(ptag->GetString() ==
"SingleSampleExperiment");
105 assert(dir->GetDirectory(
"mc"));
106 assert(dir->GetDirectory(
"data"));
113 if(dir->GetDirectory(
"cosmic")){
114 const std::unique_ptr<Spectrum> cosmicInTime =
Spectrum::LoadFrom(dir->GetDirectory(
"cosmic"));
115 return std::make_unique<SingleSampleExperiment>(mc, *data, *cosmicInTime,
Spectrum(0, {}, {}, 0, 0));
118 const std::unique_ptr<Spectrum> cosmicInTime =
Spectrum::LoadFrom(dir->GetDirectory(
"cosmicInTime"));
119 const std::unique_ptr<Spectrum> cosmicOutOfTime =
Spectrum::LoadFrom(dir->GetDirectory(
"cosmicOutOfTime"));
121 return std::make_unique<SingleSampleExperiment>(mc, *data, *cosmicInTime, *cosmicOutOfTime);
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
virtual double ChiSq(osc::IOscCalcAdjustable *osc, const SystShifts &syst=SystShifts::Nominal()) const override
static std::unique_ptr< Spectrum > LoadFrom(TDirectory *dir)
virtual void SaveTo(TDirectory *dir) const
double LogLikelihood(double e, double o)
The log-likelihood formula for a single bin.
Simple record of shifts applied to systematic parameters.
process_name opflashCryoW ana
Representation of a spectrum in any variable, with associated POT.
process_name pandoraGausCryo1 vertexChargeCryo1 vertexStubCryo1 xmin
static void Delete(TH1D *&h)
Spectrum fCosmicOutOfTime
virtual Spectrum PredictSyst(osc::IOscCalc *calc, const SystShifts &syst) const
virtual ~SingleSampleExperiment()
std::unique_ptr< IPrediction > LoadFrom< IPrediction >(TDirectory *dir)
SingleSampleExperiment(const IPrediction *pred, const Spectrum &data, const Spectrum &cosmicInTime, const Spectrum &cosmicOutOfTime)
Standard interface to all prediction techniques.
TH1 * GetMaskHist(const Spectrum &s, double xmin, double xmax, double ymin, double ymax)
double Livetime() const
Seconds. For informational purposes only. No calculations use this.
void SetMaskHist(double xmin=0, double xmax=-1, double ymin=0, double ymax=-1)
virtual void SaveTo(TDirectory *dir) const override
BEGIN_PROLOG could also be cout
static std::unique_ptr< SingleSampleExperiment > LoadFrom(TDirectory *dir)
void SaveTo(TDirectory *dir) const