make_nueFDprediction_kinematics_FHC_pTExtrap.C
Go to the documentation of this file.
1 // Analysis
6 
7 // Core
8 #include "CAFAna/Core/Binning.h"
9 #include "CAFAna/Core/Cut.h"
10 #include "CAFAna/Core/HistAxis.h"
12 #include "CAFAna/Core/Spectrum.h"
15 
16 // Cuts
17 #include "CAFAna/Cuts/Cuts.h"
20 #include "CAFAna/Cuts/SpillCuts.h"
23 
24 // Predict
27 
28 // Vars
29 #include "CAFAna/Vars/XsecTunes.h"
30 #include "CAFAna/Vars/TruthVars.h"
33 #include "CAFAna/Vars/Vars.h"
35 
37 
38 #include <iostream>
39 #include <iomanip>
40 
41 using namespace ana;
42 
44 {
45  const std::string outfilename = "FDprediction_kinematics_FHC_pTExtrap.root";
46  const std::string sample = "NOReweight";
47 
48  const unsigned int nQuants = 3;
49 
50  bool isRHC = false;
51  std::vector<Cut> PtQuantCutsND = GetNueQuantCuts2020( isRHC, caf::kNEARDET, nQuants, ana::kExtrapPt);
52  std::vector<Cut> PtQuantCutsFD = GetNueQuantCuts2020( isRHC, caf::kFARDET, nQuants, ana::kExtrapPt);
53 
56 
57  struct GenDef{
58  const IPredictionGenerator *gen;
59  const TString cutname;
60  const TString varname;
61  };
62 
63  std::vector <GenDef> gens;
64  std::vector <IPrediction * > predictions;
65 
67  sample.c_str(), "nueAxis_NoExtrap"});
68 
69  //Loop over samples
70  for ( unsigned int quant = 0; quant < nQuants; ++quant ){
71  gens.push_back({new NueSignalExtrapGenerator( kNue2020Axis,
73  kNue2020FDAllSamples && PtQuantCutsFD[quant],
74  kNumu2020ND && PtQuantCutsND[quant],
75  kNoShift,
77  sample.c_str(), Form("nueAxis_NueSignalExtrap_Quant%i", quant+1)});
78  }
79 
80  for(auto & gen:gens){
81  predictions.push_back(gen.gen->Generate(loaders).release());
82  }
83 
84  loaders.Go();
85 
86  TFile* file = new TFile(outfilename.c_str(),"RECREATE");
87  for (int i = 0 ; i < (int)gens.size(); ++i){
88  auto dir = file->GetDirectory(gens[i].cutname);
89  if(!dir) dir = file->mkdir(gens[i].cutname);
90  predictions[i]->SaveTo(dir, gens[i].varname);
91  }
92 
93  file->Close();
94 
95 }
Near Detector underground.
Definition: SREnums.h:10
Far Detector at Ash River.
Definition: SREnums.h:11
std::map< TString, IPredictionGenerator * > gens
Definition: syst_header.h:387
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
const Cut kNumu2020ND
Definition: NumuCuts2020.h:57
const HistAxis kNumuCCOptimisedAxis2020("Reconstructed Neutrino Energy (GeV)", kNumuCCEOptimisedBinning, kNumuE2020)
Definition: HistAxes.h:25
Generates FD-only predictions (no extrapolation)
void Go()
Call Go() on all the loaders.
Definition: Loaders.cxx:162
void SetSpillCut(const SpillCut &cut)
Definition: Loaders.cxx:121
string outfilename
knobs that need extra care
For nominal spectra and reweighting systs (xsec/flux)
Definition: Prod5Loaders.h:101
const HistAxis kNue2020Axis("NuE Energy / Analysis Bin", kNue2020Binning, kNue2020AnaBin)
Use this Axis for Ana2020, official Axis.
Definition: NueCuts2020.h:195
Generates extrapolated Nue signal-only predictions.
std::vector< Cut > GetNueQuantCuts2020(const bool isRHC, const caf::Det_t det, const unsigned int nquants, const ExtrapVar var)
const SystShifts kNoShift
Definition: SystShifts.h:115
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
TDirectory * dir
Definition: macro.C:5
std::vector< Loaders * > loaders
Definition: syst_header.h:386
TFile * file
Definition: cellShifts.C:17
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:46
Given loaders and an MC shift, Generate() generates an IPrediction.
const Cut kNue2020FDAllSamples
Definition: NueCuts2020.h:84
void make_nueFDprediction_kinematics_FHC_pTExtrap()
const Var kXSecCVWgt2020
Definition: XsecTunes.h:106