20 #include "Utilities/func/MathUtil.h" 45 :
ISyst(
"DemoSyst1",
"Demo syst ##1")
55 double additionalWgt = 0.1;
58 additionalWgt += 0.4 * (1 - exp(-
util::sqr(Enu-5)/10.));
62 additionalWgt *=
sigma;
71 if (additionalWgt < 0)
75 weight *= additionalWgt;
103 :
ISyst(
"DemoSyst2",
"Demo syst ##2")
114 unsigned int nNeutron = 0;
115 for (
const auto & particle : sr->
mc.
nu[0].prim)
117 if (particle.pdg != 2112)
121 if (particle.visEinslcBirks + particle.daughterVisEinslcBirks >= 0.050)
130 double addedE = sigma * 0.025 * nNeutron;
153 auto spec_shift_up = pred->
PredictSyst(calc, shifts);
154 Ratio rat_shift_up(spec_shift_up, spec_nom);
156 auto spec_shift_down = pred->
PredictSyst(calc, shifts);
157 Ratio rat_shift_down(spec_shift_down, spec_nom);
159 double pot = spec_nom.POT();
162 auto c =
new TCanvas;
166 auto leg =
new TLegend(0.6, 0.6, 0.9, 0.9);
167 leg->SetBorderSize(0);
168 leg->SetFillStyle(0);
172 auto hup = spec_shift_up.ToTH1(pot,
kRed, kDashed);
173 hup->GetXaxis()->SetTitleSize(0);
174 hup->GetXaxis()->SetLabelSize(0);
176 auto hnom = spec_nom.ToTH1(pot);
177 hnom->Draw(
"hist same");
178 auto hdown = spec_shift_down.ToTH1(pot,
kBlue, kDashed);
179 hdown->Draw(
"hist same");
180 leg->AddEntry(hnom,
"Nominal",
"l");
181 leg->AddEntry(hup,
"+1#sigma shift");
182 leg->AddEntry(hdown,
"-1#sigma shift");
188 hbottom->GetYaxis()->SetRangeUser(0.45, 1.55);
189 hbottom->Draw(
"hist");
190 rat_shift_down.
ToTH1(
kBlue)->Draw(
"hist same");
218 PredictionInterp pred_trueE_syst1(systs1, &noOscCalc, predGen_shift1, loaders, shifts1);
228 for (
const auto & particle : sr->
mc.
nu[0].prim)
230 if (particle.pdg == 2112)
241 PredictionInterp pred_recoE_withNeutron_syst2(systs2, &noOscCalc, predGen_numuCC_ND_withNeutron, loaders, shifts2);
243 PredictionInterp pred_recoE_noNeutron_syst2(systs2, &noOscCalc, predGen_numuCC_ND_noNeutron, loaders, shifts2);
Near Detector underground.
Pass neutrinos through unchanged.
Implements systematic errors by interpolation between shifted templates.
Cuts and Vars for the 2020 FD DiF Study.
TH1D * ToTH1(Color_t col=kBlack, Style_t style=kSolid) const
void TruthShift(double sigma, caf::SRNeutrinoProxy *sr, double &weight) const override
Proxy for caf::SRNeutrino.
Simple record of shifts applied to systematic parameters.
caf::Proxy< caf::SRNumuEnergy > numu
Proxy for caf::StandardRecord.
General interface to oscillation calculators.
caf::Proxy< std::vector< caf::SRNeutrino > > nu
Spectrum PredictSyst(osc::IOscCalc *calc, const SystShifts &shift) const override
void Shift(double sigma, caf::SRProxy *sr, double &weight) const override
Perform the systematic shift.
virtual Spectrum PredictUnoscillated() const
caf::Proxy< short int > nnu
void SplitCanvas(double ysplit, TPad *&p1, TPad *&p2)
Split the current pad into two vertically stacked pieces, suitable for ratio plots and so on...
caf::Proxy< caf::SREnergyBranch > energy
T sqr(T x)
More efficient square function than pow(x,2)
Encapsulate code to systematically shift a caf::SRProxy.
The simplest job module possible to illustrate the essential features of a job module.
const DemoSyst1 kDemoSyst1
const DemoSyst2 kDemoSyst2
void Go()
Call Go() on all the loaders.
void SetSpillCut(const SpillCut &cut)
const Var kTrueE([](const caf::SRProxy *sr){assert(sr->mc.nnu==1);return sr->mc.nu[0].E;})
const HistAxis kNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNumuEnergyBinning, kCCE)
SpectrumLoaderBase & GetLoader(caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Retrieve a specific loader.
caf::Proxy< float > hadcalE
Represent the ratio between two spectra.
caf::Proxy< caf::SRTruthBranch > mc
const SpillCut kStandardSpillCuts
Apply this unless you're doing something special.
For nominal spectra and reweighting systs (xsec/flux)
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
const Var kUnweighted
The simplest possible Var, always 1. Used as a default weight.
void SetShift(const ISyst *syst, double shift, bool force=false)
const Cut kNoCut
The simplest possible cut: pass everything, used as a default.
TCanvas * DrawUpDownRatioCanvas(const PredictionInterp *pred, osc::IOscCalc *calc, const ISyst *syst)