nd_data_mc.C
Go to the documentation of this file.
5 #include "CAFAna/Core/Spectrum.h"
8 #include "CAFAna/Vars/Vars.h"
9 using namespace ana;
10 
12 
13 #include "nd_vars_and_cuts.h"
14 
15 #include "TCanvas.h"
16 #include "TFile.h"
17 #include "TH1.h"
18 #include "TLegend.h"
19 #include "TPad.h"
20 
21 void nd_data_mc()
22 {
23  SpectrumLoader loaderData("defname: prod_caf_S15-05-22a_nd_numi_goodruns with stride 1");
24  SpectrumLoader loaderDataStagger("defname: prod_caf_S15-05-22a_nd_numi_stagger_goodruns with stride 1");
25  SpectrumLoader loaderMC("defname: prod_caf_S15-05-22_nd_genie_fhc_nonswap with stride 1");
26 
27  loaderData.SetSpillCut(kStandardSpillCuts);
28  loaderDataStagger.SetSpillCut(kStandardSpillCuts);
29  loaderMC.SetSpillCut(kStandardDQCuts);
30 
32  Spectrum* spectsStagger[kNumSels][kNumVars];
33  IPrediction* preds[kNumSels][kNumVars];
34 
35  for(int selIdx = 0; selIdx < kNumSels; ++selIdx){
36  for(int varIdx = 0; varIdx < kNumVars; ++varIdx){
37  const HistAxis& axis = defs[varIdx].axis;
38  spects[selIdx][varIdx] = new Spectrum(loaderData, axis, sels[selIdx].cut);
39  spectsStagger[selIdx][varIdx] = new Spectrum(loaderDataStagger, axis, sels[selIdx].cut);
40  preds[selIdx][varIdx] = new PredictionNoExtrap(loaderMC, kNullLoader, kNullLoader,
41  axis.label, axis.bins, axis.var,
42  sels[selIdx].cut);
43  }
44  }
45 
46  loaderMC.Go();
47  loaderData.Go();
48  loaderDataStagger.Go();
49 
50  TFile* fout = new TFile("fout.root", "RECREATE");
51  for(int selIdx = 0; selIdx < kNumSels; ++selIdx){
52  TDirectory* d = fout->mkdir(sels[selIdx].name.c_str());
53  for(int varIdx = 0; varIdx < kNumVars; ++varIdx){
54  const char* name = defs[varIdx].name.c_str();
55  spects[selIdx][varIdx]->SaveTo(d->mkdir(TString::Format("spect_%s", name)));
56  spectsStagger[selIdx][varIdx]->SaveTo(d->mkdir(TString::Format("spect_%s_stagger", name)));
57  preds[selIdx][varIdx]->SaveTo(d->mkdir(TString::Format("pred_%s", name)));
58  }
59  }
60 }
const XML_Char * name
Definition: expat.h:151
const int kNumVars
Definition: vars.h:14
Oscillation analysis framework, runs over CAF files outside of ART.
virtual void SaveTo(TDirectory *dir) const
HistAxis axis
Definition: NuePlotLists.h:13
void SetSpillCut(const SpillCut &cut)
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:37
const Cut sels[kNumSels]
Definition: vars.h:44
const SpillCut kStandardDQCuts([](const caf::SRSpillProxy *spill){if(spill->dcmedgematchfrac==0 &&spill->fracdcm3hits==0 &&spill->nmissingdcmslg==0) return bool(spill->isgoodspill); if(spill->det==caf::kNEARDET && (spill->fracdcm3hits > 0.45|| spill->nmissingdcms > 0)) return false; if(spill->eventincomplete) return false; if(spill->det==caf::kFARDET && spill->nmissingdcmslg > 0) return false; if(spill->det==caf::kFARDET && !spill->ismc && spill->dcmedgematchfrac<=0.2) return false;return true;})
Cut out events with a noisy detector or with parts missing.
Definition: SpillCuts.h:12
Float_t d
Definition: plot.C:236
virtual void Go() override
Load all the registered spectra.
const HistDef defs[kNumVars]
Definition: vars.h:15
const int kNumSels
Definition: vars.h:43
std::string name
Definition: NuePlotLists.h:12
const Cut cut
Definition: exporter_fd.C:30
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
Standard interface to all prediction techniques.
Definition: IPrediction.h:57
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:28
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
void spects(osc::IOscCalculatorAdjustable *calc, IPrediction *predFHC, IPrediction *predRHC)
Definition: sensitivity.C:100
Prediction that just uses FD MC, with no extrapolation.
void nd_data_mc()
Definition: nd_data_mc.C:21
static NullLoader kNullLoader
Dummy loader that doesn&#39;t load any files.
void SaveTo(TDirectory *dir) const
Definition: Spectrum.cxx:1029