MakeNus18ExtrapPred.C
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////
2 // MakeNus18ExtrapPred.C
3 // M Wallbank (wallbank@fnal.gov)
4 //
5 // Make extrapolated predictions.
6 //////////////////////////////////////////////////////////////
7 
8 // framework
11 #include "CAFAna/Core/Loaders.h"
12 #include "CAFAna/Core/Binning.h"
14 #include "NuXAna/Cuts/NusCuts18.h"
15 #include "CAFAna/Cuts/SpillCuts.h"
16 #include "CAFAna/Cuts/TimingCuts.h"
18 #include "CAFAna/Vars/HistAxes.h"
19 #include "NuXAna/Vars/HistAxes.h"
23 #include "OscLib/OscCalcSterile.h"
24 
25 // stl
26 #include <utility>
27 
28 using namespace ana;
29 
30 void MakeNus18ExtrapPred(TString opt) {
31 
32  TH1::AddDirectory(0);
33 
34  // Get running options
35  bool rhc = opt.Contains("rhc", TString::kIgnoreCase);
36  bool fhc = opt.Contains("fhc", TString::kIgnoreCase);
37  assert(rhc || fhc);
38 
39  bool concat = opt.Contains("concat", TString::kIgnoreCase);
40  bool caf = opt.Contains("caf", TString::kIgnoreCase);
41  assert(concat || caf);
42 
43  bool systematics = opt.Contains("syst", TString::kIgnoreCase);
44  bool cosmics = opt.Contains("cos", TString::kIgnoreCase);
45 
46  // Weighting
47  const Var kReweight = kXSecCVWgt2018*kPPFXFluxCVWgt;
48 
49  // Set up the loaders
54 
55  // Cosmic loaders
56  SpectrumLoader* loaders_cos;
57  if (rhc)
58  loaders_cos = new SpectrumLoader(kFDCosmicRHCProd4, kCosmic);
59  else
60  loaders_cos = new SpectrumLoader(kFDCosmicFHCProd4, kCosmic);
61  loaders_cos->SetSpillCut(kStandardSpillCuts);
62 
63  // Get systematics
64  std::vector<const ISyst*> systs;
65  // if (systematics) {
66  // NusSystematics* nus_systs = LoadSystematics();
67  // systs = nus_systs->GetISysts();
68  // }
69 
70  // Set up oscillation calculator
72 
73  // Set up the PredictionHandler object
74  FDPredictionHandler prediction("Extrap");
75  prediction.AddLoaders(loaders);
76  if (cosmics)
77  prediction.AddCosmics(loaders_cos);
78  if (systematics)
79  prediction.AddSystematics(systs, calc);
80  prediction.AddVar("Nus18Extrap", kNus18AxisE, kNus18FD, kNoShift, kReweight);
81 
82  // Set off the loaders!
83  loaders->Go();
84  loaders_cos->Go();
85 
86  // Write the data
87  std::stringstream outFileName; outFileName << "pred_nus18_";
88  rhc ? outFileName << "rhc" : outFileName << "fhc";
89  outFileName << "_extrap";
90  if (systematics) outFileName << "_syst";
91  outFileName << ".root";
92  TFile* outFile = new TFile(outFileName.str().c_str(), "RECREATE");
93  prediction.Save(outFile);
94  outFile->Close();
95  delete outFile;
96 
97  return;
98 
99 }
void AddVar(std::string name, HistAxis axis, Cut cuts, SystShifts shift, Var weight)
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
Adapt the PMNS_Sterile calculator to standard interface.
void SetSpillCut(const SpillCut &cut)
osc::OscCalcDumb calc
const Cut kNus18FD
Definition: NusCuts18.h:100
const HistAxis kNus18AxisE("Energy Deposited in Scintillator (GeV)", kNus18EnergyBinning, kNus18Energy)
Axes used in Nus18 analysis by nus group.
Definition: HistAxes.h:16
void Go()
Call Go() on all the loaders.
Definition: Loaders.cxx:162
void SetSpillCut(const SpillCut &cut)
Definition: Loaders.cxx:121
osc::OscCalcSterile * DefaultSterileCalc(int nflavors)
Create a sterile calculator with default assumptions for all parameters.
Definition: Calcs.cxx:97
TFile * outFile
Definition: PlotXSec.C:135
void AddLoaders(Loaders *loaders)
const std::string kFDCosmicRHCProd4
virtual void Go() override
Load all the registered spectra.
void MakeNus18ExtrapPred(TString opt)
void AddCosmics(SpectrumLoader *loaders_cosmics)
const SystShifts kNoShift
Definition: SystShifts.cxx:22
void Save(TFile *outFile)
const std::string kFDCosmicFHCProd4
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const Var kXSecCVWgt2018
Definition: XsecTunes.h:48
std::vector< Loaders * > loaders
Definition: syst_header.h:386
assert(nhit_max >=nhit_nbins)
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
This module creates Common Analysis Files.
Definition: FileReducer.h:10
Class to handle FD predictions.
For nominal spectra and reweighting systs (xsec/flux)
Definition: Prod4Loaders.h:96
void AddSystematics(std::vector< const ISyst * > systs, osc::OscCalcSterile *calc)