nus17_fd_cut_tables.C
Go to the documentation of this file.
1 // This macro is used to make the nue energy blessed plots. (see doc 11789)
2 // Oscillation parameters are same as those in nue_ana_basic macro
3 
4 #include "CAFAna/Cuts/Cuts.h"
8 #include "CAFAna/Core/Spectrum.h"
9 #include "CAFAna/Vars/Vars.h"
10 #include "NuXAna/Vars/NusVars.h"
12 #include "CAFAna/Cuts/TimingCuts.h"
17 
18 #include <string>
19 
20 using namespace ana;
21 
22 
24 {
25 
26  SpectrumLoader loadermc(fFDmcDECAF);
27  SpectrumLoader loadermcswap(fFDswapDECAF);
28  SpectrumLoader loadermctau(fFDtauDECAF);
30 
32  loadermcswap.SetSpillCut(kStandardSpillCuts);
33  loadermctau.SetSpillCut(kStandardSpillCuts);
35 
36  //------------------------------------------------------------
37 
38  Spectrum* spec[ncuts][nvars];
39  Spectrum* spec_nminus1[ncuts_nminus1][nvars];
40 
41  IPrediction* preds[ncuts][nvars];
42  IPrediction* preds_nminus1[ncuts_nminus1][nvars];
43 
44  const Var kReweight = kPPFXFluxCVWgt*kXSecCVWgt2017;
45  //------------------------------------------------------------
46 
47  for(int iv = 0; iv < nvars; ++iv){
48  for(int ic = 0; ic < ncuts_nminus1; ++ic){
49 
50  spec_nminus1[ic][iv] = new Spectrum(loadercos, axisarray[iv],
52 
53  preds_nminus1[ic][iv] = new PredictionNoExtrap(loadermc, loadermcswap, loadermctau,
54  axisarray[iv].GetLabels()[0],
55  axisarray[iv].GetBinnings()[0],
56  axisarray[iv].GetVars()[0],
58  kNoShift, kReweight);
59 
60  }// end loop over nminus1 cuts
61 
62  for(int ic = 0; ic < ncuts; ++ic){
63  preds[ic][iv] = new PredictionNoExtrap(loadermc, loadermcswap, loadermctau,
64  axisarray[iv].GetLabels()[0],
65  axisarray[iv].GetBinnings()[0],
66  axisarray[iv].GetVars()[0],
67  cutsarray[ic],
68  kNoShift, kReweight);
69 
70  spec[ic][iv] = new Spectrum(loadercos, axisarray[iv],
72 
73  }// end loop over cuts
74  }// end loop over vars
75 
76  loadercos.Go();
77  loadermc.Go();
78  loadermcswap.Go();
79  loadermctau.Go();
80 
81  std::cout<<"making output file \n";
82  TFile fout(outfile.c_str(), "RECREATE");
83 
84  for(int iv = 0; iv < nvars; ++iv){
85  for(int ic = 0; ic < ncuts_nminus1; ++ic){
86 
87  char name[50];
88 
89  sprintf(name, "spec_nminus1_%s_%s", cutnames_nminus1[ic].c_str(),
90  axisarray[iv].GetLabels()[0].c_str());
91  spec_nminus1[ic][iv]->SaveTo(&fout, name);
92 
93  sprintf(name, "pred_nminus1_%s_%s", cutnames_nminus1[ic].c_str(),
94  axisarray[iv].GetLabels()[0].c_str());
95  preds_nminus1[ic][iv]->SaveTo(&fout, name);
96 
97  }// end loop over nminus1 cuts
98 
99  for(int ic = 0; ic < ncuts; ic++){
100 
101  char name[50];
102  sprintf(name, "spec_%s_%s", cutnames[ic].c_str(),
103  axisarray[iv].GetLabels()[0].c_str());
104  spec[ic][iv]->SaveTo(&fout, name);
105 
106  sprintf(name, "pred_%s_%s", cutnames[ic].c_str(),
107  axisarray[iv].GetLabels()[0].c_str());
108  preds[ic][iv]->SaveTo(&fout, name);
109 
110  }// end loop over cuts
111  }// end loop over vars
112 
113 }
const XML_Char * name
Definition: expat.h:151
const HistAxis axisarray[nvars]
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
const std::string fFDtauDECAF
Definition: NusLoadProd3.h:47
virtual void SaveTo(TDirectory *dir, const std::string &name) const
void SetSpillCut(const SpillCut &cut)
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
const Cut kInCosmicTimingWindow
Is the event far from the start and ends of the spill ? For FD cosmic selection.
Definition: TimingCuts.cxx:165
const std::string cutnames[ncuts]
virtual void Go() override
Load all the registered spectra.
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Spectrum.cxx:506
const std::string cutnames_nminus1[ncuts_nminus1]
std::vector< float > Spectrum
Definition: Constants.h:610
const std::string fFDcosmicdataDECAF
Definition: NusLoadProd3.h:52
const SystShifts kNoShift
Definition: SystShifts.cxx:21
OStream cout
Definition: OStream.cxx:6
const int ncuts_nminus1
const Cut cutsarray[ncuts]
const std::string fFDmcDECAF
Definition: NusLoadProd3.h:43
const std::vector< VarDef > GetVars(TString opt, TString type="all")
const int nvars
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:49
Prediction that just uses FD MC, with no extrapolation.
const Var kXSecCVWgt2017
Definition: XsecTunes.h:37
const int ncuts
void nus17_fd_cut_tables(std::string outfile)
const std::string fFDswapDECAF
Definition: NusLoadProd3.h:45
FILE * outfile
Definition: dump_event.C:13
const Cut cutsarray_nminus1[ncuts_nminus1]
enum BeamMode string